Commit Graph

44 Commits

Author SHA1 Message Date
teor 0a5ce8280c err: Use the correct type for cb_buf
Fixes bug 32060; bug not in any released version of tor.

Resolves CID 1454761.
2019-10-20 20:01:56 +10:00
Nick Mathewson 58b87a2c59 Merge remote-tracking branch 'tor-github/pr/1379' 2019-10-07 10:15:46 -04:00
teor 56d0655ed8 err: Remove a duplicate header in backtrace.c 2019-09-30 23:17:04 +10:00
teor c23986246b err: Always lock the backtrace buffer before it is used
Fixes bug 31734; bugfix on 0.2.5.3-alpha.
2019-09-30 23:17:04 +10:00
Nick Mathewson 53116ca0b7 Re-run "make autostyle" with improved annotate_ifdef_directives 2019-09-30 08:57:37 -04:00
George Kadianakis ae8d36db31 Merge branch 'tor-github/pr/1302' 2019-09-30 13:47:53 +03:00
teor 315f14c709 backtrace: avoid undefined behaviour on re-initialisation
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-26 12:07:25 +10:00
teor ab7bfdf404 backtrace: Add a missing check for HAVE_PTHREAD_H before using mutexes
Fixes bug 31614; bugfix on 0.2.5.2-alpha.
2019-09-24 13:35:55 +10:00
teor 6b97a5a843 backtrace: Disable signal handlers in remove_bt_handler()
Fixes bug 31614; bugfix on 0.2.5.2-alpha.
2019-09-24 13:35:48 +10:00
George Kadianakis 028733e8b6 Merge branch 'tor-github/pr/1303' 2019-09-12 18:09:35 +03:00
teor 987768b077 Merge branch 'bug31615_041' into bug31615_master
Merged modified lines from bug31615_041, and unmodified lines
from master.
2019-09-10 09:03:37 +10:00
teor 7e22d99346 Merge branch 'bug31615_040' into bug31615_041
Merged modified lines from bug31615_040, and unmodified lines
from maint-0.4.1.
2019-09-10 08:43:13 +10:00
David Goulet 1e7c7870e8 Merge branch 'tor-github/pr/1287' 2019-09-09 10:51:19 -04:00
teor 1609916c79 log: Close log and err file descriptors before aborting
Part of 31594.
2019-09-09 14:56:42 +10:00
teor a22fbab986 log: Don't close file log fds that are being used by the err module
Instead, dup() file log fds, before passing them to the err module.

Closes 31613, part of 31594.
2019-09-09 14:56:28 +10:00
teor d02ced4caf torerr: Close sigsafe fds on shutdown
And clear the list of error fds.

Part of 31594.
2019-09-09 14:56:17 +10:00
teor 612b0a4139 subsys: Make the subsystem init order match the module dependencies
Fix levels for subsystems that depend on log/err
* winprocess (security) doesn't use err:
  * call windows process security APIs as early as possible
  * init err after winprocess
  * move wallclock so it's still after err
* network and time depend on log:
  * make sure that network and time can use logging.
  * init network and time after log

Add comments explaining the module init order.

Fixes bug 31615; bugfix on 0.4.0.1-alpha.
2019-09-06 16:58:53 +10:00
teor 9c798dd5a5 torerr: Fix a comment typo and update the comment for format_number_sigsafe()
Closes 31612.
2019-09-04 14:06:58 +10:00
teor abe1f4f23e Merge branch 'bug31571_040' into bug31571_041 2019-09-04 13:57:36 +10:00
teor 0cee6f498c Merge branch 'bug31571_035' into bug31571_040 2019-09-04 13:57:31 +10:00
teor f311d0676c backtrace: Check the return values of snprintf() and strncpy()
We can't use strlcat() or strlcpy() in torerr, because they are defined
in string/compat_string.h on some platforms, and string uses torerr.

Part of 31571.
2019-09-04 13:51:22 +10:00
teor c55591825f torerr: Try harder to flush raw assert messages before process termination
Some platforms (macOS, maybe others?) can swallow the last write before an
abort. This issue is probably caused by a race condition between write
buffer cache flushing, and process termination. So we write an extra
newline, to make sure that the message always gets through.

