aboutsummaryrefslogtreecommitdiff
path: root/src/common
Commit message (Collapse)AuthorAge
* Add a sighandler-safe logging mechanismNick Mathewson2013-11-18
| | | | | | | | | We had accidentially grown two fake ones: one for backtrace.c, and one for sandbox.c. Let's do this properly instead. Now, when we configure logs, we keep track of fds that should get told about bad stuff happening from signal handlers. There's another entry point for these that avoids using non-signal-handler-safe functions.
* Basic backtrace abilityNick Mathewson2013-11-18
| | | | | | On platforms with the backtrace/backtrace_symbols_fd interface, Tor can now dump stack traces on assertion failure. By default, I log them to DataDir/stack_dump and to stderr.
* Refactor the assertion-failure code into a functionNick Mathewson2013-07-19
|
* Add a signal-safe decimal formatting functionNick Mathewson2013-07-19
|
* Merge branch 'bug8929_rebase_2'Nick Mathewson2013-07-18
|\
| * Document what "escape" means in tor_escape_str_for_pt_argsNick Mathewson2013-07-18
| |
| * Rename tor_escape_str_for_socks_arg() to something more generic.George Kadianakis2013-07-18
| | | | | | | | | | Since we are going to be using that function to also escape parameters passed to transport proxies using environment variables.
| * Pass characters to be escaped to tor_escape_str_for_socks_arg().George Kadianakis2013-07-18
| | | | | | | | | | This is in preparation for using tor_escape_str_for_socks_arg() to escape server-side pluggable transport parameters.
* | Use format_hex_number_sigsafe to format syscalls in sandbox.cNick Mathewson2013-07-15
|/ | | | | | | | | | This way, we don't have to use snprintf, which is not guaranteed to be signal-safe. (Technically speaking, strlen() and strlcpy() are not guaranteed to be signal-safe by the POSIX standard. But I claim that they are on every platform that supports libseccomp2, which is what matters here.)
* Lightly refactor and test format_hex_number_sigsafeNick Mathewson2013-07-15
| | | | | | | | Better tests for upper bounds, and for failing cases. Also, change the function's interface to take a buffer length rather than a maximum length, and then NUL-terminate: functions that don't NUL-terminate are trouble waiting to happen.
* Expose format_hex_number_..., and rename it to ..._sigsafe().Nick Mathewson2013-07-15
| | | | | There are some other places in the code that will want a signal-safe way to format numbers, so it shouldn't be static to util.c.
* Don't build format_helper_exit_status on win32Nick Mathewson2013-07-15
| | | | | | | | | The only thing that used format_helper_exit_status on win32 was the unit tests. This caused an error when we tried to leave a static format_helper_exit_status lying around in a production object file. The easiest solution is to admit that this way of dealing with process exit status is Unix-only.
* Merge remote-tracking branch 'public/fancy_test_tricks'Nick Mathewson2013-07-15
|\ | | | | | | | | | | | | | | Conflicts: src/common/include.am Conflict was from adding testsupport.h near where sandbox.h had already been added.
| * Add rudimentary test mocking support.Nick Mathewson2013-07-10
| | | | | | | | | | | | This is not the most beautiful possible implementation (it requires decorating mockable functions with ugly macros), but it actually works, and is portable across multiple compilers and architectures.
| * Coverage support: build with --enable-coverage to have tests run with gcovNick Mathewson2013-07-10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If you pass the --enable-coverage flag on the command line, we build our testing binaries with appropriate options eo enable coverage testing. We also build a "tor-cov" binary that has coverage enabled, for integration tests. On recent OSX versions, test coverage only works with clang, not gcc. So we warn about that. Also add a contrib/coverage script to actually run gcov with the appropriate options to generate useful .gcov files. (Thanks to automake, the .o files will not have the names that gcov expects to find.) Also, remove generated gcda and gcno files on clean.
| * Completely refactor how FILENAME_PRIVATE worksNick Mathewson2013-07-10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We previously used FILENAME_PRIVATE identifiers mostly for identifiers exposed only to the unit tests... but also for identifiers exposed to the benchmarker, and sometimes for identifiers exposed to a similar module, and occasionally for no really good reason at all. Now, we use FILENAME_PRIVATE identifiers for identifiers shared by Tor and the unit tests. They should be defined static when we aren't building the unit test, and globally visible otherwise. (The STATIC macro will keep us honest here.) For identifiers used only by the unit tests and never by Tor at all, on the other hand, we wrap them in #ifdef TOR_UNIT_TESTS. This is not the motivating use case for the split test/non-test build system; it's just a test example to see how it works, and to take a chance to clean up the code a little.
| * Start work on fancy compiler tricks to expose extra stuff to our testsNick Mathewson2013-07-10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This is mainly a matter of automake trickery: we build each static library in two versions now: one with the TOR_UNIT_TESTS macro defined, and one without. When TOR_UNIT_TESTS is defined, we can enable mocking and expose more functions. When it's not defined, we can lock the binary down more. The alternatives would be to have alternate build modes: a "testing configuration" for building the libraries with test support, and a "production configuration" for building them without. I don't favor that approach, since I think it would mean more people runnning binaries build for testing, or more people not running unit tests.
* | Fix two pre-coffee typosPeter Palfrader2013-07-15
| |
* | Document get_parent_directory morePeter Palfrader2013-07-15
| |
* | cosmetic cleanupsRoger Dingledine2013-07-14
| |
* | put sandbox.h in the tarball, so the tarball buildsRoger Dingledine2013-07-13
| |
* | Merge remote-tracking branch 'public/gsoc-ctoader-cap-phase1-squashed'Nick Mathewson2013-07-12
|\ \ | |/ |/|
| * Add a basic seccomp2 syscall filter on LinuxCristian Toader2013-07-11
| | | | | | | | | | It's controlled by the new Sandbox argument. Right now, it's rather coarse-grained, it's Linux-only, and it may break some features.
* | Merge remote-tracking branch 'origin/maint-0.2.4'Nick Mathewson2013-06-18
|\ \
| * \ Merge remote-tracking branch 'origin/maint-0.2.3' into maint-0.2.4Nick Mathewson2013-06-18
| |\ \ | | | | | | | | | | | | | | | | | | | | Conflicts: src/or/config.c src/or/relay.c
| | * | Implement a real OOM-killer for too-long circuit queues.Nick Mathewson2013-06-18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This implements "algorithm 1" from my discussion of bug #9072: on OOM, find the circuits with the longest queues, and kill them. It's also a fix for #9063 -- without the side-effects of bug #9072. The memory bounds aren't perfect here, and you need to be sure to allow some slack for the rest of Tor's usage. This isn't a perfect fix; the rest of the solutions I describe on codeable.
* | | | Instead of testing for __GNUC__, use CHECK_SCANF, like CHECK_PRINTF.dana koch2013-06-14
| | | | | | | | | | | | | | | | This lets us have the possibility of fine-tuning the check in the tor_sscanf test cases at a later date.
* | | | Merge remote-tracking branch 'origin/maint-0.2.4'Nick Mathewson2013-06-13
|\| | |
| * | | Define SEEK_SET for platforms that lack it.Nick Mathewson2013-06-13
| | | |
| * | | If we write the annotation but not the microdescriptor, rewind.Nick Mathewson2013-06-13
| | | | | | | | | | | | | | | | | | | | This fixes bug 9047 (and some parts of 9031, 8922, 8883 that weren't fixed in 8822). Bugfix on 0.2.2.6-alpha.
* | | | Fix #9043 - simplyfy the code and use EVP_PKEY_cmp instead of pkey_eq / ↵Marek Majkowski2013-06-12
| | | | | | | | | | | | | | | | tor_tls_evp_pkey_eq
* | | | Merge remote-tracking branch 'origin/maint-0.2.4'Nick Mathewson2013-06-12
|\| | |
| * | | Revert "Use the FILE_SHARE_DELETE flag for CreateFile on a mapping"Nick Mathewson2013-06-12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 884a0e269c382f9e927d8c8b1ef4ef9d2d48379d. I'm reverting this because it doesn't actually make the problem go away. It appears that instead we need to do unmap-then-replace.
* | | | Merge remote-tracking branch 'origin/maint-0.2.4'Nick Mathewson2013-06-12
|\| | |
| * | | Merge remote-tracking branch 'public/bug2077_share_delete' into maint-0.2.4Nick Mathewson2013-06-12
| |\ \ \
| | * | | Use the FILE_SHARE_DELETE flag for CreateFile on a mappingNick Mathewson2013-06-12
| | |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A comment by rransom on #8795 taken together with a comment by doorss recorded on #2077 suggest that *every* attempt to replace the md cache will fail on Vista/Win7 if we don't have the FILE_SHARE_DELETE flag passed to CreateFile, and if we try to replace the file ourselves before unmapping it. I'm adding the FILE_SHARE_DELETE, since that's this simplest fix. Broken indexers (the favored #2077 hypothesis) could still cause trouble here, but at least this patch should make us stop stepping on our own feet. Likely fix for #2077 and its numerous duplicates. Bugfix on 0.2.2.6-alpha, which first had a microdescriptor cache that would get replaced before remapping it.
* | | | Make OPENSSL_free(dh_string_repr) conditional.Nick Mathewson2013-06-10
| | | |
* | | | Bug #5170 - make pkey_eq testable, introduce test_tortls.cMarek Majkowski2013-06-10
| | | |
* | | | Bug 5170 - simplify i2d_PublicKey in pkey_eqMarek Majkowski2013-06-06
| | | |
* | | | Bug #5170 - simplify i2d_X509Marek Majkowski2013-06-06
| | | |
* | | | Bug #5170 - also simplify i2d_DHparamsMarek Majkowski2013-06-06
| | | |
* | | | Bug #5170 - i2d_RSAPublicKey supports allocating its own output bufferMarek Majkowski2013-06-06
| |_|/ |/| |
* | | Merge remote-tracking branch 'karsten/task-6752-3'Nick Mathewson2013-05-28
|\ \ \
| * | | Tweak #6752 patch based on comments by nickm.Karsten Loesing2013-05-24
| | | |
| * | | Lower dir fetch retry schedules in testing networks.Karsten Loesing2013-05-16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Also lower maximum interval without directory requests, and raise maximum download tries. Implements #6752.
* | | | Remove PK_PKCS1_PADDINGArlo Breault2013-05-17
|/ / / | | | | | | | | | See #8792
* | | Merge remote-tracking branch 'origin/maint-0.2.4'Nick Mathewson2013-04-18
|\| | | | | | | | | | | | | | Conflicts: src/common/crypto.c
| * | Remove a double-newlineNick Mathewson2013-04-18
| | |
| * | Merge branch 'less_charbuf_rebased' into maint-0.2.4Nick Mathewson2013-04-18
| |\ \ | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/or/dirserv.c src/or/dirserv.h src/test/test_dir.c
| | * | Fix a couple of documentation issues.Nick Mathewson2013-04-18
| | | |