summaryrefslogtreecommitdiff
path: root/src/lib
AgeCommit message (Collapse)Author
2019-10-22Merge remote-tracking branch 'tor-github/pr/1417'Nick Mathewson
2019-10-22Merge branch 'from_setconf_removal_squashed'Nick Mathewson
2019-10-22Make a pair of add_*_log() functions mockable.Nick Mathewson
2019-10-21Merge remote-tracking branch 'tor-github/pr/1434'teor
2019-10-21control: Add GETINFO support for dumping microdesc consensusAmreshVenugopal
- Allows control port to read microdesc consensus using: GETINFO dir/status-vote/microdesc/consensus add: Helper function `getinfo_helper_current_consensus` test: check if GETINFO commands return expected consensus data. Resolves 31684.
2019-10-21Merge branch 'maint-0.4.2'teor
2019-10-20err: Use the correct type for cb_bufteor
Fixes bug 32060; bug not in any released version of tor. Resolves CID 1454761.
2019-10-18Merge branch 'maint-0.4.2'Nick Mathewson
2019-10-18Merge remote-tracking branch 'tor-github/pr/1426' into maint-0.4.2Nick Mathewson
2019-10-17Ensure that the exit callback is called if CreateProcessA() fails on Windows.Alexander Færøy
This patch fixes an issue where the exit handler is not called for the given process_t in case CreateProcessA() fails. This could, for example, happen if the user tries to execute a binary that does not exist. See: https://bugs.torproject.org/31810
2019-10-17Handle errors from execve() in the Unix process backend more gracefully.Alexander Færøy
This patch removes a call to tor_assert_unreached() after execve() failed. This assertion leads to the child process emitting a stack trace on its standard output, which makes the error harder for the user to demystify, since they think it is an internal error in Tor instead of "just" being a "no such file or directory" error. The process will now instead output "Error from child process: X" where X is the stringified version of the errno value. See: https://bugs.torproject.org/31810
2019-10-17Replace add_temp_log() with add_default_log().Nick Mathewson
We used to have this function so that we could mark our initial log-to-stdout as specifically temporary so that we would delete it once regular logs were configured. But it's no longer necessary to mark these logs as temporary, since we now use a mark-and-sweep process to ensure that _all_ not-configured logs are closed when we change our configuration. Instead, this function will be the basis of a refactoring in how we handle default logs.
2019-10-16Check tor_vasprintf for error return values.Tobias Stoeckmann
In case of error, a negative value will be returned or NULL written into first supplied argument. This patch uses both cases to comply with style in the specific files. A tor_vasprintf error in process_vprintf would lead to a NULL dereference later on in buf_add, because the return value -1 casted to size_t would pass an assertion check inside of buf_add. On the other hand, common systems will fail on such an operation, so it is not a huge difference to a simple assertion. Yet it is better to properly fail instead of relying on such behaviour on all systems. Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
2019-10-16Doxygen: Fix things that looked like links.Nick Mathewson
Doxygen thinks that saying #foo is linking to a "foo" anchor someplace.
2019-10-16Doxygen: fix unrecognized commands.Nick Mathewson
Doxygen seems to interpret anything starting with \ as a command, even when we don't mean it that way.
2019-10-16Doxygen: fix warnings about mismatched HTML tags.Nick Mathewson
2019-10-16Doxygen: Fix mismatched filenames.Nick Mathewson
In 8 places, our \file declarations didn't match the actual files they were in.
2019-10-14Merge remote-tracking branch 'tor-github/pr/1393' into maint-0.4.2Nick Mathewson
2019-10-09Merge remote-tracking branch 'tor-github/pr/1394'Nick Mathewson
2019-10-07Merge remote-tracking branch 'tor-github/pr/1379'Nick Mathewson
2019-10-04Make tor_addr_lookup_host_impl mockable.Nick Mathewson
2019-10-04tls: Log TLS read buffer length bugs onceteor
Rather than filling the logs with similar warnings. Fixes bug 31939; bugfix on 0.3.0.4-rc.
2019-10-03Merge branch 'tor-github/pr/1377'George Kadianakis
2019-10-03Unify backend implementations for blocking hostname lookupNick Mathewson
We have a getaddrinfo() implementation that we prefer, and a gethostbyname*() implementation that we fall back on. Give them both the same interface, and let them be called by the same name. This is a preparatory step for making them both mockable.
2019-10-02Merge branch 'tor-github/pr/1385'David Goulet
2019-10-02log: fix a typo in the function comment for log_fn_()teor
Closes 31923.
2019-10-01Fix a crash bug in max_u16_in_sl()Nick Mathewson
The documentation for this function says that the smartlist can contain NULLs, but the code only handled NULLs if they were at the start of the list. We didn't notice this for a long time, because when Tor is run normally, the sequence of msg_id_t is densely packed, and so this list (mapping msg_id_t to channel_id_t) contains no NULL elements. We could only run into this bug: * when Tor was running in embedded mode, and starting more than once. * when Tor ran first with more pubsub messages enabled, and then later with fewer. * When the second run (the one with fewer enabled pubsub messages) had at least some messages enabled, and those messages were not the ones with numerically highest msg_id_t values. Fixes bug 31898; bugfix on 47de9c7b0a828de7fb8129413db70bc4e4ecac6d in 0.4.1.1-alpha.
2019-10-01Rename max_in_sl to max_in_u16_sl, and expose it as STATIC.Nick Mathewson
Since we want to make this function slightly more visible for testing purposes, it needs a better name.
2019-10-01Add comments to try to prevent recurrence of #31495.Nick Mathewson
There is a bad design choice in two of our configuration types, where the empty string encodes a value that is not the same as the default value. This design choice, plus an implementation mistake, meant that config_dup() did not preserve the value of routerset_t, and thereby caused bug #31495. This comment-only patch documents the two types with the problem, and suggests that implementors try to avoid it in the future. Closes ticket 31907.
2019-09-30err: Remove a duplicate header in backtrace.cteor
2019-09-30err: Always lock the backtrace buffer before it is usedteor
Fixes bug 31734; bugfix on 0.2.5.3-alpha.
2019-09-30Re-run "make autostyle" with improved annotate_ifdef_directivesNick Mathewson
2019-09-30log: When initialising log domain masks, only set known log domainsteor
And add a runtime test that checks for unknown domains and flags. Fixes bug 31854; bugfix on 0.2.1.1-alpha.
2019-09-30log: Define count, boundary, and all macros for domains and flagsteor
And do static checks on those macro definitions. Part of 31854.
2019-09-30log: Remove duplicate code and an outdated commentteor
Preparation for 31854.
2019-09-30Merge branch 'tor-github/pr/1346'George Kadianakis
2019-09-30Merge branch 'tor-github/pr/1302'George Kadianakis
2019-09-30Merge branch 'tor-github/pr/1356'George Kadianakis
2019-09-30Merge branch 'tor-github/pr/1339'George Kadianakis
2019-09-26Run "make autostyle" with new "annotate_ifdef_directives"Nick Mathewson
2019-09-26lock: Avoid some undefined behaviour when freeing mutexes.teor
Fixes bug 31736; bugfix on 0.0.7.
2019-09-26log: explain why it is safe to leave the log mutex initializedteor
The log mutex is dynamically initialized, guarded by log_mutex_initialized. We don't want to destroy it, because after it is destroyed, we won't see any more logs. If tor is re-initialized, log_mutex_initialized will still be 1. So we won't trigger any undefined behaviour by trying to re-initialize the log mutex. Part of 31736, but committed in this branch to avoid merge conflicts.
2019-09-26sandbox: Allow backtrace signals to be disabledteor
Part of 31614.
2019-09-26backtrace: avoid undefined behaviour on re-initialisationteor
cb_buf_mutex is statically initialised, so we can not destroy it when we are shutting down the err subsystem. If we destroy it, and then re-initialise tor, all our backtraces will fail. Part of 31736, but committed in this branch to avoid merge conflicts.
2019-09-25Merge remote-tracking branch 'tor-github/pr/1349'Nick Mathewson
2019-09-25log: Move SEVERITY_MASK_IDX() to log.hteor
Move SEVERITY_MASK_IDX() to log.h private/unit tests section, so that we can use it in log.c, the unit tests, and the fuzzers. (The test and fuzzer code changes are in a subsequent commit.) Preparation for bug 31334.
2019-09-24log: Improve the documentation for tor_log_update_sigsafe_err_fds()teor
Part of 31839.
2019-09-24backtrace: Add a missing check for HAVE_PTHREAD_H before using mutexesteor
Fixes bug 31614; bugfix on 0.2.5.2-alpha.
2019-09-24backtrace: Disable signal handlers in remove_bt_handler()teor
Fixes bug 31614; bugfix on 0.2.5.2-alpha.
2019-09-24Merge branch 'bug31408_035' into bug31408_masterteor