Fixes bug 31571; bugfix on 0.3.5.1-alpha.
2019-08-30 21:51:11 +10:00
teor 65a1d86491 torerr: Log the Tor backtrace version when a raw assertion fails
Part of 31571.
2019-08-30 21:51:07 +10:00
teor 743bc0028b backtrace: Log the Tor backtrace version whenever we log a backtrace
Previously, we just logged it in the crash handler.

Part of 31571.
2019-08-30 21:51:03 +10:00
teor e2a7d08aa7 backtrace: Always set a backtrace Tor version
We want to report the tor version, even on platforms that don't have
backtrace support (like Android).

This commit stores the backtrace Tor version, regardless of USE_BACKTRACE.

Preparation for 31571.
2019-08-30 21:50:57 +10:00
Nick Mathewson 5fb070a14d Extract the log_domain_t type to a lower-level header
This way, both err and log may depend on it.
2019-07-19 10:17:22 -04:00
Nick Mathewson 09c692e72b Use a 64-bit mask for log domains, and fix a conflict
When we added LD_MESG, we created a conflict with the LD_NO_MOCK
flag.  We now need 64 bits for log domains in order to fix this
issue.

Fixes bug 31080; bugfix on 0.4.1.1-alpha.
2019-07-08 13:32:45 -04:00
Nick Mathewson 60213a3621 Run "make autostyle." 2019-06-05 09:33:35 -04:00
Nick Mathewson 721e65a1d5 Add comments to include.am files to note where new sources go
This mechanism isn't perfect, and sometimes it will guess wrong,
but it will help our automation.
2019-05-02 09:37:18 -04:00
Nick Mathewson 2f683465d4 Bump copyright date to 2019 2019-01-16 12:33:22 -05:00
Nick Mathewson efe55b8898 Bump copyright date to 2019. 2019-01-16 12:32:32 -05:00
Nick Mathewson e6a4401200 Merge branch 'maint-0.3.5' 2019-01-09 08:52:10 -05:00
Kris Katterjohn c13a81f7f9 Fix (and make consistent) the use of OpenBSD preprocessor macro tests
Prior to this commit, the testsuite was failing on OpenBSD.  After
this commit the testsuite runs fine on OpenBSD.

It was previously decided to test for the OpenBSD macro (rather than
__OpenBSD__, etc.) because OpenBSD forks seem to have the former
macro defined.  sys/param.h must be included for the OpenBSD macro
definition; however, many files tested for the OpenBSD macro without
having this header included.

This commit includes sys/param.h in the files where the OpenBSD macro
is used (and sys/param.h is not already included), and it also
changes some instances of the __OpenBSD__ macro to OpenBSD.

See commit 27df23abb6 which changed
everything to use OpenBSD instead of __OpenBSD__ or OPENBSD.  See
also tickets #6982 and #20980 (the latter ticket is where it was
decided to use the OpenBSD macro).

Signed-off-by: Kris Katterjohn <katterjohn@gmail.com>
2019-01-09 08:51:57 -05:00
Nick Mathewson c6336727ca Rename subsystem callback functions to make them consistent 2018-11-09 11:12:12 -05:00
Nick Mathewson e80595f562 fixup! Make initialization for the "err" library into a subsystem.
Check for failure to install backtrace handler.
2018-11-09 11:00:31 -05:00
Nick Mathewson 175153a329 Make initialization for the "err" library into a subsystem. 2018-11-05 09:22:02 -05:00
rl1987 d0525c38d6 Refrain from potentially insecure usage of strncat() 2018-07-03 11:34:14 -04:00
Nick Mathewson cb1a3674eb File-level documentation for some of src/lib. 2018-07-01 20:22:55 -04:00
Nick Mathewson b556894ef2 Include stdio.h in torerr.c. 2018-06-25 16:52:14 -04:00
Nick Mathewson 999f7984e1 New script to check includes for modularity violations
Includes configuration files to enforce these rules on lib and
common.  Of course, "common" *is* a modularity violation right now,
so these rules aren't as strict as I would like them to be.
2018-06-21 14:05:33 -04:00
Nick Mathewson fa5fda5bbf Rectify include paths (automated) 2018-06-21 13:14:14 -04:00
Nick Mathewson 03d7812615 Make sure liberr-testing is build with testing flags. 2018-06-21 13:14:14 -04:00
Nick Mathewson 275aff6917 Rectify include paths (automated) 2018-06-21 10:47:11 -04:00
Nick Mathewson 2cfcb7b364 Extract error functionality into a new lowest-level library. 2018-06-21 10:47:11 -04:00