[tor-commits] [translation/tails-iuk] https://gitweb.torproject.org/translation.git/commit/?h=tails-iuk
commit 874f61d98fe2d3a199f2f21928287f229a6b6197 Author: Translation commit bot Date: Thu Dec 5 01:18:41 2019 + https://gitweb.torproject.org/translation.git/commit/?h=tails-iuk --- da.po | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/da.po b/da.po index 81f56a7171..586468af1b 100644 --- a/da.po +++ b/da.po @@ -15,8 +15,8 @@ msgstr "" "Project-Id-Version: Tor Project\n" "Report-Msgid-Bugs-To: Tails developers \n" "POT-Creation-Date: 2019-11-28 16:51+0100\n" -"PO-Revision-Date: 2019-11-29 03:10+\n" -"Last-Translator: carolyn \n" +"PO-Revision-Date: 2019-12-05 00:48+\n" +"Last-Translator: scootergrisen\n" "Language-Team: Danish (http://www.transifex.com/otf/torproject/language/da/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -50,7 +50,7 @@ msgstr "ingen automatisk opgradering er tilgængelig fra vores websted for denne #: ../lib/Tails/IUK/Frontend.pm:242 msgid "your device was not created using a USB image or Tails Installer" -msgstr "" +msgstr "din enhed blev ikke oprettet med et USB-aftryk eller Tails-installationsprogram" #: ../lib/Tails/IUK/Frontend.pm:247 msgid "Tails was started from a DVD or a read-only device" ___ tor-commits mailing list tor-commits@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits
[tor-commits] [translation/tails-misc_release] https://gitweb.torproject.org/translation.git/commit/?h=tails-misc_release
commit 606461edc7dad28240b5f9eea62e7a7f7b3421ab Author: Translation commit bot Date: Thu Dec 5 01:18:35 2019 + https://gitweb.torproject.org/translation.git/commit/?h=tails-misc_release --- da.po | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/da.po b/da.po index 38a640d041..8da0262923 100644 --- a/da.po +++ b/da.po @@ -21,8 +21,8 @@ msgstr "" "Project-Id-Version: Tor Project\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2019-11-28 17:02+0100\n" -"PO-Revision-Date: 2019-11-29 02:19+\n" -"Last-Translator: erinm\n" +"PO-Revision-Date: 2019-12-05 00:49+\n" +"Last-Translator: scootergrisen\n" "Language-Team: Danish (http://www.transifex.com/otf/torproject/language/da/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" ___ tor-commits mailing list tor-commits@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits
[tor-commits] [translation/tails-misc] https://gitweb.torproject.org/translation.git/commit/?h=tails-misc
commit 13160c0d85aca57a54fa31b4daf93616e38f8b23 Author: Translation commit bot Date: Thu Dec 5 01:17:24 2019 + https://gitweb.torproject.org/translation.git/commit/?h=tails-misc --- da.po | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/da.po b/da.po index 917448e1da..3eca7fb7f8 100644 --- a/da.po +++ b/da.po @@ -21,8 +21,8 @@ msgstr "" "Project-Id-Version: Tor Project\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2019-11-28 17:02+0100\n" -"PO-Revision-Date: 2019-11-29 02:19+\n" -"Last-Translator: erinm\n" +"PO-Revision-Date: 2019-12-05 00:49+\n" +"Last-Translator: scootergrisen\n" "Language-Team: Danish (http://www.transifex.com/otf/torproject/language/da/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -384,7 +384,7 @@ msgstr "Du kan automatisk installere {packages} når Tails startes" #: config/chroot_local-includes/usr/local/sbin/tails-additional-software:345 msgid "To do so, you need to run Tails from a USB stick." -msgstr "" +msgstr "For at gøre det skal du køre Tails, fra en USB-pen." #. Translators: Don't translate {packages}, it's a placeholder and will be #. replaced. @@ -492,7 +492,7 @@ msgstr "Gør det, ved at oprette et vedvarende lager og installer software med < #: config/chroot_local-includes/usr/local/bin/tails-additional-software-config:205 msgid "" "To do so, install Tails on a USB stick and create a persistent storage." -msgstr "" +msgstr "For at gøre det skal du installere Tails på en USB-pen og oprette et vedvarende lager." #: config/chroot_local-includes/usr/local/bin/tails-additional-software-config:251 msgid "[package not available]" ___ tor-commits mailing list tor-commits@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits
[tor-commits] [tor/release-0.4.2] Merge branch 'maint-0.4.1' into maint-0.4.2
commit bb786797aa449389d47f7bf94fb5fa238e51e377 Merge: 3207a8e5c cfa9cc34a Author: teor Date: Thu Dec 5 10:14:08 2019 +1000 Merge branch 'maint-0.4.1' into maint-0.4.2 ___ tor-commits mailing list tor-commits@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits
[tor-commits] [tor/release-0.4.0] Merge branch 'maint-0.4.0' into release-0.4.0
commit aa47cb6e0f6edb2adeb357d2da1b090a11430f96 Merge: 03dc0e19a 92fb09906 Author: teor Date: Thu Dec 5 10:13:57 2019 +1000 Merge branch 'maint-0.4.0' into release-0.4.0 changes/bug31571| 7 +++ changes/bug31810| 4 src/lib/err/backtrace.c | 42 ++--- src/lib/err/backtrace.h | 1 + src/lib/err/torerr.c| 11 +-- src/lib/process/process_unix.c | 9 + src/lib/process/process_win32.c | 18 ++ src/test/test_process_slow.c| 30 + 8 files changed, 101 insertions(+), 21 deletions(-) ___ tor-commits mailing list tor-commits@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits
[tor-commits] [tor/release-0.4.1] Merge branch 'maint-0.4.1' into release-0.4.1
commit 2ef4c04a92654cb5441d8b9ccba3c7a032145652 Merge: 82cef8032 cfa9cc34a Author: teor Date: Thu Dec 5 10:14:05 2019 +1000 Merge branch 'maint-0.4.1' into release-0.4.1 changes/bug31571| 7 +++ changes/bug31810| 4 src/lib/err/backtrace.c | 42 ++--- src/lib/err/backtrace.h | 1 + src/lib/err/torerr.c| 11 +-- src/lib/process/process_unix.c | 9 + src/lib/process/process_win32.c | 18 ++ src/test/test_process_slow.c| 30 + 8 files changed, 101 insertions(+), 21 deletions(-) ___ tor-commits mailing list tor-commits@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits
[tor-commits] [tor/release-0.4.2] Handle errors from execve() in the Unix process backend more gracefully.
commit 9915b8f0bc3e6a1b6c8413fbb87c41137ea89104 Author: Alexander Færøy Date: Thu Oct 17 16:39:05 2019 +0200 Handle errors from execve() in the Unix process backend more gracefully. 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 --- changes/bug31810 | 4 src/lib/process/process_unix.c | 9 + 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/changes/bug31810 b/changes/bug31810 new file mode 100644 index 0..628d12f09 --- /dev/null +++ b/changes/bug31810 @@ -0,0 +1,4 @@ + o Minor bugfixes (process management): +- Remove assertion in the Unix process backend. This assertion would trigger + when a new process is spawned where the executable is not found leading to + a stack trace from the child process. Fixes bug 31810; bugfix on 0.4.0.1-alpha. diff --git a/src/lib/process/process_unix.c b/src/lib/process/process_unix.c index 790ab897e..b102afff4 100644 --- a/src/lib/process/process_unix.c +++ b/src/lib/process/process_unix.c @@ -253,22 +253,15 @@ process_unix_exec(process_t *process) process_environment_t *env = process_get_environment(process); /* Call the requested program. */ -retval = execve(argv[0], argv, env->unixoid_environment_block); +execve(argv[0], argv, env->unixoid_environment_block); /* If we made it here it is because execve failed :-( */ -if (-1 == retval) - fprintf(stderr, "Call to execve() failed: %s", strerror(errno)); - tor_free(argv); process_environment_free(env); -tor_assert_unreached(); - error: -/* LCOV_EXCL_START */ fprintf(stderr, "Error from child process: %s", strerror(errno)); _exit(1); -/* LCOV_EXCL_STOP */ } /* We are in the parent process. */ ___ tor-commits mailing list tor-commits@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits
[tor-commits] [tor/release-0.4.1] Merge branch 'maint-0.3.5' into maint-0.4.0
commit 92fb0990675424cd04eb0b39b4ae157ac7f5385b Merge: 46057ec5a aee966cb0 Author: teor Date: Thu Dec 5 10:13:53 2019 +1000 Merge branch 'maint-0.3.5' into maint-0.4.0 changes/bug31571| 7 +++ src/lib/err/backtrace.c | 42 +++--- src/lib/err/backtrace.h | 1 + src/lib/err/torerr.c| 11 +-- 4 files changed, 48 insertions(+), 13 deletions(-) ___ tor-commits mailing list tor-commits@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits
[tor-commits] [tor/release-0.4.1] Ensure that the exit callback is called if CreateProcessA() fails on Windows.
commit cbed6ff8430ee7f7d1002965ebf784628735c234 Author: Alexander Færøy Date: Thu Oct 17 16:47:04 2019 +0200 Ensure that the exit callback is called if CreateProcessA() fails on Windows. 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 --- src/lib/process/process_win32.c | 18 ++ 1 file changed, 18 insertions(+) diff --git a/src/lib/process/process_win32.c b/src/lib/process/process_win32.c index ddbe76bfd..1b1de6ad5 100644 --- a/src/lib/process/process_win32.c +++ b/src/lib/process/process_win32.c @@ -234,6 +234,24 @@ process_win32_exec(process_t *process) CloseHandle(stdin_pipe_read); CloseHandle(stdin_pipe_write); +/* In the Unix backend, we do not get an error in the Tor process when a + * child process fails to spawn its target executable since we need to + * first do the fork() call in the Tor process and then the child process + * is responsible for doing the call to execve(). + * + * This means that the user of the process_exec() API must check for + * whether it returns PROCESS_STATUS_ERROR, which will rarely happen on + * Unix, but will happen for error cases on Windows where it does not + * happen on Unix. For example: when the target executable does not exist + * on the file system. + * + * To have somewhat feature compatibility between the Unix and the Windows + * backend, we here notify the process_t owner that the process have exited + * (even though it never managed to run) to ensure that the exit callback + * is executed. + */ +process_notify_event_exit(process, 0); + return PROCESS_STATUS_ERROR; } ___ tor-commits mailing list tor-commits@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits
[tor-commits] [translation/donatepages-messagespot_completed] https://gitweb.torproject.org/translation.git/commit/?h=donatepages-messagespot_completed
commit a426bc1d1ffeda998a491463e34c7b1102d0c2e5 Author: Translation commit bot Date: Thu Dec 5 00:17:51 2019 + https://gitweb.torproject.org/translation.git/commit/?h=donatepages-messagespot_completed --- messages.pot | 48 1 file changed, 20 insertions(+), 28 deletions(-) diff --git a/messages.pot b/messages.pot index 5170acd794..256e7e6368 100644 --- a/messages.pot +++ b/messages.pot @@ -107,22 +107,14 @@ msgid "Want to donate by credit card or PayPal?" msgstr "Want to donate by credit card or PayPal?" #: tmp/cache_locale/cc/cc2e1dd4edb96c59a6514d676ca3f562a2a9a2cd34e2c211c03fb08b3e664469.php:92 -msgid "" -"Donate using The Giving Block and help Tor receive additional matching funds" -" on #BitcoinTuesday, December 3rd!" -msgstr "" -"Donate using The Giving Block and help Tor receive additional matching funds" -" on #BitcoinTuesday, December 3rd!" - -#: tmp/cache_locale/cc/cc2e1dd4edb96c59a6514d676ca3f562a2a9a2cd34e2c211c03fb08b3e664469.php:101 msgid "Donate using BTCPayServer" msgstr "Donate using BTCPayServer" -#: tmp/cache_locale/cc/cc2e1dd4edb96c59a6514d676ca3f562a2a9a2cd34e2c211c03fb08b3e664469.php:135 +#: tmp/cache_locale/cc/cc2e1dd4edb96c59a6514d676ca3f562a2a9a2cd34e2c211c03fb08b3e664469.php:126 msgid "Donate using wallet addresses" msgstr "Donate using wallet addresses" -#: tmp/cache_locale/cc/cc2e1dd4edb96c59a6514d676ca3f562a2a9a2cd34e2c211c03fb08b3e664469.php:142 +#: tmp/cache_locale/cc/cc2e1dd4edb96c59a6514d676ca3f562a2a9a2cd34e2c211c03fb08b3e664469.php:133 msgid "" "Please fill out this form and then send your coins to the appropriate " "wallet." @@ -130,7 +122,7 @@ msgstr "" "Please fill out this form and then send your coins to the appropriate " "wallet." -#: tmp/cache_locale/cc/cc2e1dd4edb96c59a6514d676ca3f562a2a9a2cd34e2c211c03fb08b3e664469.php:144 +#: tmp/cache_locale/cc/cc2e1dd4edb96c59a6514d676ca3f562a2a9a2cd34e2c211c03fb08b3e664469.php:135 msgid "" "Filling out the form is not necessary, but doing so will notify us about " "your donation quickly, allow us to send you an acknowledgement, and let us " @@ -140,19 +132,19 @@ msgstr "" "your donation quickly, allow us to send you an acknowledgement, and let us " "know your communication preferences." -#: tmp/cache_locale/cc/cc2e1dd4edb96c59a6514d676ca3f562a2a9a2cd34e2c211c03fb08b3e664469.php:150 +#: tmp/cache_locale/cc/cc2e1dd4edb96c59a6514d676ca3f562a2a9a2cd34e2c211c03fb08b3e664469.php:141 msgid "" "Below you will find the cryptocurrencies we accept and our wallet addresses." msgstr "" "Below you will find the cryptocurrencies we accept and our wallet addresses." -#: tmp/cache_locale/cc/cc2e1dd4edb96c59a6514d676ca3f562a2a9a2cd34e2c211c03fb08b3e664469.php:152 +#: tmp/cache_locale/cc/cc2e1dd4edb96c59a6514d676ca3f562a2a9a2cd34e2c211c03fb08b3e664469.php:143 msgid "" "The wallet addresses will be displayed again after you complete the form." msgstr "" "The wallet addresses will be displayed again after you complete the form." -#: tmp/cache_locale/cc/cc2e1dd4edb96c59a6514d676ca3f562a2a9a2cd34e2c211c03fb08b3e664469.php:154 +#: tmp/cache_locale/cc/cc2e1dd4edb96c59a6514d676ca3f562a2a9a2cd34e2c211c03fb08b3e664469.php:145 msgid "" "Please make sure to copy the wallet addresses exactly when making your " "donation, as we cannot recover funds sent to the wrong wallet." @@ -160,7 +152,7 @@ msgstr "" "Please make sure to copy the wallet addresses exactly when making your " "donation, as we cannot recover funds sent to the wrong wallet." -#: tmp/cache_locale/cc/cc2e1dd4edb96c59a6514d676ca3f562a2a9a2cd34e2c211c03fb08b3e664469.php:160 +#: tmp/cache_locale/cc/cc2e1dd4edb96c59a6514d676ca3f562a2a9a2cd34e2c211c03fb08b3e664469.php:151 msgid "" "If you have any questions, or would like to donate a cryptocurrency not " "listed below, please email us at giv...@torproject.org." @@ -168,65 +160,65 @@ msgstr "" "If you have any questions, or would like to donate a cryptocurrency not " "listed below, please email us at giv...@torproject.org." -#: tmp/cache_locale/cc/cc2e1dd4edb96c59a6514d676ca3f562a2a9a2cd34e2c211c03fb08b3e664469.php:175 +#: tmp/cache_locale/cc/cc2e1dd4edb96c59a6514d676ca3f562a2a9a2cd34e2c211c03fb08b3e664469.php:166 msgid "Copied" msgstr "Copied" -#: tmp/cache_locale/cc/cc2e1dd4edb96c59a6514d676ca3f562a2a9a2cd34e2c211c03fb08b3e664469.php:179 +#: tmp/cache_locale/cc/cc2e1dd4edb96c59a6514d676ca3f562a2a9a2cd34e2c211c03fb08b3e664469.php:170 msgid "Currency Amount must be a number." msgstr "Currency Amount must be a number." -#: tmp/cache_locale/cc/cc2e1dd4edb96c59a6514d676ca3f562a2a9a2cd34e2c211c03fb08b3e664469.php:183 +#: tmp/cache_locale/cc/cc2e1dd4edb96c59a6514d676ca3f562a2a9a2cd34e2c211c03fb08b3e664469.php:174 #: tmp/cache_locale/a1/a1384b9a21e3d43e946972b01389567dff845ee982dcf05228aa3e5096a74210.php:69 msgid "Choose a Currency" msgstr "Choose a Currency" -#:
[tor-commits] [tor/release-0.4.2] Merge branch 'maint-0.4.2' into release-0.4.2
commit 24e6251b81794b66800fa208c6699808b9a079b0 Merge: df9a1f313 bb786797a Author: teor Date: Thu Dec 5 10:14:12 2019 +1000 Merge branch 'maint-0.4.2' into release-0.4.2 ___ tor-commits mailing list tor-commits@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits
[tor-commits] [tor/release-0.4.2] Merge branch 'maint-0.4.0' into maint-0.4.1
commit cfa9cc34aa36c0f300724a01998633efbe8439ea Merge: 14089a29b 92fb09906 Author: teor Date: Thu Dec 5 10:14:01 2019 +1000 Merge branch 'maint-0.4.0' into maint-0.4.1 changes/bug31571| 7 +++ changes/bug31810| 4 src/lib/err/backtrace.c | 42 ++--- src/lib/err/backtrace.h | 1 + src/lib/err/torerr.c| 11 +-- src/lib/process/process_unix.c | 9 + src/lib/process/process_win32.c | 18 ++ src/test/test_process_slow.c| 30 + 8 files changed, 101 insertions(+), 21 deletions(-) diff --cc src/lib/err/backtrace.c index 2408a6851,8606f4217..8bc7e6965 --- a/src/lib/err/backtrace.c +++ b/src/lib/err/backtrace.c @@@ -198,13 -193,12 +198,10 @@@ static int trap_signals[] = { SIGSEGV, /** Install signal handlers as needed so that when we crash, we produce a * useful stack trace. Return 0 on success, -errno on failure. */ static int - install_bt_handler(const char *software) + install_bt_handler(void) { - int trap_signals[] = { SIGSEGV, SIGILL, SIGFPE, SIGBUS, SIGSYS, - SIGIO, -1 }; int i, rv=0; - strncpy(bt_version, software, sizeof(bt_version) - 1); - bt_version[sizeof(bt_version) - 1] = 0; - struct sigaction sa; memset(, 0, sizeof(sa)); @@@ -260,10 -237,11 +257,11 @@@ remove_bt_handler(void #ifdef NO_BACKTRACE_IMPL void -log_backtrace_impl(int severity, int domain, const char *msg, +log_backtrace_impl(int severity, log_domain_mask_t domain, const char *msg, tor_log_fn logger) { - logger(severity, domain, "%s. (Stack trace not available)", msg); + logger(severity, domain, "%s: %s. (Stack trace not available)", + bt_version, msg); } static int diff --cc src/lib/err/torerr.c index 21b28a5f6,1a246e995..b7e32a3e2 --- a/src/lib/err/torerr.c +++ b/src/lib/err/torerr.c @@@ -206,20 -163,14 +207,26 @@@ tor_raw_assertion_failed_msg_(const cha } dump_stack_symbols_to_error_fds(); + + /* 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. */ + tor_log_err_sigsafe_write("\n"); } +/** + * Call the abort() function to kill the current process with a fatal + * error. But first, close the raw error file descriptors, so error messages + * are written before process termination. + **/ +void +tor_raw_abort_(void) +{ + tor_log_close_sigsafe_err_fds(); + abort(); +} + /* As format_{hex,dex}_number_sigsafe, but takes a radix argument * in range 2..16 inclusive. */ static int ___ tor-commits mailing list tor-commits@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits
[tor-commits] [tor/release-0.4.0] Merge branch 'maint-0.3.5' into maint-0.4.0
commit 92fb0990675424cd04eb0b39b4ae157ac7f5385b Merge: 46057ec5a aee966cb0 Author: teor Date: Thu Dec 5 10:13:53 2019 +1000 Merge branch 'maint-0.3.5' into maint-0.4.0 changes/bug31571| 7 +++ src/lib/err/backtrace.c | 42 +++--- src/lib/err/backtrace.h | 1 + src/lib/err/torerr.c| 11 +-- 4 files changed, 48 insertions(+), 13 deletions(-) ___ tor-commits mailing list tor-commits@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits
[tor-commits] [tor/release-0.4.2] Merge remote-tracking branch 'tor-github/pr/1277' into maint-0.3.5
commit aee966cb06711a413980b8cf7fa359e69d62dd05 Merge: 62cf12a8b f311d0676 Author: teor Date: Thu Dec 5 10:11:18 2019 +1000 Merge remote-tracking branch 'tor-github/pr/1277' into maint-0.3.5 changes/bug31571| 7 +++ src/lib/err/backtrace.c | 42 +++--- src/lib/err/backtrace.h | 1 + src/lib/err/torerr.c| 11 +-- 4 files changed, 48 insertions(+), 13 deletions(-) ___ tor-commits mailing list tor-commits@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits
[tor-commits] [tor/release-0.4.1] backtrace: Check the return values of snprintf() and strncpy()
commit f311d0676caad1c61a4dbf8fffbeb79003866903 Author: teor Date: Tue Sep 3 15:50:37 2019 +1000 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. --- src/lib/err/backtrace.c | 16 ++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/lib/err/backtrace.c b/src/lib/err/backtrace.c index a4d8269c6..8606f4217 100644 --- a/src/lib/err/backtrace.c +++ b/src/lib/err/backtrace.c @@ -276,11 +276,23 @@ configure_backtrace_handler(const char *tor_version) char version[128] = "Tor\0"; if (tor_version) { -snprintf(version, sizeof(version), "Tor %s", tor_version); +int snp_rv = 0; +/* We can't use strlcat() here, because it is defined in + * string/compat_string.h on some platforms, and string uses torerr. */ +snp_rv = snprintf(version, sizeof(version), "Tor %s", tor_version); +/* It's safe to call raw_assert() here, because raw_assert() does not + * call configure_backtrace_handler(). */ +raw_assert(snp_rv < (int)sizeof(version)); +raw_assert(snp_rv >= 0); } - strncpy(bt_version, version, sizeof(bt_version) - 1); + char *str_rv = NULL; + /* We can't use strlcpy() here, see the note about strlcat() above. */ + str_rv = strncpy(bt_version, version, sizeof(bt_version) - 1); + /* We must terminate bt_version, then raw_assert(), because raw_assert() + * uses bt_version. */ bt_version[sizeof(bt_version) - 1] = 0; + raw_assert(str_rv == bt_version); return install_bt_handler(); } ___ tor-commits mailing list tor-commits@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits
[tor-commits] [tor/release-0.4.1] Merge remote-tracking branch 'tor-github/pr/1277' into maint-0.3.5
commit aee966cb06711a413980b8cf7fa359e69d62dd05 Merge: 62cf12a8b f311d0676 Author: teor Date: Thu Dec 5 10:11:18 2019 +1000 Merge remote-tracking branch 'tor-github/pr/1277' into maint-0.3.5 changes/bug31571| 7 +++ src/lib/err/backtrace.c | 42 +++--- src/lib/err/backtrace.h | 1 + src/lib/err/torerr.c| 11 +-- 4 files changed, 48 insertions(+), 13 deletions(-) ___ tor-commits mailing list tor-commits@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits
[tor-commits] [tor/release-0.4.2] Ensure that the exit callback is called if CreateProcessA() fails on Windows.
commit cbed6ff8430ee7f7d1002965ebf784628735c234 Author: Alexander Færøy Date: Thu Oct 17 16:47:04 2019 +0200 Ensure that the exit callback is called if CreateProcessA() fails on Windows. 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 --- src/lib/process/process_win32.c | 18 ++ 1 file changed, 18 insertions(+) diff --git a/src/lib/process/process_win32.c b/src/lib/process/process_win32.c index ddbe76bfd..1b1de6ad5 100644 --- a/src/lib/process/process_win32.c +++ b/src/lib/process/process_win32.c @@ -234,6 +234,24 @@ process_win32_exec(process_t *process) CloseHandle(stdin_pipe_read); CloseHandle(stdin_pipe_write); +/* In the Unix backend, we do not get an error in the Tor process when a + * child process fails to spawn its target executable since we need to + * first do the fork() call in the Tor process and then the child process + * is responsible for doing the call to execve(). + * + * This means that the user of the process_exec() API must check for + * whether it returns PROCESS_STATUS_ERROR, which will rarely happen on + * Unix, but will happen for error cases on Windows where it does not + * happen on Unix. For example: when the target executable does not exist + * on the file system. + * + * To have somewhat feature compatibility between the Unix and the Windows + * backend, we here notify the process_t owner that the process have exited + * (even though it never managed to run) to ensure that the exit callback + * is executed. + */ +process_notify_event_exit(process, 0); + return PROCESS_STATUS_ERROR; } ___ tor-commits mailing list tor-commits@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits
[tor-commits] [tor/release-0.4.0] Merge remote-tracking branch 'tor-github/pr/1277' into maint-0.3.5
commit aee966cb06711a413980b8cf7fa359e69d62dd05 Merge: 62cf12a8b f311d0676 Author: teor Date: Thu Dec 5 10:11:18 2019 +1000 Merge remote-tracking branch 'tor-github/pr/1277' into maint-0.3.5 changes/bug31571| 7 +++ src/lib/err/backtrace.c | 42 +++--- src/lib/err/backtrace.h | 1 + src/lib/err/torerr.c| 11 +-- 4 files changed, 48 insertions(+), 13 deletions(-) ___ tor-commits mailing list tor-commits@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits
[tor-commits] [tor/release-0.4.2] Add test to check if the exit callback is called in process_t upon process_exec() failures.
commit ee8db8a2eb7a5d345d16d02bade593fa6db2877e Author: Alexander Færøy Date: Thu Oct 17 16:56:21 2019 +0200 Add test to check if the exit callback is called in process_t upon process_exec() failures. This patch adds a test to check for whether the exit callback is always called when process_exec() fails, both on Windows and Unix. See: https://bugs.torproject.org/31810 --- src/test/test_process_slow.c | 30 ++ 1 file changed, 30 insertions(+) diff --git a/src/test/test_process_slow.c b/src/test/test_process_slow.c index 1322d7b83..d269a068e 100644 --- a/src/test/test_process_slow.c +++ b/src/test/test_process_slow.c @@ -328,8 +328,38 @@ test_callbacks_terminate(void *arg) process_free(process); } +static void +test_nonexistent_executable(void *arg) +{ + (void)arg; + + /* Process callback data. */ + process_data_t *process_data = process_data_new(); + + /* Setup our process. */ + process_t *process = process_new("binary-does-not-exist"); + process_set_data(process, process_data); + process_set_exit_callback(process, process_exit_callback); + + /* Run our process. */ + process_exec(process); + + /* Start our main loop. */ + run_main_loop(process_data); + + /* Ensure that the exit callback was actually called even though the binary + * did not exist. + */ + tt_assert(process_data->did_exit); + + done: + process_data_free(process_data); + process_free(process); +} + struct testcase_t slow_process_tests[] = { { "callbacks", test_callbacks, 0, NULL, NULL }, { "callbacks_terminate", test_callbacks_terminate, 0, NULL, NULL }, + { "nonexistent_executable", test_nonexistent_executable, 0, NULL, NULL }, END_OF_TESTCASES }; ___ tor-commits mailing list tor-commits@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits
[tor-commits] [tor/release-0.4.1] Merge branch 'maint-0.4.0' into maint-0.4.1
commit cfa9cc34aa36c0f300724a01998633efbe8439ea Merge: 14089a29b 92fb09906 Author: teor Date: Thu Dec 5 10:14:01 2019 +1000 Merge branch 'maint-0.4.0' into maint-0.4.1 changes/bug31571| 7 +++ changes/bug31810| 4 src/lib/err/backtrace.c | 42 ++--- src/lib/err/backtrace.h | 1 + src/lib/err/torerr.c| 11 +-- src/lib/process/process_unix.c | 9 + src/lib/process/process_win32.c | 18 ++ src/test/test_process_slow.c| 30 + 8 files changed, 101 insertions(+), 21 deletions(-) diff --cc src/lib/err/backtrace.c index 2408a6851,8606f4217..8bc7e6965 --- a/src/lib/err/backtrace.c +++ b/src/lib/err/backtrace.c @@@ -198,13 -193,12 +198,10 @@@ static int trap_signals[] = { SIGSEGV, /** Install signal handlers as needed so that when we crash, we produce a * useful stack trace. Return 0 on success, -errno on failure. */ static int - install_bt_handler(const char *software) + install_bt_handler(void) { - int trap_signals[] = { SIGSEGV, SIGILL, SIGFPE, SIGBUS, SIGSYS, - SIGIO, -1 }; int i, rv=0; - strncpy(bt_version, software, sizeof(bt_version) - 1); - bt_version[sizeof(bt_version) - 1] = 0; - struct sigaction sa; memset(, 0, sizeof(sa)); @@@ -260,10 -237,11 +257,11 @@@ remove_bt_handler(void #ifdef NO_BACKTRACE_IMPL void -log_backtrace_impl(int severity, int domain, const char *msg, +log_backtrace_impl(int severity, log_domain_mask_t domain, const char *msg, tor_log_fn logger) { - logger(severity, domain, "%s. (Stack trace not available)", msg); + logger(severity, domain, "%s: %s. (Stack trace not available)", + bt_version, msg); } static int diff --cc src/lib/err/torerr.c index 21b28a5f6,1a246e995..b7e32a3e2 --- a/src/lib/err/torerr.c +++ b/src/lib/err/torerr.c @@@ -206,20 -163,14 +207,26 @@@ tor_raw_assertion_failed_msg_(const cha } dump_stack_symbols_to_error_fds(); + + /* 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. */ + tor_log_err_sigsafe_write("\n"); } +/** + * Call the abort() function to kill the current process with a fatal + * error. But first, close the raw error file descriptors, so error messages + * are written before process termination. + **/ +void +tor_raw_abort_(void) +{ + tor_log_close_sigsafe_err_fds(); + abort(); +} + /* As format_{hex,dex}_number_sigsafe, but takes a radix argument * in range 2..16 inclusive. */ static int ___ tor-commits mailing list tor-commits@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits
[tor-commits] [tor/release-0.4.1] backtrace: Log the Tor backtrace version whenever we log a backtrace
commit 743bc0028be46e92a46b3b5e38f1e50ee69ff284 Author: teor Date: Fri Aug 30 21:15:54 2019 +1000 backtrace: Log the Tor backtrace version whenever we log a backtrace Previously, we just logged it in the crash handler. Part of 31571. --- src/lib/err/backtrace.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/lib/err/backtrace.c b/src/lib/err/backtrace.c index 8cca3c37e..c34eb6dfa 100644 --- a/src/lib/err/backtrace.c +++ b/src/lib/err/backtrace.c @@ -127,7 +127,7 @@ log_backtrace_impl(int severity, int domain, const char *msg, depth = backtrace(cb_buf, MAX_DEPTH); symbols = backtrace_symbols(cb_buf, (int)depth); - logger(severity, domain, "%s. Stack trace:", msg); + logger(severity, domain, "%s: %s. Stack trace:", bt_version, msg); if (!symbols) { /* LCOV_EXCL_START -- we can't provoke this. */ logger(severity, domain, "Unable to generate backtrace."); @@ -240,7 +240,8 @@ void log_backtrace_impl(int severity, int domain, const char *msg, tor_log_fn logger) { - logger(severity, domain, "%s. (Stack trace not available)", msg); + logger(severity, domain, "%s: %s. (Stack trace not available)", + bt_version, msg); } static int ___ tor-commits mailing list tor-commits@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits
[tor-commits] [tor/release-0.4.2] Merge remote-tracking branch 'tor-github/pr/1424' into maint-0.4.0
commit 46057ec5ae5ecc183fb7ed5060b8ba07ad235fb3 Merge: febbc236d ee8db8a2e Author: teor Date: Thu Dec 5 10:13:15 2019 +1000 Merge remote-tracking branch 'tor-github/pr/1424' into maint-0.4.0 changes/bug31810| 4 src/lib/process/process_unix.c | 9 + src/lib/process/process_win32.c | 18 ++ src/test/test_process_slow.c| 30 ++ 4 files changed, 53 insertions(+), 8 deletions(-) ___ tor-commits mailing list tor-commits@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits
[tor-commits] [tor/release-0.4.1] torerr: Log the Tor backtrace version when a raw assertion fails
commit 65a1d86491d56c77048d01e0b4fc6b933a13795c Author: teor Date: Fri Aug 30 21:17:07 2019 +1000 torerr: Log the Tor backtrace version when a raw assertion fails Part of 31571. --- src/lib/err/backtrace.c | 8 src/lib/err/backtrace.h | 1 + src/lib/err/torerr.c| 3 ++- 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/lib/err/backtrace.c b/src/lib/err/backtrace.c index c34eb6dfa..a4d8269c6 100644 --- a/src/lib/err/backtrace.c +++ b/src/lib/err/backtrace.c @@ -261,6 +261,14 @@ dump_stack_symbols_to_error_fds(void) } #endif /* defined(NO_BACKTRACE_IMPL) */ +/** Return the tor version used for error messages on crashes. + * Signal-safe: returns a pointer to a static array. */ +const char * +get_tor_backtrace_version(void) +{ + return bt_version; +} + /** Set up code to handle generating error messages on crashes. */ int configure_backtrace_handler(const char *tor_version) diff --git a/src/lib/err/backtrace.h b/src/lib/err/backtrace.h index 9b313261e..48b41fca0 100644 --- a/src/lib/err/backtrace.h +++ b/src/lib/err/backtrace.h @@ -21,6 +21,7 @@ void log_backtrace_impl(int severity, int domain, const char *msg, int configure_backtrace_handler(const char *tor_version); void clean_up_backtrace_handler(void); void dump_stack_symbols_to_error_fds(void); +const char *get_tor_backtrace_version(void); #define log_backtrace(sev, dom, msg) \ log_backtrace_impl((sev), (dom), (msg), tor_log) diff --git a/src/lib/err/torerr.c b/src/lib/err/torerr.c index 54acf722a..88b19b732 100644 --- a/src/lib/err/torerr.c +++ b/src/lib/err/torerr.c @@ -144,7 +144,8 @@ tor_raw_assertion_failed_msg_(const char *file, int line, const char *expr, { char linebuf[16]; format_dec_number_sigsafe(line, linebuf, sizeof(linebuf)); - tor_log_err_sigsafe("INTERNAL ERROR: Raw assertion failed at ", + tor_log_err_sigsafe("INTERNAL ERROR: Raw assertion failed in ", + get_tor_backtrace_version(), " at ", file, ":", linebuf, ": ", expr, NULL); if (msg) { tor_log_err_sigsafe_write(msg); ___ tor-commits mailing list tor-commits@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits
[tor-commits] [tor/release-0.4.2] Merge branch 'maint-0.3.5' into maint-0.4.0
commit 92fb0990675424cd04eb0b39b4ae157ac7f5385b Merge: 46057ec5a aee966cb0 Author: teor Date: Thu Dec 5 10:13:53 2019 +1000 Merge branch 'maint-0.3.5' into maint-0.4.0 changes/bug31571| 7 +++ src/lib/err/backtrace.c | 42 +++--- src/lib/err/backtrace.h | 1 + src/lib/err/torerr.c| 11 +-- 4 files changed, 48 insertions(+), 13 deletions(-) ___ tor-commits mailing list tor-commits@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits
[tor-commits] [tor/release-0.4.0] Ensure that the exit callback is called if CreateProcessA() fails on Windows.
commit cbed6ff8430ee7f7d1002965ebf784628735c234 Author: Alexander Færøy Date: Thu Oct 17 16:47:04 2019 +0200 Ensure that the exit callback is called if CreateProcessA() fails on Windows. 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 --- src/lib/process/process_win32.c | 18 ++ 1 file changed, 18 insertions(+) diff --git a/src/lib/process/process_win32.c b/src/lib/process/process_win32.c index ddbe76bfd..1b1de6ad5 100644 --- a/src/lib/process/process_win32.c +++ b/src/lib/process/process_win32.c @@ -234,6 +234,24 @@ process_win32_exec(process_t *process) CloseHandle(stdin_pipe_read); CloseHandle(stdin_pipe_write); +/* In the Unix backend, we do not get an error in the Tor process when a + * child process fails to spawn its target executable since we need to + * first do the fork() call in the Tor process and then the child process + * is responsible for doing the call to execve(). + * + * This means that the user of the process_exec() API must check for + * whether it returns PROCESS_STATUS_ERROR, which will rarely happen on + * Unix, but will happen for error cases on Windows where it does not + * happen on Unix. For example: when the target executable does not exist + * on the file system. + * + * To have somewhat feature compatibility between the Unix and the Windows + * backend, we here notify the process_t owner that the process have exited + * (even though it never managed to run) to ensure that the exit callback + * is executed. + */ +process_notify_event_exit(process, 0); + return PROCESS_STATUS_ERROR; } ___ tor-commits mailing list tor-commits@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits
[tor-commits] [tor/release-0.4.1] backtrace: Always set a backtrace Tor version
commit e2a7d08aa7c51fa903d5294628612a13b4c0d6e0 Author: teor Date: Fri Aug 30 21:12:52 2019 +1000 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. --- src/lib/err/backtrace.c | 15 +++ 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/lib/err/backtrace.c b/src/lib/err/backtrace.c index 1d1b3bcfa..8cca3c37e 100644 --- a/src/lib/err/backtrace.c +++ b/src/lib/err/backtrace.c @@ -68,10 +68,10 @@ // Redundant with util.h, but doing it here so we can avoid that dependency. #define raw_free free -#ifdef USE_BACKTRACE /** Version of Tor to report in backtrace messages. */ static char bt_version[128] = ""; +#ifdef USE_BACKTRACE /** Largest stack depth to try to dump. */ #define MAX_DEPTH 256 /** Static allocation of stack to dump. This is static so we avoid stack @@ -193,15 +193,12 @@ dump_stack_symbols_to_error_fds(void) /** Install signal handlers as needed so that when we crash, we produce a * useful stack trace. Return 0 on success, -errno on failure. */ static int -install_bt_handler(const char *software) +install_bt_handler(void) { int trap_signals[] = { SIGSEGV, SIGILL, SIGFPE, SIGBUS, SIGSYS, SIGIO, -1 }; int i, rv=0; - strncpy(bt_version, software, sizeof(bt_version) - 1); - bt_version[sizeof(bt_version) - 1] = 0; - struct sigaction sa; memset(, 0, sizeof(sa)); @@ -247,9 +244,8 @@ log_backtrace_impl(int severity, int domain, const char *msg, } static int -install_bt_handler(const char *software) +install_bt_handler(void) { - (void) software; return 0; } @@ -274,7 +270,10 @@ configure_backtrace_handler(const char *tor_version) snprintf(version, sizeof(version), "Tor %s", tor_version); } - return install_bt_handler(version); + strncpy(bt_version, version, sizeof(bt_version) - 1); + bt_version[sizeof(bt_version) - 1] = 0; + + return install_bt_handler(); } /** Perform end-of-process cleanup for code that generates error messages on ___ tor-commits mailing list tor-commits@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits
[tor-commits] [tor/release-0.4.1] Merge remote-tracking branch 'tor-github/pr/1424' into maint-0.4.0
commit 46057ec5ae5ecc183fb7ed5060b8ba07ad235fb3 Merge: febbc236d ee8db8a2e Author: teor Date: Thu Dec 5 10:13:15 2019 +1000 Merge remote-tracking branch 'tor-github/pr/1424' into maint-0.4.0 changes/bug31810| 4 src/lib/process/process_unix.c | 9 + src/lib/process/process_win32.c | 18 ++ src/test/test_process_slow.c| 30 ++ 4 files changed, 53 insertions(+), 8 deletions(-) ___ tor-commits mailing list tor-commits@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits
[tor-commits] [tor/release-0.4.0] Merge remote-tracking branch 'tor-github/pr/1424' into maint-0.4.0
commit 46057ec5ae5ecc183fb7ed5060b8ba07ad235fb3 Merge: febbc236d ee8db8a2e Author: teor Date: Thu Dec 5 10:13:15 2019 +1000 Merge remote-tracking branch 'tor-github/pr/1424' into maint-0.4.0 changes/bug31810| 4 src/lib/process/process_unix.c | 9 + src/lib/process/process_win32.c | 18 ++ src/test/test_process_slow.c| 30 ++ 4 files changed, 53 insertions(+), 8 deletions(-) ___ tor-commits mailing list tor-commits@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits
[tor-commits] [tor/release-0.4.1] Handle errors from execve() in the Unix process backend more gracefully.
commit 9915b8f0bc3e6a1b6c8413fbb87c41137ea89104 Author: Alexander Færøy Date: Thu Oct 17 16:39:05 2019 +0200 Handle errors from execve() in the Unix process backend more gracefully. 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 --- changes/bug31810 | 4 src/lib/process/process_unix.c | 9 + 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/changes/bug31810 b/changes/bug31810 new file mode 100644 index 0..628d12f09 --- /dev/null +++ b/changes/bug31810 @@ -0,0 +1,4 @@ + o Minor bugfixes (process management): +- Remove assertion in the Unix process backend. This assertion would trigger + when a new process is spawned where the executable is not found leading to + a stack trace from the child process. Fixes bug 31810; bugfix on 0.4.0.1-alpha. diff --git a/src/lib/process/process_unix.c b/src/lib/process/process_unix.c index 790ab897e..b102afff4 100644 --- a/src/lib/process/process_unix.c +++ b/src/lib/process/process_unix.c @@ -253,22 +253,15 @@ process_unix_exec(process_t *process) process_environment_t *env = process_get_environment(process); /* Call the requested program. */ -retval = execve(argv[0], argv, env->unixoid_environment_block); +execve(argv[0], argv, env->unixoid_environment_block); /* If we made it here it is because execve failed :-( */ -if (-1 == retval) - fprintf(stderr, "Call to execve() failed: %s", strerror(errno)); - tor_free(argv); process_environment_free(env); -tor_assert_unreached(); - error: -/* LCOV_EXCL_START */ fprintf(stderr, "Error from child process: %s", strerror(errno)); _exit(1); -/* LCOV_EXCL_STOP */ } /* We are in the parent process. */ ___ tor-commits mailing list tor-commits@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits
[tor-commits] [tor/release-0.4.1] torerr: Try harder to flush raw assert messages before process termination
commit c55591825fedb0fe1db92fab7b654ccc15ad50d3 Author: teor Date: Fri Aug 30 21:17:56 2019 +1000 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. --- changes/bug31571 | 7 +++ src/lib/err/torerr.c | 8 +++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/changes/bug31571 b/changes/bug31571 new file mode 100644 index 0..86de3537b --- /dev/null +++ b/changes/bug31571 @@ -0,0 +1,7 @@ + o Minor bugfixes (error handling): +- Report the tor version whenever an assertion fails. Previously, we only + reported the Tor version on some crashes, and some non-fatal assertions. + Fixes bug 31571; bugfix on 0.3.5.1-alpha. +- On abort, try harder to flush the output buffers of log messages. On + some platforms (macOS), log messages can be discarded when the process + terminates. Fixes bug 31571; bugfix on 0.3.5.1-alpha. diff --git a/src/lib/err/torerr.c b/src/lib/err/torerr.c index 88b19b732..6b5224273 100644 --- a/src/lib/err/torerr.c +++ b/src/lib/err/torerr.c @@ -146,13 +146,19 @@ tor_raw_assertion_failed_msg_(const char *file, int line, const char *expr, format_dec_number_sigsafe(line, linebuf, sizeof(linebuf)); tor_log_err_sigsafe("INTERNAL ERROR: Raw assertion failed in ", get_tor_backtrace_version(), " at ", - file, ":", linebuf, ": ", expr, NULL); + file, ":", linebuf, ": ", expr, "\n", NULL); if (msg) { tor_log_err_sigsafe_write(msg); tor_log_err_sigsafe_write("\n"); } dump_stack_symbols_to_error_fds(); + + /* 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. */ + tor_log_err_sigsafe_write("\n"); } /* As format_{hex,dex}_number_sigsafe, but takes a radix argument ___ tor-commits mailing list tor-commits@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits
[tor-commits] [tor/release-0.4.0] backtrace: Log the Tor backtrace version whenever we log a backtrace
commit 743bc0028be46e92a46b3b5e38f1e50ee69ff284 Author: teor Date: Fri Aug 30 21:15:54 2019 +1000 backtrace: Log the Tor backtrace version whenever we log a backtrace Previously, we just logged it in the crash handler. Part of 31571. --- src/lib/err/backtrace.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/lib/err/backtrace.c b/src/lib/err/backtrace.c index 8cca3c37e..c34eb6dfa 100644 --- a/src/lib/err/backtrace.c +++ b/src/lib/err/backtrace.c @@ -127,7 +127,7 @@ log_backtrace_impl(int severity, int domain, const char *msg, depth = backtrace(cb_buf, MAX_DEPTH); symbols = backtrace_symbols(cb_buf, (int)depth); - logger(severity, domain, "%s. Stack trace:", msg); + logger(severity, domain, "%s: %s. Stack trace:", bt_version, msg); if (!symbols) { /* LCOV_EXCL_START -- we can't provoke this. */ logger(severity, domain, "Unable to generate backtrace."); @@ -240,7 +240,8 @@ void log_backtrace_impl(int severity, int domain, const char *msg, tor_log_fn logger) { - logger(severity, domain, "%s. (Stack trace not available)", msg); + logger(severity, domain, "%s: %s. (Stack trace not available)", + bt_version, msg); } static int ___ tor-commits mailing list tor-commits@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits
[tor-commits] [tor/release-0.4.1] Add test to check if the exit callback is called in process_t upon process_exec() failures.
commit ee8db8a2eb7a5d345d16d02bade593fa6db2877e Author: Alexander Færøy Date: Thu Oct 17 16:56:21 2019 +0200 Add test to check if the exit callback is called in process_t upon process_exec() failures. This patch adds a test to check for whether the exit callback is always called when process_exec() fails, both on Windows and Unix. See: https://bugs.torproject.org/31810 --- src/test/test_process_slow.c | 30 ++ 1 file changed, 30 insertions(+) diff --git a/src/test/test_process_slow.c b/src/test/test_process_slow.c index 1322d7b83..d269a068e 100644 --- a/src/test/test_process_slow.c +++ b/src/test/test_process_slow.c @@ -328,8 +328,38 @@ test_callbacks_terminate(void *arg) process_free(process); } +static void +test_nonexistent_executable(void *arg) +{ + (void)arg; + + /* Process callback data. */ + process_data_t *process_data = process_data_new(); + + /* Setup our process. */ + process_t *process = process_new("binary-does-not-exist"); + process_set_data(process, process_data); + process_set_exit_callback(process, process_exit_callback); + + /* Run our process. */ + process_exec(process); + + /* Start our main loop. */ + run_main_loop(process_data); + + /* Ensure that the exit callback was actually called even though the binary + * did not exist. + */ + tt_assert(process_data->did_exit); + + done: + process_data_free(process_data); + process_free(process); +} + struct testcase_t slow_process_tests[] = { { "callbacks", test_callbacks, 0, NULL, NULL }, { "callbacks_terminate", test_callbacks_terminate, 0, NULL, NULL }, + { "nonexistent_executable", test_nonexistent_executable, 0, NULL, NULL }, END_OF_TESTCASES }; ___ tor-commits mailing list tor-commits@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits
[tor-commits] [tor/release-0.3.5] Merge branch 'maint-0.3.5' into release-0.3.5
commit c64844243a22a8f7495df79edac525d7b67f1440 Merge: 4ded6981b aee966cb0 Author: teor Date: Thu Dec 5 10:13:49 2019 +1000 Merge branch 'maint-0.3.5' into release-0.3.5 changes/bug31571| 7 +++ src/lib/err/backtrace.c | 42 +++--- src/lib/err/backtrace.h | 1 + src/lib/err/torerr.c| 11 +-- 4 files changed, 48 insertions(+), 13 deletions(-) ___ tor-commits mailing list tor-commits@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits
[tor-commits] [tor/release-0.4.0] backtrace: Always set a backtrace Tor version
commit e2a7d08aa7c51fa903d5294628612a13b4c0d6e0 Author: teor Date: Fri Aug 30 21:12:52 2019 +1000 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. --- src/lib/err/backtrace.c | 15 +++ 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/lib/err/backtrace.c b/src/lib/err/backtrace.c index 1d1b3bcfa..8cca3c37e 100644 --- a/src/lib/err/backtrace.c +++ b/src/lib/err/backtrace.c @@ -68,10 +68,10 @@ // Redundant with util.h, but doing it here so we can avoid that dependency. #define raw_free free -#ifdef USE_BACKTRACE /** Version of Tor to report in backtrace messages. */ static char bt_version[128] = ""; +#ifdef USE_BACKTRACE /** Largest stack depth to try to dump. */ #define MAX_DEPTH 256 /** Static allocation of stack to dump. This is static so we avoid stack @@ -193,15 +193,12 @@ dump_stack_symbols_to_error_fds(void) /** Install signal handlers as needed so that when we crash, we produce a * useful stack trace. Return 0 on success, -errno on failure. */ static int -install_bt_handler(const char *software) +install_bt_handler(void) { int trap_signals[] = { SIGSEGV, SIGILL, SIGFPE, SIGBUS, SIGSYS, SIGIO, -1 }; int i, rv=0; - strncpy(bt_version, software, sizeof(bt_version) - 1); - bt_version[sizeof(bt_version) - 1] = 0; - struct sigaction sa; memset(, 0, sizeof(sa)); @@ -247,9 +244,8 @@ log_backtrace_impl(int severity, int domain, const char *msg, } static int -install_bt_handler(const char *software) +install_bt_handler(void) { - (void) software; return 0; } @@ -274,7 +270,10 @@ configure_backtrace_handler(const char *tor_version) snprintf(version, sizeof(version), "Tor %s", tor_version); } - return install_bt_handler(version); + strncpy(bt_version, version, sizeof(bt_version) - 1); + bt_version[sizeof(bt_version) - 1] = 0; + + return install_bt_handler(); } /** Perform end-of-process cleanup for code that generates error messages on ___ tor-commits mailing list tor-commits@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits
[tor-commits] [tor/release-0.4.0] torerr: Try harder to flush raw assert messages before process termination
commit c55591825fedb0fe1db92fab7b654ccc15ad50d3 Author: teor Date: Fri Aug 30 21:17:56 2019 +1000 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. --- changes/bug31571 | 7 +++ src/lib/err/torerr.c | 8 +++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/changes/bug31571 b/changes/bug31571 new file mode 100644 index 0..86de3537b --- /dev/null +++ b/changes/bug31571 @@ -0,0 +1,7 @@ + o Minor bugfixes (error handling): +- Report the tor version whenever an assertion fails. Previously, we only + reported the Tor version on some crashes, and some non-fatal assertions. + Fixes bug 31571; bugfix on 0.3.5.1-alpha. +- On abort, try harder to flush the output buffers of log messages. On + some platforms (macOS), log messages can be discarded when the process + terminates. Fixes bug 31571; bugfix on 0.3.5.1-alpha. diff --git a/src/lib/err/torerr.c b/src/lib/err/torerr.c index 88b19b732..6b5224273 100644 --- a/src/lib/err/torerr.c +++ b/src/lib/err/torerr.c @@ -146,13 +146,19 @@ tor_raw_assertion_failed_msg_(const char *file, int line, const char *expr, format_dec_number_sigsafe(line, linebuf, sizeof(linebuf)); tor_log_err_sigsafe("INTERNAL ERROR: Raw assertion failed in ", get_tor_backtrace_version(), " at ", - file, ":", linebuf, ": ", expr, NULL); + file, ":", linebuf, ": ", expr, "\n", NULL); if (msg) { tor_log_err_sigsafe_write(msg); tor_log_err_sigsafe_write("\n"); } dump_stack_symbols_to_error_fds(); + + /* 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. */ + tor_log_err_sigsafe_write("\n"); } /* As format_{hex,dex}_number_sigsafe, but takes a radix argument ___ tor-commits mailing list tor-commits@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits
[tor-commits] [tor/release-0.4.0] Add test to check if the exit callback is called in process_t upon process_exec() failures.
commit ee8db8a2eb7a5d345d16d02bade593fa6db2877e Author: Alexander Færøy Date: Thu Oct 17 16:56:21 2019 +0200 Add test to check if the exit callback is called in process_t upon process_exec() failures. This patch adds a test to check for whether the exit callback is always called when process_exec() fails, both on Windows and Unix. See: https://bugs.torproject.org/31810 --- src/test/test_process_slow.c | 30 ++ 1 file changed, 30 insertions(+) diff --git a/src/test/test_process_slow.c b/src/test/test_process_slow.c index 1322d7b83..d269a068e 100644 --- a/src/test/test_process_slow.c +++ b/src/test/test_process_slow.c @@ -328,8 +328,38 @@ test_callbacks_terminate(void *arg) process_free(process); } +static void +test_nonexistent_executable(void *arg) +{ + (void)arg; + + /* Process callback data. */ + process_data_t *process_data = process_data_new(); + + /* Setup our process. */ + process_t *process = process_new("binary-does-not-exist"); + process_set_data(process, process_data); + process_set_exit_callback(process, process_exit_callback); + + /* Run our process. */ + process_exec(process); + + /* Start our main loop. */ + run_main_loop(process_data); + + /* Ensure that the exit callback was actually called even though the binary + * did not exist. + */ + tt_assert(process_data->did_exit); + + done: + process_data_free(process_data); + process_free(process); +} + struct testcase_t slow_process_tests[] = { { "callbacks", test_callbacks, 0, NULL, NULL }, { "callbacks_terminate", test_callbacks_terminate, 0, NULL, NULL }, + { "nonexistent_executable", test_nonexistent_executable, 0, NULL, NULL }, END_OF_TESTCASES }; ___ tor-commits mailing list tor-commits@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits
[tor-commits] [tor/release-0.4.0] Handle errors from execve() in the Unix process backend more gracefully.
commit 9915b8f0bc3e6a1b6c8413fbb87c41137ea89104 Author: Alexander Færøy Date: Thu Oct 17 16:39:05 2019 +0200 Handle errors from execve() in the Unix process backend more gracefully. 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 --- changes/bug31810 | 4 src/lib/process/process_unix.c | 9 + 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/changes/bug31810 b/changes/bug31810 new file mode 100644 index 0..628d12f09 --- /dev/null +++ b/changes/bug31810 @@ -0,0 +1,4 @@ + o Minor bugfixes (process management): +- Remove assertion in the Unix process backend. This assertion would trigger + when a new process is spawned where the executable is not found leading to + a stack trace from the child process. Fixes bug 31810; bugfix on 0.4.0.1-alpha. diff --git a/src/lib/process/process_unix.c b/src/lib/process/process_unix.c index 790ab897e..b102afff4 100644 --- a/src/lib/process/process_unix.c +++ b/src/lib/process/process_unix.c @@ -253,22 +253,15 @@ process_unix_exec(process_t *process) process_environment_t *env = process_get_environment(process); /* Call the requested program. */ -retval = execve(argv[0], argv, env->unixoid_environment_block); +execve(argv[0], argv, env->unixoid_environment_block); /* If we made it here it is because execve failed :-( */ -if (-1 == retval) - fprintf(stderr, "Call to execve() failed: %s", strerror(errno)); - tor_free(argv); process_environment_free(env); -tor_assert_unreached(); - error: -/* LCOV_EXCL_START */ fprintf(stderr, "Error from child process: %s", strerror(errno)); _exit(1); -/* LCOV_EXCL_STOP */ } /* We are in the parent process. */ ___ tor-commits mailing list tor-commits@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits
[tor-commits] [tor/release-0.3.5] backtrace: Check the return values of snprintf() and strncpy()
commit f311d0676caad1c61a4dbf8fffbeb79003866903 Author: teor Date: Tue Sep 3 15:50:37 2019 +1000 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. --- src/lib/err/backtrace.c | 16 ++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/lib/err/backtrace.c b/src/lib/err/backtrace.c index a4d8269c6..8606f4217 100644 --- a/src/lib/err/backtrace.c +++ b/src/lib/err/backtrace.c @@ -276,11 +276,23 @@ configure_backtrace_handler(const char *tor_version) char version[128] = "Tor\0"; if (tor_version) { -snprintf(version, sizeof(version), "Tor %s", tor_version); +int snp_rv = 0; +/* We can't use strlcat() here, because it is defined in + * string/compat_string.h on some platforms, and string uses torerr. */ +snp_rv = snprintf(version, sizeof(version), "Tor %s", tor_version); +/* It's safe to call raw_assert() here, because raw_assert() does not + * call configure_backtrace_handler(). */ +raw_assert(snp_rv < (int)sizeof(version)); +raw_assert(snp_rv >= 0); } - strncpy(bt_version, version, sizeof(bt_version) - 1); + char *str_rv = NULL; + /* We can't use strlcpy() here, see the note about strlcat() above. */ + str_rv = strncpy(bt_version, version, sizeof(bt_version) - 1); + /* We must terminate bt_version, then raw_assert(), because raw_assert() + * uses bt_version. */ bt_version[sizeof(bt_version) - 1] = 0; + raw_assert(str_rv == bt_version); return install_bt_handler(); } ___ tor-commits mailing list tor-commits@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits
[tor-commits] [tor/release-0.3.5] Merge remote-tracking branch 'tor-github/pr/1277' into maint-0.3.5
commit aee966cb06711a413980b8cf7fa359e69d62dd05 Merge: 62cf12a8b f311d0676 Author: teor Date: Thu Dec 5 10:11:18 2019 +1000 Merge remote-tracking branch 'tor-github/pr/1277' into maint-0.3.5 changes/bug31571| 7 +++ src/lib/err/backtrace.c | 42 +++--- src/lib/err/backtrace.h | 1 + src/lib/err/torerr.c| 11 +-- 4 files changed, 48 insertions(+), 13 deletions(-) ___ tor-commits mailing list tor-commits@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits
[tor-commits] [tor/release-0.4.0] backtrace: Check the return values of snprintf() and strncpy()
commit f311d0676caad1c61a4dbf8fffbeb79003866903 Author: teor Date: Tue Sep 3 15:50:37 2019 +1000 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. --- src/lib/err/backtrace.c | 16 ++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/lib/err/backtrace.c b/src/lib/err/backtrace.c index a4d8269c6..8606f4217 100644 --- a/src/lib/err/backtrace.c +++ b/src/lib/err/backtrace.c @@ -276,11 +276,23 @@ configure_backtrace_handler(const char *tor_version) char version[128] = "Tor\0"; if (tor_version) { -snprintf(version, sizeof(version), "Tor %s", tor_version); +int snp_rv = 0; +/* We can't use strlcat() here, because it is defined in + * string/compat_string.h on some platforms, and string uses torerr. */ +snp_rv = snprintf(version, sizeof(version), "Tor %s", tor_version); +/* It's safe to call raw_assert() here, because raw_assert() does not + * call configure_backtrace_handler(). */ +raw_assert(snp_rv < (int)sizeof(version)); +raw_assert(snp_rv >= 0); } - strncpy(bt_version, version, sizeof(bt_version) - 1); + char *str_rv = NULL; + /* We can't use strlcpy() here, see the note about strlcat() above. */ + str_rv = strncpy(bt_version, version, sizeof(bt_version) - 1); + /* We must terminate bt_version, then raw_assert(), because raw_assert() + * uses bt_version. */ bt_version[sizeof(bt_version) - 1] = 0; + raw_assert(str_rv == bt_version); return install_bt_handler(); } ___ tor-commits mailing list tor-commits@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits
[tor-commits] [tor/release-0.3.5] backtrace: Always set a backtrace Tor version
commit e2a7d08aa7c51fa903d5294628612a13b4c0d6e0 Author: teor Date: Fri Aug 30 21:12:52 2019 +1000 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. --- src/lib/err/backtrace.c | 15 +++ 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/lib/err/backtrace.c b/src/lib/err/backtrace.c index 1d1b3bcfa..8cca3c37e 100644 --- a/src/lib/err/backtrace.c +++ b/src/lib/err/backtrace.c @@ -68,10 +68,10 @@ // Redundant with util.h, but doing it here so we can avoid that dependency. #define raw_free free -#ifdef USE_BACKTRACE /** Version of Tor to report in backtrace messages. */ static char bt_version[128] = ""; +#ifdef USE_BACKTRACE /** Largest stack depth to try to dump. */ #define MAX_DEPTH 256 /** Static allocation of stack to dump. This is static so we avoid stack @@ -193,15 +193,12 @@ dump_stack_symbols_to_error_fds(void) /** Install signal handlers as needed so that when we crash, we produce a * useful stack trace. Return 0 on success, -errno on failure. */ static int -install_bt_handler(const char *software) +install_bt_handler(void) { int trap_signals[] = { SIGSEGV, SIGILL, SIGFPE, SIGBUS, SIGSYS, SIGIO, -1 }; int i, rv=0; - strncpy(bt_version, software, sizeof(bt_version) - 1); - bt_version[sizeof(bt_version) - 1] = 0; - struct sigaction sa; memset(, 0, sizeof(sa)); @@ -247,9 +244,8 @@ log_backtrace_impl(int severity, int domain, const char *msg, } static int -install_bt_handler(const char *software) +install_bt_handler(void) { - (void) software; return 0; } @@ -274,7 +270,10 @@ configure_backtrace_handler(const char *tor_version) snprintf(version, sizeof(version), "Tor %s", tor_version); } - return install_bt_handler(version); + strncpy(bt_version, version, sizeof(bt_version) - 1); + bt_version[sizeof(bt_version) - 1] = 0; + + return install_bt_handler(); } /** Perform end-of-process cleanup for code that generates error messages on ___ tor-commits mailing list tor-commits@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits
[tor-commits] [tor/release-0.3.5] torerr: Try harder to flush raw assert messages before process termination
commit c55591825fedb0fe1db92fab7b654ccc15ad50d3 Author: teor Date: Fri Aug 30 21:17:56 2019 +1000 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. --- changes/bug31571 | 7 +++ src/lib/err/torerr.c | 8 +++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/changes/bug31571 b/changes/bug31571 new file mode 100644 index 0..86de3537b --- /dev/null +++ b/changes/bug31571 @@ -0,0 +1,7 @@ + o Minor bugfixes (error handling): +- Report the tor version whenever an assertion fails. Previously, we only + reported the Tor version on some crashes, and some non-fatal assertions. + Fixes bug 31571; bugfix on 0.3.5.1-alpha. +- On abort, try harder to flush the output buffers of log messages. On + some platforms (macOS), log messages can be discarded when the process + terminates. Fixes bug 31571; bugfix on 0.3.5.1-alpha. diff --git a/src/lib/err/torerr.c b/src/lib/err/torerr.c index 88b19b732..6b5224273 100644 --- a/src/lib/err/torerr.c +++ b/src/lib/err/torerr.c @@ -146,13 +146,19 @@ tor_raw_assertion_failed_msg_(const char *file, int line, const char *expr, format_dec_number_sigsafe(line, linebuf, sizeof(linebuf)); tor_log_err_sigsafe("INTERNAL ERROR: Raw assertion failed in ", get_tor_backtrace_version(), " at ", - file, ":", linebuf, ": ", expr, NULL); + file, ":", linebuf, ": ", expr, "\n", NULL); if (msg) { tor_log_err_sigsafe_write(msg); tor_log_err_sigsafe_write("\n"); } dump_stack_symbols_to_error_fds(); + + /* 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. */ + tor_log_err_sigsafe_write("\n"); } /* As format_{hex,dex}_number_sigsafe, but takes a radix argument ___ tor-commits mailing list tor-commits@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits
[tor-commits] [tor/release-0.4.0] torerr: Log the Tor backtrace version when a raw assertion fails
commit 65a1d86491d56c77048d01e0b4fc6b933a13795c Author: teor Date: Fri Aug 30 21:17:07 2019 +1000 torerr: Log the Tor backtrace version when a raw assertion fails Part of 31571. --- src/lib/err/backtrace.c | 8 src/lib/err/backtrace.h | 1 + src/lib/err/torerr.c| 3 ++- 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/lib/err/backtrace.c b/src/lib/err/backtrace.c index c34eb6dfa..a4d8269c6 100644 --- a/src/lib/err/backtrace.c +++ b/src/lib/err/backtrace.c @@ -261,6 +261,14 @@ dump_stack_symbols_to_error_fds(void) } #endif /* defined(NO_BACKTRACE_IMPL) */ +/** Return the tor version used for error messages on crashes. + * Signal-safe: returns a pointer to a static array. */ +const char * +get_tor_backtrace_version(void) +{ + return bt_version; +} + /** Set up code to handle generating error messages on crashes. */ int configure_backtrace_handler(const char *tor_version) diff --git a/src/lib/err/backtrace.h b/src/lib/err/backtrace.h index 9b313261e..48b41fca0 100644 --- a/src/lib/err/backtrace.h +++ b/src/lib/err/backtrace.h @@ -21,6 +21,7 @@ void log_backtrace_impl(int severity, int domain, const char *msg, int configure_backtrace_handler(const char *tor_version); void clean_up_backtrace_handler(void); void dump_stack_symbols_to_error_fds(void); +const char *get_tor_backtrace_version(void); #define log_backtrace(sev, dom, msg) \ log_backtrace_impl((sev), (dom), (msg), tor_log) diff --git a/src/lib/err/torerr.c b/src/lib/err/torerr.c index 54acf722a..88b19b732 100644 --- a/src/lib/err/torerr.c +++ b/src/lib/err/torerr.c @@ -144,7 +144,8 @@ tor_raw_assertion_failed_msg_(const char *file, int line, const char *expr, { char linebuf[16]; format_dec_number_sigsafe(line, linebuf, sizeof(linebuf)); - tor_log_err_sigsafe("INTERNAL ERROR: Raw assertion failed at ", + tor_log_err_sigsafe("INTERNAL ERROR: Raw assertion failed in ", + get_tor_backtrace_version(), " at ", file, ":", linebuf, ": ", expr, NULL); if (msg) { tor_log_err_sigsafe_write(msg); ___ tor-commits mailing list tor-commits@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits
[tor-commits] [tor/release-0.3.5] backtrace: Log the Tor backtrace version whenever we log a backtrace
commit 743bc0028be46e92a46b3b5e38f1e50ee69ff284 Author: teor Date: Fri Aug 30 21:15:54 2019 +1000 backtrace: Log the Tor backtrace version whenever we log a backtrace Previously, we just logged it in the crash handler. Part of 31571. --- src/lib/err/backtrace.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/lib/err/backtrace.c b/src/lib/err/backtrace.c index 8cca3c37e..c34eb6dfa 100644 --- a/src/lib/err/backtrace.c +++ b/src/lib/err/backtrace.c @@ -127,7 +127,7 @@ log_backtrace_impl(int severity, int domain, const char *msg, depth = backtrace(cb_buf, MAX_DEPTH); symbols = backtrace_symbols(cb_buf, (int)depth); - logger(severity, domain, "%s. Stack trace:", msg); + logger(severity, domain, "%s: %s. Stack trace:", bt_version, msg); if (!symbols) { /* LCOV_EXCL_START -- we can't provoke this. */ logger(severity, domain, "Unable to generate backtrace."); @@ -240,7 +240,8 @@ void log_backtrace_impl(int severity, int domain, const char *msg, tor_log_fn logger) { - logger(severity, domain, "%s. (Stack trace not available)", msg); + logger(severity, domain, "%s: %s. (Stack trace not available)", + bt_version, msg); } static int ___ tor-commits mailing list tor-commits@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits
[tor-commits] [tor/maint-0.4.2] Merge remote-tracking branch 'tor-github/pr/1424' into maint-0.4.0
commit 46057ec5ae5ecc183fb7ed5060b8ba07ad235fb3 Merge: febbc236d ee8db8a2e Author: teor Date: Thu Dec 5 10:13:15 2019 +1000 Merge remote-tracking branch 'tor-github/pr/1424' into maint-0.4.0 changes/bug31810| 4 src/lib/process/process_unix.c | 9 + src/lib/process/process_win32.c | 18 ++ src/test/test_process_slow.c| 30 ++ 4 files changed, 53 insertions(+), 8 deletions(-) ___ tor-commits mailing list tor-commits@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits
[tor-commits] [tor/maint-0.4.2] Ensure that the exit callback is called if CreateProcessA() fails on Windows.
commit cbed6ff8430ee7f7d1002965ebf784628735c234 Author: Alexander Færøy Date: Thu Oct 17 16:47:04 2019 +0200 Ensure that the exit callback is called if CreateProcessA() fails on Windows. 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 --- src/lib/process/process_win32.c | 18 ++ 1 file changed, 18 insertions(+) diff --git a/src/lib/process/process_win32.c b/src/lib/process/process_win32.c index ddbe76bfd..1b1de6ad5 100644 --- a/src/lib/process/process_win32.c +++ b/src/lib/process/process_win32.c @@ -234,6 +234,24 @@ process_win32_exec(process_t *process) CloseHandle(stdin_pipe_read); CloseHandle(stdin_pipe_write); +/* In the Unix backend, we do not get an error in the Tor process when a + * child process fails to spawn its target executable since we need to + * first do the fork() call in the Tor process and then the child process + * is responsible for doing the call to execve(). + * + * This means that the user of the process_exec() API must check for + * whether it returns PROCESS_STATUS_ERROR, which will rarely happen on + * Unix, but will happen for error cases on Windows where it does not + * happen on Unix. For example: when the target executable does not exist + * on the file system. + * + * To have somewhat feature compatibility between the Unix and the Windows + * backend, we here notify the process_t owner that the process have exited + * (even though it never managed to run) to ensure that the exit callback + * is executed. + */ +process_notify_event_exit(process, 0); + return PROCESS_STATUS_ERROR; } ___ tor-commits mailing list tor-commits@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits
[tor-commits] [tor/release-0.3.5] torerr: Log the Tor backtrace version when a raw assertion fails
commit 65a1d86491d56c77048d01e0b4fc6b933a13795c Author: teor Date: Fri Aug 30 21:17:07 2019 +1000 torerr: Log the Tor backtrace version when a raw assertion fails Part of 31571. --- src/lib/err/backtrace.c | 8 src/lib/err/backtrace.h | 1 + src/lib/err/torerr.c| 3 ++- 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/lib/err/backtrace.c b/src/lib/err/backtrace.c index c34eb6dfa..a4d8269c6 100644 --- a/src/lib/err/backtrace.c +++ b/src/lib/err/backtrace.c @@ -261,6 +261,14 @@ dump_stack_symbols_to_error_fds(void) } #endif /* defined(NO_BACKTRACE_IMPL) */ +/** Return the tor version used for error messages on crashes. + * Signal-safe: returns a pointer to a static array. */ +const char * +get_tor_backtrace_version(void) +{ + return bt_version; +} + /** Set up code to handle generating error messages on crashes. */ int configure_backtrace_handler(const char *tor_version) diff --git a/src/lib/err/backtrace.h b/src/lib/err/backtrace.h index 9b313261e..48b41fca0 100644 --- a/src/lib/err/backtrace.h +++ b/src/lib/err/backtrace.h @@ -21,6 +21,7 @@ void log_backtrace_impl(int severity, int domain, const char *msg, int configure_backtrace_handler(const char *tor_version); void clean_up_backtrace_handler(void); void dump_stack_symbols_to_error_fds(void); +const char *get_tor_backtrace_version(void); #define log_backtrace(sev, dom, msg) \ log_backtrace_impl((sev), (dom), (msg), tor_log) diff --git a/src/lib/err/torerr.c b/src/lib/err/torerr.c index 54acf722a..88b19b732 100644 --- a/src/lib/err/torerr.c +++ b/src/lib/err/torerr.c @@ -144,7 +144,8 @@ tor_raw_assertion_failed_msg_(const char *file, int line, const char *expr, { char linebuf[16]; format_dec_number_sigsafe(line, linebuf, sizeof(linebuf)); - tor_log_err_sigsafe("INTERNAL ERROR: Raw assertion failed at ", + tor_log_err_sigsafe("INTERNAL ERROR: Raw assertion failed in ", + get_tor_backtrace_version(), " at ", file, ":", linebuf, ": ", expr, NULL); if (msg) { tor_log_err_sigsafe_write(msg); ___ tor-commits mailing list tor-commits@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits
[tor-commits] [tor/maint-0.4.2] Merge branch 'maint-0.3.5' into maint-0.4.0
commit 92fb0990675424cd04eb0b39b4ae157ac7f5385b Merge: 46057ec5a aee966cb0 Author: teor Date: Thu Dec 5 10:13:53 2019 +1000 Merge branch 'maint-0.3.5' into maint-0.4.0 changes/bug31571| 7 +++ src/lib/err/backtrace.c | 42 +++--- src/lib/err/backtrace.h | 1 + src/lib/err/torerr.c| 11 +-- 4 files changed, 48 insertions(+), 13 deletions(-) ___ tor-commits mailing list tor-commits@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits
[tor-commits] [tor/maint-0.4.2] Merge branch 'maint-0.4.1' into maint-0.4.2
commit bb786797aa449389d47f7bf94fb5fa238e51e377 Merge: 3207a8e5c cfa9cc34a Author: teor Date: Thu Dec 5 10:14:08 2019 +1000 Merge branch 'maint-0.4.1' into maint-0.4.2 ___ tor-commits mailing list tor-commits@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits
[tor-commits] [tor/maint-0.4.2] Add test to check if the exit callback is called in process_t upon process_exec() failures.
commit ee8db8a2eb7a5d345d16d02bade593fa6db2877e Author: Alexander Færøy Date: Thu Oct 17 16:56:21 2019 +0200 Add test to check if the exit callback is called in process_t upon process_exec() failures. This patch adds a test to check for whether the exit callback is always called when process_exec() fails, both on Windows and Unix. See: https://bugs.torproject.org/31810 --- src/test/test_process_slow.c | 30 ++ 1 file changed, 30 insertions(+) diff --git a/src/test/test_process_slow.c b/src/test/test_process_slow.c index 1322d7b83..d269a068e 100644 --- a/src/test/test_process_slow.c +++ b/src/test/test_process_slow.c @@ -328,8 +328,38 @@ test_callbacks_terminate(void *arg) process_free(process); } +static void +test_nonexistent_executable(void *arg) +{ + (void)arg; + + /* Process callback data. */ + process_data_t *process_data = process_data_new(); + + /* Setup our process. */ + process_t *process = process_new("binary-does-not-exist"); + process_set_data(process, process_data); + process_set_exit_callback(process, process_exit_callback); + + /* Run our process. */ + process_exec(process); + + /* Start our main loop. */ + run_main_loop(process_data); + + /* Ensure that the exit callback was actually called even though the binary + * did not exist. + */ + tt_assert(process_data->did_exit); + + done: + process_data_free(process_data); + process_free(process); +} + struct testcase_t slow_process_tests[] = { { "callbacks", test_callbacks, 0, NULL, NULL }, { "callbacks_terminate", test_callbacks_terminate, 0, NULL, NULL }, + { "nonexistent_executable", test_nonexistent_executable, 0, NULL, NULL }, END_OF_TESTCASES }; ___ tor-commits mailing list tor-commits@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits
[tor-commits] [tor/maint-0.4.2] Merge branch 'maint-0.4.0' into maint-0.4.1
commit cfa9cc34aa36c0f300724a01998633efbe8439ea Merge: 14089a29b 92fb09906 Author: teor Date: Thu Dec 5 10:14:01 2019 +1000 Merge branch 'maint-0.4.0' into maint-0.4.1 changes/bug31571| 7 +++ changes/bug31810| 4 src/lib/err/backtrace.c | 42 ++--- src/lib/err/backtrace.h | 1 + src/lib/err/torerr.c| 11 +-- src/lib/process/process_unix.c | 9 + src/lib/process/process_win32.c | 18 ++ src/test/test_process_slow.c| 30 + 8 files changed, 101 insertions(+), 21 deletions(-) diff --cc src/lib/err/backtrace.c index 2408a6851,8606f4217..8bc7e6965 --- a/src/lib/err/backtrace.c +++ b/src/lib/err/backtrace.c @@@ -198,13 -193,12 +198,10 @@@ static int trap_signals[] = { SIGSEGV, /** Install signal handlers as needed so that when we crash, we produce a * useful stack trace. Return 0 on success, -errno on failure. */ static int - install_bt_handler(const char *software) + install_bt_handler(void) { - int trap_signals[] = { SIGSEGV, SIGILL, SIGFPE, SIGBUS, SIGSYS, - SIGIO, -1 }; int i, rv=0; - strncpy(bt_version, software, sizeof(bt_version) - 1); - bt_version[sizeof(bt_version) - 1] = 0; - struct sigaction sa; memset(, 0, sizeof(sa)); @@@ -260,10 -237,11 +257,11 @@@ remove_bt_handler(void #ifdef NO_BACKTRACE_IMPL void -log_backtrace_impl(int severity, int domain, const char *msg, +log_backtrace_impl(int severity, log_domain_mask_t domain, const char *msg, tor_log_fn logger) { - logger(severity, domain, "%s. (Stack trace not available)", msg); + logger(severity, domain, "%s: %s. (Stack trace not available)", + bt_version, msg); } static int diff --cc src/lib/err/torerr.c index 21b28a5f6,1a246e995..b7e32a3e2 --- a/src/lib/err/torerr.c +++ b/src/lib/err/torerr.c @@@ -206,20 -163,14 +207,26 @@@ tor_raw_assertion_failed_msg_(const cha } dump_stack_symbols_to_error_fds(); + + /* 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. */ + tor_log_err_sigsafe_write("\n"); } +/** + * Call the abort() function to kill the current process with a fatal + * error. But first, close the raw error file descriptors, so error messages + * are written before process termination. + **/ +void +tor_raw_abort_(void) +{ + tor_log_close_sigsafe_err_fds(); + abort(); +} + /* As format_{hex,dex}_number_sigsafe, but takes a radix argument * in range 2..16 inclusive. */ static int ___ tor-commits mailing list tor-commits@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits
[tor-commits] [tor/maint-0.4.1] Merge remote-tracking branch 'tor-github/pr/1424' into maint-0.4.0
commit 46057ec5ae5ecc183fb7ed5060b8ba07ad235fb3 Merge: febbc236d ee8db8a2e Author: teor Date: Thu Dec 5 10:13:15 2019 +1000 Merge remote-tracking branch 'tor-github/pr/1424' into maint-0.4.0 changes/bug31810| 4 src/lib/process/process_unix.c | 9 + src/lib/process/process_win32.c | 18 ++ src/test/test_process_slow.c| 30 ++ 4 files changed, 53 insertions(+), 8 deletions(-) ___ tor-commits mailing list tor-commits@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits
[tor-commits] [tor/maint-0.4.2] Merge remote-tracking branch 'tor-github/pr/1277' into maint-0.3.5
commit aee966cb06711a413980b8cf7fa359e69d62dd05 Merge: 62cf12a8b f311d0676 Author: teor Date: Thu Dec 5 10:11:18 2019 +1000 Merge remote-tracking branch 'tor-github/pr/1277' into maint-0.3.5 changes/bug31571| 7 +++ src/lib/err/backtrace.c | 42 +++--- src/lib/err/backtrace.h | 1 + src/lib/err/torerr.c| 11 +-- 4 files changed, 48 insertions(+), 13 deletions(-) ___ tor-commits mailing list tor-commits@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits
[tor-commits] [tor/maint-0.4.2] Handle errors from execve() in the Unix process backend more gracefully.
commit 9915b8f0bc3e6a1b6c8413fbb87c41137ea89104 Author: Alexander Færøy Date: Thu Oct 17 16:39:05 2019 +0200 Handle errors from execve() in the Unix process backend more gracefully. 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 --- changes/bug31810 | 4 src/lib/process/process_unix.c | 9 + 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/changes/bug31810 b/changes/bug31810 new file mode 100644 index 0..628d12f09 --- /dev/null +++ b/changes/bug31810 @@ -0,0 +1,4 @@ + o Minor bugfixes (process management): +- Remove assertion in the Unix process backend. This assertion would trigger + when a new process is spawned where the executable is not found leading to + a stack trace from the child process. Fixes bug 31810; bugfix on 0.4.0.1-alpha. diff --git a/src/lib/process/process_unix.c b/src/lib/process/process_unix.c index 790ab897e..b102afff4 100644 --- a/src/lib/process/process_unix.c +++ b/src/lib/process/process_unix.c @@ -253,22 +253,15 @@ process_unix_exec(process_t *process) process_environment_t *env = process_get_environment(process); /* Call the requested program. */ -retval = execve(argv[0], argv, env->unixoid_environment_block); +execve(argv[0], argv, env->unixoid_environment_block); /* If we made it here it is because execve failed :-( */ -if (-1 == retval) - fprintf(stderr, "Call to execve() failed: %s", strerror(errno)); - tor_free(argv); process_environment_free(env); -tor_assert_unreached(); - error: -/* LCOV_EXCL_START */ fprintf(stderr, "Error from child process: %s", strerror(errno)); _exit(1); -/* LCOV_EXCL_STOP */ } /* We are in the parent process. */ ___ tor-commits mailing list tor-commits@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits
[tor-commits] [tor/maint-0.4.1] Merge branch 'maint-0.4.0' into maint-0.4.1
commit cfa9cc34aa36c0f300724a01998633efbe8439ea Merge: 14089a29b 92fb09906 Author: teor Date: Thu Dec 5 10:14:01 2019 +1000 Merge branch 'maint-0.4.0' into maint-0.4.1 changes/bug31571| 7 +++ changes/bug31810| 4 src/lib/err/backtrace.c | 42 ++--- src/lib/err/backtrace.h | 1 + src/lib/err/torerr.c| 11 +-- src/lib/process/process_unix.c | 9 + src/lib/process/process_win32.c | 18 ++ src/test/test_process_slow.c| 30 + 8 files changed, 101 insertions(+), 21 deletions(-) diff --cc src/lib/err/backtrace.c index 2408a6851,8606f4217..8bc7e6965 --- a/src/lib/err/backtrace.c +++ b/src/lib/err/backtrace.c @@@ -198,13 -193,12 +198,10 @@@ static int trap_signals[] = { SIGSEGV, /** Install signal handlers as needed so that when we crash, we produce a * useful stack trace. Return 0 on success, -errno on failure. */ static int - install_bt_handler(const char *software) + install_bt_handler(void) { - int trap_signals[] = { SIGSEGV, SIGILL, SIGFPE, SIGBUS, SIGSYS, - SIGIO, -1 }; int i, rv=0; - strncpy(bt_version, software, sizeof(bt_version) - 1); - bt_version[sizeof(bt_version) - 1] = 0; - struct sigaction sa; memset(, 0, sizeof(sa)); @@@ -260,10 -237,11 +257,11 @@@ remove_bt_handler(void #ifdef NO_BACKTRACE_IMPL void -log_backtrace_impl(int severity, int domain, const char *msg, +log_backtrace_impl(int severity, log_domain_mask_t domain, const char *msg, tor_log_fn logger) { - logger(severity, domain, "%s. (Stack trace not available)", msg); + logger(severity, domain, "%s: %s. (Stack trace not available)", + bt_version, msg); } static int diff --cc src/lib/err/torerr.c index 21b28a5f6,1a246e995..b7e32a3e2 --- a/src/lib/err/torerr.c +++ b/src/lib/err/torerr.c @@@ -206,20 -163,14 +207,26 @@@ tor_raw_assertion_failed_msg_(const cha } dump_stack_symbols_to_error_fds(); + + /* 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. */ + tor_log_err_sigsafe_write("\n"); } +/** + * Call the abort() function to kill the current process with a fatal + * error. But first, close the raw error file descriptors, so error messages + * are written before process termination. + **/ +void +tor_raw_abort_(void) +{ + tor_log_close_sigsafe_err_fds(); + abort(); +} + /* As format_{hex,dex}_number_sigsafe, but takes a radix argument * in range 2..16 inclusive. */ static int ___ tor-commits mailing list tor-commits@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits
[tor-commits] [tor/maint-0.4.1] Add test to check if the exit callback is called in process_t upon process_exec() failures.
commit ee8db8a2eb7a5d345d16d02bade593fa6db2877e Author: Alexander Færøy Date: Thu Oct 17 16:56:21 2019 +0200 Add test to check if the exit callback is called in process_t upon process_exec() failures. This patch adds a test to check for whether the exit callback is always called when process_exec() fails, both on Windows and Unix. See: https://bugs.torproject.org/31810 --- src/test/test_process_slow.c | 30 ++ 1 file changed, 30 insertions(+) diff --git a/src/test/test_process_slow.c b/src/test/test_process_slow.c index 1322d7b83..d269a068e 100644 --- a/src/test/test_process_slow.c +++ b/src/test/test_process_slow.c @@ -328,8 +328,38 @@ test_callbacks_terminate(void *arg) process_free(process); } +static void +test_nonexistent_executable(void *arg) +{ + (void)arg; + + /* Process callback data. */ + process_data_t *process_data = process_data_new(); + + /* Setup our process. */ + process_t *process = process_new("binary-does-not-exist"); + process_set_data(process, process_data); + process_set_exit_callback(process, process_exit_callback); + + /* Run our process. */ + process_exec(process); + + /* Start our main loop. */ + run_main_loop(process_data); + + /* Ensure that the exit callback was actually called even though the binary + * did not exist. + */ + tt_assert(process_data->did_exit); + + done: + process_data_free(process_data); + process_free(process); +} + struct testcase_t slow_process_tests[] = { { "callbacks", test_callbacks, 0, NULL, NULL }, { "callbacks_terminate", test_callbacks_terminate, 0, NULL, NULL }, + { "nonexistent_executable", test_nonexistent_executable, 0, NULL, NULL }, END_OF_TESTCASES }; ___ tor-commits mailing list tor-commits@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits
[tor-commits] [tor/maint-0.4.1] Handle errors from execve() in the Unix process backend more gracefully.
commit 9915b8f0bc3e6a1b6c8413fbb87c41137ea89104 Author: Alexander Færøy Date: Thu Oct 17 16:39:05 2019 +0200 Handle errors from execve() in the Unix process backend more gracefully. 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 --- changes/bug31810 | 4 src/lib/process/process_unix.c | 9 + 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/changes/bug31810 b/changes/bug31810 new file mode 100644 index 0..628d12f09 --- /dev/null +++ b/changes/bug31810 @@ -0,0 +1,4 @@ + o Minor bugfixes (process management): +- Remove assertion in the Unix process backend. This assertion would trigger + when a new process is spawned where the executable is not found leading to + a stack trace from the child process. Fixes bug 31810; bugfix on 0.4.0.1-alpha. diff --git a/src/lib/process/process_unix.c b/src/lib/process/process_unix.c index 790ab897e..b102afff4 100644 --- a/src/lib/process/process_unix.c +++ b/src/lib/process/process_unix.c @@ -253,22 +253,15 @@ process_unix_exec(process_t *process) process_environment_t *env = process_get_environment(process); /* Call the requested program. */ -retval = execve(argv[0], argv, env->unixoid_environment_block); +execve(argv[0], argv, env->unixoid_environment_block); /* If we made it here it is because execve failed :-( */ -if (-1 == retval) - fprintf(stderr, "Call to execve() failed: %s", strerror(errno)); - tor_free(argv); process_environment_free(env); -tor_assert_unreached(); - error: -/* LCOV_EXCL_START */ fprintf(stderr, "Error from child process: %s", strerror(errno)); _exit(1); -/* LCOV_EXCL_STOP */ } /* We are in the parent process. */ ___ tor-commits mailing list tor-commits@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits
[tor-commits] [tor/maint-0.4.1] Merge remote-tracking branch 'tor-github/pr/1277' into maint-0.3.5
commit aee966cb06711a413980b8cf7fa359e69d62dd05 Merge: 62cf12a8b f311d0676 Author: teor Date: Thu Dec 5 10:11:18 2019 +1000 Merge remote-tracking branch 'tor-github/pr/1277' into maint-0.3.5 changes/bug31571| 7 +++ src/lib/err/backtrace.c | 42 +++--- src/lib/err/backtrace.h | 1 + src/lib/err/torerr.c| 11 +-- 4 files changed, 48 insertions(+), 13 deletions(-) ___ tor-commits mailing list tor-commits@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits
[tor-commits] [tor/maint-0.4.1] Ensure that the exit callback is called if CreateProcessA() fails on Windows.
commit cbed6ff8430ee7f7d1002965ebf784628735c234 Author: Alexander Færøy Date: Thu Oct 17 16:47:04 2019 +0200 Ensure that the exit callback is called if CreateProcessA() fails on Windows. 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 --- src/lib/process/process_win32.c | 18 ++ 1 file changed, 18 insertions(+) diff --git a/src/lib/process/process_win32.c b/src/lib/process/process_win32.c index ddbe76bfd..1b1de6ad5 100644 --- a/src/lib/process/process_win32.c +++ b/src/lib/process/process_win32.c @@ -234,6 +234,24 @@ process_win32_exec(process_t *process) CloseHandle(stdin_pipe_read); CloseHandle(stdin_pipe_write); +/* In the Unix backend, we do not get an error in the Tor process when a + * child process fails to spawn its target executable since we need to + * first do the fork() call in the Tor process and then the child process + * is responsible for doing the call to execve(). + * + * This means that the user of the process_exec() API must check for + * whether it returns PROCESS_STATUS_ERROR, which will rarely happen on + * Unix, but will happen for error cases on Windows where it does not + * happen on Unix. For example: when the target executable does not exist + * on the file system. + * + * To have somewhat feature compatibility between the Unix and the Windows + * backend, we here notify the process_t owner that the process have exited + * (even though it never managed to run) to ensure that the exit callback + * is executed. + */ +process_notify_event_exit(process, 0); + return PROCESS_STATUS_ERROR; } ___ tor-commits mailing list tor-commits@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits
[tor-commits] [tor/maint-0.4.1] torerr: Log the Tor backtrace version when a raw assertion fails
commit 65a1d86491d56c77048d01e0b4fc6b933a13795c Author: teor Date: Fri Aug 30 21:17:07 2019 +1000 torerr: Log the Tor backtrace version when a raw assertion fails Part of 31571. --- src/lib/err/backtrace.c | 8 src/lib/err/backtrace.h | 1 + src/lib/err/torerr.c| 3 ++- 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/lib/err/backtrace.c b/src/lib/err/backtrace.c index c34eb6dfa..a4d8269c6 100644 --- a/src/lib/err/backtrace.c +++ b/src/lib/err/backtrace.c @@ -261,6 +261,14 @@ dump_stack_symbols_to_error_fds(void) } #endif /* defined(NO_BACKTRACE_IMPL) */ +/** Return the tor version used for error messages on crashes. + * Signal-safe: returns a pointer to a static array. */ +const char * +get_tor_backtrace_version(void) +{ + return bt_version; +} + /** Set up code to handle generating error messages on crashes. */ int configure_backtrace_handler(const char *tor_version) diff --git a/src/lib/err/backtrace.h b/src/lib/err/backtrace.h index 9b313261e..48b41fca0 100644 --- a/src/lib/err/backtrace.h +++ b/src/lib/err/backtrace.h @@ -21,6 +21,7 @@ void log_backtrace_impl(int severity, int domain, const char *msg, int configure_backtrace_handler(const char *tor_version); void clean_up_backtrace_handler(void); void dump_stack_symbols_to_error_fds(void); +const char *get_tor_backtrace_version(void); #define log_backtrace(sev, dom, msg) \ log_backtrace_impl((sev), (dom), (msg), tor_log) diff --git a/src/lib/err/torerr.c b/src/lib/err/torerr.c index 54acf722a..88b19b732 100644 --- a/src/lib/err/torerr.c +++ b/src/lib/err/torerr.c @@ -144,7 +144,8 @@ tor_raw_assertion_failed_msg_(const char *file, int line, const char *expr, { char linebuf[16]; format_dec_number_sigsafe(line, linebuf, sizeof(linebuf)); - tor_log_err_sigsafe("INTERNAL ERROR: Raw assertion failed at ", + tor_log_err_sigsafe("INTERNAL ERROR: Raw assertion failed in ", + get_tor_backtrace_version(), " at ", file, ":", linebuf, ": ", expr, NULL); if (msg) { tor_log_err_sigsafe_write(msg); ___ tor-commits mailing list tor-commits@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits
[tor-commits] [tor/maint-0.4.1] Merge branch 'maint-0.3.5' into maint-0.4.0
commit 92fb0990675424cd04eb0b39b4ae157ac7f5385b Merge: 46057ec5a aee966cb0 Author: teor Date: Thu Dec 5 10:13:53 2019 +1000 Merge branch 'maint-0.3.5' into maint-0.4.0 changes/bug31571| 7 +++ src/lib/err/backtrace.c | 42 +++--- src/lib/err/backtrace.h | 1 + src/lib/err/torerr.c| 11 +-- 4 files changed, 48 insertions(+), 13 deletions(-) ___ tor-commits mailing list tor-commits@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits
[tor-commits] [tor/maint-0.4.1] backtrace: Always set a backtrace Tor version
commit e2a7d08aa7c51fa903d5294628612a13b4c0d6e0 Author: teor Date: Fri Aug 30 21:12:52 2019 +1000 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. --- src/lib/err/backtrace.c | 15 +++ 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/lib/err/backtrace.c b/src/lib/err/backtrace.c index 1d1b3bcfa..8cca3c37e 100644 --- a/src/lib/err/backtrace.c +++ b/src/lib/err/backtrace.c @@ -68,10 +68,10 @@ // Redundant with util.h, but doing it here so we can avoid that dependency. #define raw_free free -#ifdef USE_BACKTRACE /** Version of Tor to report in backtrace messages. */ static char bt_version[128] = ""; +#ifdef USE_BACKTRACE /** Largest stack depth to try to dump. */ #define MAX_DEPTH 256 /** Static allocation of stack to dump. This is static so we avoid stack @@ -193,15 +193,12 @@ dump_stack_symbols_to_error_fds(void) /** Install signal handlers as needed so that when we crash, we produce a * useful stack trace. Return 0 on success, -errno on failure. */ static int -install_bt_handler(const char *software) +install_bt_handler(void) { int trap_signals[] = { SIGSEGV, SIGILL, SIGFPE, SIGBUS, SIGSYS, SIGIO, -1 }; int i, rv=0; - strncpy(bt_version, software, sizeof(bt_version) - 1); - bt_version[sizeof(bt_version) - 1] = 0; - struct sigaction sa; memset(, 0, sizeof(sa)); @@ -247,9 +244,8 @@ log_backtrace_impl(int severity, int domain, const char *msg, } static int -install_bt_handler(const char *software) +install_bt_handler(void) { - (void) software; return 0; } @@ -274,7 +270,10 @@ configure_backtrace_handler(const char *tor_version) snprintf(version, sizeof(version), "Tor %s", tor_version); } - return install_bt_handler(version); + strncpy(bt_version, version, sizeof(bt_version) - 1); + bt_version[sizeof(bt_version) - 1] = 0; + + return install_bt_handler(); } /** Perform end-of-process cleanup for code that generates error messages on ___ tor-commits mailing list tor-commits@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits
[tor-commits] [tor/maint-0.4.1] torerr: Try harder to flush raw assert messages before process termination
commit c55591825fedb0fe1db92fab7b654ccc15ad50d3 Author: teor Date: Fri Aug 30 21:17:56 2019 +1000 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. --- changes/bug31571 | 7 +++ src/lib/err/torerr.c | 8 +++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/changes/bug31571 b/changes/bug31571 new file mode 100644 index 0..86de3537b --- /dev/null +++ b/changes/bug31571 @@ -0,0 +1,7 @@ + o Minor bugfixes (error handling): +- Report the tor version whenever an assertion fails. Previously, we only + reported the Tor version on some crashes, and some non-fatal assertions. + Fixes bug 31571; bugfix on 0.3.5.1-alpha. +- On abort, try harder to flush the output buffers of log messages. On + some platforms (macOS), log messages can be discarded when the process + terminates. Fixes bug 31571; bugfix on 0.3.5.1-alpha. diff --git a/src/lib/err/torerr.c b/src/lib/err/torerr.c index 88b19b732..6b5224273 100644 --- a/src/lib/err/torerr.c +++ b/src/lib/err/torerr.c @@ -146,13 +146,19 @@ tor_raw_assertion_failed_msg_(const char *file, int line, const char *expr, format_dec_number_sigsafe(line, linebuf, sizeof(linebuf)); tor_log_err_sigsafe("INTERNAL ERROR: Raw assertion failed in ", get_tor_backtrace_version(), " at ", - file, ":", linebuf, ": ", expr, NULL); + file, ":", linebuf, ": ", expr, "\n", NULL); if (msg) { tor_log_err_sigsafe_write(msg); tor_log_err_sigsafe_write("\n"); } dump_stack_symbols_to_error_fds(); + + /* 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. */ + tor_log_err_sigsafe_write("\n"); } /* As format_{hex,dex}_number_sigsafe, but takes a radix argument ___ tor-commits mailing list tor-commits@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits
[tor-commits] [tor/maint-0.4.1] backtrace: Log the Tor backtrace version whenever we log a backtrace
commit 743bc0028be46e92a46b3b5e38f1e50ee69ff284 Author: teor Date: Fri Aug 30 21:15:54 2019 +1000 backtrace: Log the Tor backtrace version whenever we log a backtrace Previously, we just logged it in the crash handler. Part of 31571. --- src/lib/err/backtrace.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/lib/err/backtrace.c b/src/lib/err/backtrace.c index 8cca3c37e..c34eb6dfa 100644 --- a/src/lib/err/backtrace.c +++ b/src/lib/err/backtrace.c @@ -127,7 +127,7 @@ log_backtrace_impl(int severity, int domain, const char *msg, depth = backtrace(cb_buf, MAX_DEPTH); symbols = backtrace_symbols(cb_buf, (int)depth); - logger(severity, domain, "%s. Stack trace:", msg); + logger(severity, domain, "%s: %s. Stack trace:", bt_version, msg); if (!symbols) { /* LCOV_EXCL_START -- we can't provoke this. */ logger(severity, domain, "Unable to generate backtrace."); @@ -240,7 +240,8 @@ void log_backtrace_impl(int severity, int domain, const char *msg, tor_log_fn logger) { - logger(severity, domain, "%s. (Stack trace not available)", msg); + logger(severity, domain, "%s: %s. (Stack trace not available)", + bt_version, msg); } static int ___ tor-commits mailing list tor-commits@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits
[tor-commits] [tor/maint-0.4.0] Merge branch 'maint-0.3.5' into maint-0.4.0
commit 92fb0990675424cd04eb0b39b4ae157ac7f5385b Merge: 46057ec5a aee966cb0 Author: teor Date: Thu Dec 5 10:13:53 2019 +1000 Merge branch 'maint-0.3.5' into maint-0.4.0 changes/bug31571| 7 +++ src/lib/err/backtrace.c | 42 +++--- src/lib/err/backtrace.h | 1 + src/lib/err/torerr.c| 11 +-- 4 files changed, 48 insertions(+), 13 deletions(-) ___ tor-commits mailing list tor-commits@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits
[tor-commits] [tor/maint-0.4.1] backtrace: Check the return values of snprintf() and strncpy()
commit f311d0676caad1c61a4dbf8fffbeb79003866903 Author: teor Date: Tue Sep 3 15:50:37 2019 +1000 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. --- src/lib/err/backtrace.c | 16 ++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/lib/err/backtrace.c b/src/lib/err/backtrace.c index a4d8269c6..8606f4217 100644 --- a/src/lib/err/backtrace.c +++ b/src/lib/err/backtrace.c @@ -276,11 +276,23 @@ configure_backtrace_handler(const char *tor_version) char version[128] = "Tor\0"; if (tor_version) { -snprintf(version, sizeof(version), "Tor %s", tor_version); +int snp_rv = 0; +/* We can't use strlcat() here, because it is defined in + * string/compat_string.h on some platforms, and string uses torerr. */ +snp_rv = snprintf(version, sizeof(version), "Tor %s", tor_version); +/* It's safe to call raw_assert() here, because raw_assert() does not + * call configure_backtrace_handler(). */ +raw_assert(snp_rv < (int)sizeof(version)); +raw_assert(snp_rv >= 0); } - strncpy(bt_version, version, sizeof(bt_version) - 1); + char *str_rv = NULL; + /* We can't use strlcpy() here, see the note about strlcat() above. */ + str_rv = strncpy(bt_version, version, sizeof(bt_version) - 1); + /* We must terminate bt_version, then raw_assert(), because raw_assert() + * uses bt_version. */ bt_version[sizeof(bt_version) - 1] = 0; + raw_assert(str_rv == bt_version); return install_bt_handler(); } ___ tor-commits mailing list tor-commits@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits
[tor-commits] [tor/maint-0.4.0] Ensure that the exit callback is called if CreateProcessA() fails on Windows.
commit cbed6ff8430ee7f7d1002965ebf784628735c234 Author: Alexander Færøy Date: Thu Oct 17 16:47:04 2019 +0200 Ensure that the exit callback is called if CreateProcessA() fails on Windows. 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 --- src/lib/process/process_win32.c | 18 ++ 1 file changed, 18 insertions(+) diff --git a/src/lib/process/process_win32.c b/src/lib/process/process_win32.c index ddbe76bfd..1b1de6ad5 100644 --- a/src/lib/process/process_win32.c +++ b/src/lib/process/process_win32.c @@ -234,6 +234,24 @@ process_win32_exec(process_t *process) CloseHandle(stdin_pipe_read); CloseHandle(stdin_pipe_write); +/* In the Unix backend, we do not get an error in the Tor process when a + * child process fails to spawn its target executable since we need to + * first do the fork() call in the Tor process and then the child process + * is responsible for doing the call to execve(). + * + * This means that the user of the process_exec() API must check for + * whether it returns PROCESS_STATUS_ERROR, which will rarely happen on + * Unix, but will happen for error cases on Windows where it does not + * happen on Unix. For example: when the target executable does not exist + * on the file system. + * + * To have somewhat feature compatibility between the Unix and the Windows + * backend, we here notify the process_t owner that the process have exited + * (even though it never managed to run) to ensure that the exit callback + * is executed. + */ +process_notify_event_exit(process, 0); + return PROCESS_STATUS_ERROR; } ___ tor-commits mailing list tor-commits@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits
[tor-commits] [tor/maint-0.4.0] Merge remote-tracking branch 'tor-github/pr/1424' into maint-0.4.0
commit 46057ec5ae5ecc183fb7ed5060b8ba07ad235fb3 Merge: febbc236d ee8db8a2e Author: teor Date: Thu Dec 5 10:13:15 2019 +1000 Merge remote-tracking branch 'tor-github/pr/1424' into maint-0.4.0 changes/bug31810| 4 src/lib/process/process_unix.c | 9 + src/lib/process/process_win32.c | 18 ++ src/test/test_process_slow.c| 30 ++ 4 files changed, 53 insertions(+), 8 deletions(-) ___ tor-commits mailing list tor-commits@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits
[tor-commits] [tor/maint-0.4.0] backtrace: Always set a backtrace Tor version
commit e2a7d08aa7c51fa903d5294628612a13b4c0d6e0 Author: teor Date: Fri Aug 30 21:12:52 2019 +1000 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. --- src/lib/err/backtrace.c | 15 +++ 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/lib/err/backtrace.c b/src/lib/err/backtrace.c index 1d1b3bcfa..8cca3c37e 100644 --- a/src/lib/err/backtrace.c +++ b/src/lib/err/backtrace.c @@ -68,10 +68,10 @@ // Redundant with util.h, but doing it here so we can avoid that dependency. #define raw_free free -#ifdef USE_BACKTRACE /** Version of Tor to report in backtrace messages. */ static char bt_version[128] = ""; +#ifdef USE_BACKTRACE /** Largest stack depth to try to dump. */ #define MAX_DEPTH 256 /** Static allocation of stack to dump. This is static so we avoid stack @@ -193,15 +193,12 @@ dump_stack_symbols_to_error_fds(void) /** Install signal handlers as needed so that when we crash, we produce a * useful stack trace. Return 0 on success, -errno on failure. */ static int -install_bt_handler(const char *software) +install_bt_handler(void) { int trap_signals[] = { SIGSEGV, SIGILL, SIGFPE, SIGBUS, SIGSYS, SIGIO, -1 }; int i, rv=0; - strncpy(bt_version, software, sizeof(bt_version) - 1); - bt_version[sizeof(bt_version) - 1] = 0; - struct sigaction sa; memset(, 0, sizeof(sa)); @@ -247,9 +244,8 @@ log_backtrace_impl(int severity, int domain, const char *msg, } static int -install_bt_handler(const char *software) +install_bt_handler(void) { - (void) software; return 0; } @@ -274,7 +270,10 @@ configure_backtrace_handler(const char *tor_version) snprintf(version, sizeof(version), "Tor %s", tor_version); } - return install_bt_handler(version); + strncpy(bt_version, version, sizeof(bt_version) - 1); + bt_version[sizeof(bt_version) - 1] = 0; + + return install_bt_handler(); } /** Perform end-of-process cleanup for code that generates error messages on ___ tor-commits mailing list tor-commits@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits
[tor-commits] [tor/maint-0.4.0] Add test to check if the exit callback is called in process_t upon process_exec() failures.
commit ee8db8a2eb7a5d345d16d02bade593fa6db2877e Author: Alexander Færøy Date: Thu Oct 17 16:56:21 2019 +0200 Add test to check if the exit callback is called in process_t upon process_exec() failures. This patch adds a test to check for whether the exit callback is always called when process_exec() fails, both on Windows and Unix. See: https://bugs.torproject.org/31810 --- src/test/test_process_slow.c | 30 ++ 1 file changed, 30 insertions(+) diff --git a/src/test/test_process_slow.c b/src/test/test_process_slow.c index 1322d7b83..d269a068e 100644 --- a/src/test/test_process_slow.c +++ b/src/test/test_process_slow.c @@ -328,8 +328,38 @@ test_callbacks_terminate(void *arg) process_free(process); } +static void +test_nonexistent_executable(void *arg) +{ + (void)arg; + + /* Process callback data. */ + process_data_t *process_data = process_data_new(); + + /* Setup our process. */ + process_t *process = process_new("binary-does-not-exist"); + process_set_data(process, process_data); + process_set_exit_callback(process, process_exit_callback); + + /* Run our process. */ + process_exec(process); + + /* Start our main loop. */ + run_main_loop(process_data); + + /* Ensure that the exit callback was actually called even though the binary + * did not exist. + */ + tt_assert(process_data->did_exit); + + done: + process_data_free(process_data); + process_free(process); +} + struct testcase_t slow_process_tests[] = { { "callbacks", test_callbacks, 0, NULL, NULL }, { "callbacks_terminate", test_callbacks_terminate, 0, NULL, NULL }, + { "nonexistent_executable", test_nonexistent_executable, 0, NULL, NULL }, END_OF_TESTCASES }; ___ tor-commits mailing list tor-commits@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits
[tor-commits] [tor/maint-0.4.0] torerr: Try harder to flush raw assert messages before process termination
commit c55591825fedb0fe1db92fab7b654ccc15ad50d3 Author: teor Date: Fri Aug 30 21:17:56 2019 +1000 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. --- changes/bug31571 | 7 +++ src/lib/err/torerr.c | 8 +++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/changes/bug31571 b/changes/bug31571 new file mode 100644 index 0..86de3537b --- /dev/null +++ b/changes/bug31571 @@ -0,0 +1,7 @@ + o Minor bugfixes (error handling): +- Report the tor version whenever an assertion fails. Previously, we only + reported the Tor version on some crashes, and some non-fatal assertions. + Fixes bug 31571; bugfix on 0.3.5.1-alpha. +- On abort, try harder to flush the output buffers of log messages. On + some platforms (macOS), log messages can be discarded when the process + terminates. Fixes bug 31571; bugfix on 0.3.5.1-alpha. diff --git a/src/lib/err/torerr.c b/src/lib/err/torerr.c index 88b19b732..6b5224273 100644 --- a/src/lib/err/torerr.c +++ b/src/lib/err/torerr.c @@ -146,13 +146,19 @@ tor_raw_assertion_failed_msg_(const char *file, int line, const char *expr, format_dec_number_sigsafe(line, linebuf, sizeof(linebuf)); tor_log_err_sigsafe("INTERNAL ERROR: Raw assertion failed in ", get_tor_backtrace_version(), " at ", - file, ":", linebuf, ": ", expr, NULL); + file, ":", linebuf, ": ", expr, "\n", NULL); if (msg) { tor_log_err_sigsafe_write(msg); tor_log_err_sigsafe_write("\n"); } dump_stack_symbols_to_error_fds(); + + /* 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. */ + tor_log_err_sigsafe_write("\n"); } /* As format_{hex,dex}_number_sigsafe, but takes a radix argument ___ tor-commits mailing list tor-commits@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits
[tor-commits] [tor/maint-0.4.0] torerr: Log the Tor backtrace version when a raw assertion fails
commit 65a1d86491d56c77048d01e0b4fc6b933a13795c Author: teor Date: Fri Aug 30 21:17:07 2019 +1000 torerr: Log the Tor backtrace version when a raw assertion fails Part of 31571. --- src/lib/err/backtrace.c | 8 src/lib/err/backtrace.h | 1 + src/lib/err/torerr.c| 3 ++- 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/lib/err/backtrace.c b/src/lib/err/backtrace.c index c34eb6dfa..a4d8269c6 100644 --- a/src/lib/err/backtrace.c +++ b/src/lib/err/backtrace.c @@ -261,6 +261,14 @@ dump_stack_symbols_to_error_fds(void) } #endif /* defined(NO_BACKTRACE_IMPL) */ +/** Return the tor version used for error messages on crashes. + * Signal-safe: returns a pointer to a static array. */ +const char * +get_tor_backtrace_version(void) +{ + return bt_version; +} + /** Set up code to handle generating error messages on crashes. */ int configure_backtrace_handler(const char *tor_version) diff --git a/src/lib/err/backtrace.h b/src/lib/err/backtrace.h index 9b313261e..48b41fca0 100644 --- a/src/lib/err/backtrace.h +++ b/src/lib/err/backtrace.h @@ -21,6 +21,7 @@ void log_backtrace_impl(int severity, int domain, const char *msg, int configure_backtrace_handler(const char *tor_version); void clean_up_backtrace_handler(void); void dump_stack_symbols_to_error_fds(void); +const char *get_tor_backtrace_version(void); #define log_backtrace(sev, dom, msg) \ log_backtrace_impl((sev), (dom), (msg), tor_log) diff --git a/src/lib/err/torerr.c b/src/lib/err/torerr.c index 54acf722a..88b19b732 100644 --- a/src/lib/err/torerr.c +++ b/src/lib/err/torerr.c @@ -144,7 +144,8 @@ tor_raw_assertion_failed_msg_(const char *file, int line, const char *expr, { char linebuf[16]; format_dec_number_sigsafe(line, linebuf, sizeof(linebuf)); - tor_log_err_sigsafe("INTERNAL ERROR: Raw assertion failed at ", + tor_log_err_sigsafe("INTERNAL ERROR: Raw assertion failed in ", + get_tor_backtrace_version(), " at ", file, ":", linebuf, ": ", expr, NULL); if (msg) { tor_log_err_sigsafe_write(msg); ___ tor-commits mailing list tor-commits@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits
[tor-commits] [tor/maint-0.4.0] Merge remote-tracking branch 'tor-github/pr/1277' into maint-0.3.5
commit aee966cb06711a413980b8cf7fa359e69d62dd05 Merge: 62cf12a8b f311d0676 Author: teor Date: Thu Dec 5 10:11:18 2019 +1000 Merge remote-tracking branch 'tor-github/pr/1277' into maint-0.3.5 changes/bug31571| 7 +++ src/lib/err/backtrace.c | 42 +++--- src/lib/err/backtrace.h | 1 + src/lib/err/torerr.c| 11 +-- 4 files changed, 48 insertions(+), 13 deletions(-) ___ tor-commits mailing list tor-commits@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits
[tor-commits] [tor/maint-0.3.5] Merge remote-tracking branch 'tor-github/pr/1277' into maint-0.3.5
commit aee966cb06711a413980b8cf7fa359e69d62dd05 Merge: 62cf12a8b f311d0676 Author: teor Date: Thu Dec 5 10:11:18 2019 +1000 Merge remote-tracking branch 'tor-github/pr/1277' into maint-0.3.5 changes/bug31571| 7 +++ src/lib/err/backtrace.c | 42 +++--- src/lib/err/backtrace.h | 1 + src/lib/err/torerr.c| 11 +-- 4 files changed, 48 insertions(+), 13 deletions(-) ___ tor-commits mailing list tor-commits@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits
[tor-commits] [tor/maint-0.4.0] backtrace: Log the Tor backtrace version whenever we log a backtrace
commit 743bc0028be46e92a46b3b5e38f1e50ee69ff284 Author: teor Date: Fri Aug 30 21:15:54 2019 +1000 backtrace: Log the Tor backtrace version whenever we log a backtrace Previously, we just logged it in the crash handler. Part of 31571. --- src/lib/err/backtrace.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/lib/err/backtrace.c b/src/lib/err/backtrace.c index 8cca3c37e..c34eb6dfa 100644 --- a/src/lib/err/backtrace.c +++ b/src/lib/err/backtrace.c @@ -127,7 +127,7 @@ log_backtrace_impl(int severity, int domain, const char *msg, depth = backtrace(cb_buf, MAX_DEPTH); symbols = backtrace_symbols(cb_buf, (int)depth); - logger(severity, domain, "%s. Stack trace:", msg); + logger(severity, domain, "%s: %s. Stack trace:", bt_version, msg); if (!symbols) { /* LCOV_EXCL_START -- we can't provoke this. */ logger(severity, domain, "Unable to generate backtrace."); @@ -240,7 +240,8 @@ void log_backtrace_impl(int severity, int domain, const char *msg, tor_log_fn logger) { - logger(severity, domain, "%s. (Stack trace not available)", msg); + logger(severity, domain, "%s: %s. (Stack trace not available)", + bt_version, msg); } static int ___ tor-commits mailing list tor-commits@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits
[tor-commits] [tor/master] Merge branch 'maint-0.4.0' into maint-0.4.1
commit cfa9cc34aa36c0f300724a01998633efbe8439ea Merge: 14089a29b 92fb09906 Author: teor Date: Thu Dec 5 10:14:01 2019 +1000 Merge branch 'maint-0.4.0' into maint-0.4.1 changes/bug31571| 7 +++ changes/bug31810| 4 src/lib/err/backtrace.c | 42 ++--- src/lib/err/backtrace.h | 1 + src/lib/err/torerr.c| 11 +-- src/lib/process/process_unix.c | 9 + src/lib/process/process_win32.c | 18 ++ src/test/test_process_slow.c| 30 + 8 files changed, 101 insertions(+), 21 deletions(-) diff --cc src/lib/err/backtrace.c index 2408a6851,8606f4217..8bc7e6965 --- a/src/lib/err/backtrace.c +++ b/src/lib/err/backtrace.c @@@ -198,13 -193,12 +198,10 @@@ static int trap_signals[] = { SIGSEGV, /** Install signal handlers as needed so that when we crash, we produce a * useful stack trace. Return 0 on success, -errno on failure. */ static int - install_bt_handler(const char *software) + install_bt_handler(void) { - int trap_signals[] = { SIGSEGV, SIGILL, SIGFPE, SIGBUS, SIGSYS, - SIGIO, -1 }; int i, rv=0; - strncpy(bt_version, software, sizeof(bt_version) - 1); - bt_version[sizeof(bt_version) - 1] = 0; - struct sigaction sa; memset(, 0, sizeof(sa)); @@@ -260,10 -237,11 +257,11 @@@ remove_bt_handler(void #ifdef NO_BACKTRACE_IMPL void -log_backtrace_impl(int severity, int domain, const char *msg, +log_backtrace_impl(int severity, log_domain_mask_t domain, const char *msg, tor_log_fn logger) { - logger(severity, domain, "%s. (Stack trace not available)", msg); + logger(severity, domain, "%s: %s. (Stack trace not available)", + bt_version, msg); } static int diff --cc src/lib/err/torerr.c index 21b28a5f6,1a246e995..b7e32a3e2 --- a/src/lib/err/torerr.c +++ b/src/lib/err/torerr.c @@@ -206,20 -163,14 +207,26 @@@ tor_raw_assertion_failed_msg_(const cha } dump_stack_symbols_to_error_fds(); + + /* 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. */ + tor_log_err_sigsafe_write("\n"); } +/** + * Call the abort() function to kill the current process with a fatal + * error. But first, close the raw error file descriptors, so error messages + * are written before process termination. + **/ +void +tor_raw_abort_(void) +{ + tor_log_close_sigsafe_err_fds(); + abort(); +} + /* As format_{hex,dex}_number_sigsafe, but takes a radix argument * in range 2..16 inclusive. */ static int ___ tor-commits mailing list tor-commits@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits
[tor-commits] [tor/maint-0.3.5] backtrace: Always set a backtrace Tor version
commit e2a7d08aa7c51fa903d5294628612a13b4c0d6e0 Author: teor Date: Fri Aug 30 21:12:52 2019 +1000 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. --- src/lib/err/backtrace.c | 15 +++ 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/lib/err/backtrace.c b/src/lib/err/backtrace.c index 1d1b3bcfa..8cca3c37e 100644 --- a/src/lib/err/backtrace.c +++ b/src/lib/err/backtrace.c @@ -68,10 +68,10 @@ // Redundant with util.h, but doing it here so we can avoid that dependency. #define raw_free free -#ifdef USE_BACKTRACE /** Version of Tor to report in backtrace messages. */ static char bt_version[128] = ""; +#ifdef USE_BACKTRACE /** Largest stack depth to try to dump. */ #define MAX_DEPTH 256 /** Static allocation of stack to dump. This is static so we avoid stack @@ -193,15 +193,12 @@ dump_stack_symbols_to_error_fds(void) /** Install signal handlers as needed so that when we crash, we produce a * useful stack trace. Return 0 on success, -errno on failure. */ static int -install_bt_handler(const char *software) +install_bt_handler(void) { int trap_signals[] = { SIGSEGV, SIGILL, SIGFPE, SIGBUS, SIGSYS, SIGIO, -1 }; int i, rv=0; - strncpy(bt_version, software, sizeof(bt_version) - 1); - bt_version[sizeof(bt_version) - 1] = 0; - struct sigaction sa; memset(, 0, sizeof(sa)); @@ -247,9 +244,8 @@ log_backtrace_impl(int severity, int domain, const char *msg, } static int -install_bt_handler(const char *software) +install_bt_handler(void) { - (void) software; return 0; } @@ -274,7 +270,10 @@ configure_backtrace_handler(const char *tor_version) snprintf(version, sizeof(version), "Tor %s", tor_version); } - return install_bt_handler(version); + strncpy(bt_version, version, sizeof(bt_version) - 1); + bt_version[sizeof(bt_version) - 1] = 0; + + return install_bt_handler(); } /** Perform end-of-process cleanup for code that generates error messages on ___ tor-commits mailing list tor-commits@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits
[tor-commits] [tor/maint-0.4.0] Handle errors from execve() in the Unix process backend more gracefully.
commit 9915b8f0bc3e6a1b6c8413fbb87c41137ea89104 Author: Alexander Færøy Date: Thu Oct 17 16:39:05 2019 +0200 Handle errors from execve() in the Unix process backend more gracefully. 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 --- changes/bug31810 | 4 src/lib/process/process_unix.c | 9 + 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/changes/bug31810 b/changes/bug31810 new file mode 100644 index 0..628d12f09 --- /dev/null +++ b/changes/bug31810 @@ -0,0 +1,4 @@ + o Minor bugfixes (process management): +- Remove assertion in the Unix process backend. This assertion would trigger + when a new process is spawned where the executable is not found leading to + a stack trace from the child process. Fixes bug 31810; bugfix on 0.4.0.1-alpha. diff --git a/src/lib/process/process_unix.c b/src/lib/process/process_unix.c index 790ab897e..b102afff4 100644 --- a/src/lib/process/process_unix.c +++ b/src/lib/process/process_unix.c @@ -253,22 +253,15 @@ process_unix_exec(process_t *process) process_environment_t *env = process_get_environment(process); /* Call the requested program. */ -retval = execve(argv[0], argv, env->unixoid_environment_block); +execve(argv[0], argv, env->unixoid_environment_block); /* If we made it here it is because execve failed :-( */ -if (-1 == retval) - fprintf(stderr, "Call to execve() failed: %s", strerror(errno)); - tor_free(argv); process_environment_free(env); -tor_assert_unreached(); - error: -/* LCOV_EXCL_START */ fprintf(stderr, "Error from child process: %s", strerror(errno)); _exit(1); -/* LCOV_EXCL_STOP */ } /* We are in the parent process. */ ___ tor-commits mailing list tor-commits@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits
[tor-commits] [tor/maint-0.3.5] backtrace: Check the return values of snprintf() and strncpy()
commit f311d0676caad1c61a4dbf8fffbeb79003866903 Author: teor Date: Tue Sep 3 15:50:37 2019 +1000 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. --- src/lib/err/backtrace.c | 16 ++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/lib/err/backtrace.c b/src/lib/err/backtrace.c index a4d8269c6..8606f4217 100644 --- a/src/lib/err/backtrace.c +++ b/src/lib/err/backtrace.c @@ -276,11 +276,23 @@ configure_backtrace_handler(const char *tor_version) char version[128] = "Tor\0"; if (tor_version) { -snprintf(version, sizeof(version), "Tor %s", tor_version); +int snp_rv = 0; +/* We can't use strlcat() here, because it is defined in + * string/compat_string.h on some platforms, and string uses torerr. */ +snp_rv = snprintf(version, sizeof(version), "Tor %s", tor_version); +/* It's safe to call raw_assert() here, because raw_assert() does not + * call configure_backtrace_handler(). */ +raw_assert(snp_rv < (int)sizeof(version)); +raw_assert(snp_rv >= 0); } - strncpy(bt_version, version, sizeof(bt_version) - 1); + char *str_rv = NULL; + /* We can't use strlcpy() here, see the note about strlcat() above. */ + str_rv = strncpy(bt_version, version, sizeof(bt_version) - 1); + /* We must terminate bt_version, then raw_assert(), because raw_assert() + * uses bt_version. */ bt_version[sizeof(bt_version) - 1] = 0; + raw_assert(str_rv == bt_version); return install_bt_handler(); } ___ tor-commits mailing list tor-commits@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits
[tor-commits] [tor/maint-0.3.5] backtrace: Log the Tor backtrace version whenever we log a backtrace
commit 743bc0028be46e92a46b3b5e38f1e50ee69ff284 Author: teor Date: Fri Aug 30 21:15:54 2019 +1000 backtrace: Log the Tor backtrace version whenever we log a backtrace Previously, we just logged it in the crash handler. Part of 31571. --- src/lib/err/backtrace.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/lib/err/backtrace.c b/src/lib/err/backtrace.c index 8cca3c37e..c34eb6dfa 100644 --- a/src/lib/err/backtrace.c +++ b/src/lib/err/backtrace.c @@ -127,7 +127,7 @@ log_backtrace_impl(int severity, int domain, const char *msg, depth = backtrace(cb_buf, MAX_DEPTH); symbols = backtrace_symbols(cb_buf, (int)depth); - logger(severity, domain, "%s. Stack trace:", msg); + logger(severity, domain, "%s: %s. Stack trace:", bt_version, msg); if (!symbols) { /* LCOV_EXCL_START -- we can't provoke this. */ logger(severity, domain, "Unable to generate backtrace."); @@ -240,7 +240,8 @@ void log_backtrace_impl(int severity, int domain, const char *msg, tor_log_fn logger) { - logger(severity, domain, "%s. (Stack trace not available)", msg); + logger(severity, domain, "%s: %s. (Stack trace not available)", + bt_version, msg); } static int ___ tor-commits mailing list tor-commits@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits
[tor-commits] [tor/master] Merge branch 'maint-0.4.1' into maint-0.4.2
commit bb786797aa449389d47f7bf94fb5fa238e51e377 Merge: 3207a8e5c cfa9cc34a Author: teor Date: Thu Dec 5 10:14:08 2019 +1000 Merge branch 'maint-0.4.1' into maint-0.4.2 ___ tor-commits mailing list tor-commits@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits
[tor-commits] [tor/maint-0.4.0] backtrace: Check the return values of snprintf() and strncpy()
commit f311d0676caad1c61a4dbf8fffbeb79003866903 Author: teor Date: Tue Sep 3 15:50:37 2019 +1000 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. --- src/lib/err/backtrace.c | 16 ++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/lib/err/backtrace.c b/src/lib/err/backtrace.c index a4d8269c6..8606f4217 100644 --- a/src/lib/err/backtrace.c +++ b/src/lib/err/backtrace.c @@ -276,11 +276,23 @@ configure_backtrace_handler(const char *tor_version) char version[128] = "Tor\0"; if (tor_version) { -snprintf(version, sizeof(version), "Tor %s", tor_version); +int snp_rv = 0; +/* We can't use strlcat() here, because it is defined in + * string/compat_string.h on some platforms, and string uses torerr. */ +snp_rv = snprintf(version, sizeof(version), "Tor %s", tor_version); +/* It's safe to call raw_assert() here, because raw_assert() does not + * call configure_backtrace_handler(). */ +raw_assert(snp_rv < (int)sizeof(version)); +raw_assert(snp_rv >= 0); } - strncpy(bt_version, version, sizeof(bt_version) - 1); + char *str_rv = NULL; + /* We can't use strlcpy() here, see the note about strlcat() above. */ + str_rv = strncpy(bt_version, version, sizeof(bt_version) - 1); + /* We must terminate bt_version, then raw_assert(), because raw_assert() + * uses bt_version. */ bt_version[sizeof(bt_version) - 1] = 0; + raw_assert(str_rv == bt_version); return install_bt_handler(); } ___ tor-commits mailing list tor-commits@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits
[tor-commits] [tor/maint-0.3.5] torerr: Try harder to flush raw assert messages before process termination
commit c55591825fedb0fe1db92fab7b654ccc15ad50d3 Author: teor Date: Fri Aug 30 21:17:56 2019 +1000 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. --- changes/bug31571 | 7 +++ src/lib/err/torerr.c | 8 +++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/changes/bug31571 b/changes/bug31571 new file mode 100644 index 0..86de3537b --- /dev/null +++ b/changes/bug31571 @@ -0,0 +1,7 @@ + o Minor bugfixes (error handling): +- Report the tor version whenever an assertion fails. Previously, we only + reported the Tor version on some crashes, and some non-fatal assertions. + Fixes bug 31571; bugfix on 0.3.5.1-alpha. +- On abort, try harder to flush the output buffers of log messages. On + some platforms (macOS), log messages can be discarded when the process + terminates. Fixes bug 31571; bugfix on 0.3.5.1-alpha. diff --git a/src/lib/err/torerr.c b/src/lib/err/torerr.c index 88b19b732..6b5224273 100644 --- a/src/lib/err/torerr.c +++ b/src/lib/err/torerr.c @@ -146,13 +146,19 @@ tor_raw_assertion_failed_msg_(const char *file, int line, const char *expr, format_dec_number_sigsafe(line, linebuf, sizeof(linebuf)); tor_log_err_sigsafe("INTERNAL ERROR: Raw assertion failed in ", get_tor_backtrace_version(), " at ", - file, ":", linebuf, ": ", expr, NULL); + file, ":", linebuf, ": ", expr, "\n", NULL); if (msg) { tor_log_err_sigsafe_write(msg); tor_log_err_sigsafe_write("\n"); } dump_stack_symbols_to_error_fds(); + + /* 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. */ + tor_log_err_sigsafe_write("\n"); } /* As format_{hex,dex}_number_sigsafe, but takes a radix argument ___ tor-commits mailing list tor-commits@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits
[tor-commits] [tor/master] Handle errors from execve() in the Unix process backend more gracefully.
commit 9915b8f0bc3e6a1b6c8413fbb87c41137ea89104 Author: Alexander Færøy Date: Thu Oct 17 16:39:05 2019 +0200 Handle errors from execve() in the Unix process backend more gracefully. 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 --- changes/bug31810 | 4 src/lib/process/process_unix.c | 9 + 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/changes/bug31810 b/changes/bug31810 new file mode 100644 index 0..628d12f09 --- /dev/null +++ b/changes/bug31810 @@ -0,0 +1,4 @@ + o Minor bugfixes (process management): +- Remove assertion in the Unix process backend. This assertion would trigger + when a new process is spawned where the executable is not found leading to + a stack trace from the child process. Fixes bug 31810; bugfix on 0.4.0.1-alpha. diff --git a/src/lib/process/process_unix.c b/src/lib/process/process_unix.c index 790ab897e..b102afff4 100644 --- a/src/lib/process/process_unix.c +++ b/src/lib/process/process_unix.c @@ -253,22 +253,15 @@ process_unix_exec(process_t *process) process_environment_t *env = process_get_environment(process); /* Call the requested program. */ -retval = execve(argv[0], argv, env->unixoid_environment_block); +execve(argv[0], argv, env->unixoid_environment_block); /* If we made it here it is because execve failed :-( */ -if (-1 == retval) - fprintf(stderr, "Call to execve() failed: %s", strerror(errno)); - tor_free(argv); process_environment_free(env); -tor_assert_unreached(); - error: -/* LCOV_EXCL_START */ fprintf(stderr, "Error from child process: %s", strerror(errno)); _exit(1); -/* LCOV_EXCL_STOP */ } /* We are in the parent process. */ ___ tor-commits mailing list tor-commits@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits
[tor-commits] [tor/maint-0.3.5] torerr: Log the Tor backtrace version when a raw assertion fails
commit 65a1d86491d56c77048d01e0b4fc6b933a13795c Author: teor Date: Fri Aug 30 21:17:07 2019 +1000 torerr: Log the Tor backtrace version when a raw assertion fails Part of 31571. --- src/lib/err/backtrace.c | 8 src/lib/err/backtrace.h | 1 + src/lib/err/torerr.c| 3 ++- 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/lib/err/backtrace.c b/src/lib/err/backtrace.c index c34eb6dfa..a4d8269c6 100644 --- a/src/lib/err/backtrace.c +++ b/src/lib/err/backtrace.c @@ -261,6 +261,14 @@ dump_stack_symbols_to_error_fds(void) } #endif /* defined(NO_BACKTRACE_IMPL) */ +/** Return the tor version used for error messages on crashes. + * Signal-safe: returns a pointer to a static array. */ +const char * +get_tor_backtrace_version(void) +{ + return bt_version; +} + /** Set up code to handle generating error messages on crashes. */ int configure_backtrace_handler(const char *tor_version) diff --git a/src/lib/err/backtrace.h b/src/lib/err/backtrace.h index 9b313261e..48b41fca0 100644 --- a/src/lib/err/backtrace.h +++ b/src/lib/err/backtrace.h @@ -21,6 +21,7 @@ void log_backtrace_impl(int severity, int domain, const char *msg, int configure_backtrace_handler(const char *tor_version); void clean_up_backtrace_handler(void); void dump_stack_symbols_to_error_fds(void); +const char *get_tor_backtrace_version(void); #define log_backtrace(sev, dom, msg) \ log_backtrace_impl((sev), (dom), (msg), tor_log) diff --git a/src/lib/err/torerr.c b/src/lib/err/torerr.c index 54acf722a..88b19b732 100644 --- a/src/lib/err/torerr.c +++ b/src/lib/err/torerr.c @@ -144,7 +144,8 @@ tor_raw_assertion_failed_msg_(const char *file, int line, const char *expr, { char linebuf[16]; format_dec_number_sigsafe(line, linebuf, sizeof(linebuf)); - tor_log_err_sigsafe("INTERNAL ERROR: Raw assertion failed at ", + tor_log_err_sigsafe("INTERNAL ERROR: Raw assertion failed in ", + get_tor_backtrace_version(), " at ", file, ":", linebuf, ": ", expr, NULL); if (msg) { tor_log_err_sigsafe_write(msg); ___ tor-commits mailing list tor-commits@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits
[tor-commits] [tor/master] Merge branch 'maint-0.4.2'
commit 8d616a1a49a0f5433966a16b17a20121fc2845fd Merge: 64d691423 bb786797a Author: teor Date: Thu Dec 5 10:14:16 2019 +1000 Merge branch 'maint-0.4.2' ___ tor-commits mailing list tor-commits@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits
[tor-commits] [tor/master] Merge remote-tracking branch 'tor-github/pr/1424' into maint-0.4.0
commit 46057ec5ae5ecc183fb7ed5060b8ba07ad235fb3 Merge: febbc236d ee8db8a2e Author: teor Date: Thu Dec 5 10:13:15 2019 +1000 Merge remote-tracking branch 'tor-github/pr/1424' into maint-0.4.0 changes/bug31810| 4 src/lib/process/process_unix.c | 9 + src/lib/process/process_win32.c | 18 ++ src/test/test_process_slow.c| 30 ++ 4 files changed, 53 insertions(+), 8 deletions(-) ___ tor-commits mailing list tor-commits@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits
[tor-commits] [tor/master] Merge branch 'maint-0.3.5' into maint-0.4.0
commit 92fb0990675424cd04eb0b39b4ae157ac7f5385b Merge: 46057ec5a aee966cb0 Author: teor Date: Thu Dec 5 10:13:53 2019 +1000 Merge branch 'maint-0.3.5' into maint-0.4.0 changes/bug31571| 7 +++ src/lib/err/backtrace.c | 42 +++--- src/lib/err/backtrace.h | 1 + src/lib/err/torerr.c| 11 +-- 4 files changed, 48 insertions(+), 13 deletions(-) ___ tor-commits mailing list tor-commits@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits
[tor-commits] [tor/master] Add test to check if the exit callback is called in process_t upon process_exec() failures.
commit ee8db8a2eb7a5d345d16d02bade593fa6db2877e Author: Alexander Færøy Date: Thu Oct 17 16:56:21 2019 +0200 Add test to check if the exit callback is called in process_t upon process_exec() failures. This patch adds a test to check for whether the exit callback is always called when process_exec() fails, both on Windows and Unix. See: https://bugs.torproject.org/31810 --- src/test/test_process_slow.c | 30 ++ 1 file changed, 30 insertions(+) diff --git a/src/test/test_process_slow.c b/src/test/test_process_slow.c index 1322d7b83..d269a068e 100644 --- a/src/test/test_process_slow.c +++ b/src/test/test_process_slow.c @@ -328,8 +328,38 @@ test_callbacks_terminate(void *arg) process_free(process); } +static void +test_nonexistent_executable(void *arg) +{ + (void)arg; + + /* Process callback data. */ + process_data_t *process_data = process_data_new(); + + /* Setup our process. */ + process_t *process = process_new("binary-does-not-exist"); + process_set_data(process, process_data); + process_set_exit_callback(process, process_exit_callback); + + /* Run our process. */ + process_exec(process); + + /* Start our main loop. */ + run_main_loop(process_data); + + /* Ensure that the exit callback was actually called even though the binary + * did not exist. + */ + tt_assert(process_data->did_exit); + + done: + process_data_free(process_data); + process_free(process); +} + struct testcase_t slow_process_tests[] = { { "callbacks", test_callbacks, 0, NULL, NULL }, { "callbacks_terminate", test_callbacks_terminate, 0, NULL, NULL }, + { "nonexistent_executable", test_nonexistent_executable, 0, NULL, NULL }, END_OF_TESTCASES }; ___ tor-commits mailing list tor-commits@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits
[tor-commits] [tor/master] Ensure that the exit callback is called if CreateProcessA() fails on Windows.
commit cbed6ff8430ee7f7d1002965ebf784628735c234 Author: Alexander Færøy Date: Thu Oct 17 16:47:04 2019 +0200 Ensure that the exit callback is called if CreateProcessA() fails on Windows. 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 --- src/lib/process/process_win32.c | 18 ++ 1 file changed, 18 insertions(+) diff --git a/src/lib/process/process_win32.c b/src/lib/process/process_win32.c index ddbe76bfd..1b1de6ad5 100644 --- a/src/lib/process/process_win32.c +++ b/src/lib/process/process_win32.c @@ -234,6 +234,24 @@ process_win32_exec(process_t *process) CloseHandle(stdin_pipe_read); CloseHandle(stdin_pipe_write); +/* In the Unix backend, we do not get an error in the Tor process when a + * child process fails to spawn its target executable since we need to + * first do the fork() call in the Tor process and then the child process + * is responsible for doing the call to execve(). + * + * This means that the user of the process_exec() API must check for + * whether it returns PROCESS_STATUS_ERROR, which will rarely happen on + * Unix, but will happen for error cases on Windows where it does not + * happen on Unix. For example: when the target executable does not exist + * on the file system. + * + * To have somewhat feature compatibility between the Unix and the Windows + * backend, we here notify the process_t owner that the process have exited + * (even though it never managed to run) to ensure that the exit callback + * is executed. + */ +process_notify_event_exit(process, 0); + return PROCESS_STATUS_ERROR; } ___ tor-commits mailing list tor-commits@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits
[tor-commits] [tor/master] Merge remote-tracking branch 'tor-github/pr/1277' into maint-0.3.5
commit aee966cb06711a413980b8cf7fa359e69d62dd05 Merge: 62cf12a8b f311d0676 Author: teor Date: Thu Dec 5 10:11:18 2019 +1000 Merge remote-tracking branch 'tor-github/pr/1277' into maint-0.3.5 changes/bug31571| 7 +++ src/lib/err/backtrace.c | 42 +++--- src/lib/err/backtrace.h | 1 + src/lib/err/torerr.c| 11 +-- 4 files changed, 48 insertions(+), 13 deletions(-) ___ tor-commits mailing list tor-commits@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits
[tor-commits] [tpo/master] Add new Tor Browser version: 9.5a3
commit d9811c03b50245c4b2e60617e5daa6fb880f806d Author: Nicolas Vigier Date: Wed Dec 4 22:28:13 2019 +0100 Add new Tor Browser version: 9.5a3 --- content/projects/torbrowser/RecommendedTBBVersions/contents.lr | 6 +- databags/versions.ini | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/content/projects/torbrowser/RecommendedTBBVersions/contents.lr b/content/projects/torbrowser/RecommendedTBBVersions/contents.lr index e430f7d..f7bcee0 100644 --- a/content/projects/torbrowser/RecommendedTBBVersions/contents.lr +++ b/content/projects/torbrowser/RecommendedTBBVersions/contents.lr @@ -16,5 +16,9 @@ body: "9.5a2", "9.5a2-MacOS", "9.5a2-Linux", -"9.5a2-Windows" +"9.5a2-Windows", +"9.5a3", +"9.5a3-MacOS", +"9.5a3-Linux", +"9.5a3-Windows" ] diff --git a/databags/versions.ini b/databags/versions.ini index 264ce54..0186dc1 100644 --- a/databags/versions.ini +++ b/databags/versions.ini @@ -3,7 +3,7 @@ version = 9.0.2 win32 = 0.4.1.6 [torbrowser-alpha] -version = 9.5a2 +version = 9.5a3 [tor-stable] version = 0.4.1.6 ___ tor-commits mailing list tor-commits@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits
[tor-commits] [tpo/master] Remove 9.0 and 9.0.1 from RecommendedTBBVersions
commit 633686b55aec4a54ab0023bbc6055ab328dbc5c8 Author: Nicolas Vigier Date: Wed Dec 4 22:27:21 2019 +0100 Remove 9.0 and 9.0.1 from RecommendedTBBVersions --- content/projects/torbrowser/RecommendedTBBVersions/contents.lr | 8 1 file changed, 8 deletions(-) diff --git a/content/projects/torbrowser/RecommendedTBBVersions/contents.lr b/content/projects/torbrowser/RecommendedTBBVersions/contents.lr index fefc18f..e430f7d 100644 --- a/content/projects/torbrowser/RecommendedTBBVersions/contents.lr +++ b/content/projects/torbrowser/RecommendedTBBVersions/contents.lr @@ -5,14 +5,6 @@ _template: empty.html body: [ -"9.0", -"9.0-MacOS", -"9.0-Linux", -"9.0-Windows", -"9.0.1", -"9.0.1-MacOS", -"9.0.1-Linux", -"9.0.1-Windows", "9.0.2", "9.0.2-MacOS", "9.0.2-Linux", ___ tor-commits mailing list tor-commits@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits
[tor-commits] [translation/tpo-web] https://gitweb.torproject.org/translation.git/commit/?h=tpo-web
commit f9a1452d2441b74580c43c2b9ef4a7aac6232777 Author: Translation commit bot Date: Wed Dec 4 21:22:58 2019 + https://gitweb.torproject.org/translation.git/commit/?h=tpo-web --- contents+lt.po | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/contents+lt.po b/contents+lt.po index bb1f0f83b2..210657523d 100644 --- a/contents+lt.po +++ b/contents+lt.po @@ -267,7 +267,7 @@ msgstr "" #: https//www.torproject.org/about/cy-pres/ #: (content/about/cy-pres/contents+en.lrpage.body) msgid " About the Tor Project" -msgstr "" +msgstr " Apie Tor Project" #: https//www.torproject.org/about/cy-pres/ #: (content/about/cy-pres/contents+en.lrpage.body) @@ -1076,7 +1076,7 @@ msgstr "" #: templates/download.html:19 templates/download.html:21 msgid "Stay safe" -msgstr "BÅ«kite saugÅ«s" +msgstr "IÅ¡likite saugÅ«s" #: templates/download.html:23 msgid "Please do not torrent over Tor." @@ -1112,7 +1112,7 @@ msgstr "" #: templates/download.html:54 msgid "Stand up for privacy and freedom online." -msgstr "" +msgstr "Palaikykite privatumÄ ir laisvÄ internete." #: templates/download.html:55 msgid "" ___ tor-commits mailing list tor-commits@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits
[tor-commits] [translation/tbmanual-contentspot] https://gitweb.torproject.org/translation.git/commit/?h=tbmanual-contentspot
commit 060c50c907ff0850f616fbb7b684679705c6bf21 Author: Translation commit bot Date: Wed Dec 4 21:20:06 2019 + https://gitweb.torproject.org/translation.git/commit/?h=tbmanual-contentspot --- contents+lt.po | 36 +--- 1 file changed, 17 insertions(+), 19 deletions(-) diff --git a/contents+lt.po b/contents+lt.po index 2641ec06dc..c38d4e215e 100644 --- a/contents+lt.po +++ b/contents+lt.po @@ -1,6 +1,5 @@ # Translators: # erinm, 2019 -# Emma Peel, 2019 # Tautvydas Ž., 2019 # Moo, 2019 # @@ -2272,7 +2271,7 @@ msgid "" "* BitTorrent in specific is [not anonymous over " "Tor](https://blog.torproject.org/bittorrent-over-tor-isnt-good-idea)." msgstr "" -"* SpecifiÅ¡kai âBitTorrentâ [nÄra anonimiÅ¡kas per " +"* KonkreÄiai âBitTorrentâ [nÄra anoniminis per " "Tor](https://blog.torproject.org/bittorrent-over-tor-isnt-good-idea)." #: https//tb-manual.torproject.org/make-tor-portable/ @@ -2319,15 +2318,15 @@ msgid "" "2. Navigate to the Tor Browser [download " "page](https://torproject.org/download)." msgstr "" -"2. Eikite į Tor NarÅ¡yklÄs [atsisiuntimo " -"puslapį](https://www.torproject.org/download). " +"2. Pereikite į Tor NarÅ¡yklÄs [atsisiuntimo " +"puslapį](https://www.torproject.org/download)." #: https//tb-manual.torproject.org/make-tor-portable/ #: (content/make-tor-portable/contents+en.lrtopic.body) msgid "" "3. Download the Windows `.exe` file and save it directly to your media." msgstr "" -"3. Atsisiųskite Windows `.exe` failÄ ir iÅ¡saugokite jį tiesiai į savo " +"3. Atsisiųskite Windows `.exe` failÄ ir įraÅ¡ykite jį tiesiai į savo " "laikmenÄ ." #: https//tb-manual.torproject.org/make-tor-portable/ @@ -2336,7 +2335,7 @@ msgid "" "4. (Recommended) Verify the [files " "signature](https://support.torproject.org/tbb/how-to-verify-signature/)." msgstr "" -"4. (Rekomenduojama) Patvirtinti [failo " +"4. (Rekomenduojama) Patikrinkite [failo " "paraÅ¡Ä ](https://support.torproject.org/tbb/how-to-verify-signature/)." #: https//tb-manual.torproject.org/make-tor-portable/ @@ -2345,8 +2344,8 @@ msgid "" "5. When the download is complete, click the `.exe` file and begin the " "installation process." msgstr "" -"5. Kai atsisiuntimas baigtas, paspauskite ant `.exe` failo ir pradÄkite " -"diegimo procesÄ " +"5. Kai atsisiuntimas užbaigtas, spustelÄkite ant `.exe` failo ir pradÄkite " +"įdiegimo procesÄ " #: https//tb-manual.torproject.org/make-tor-portable/ #: (content/make-tor-portable/contents+en.lrtopic.body) @@ -2354,8 +2353,8 @@ msgid "" "6. When the installer asks where to install Tor Browser, select your " "removable media." msgstr "" -"6. Kai įdiegiklis paklaus, kur diegti Tor narÅ¡yklÄ, pasirinkite savo " -"neÅ¡iojamÄ jÄ laikmenÄ ." +"6. Kai diegimo programa paklaus, kur įdiegti Tor NarÅ¡yklÄ, pasirinkite savo " +"keiÄiamÄ jÄ laikmenÄ ." #: https//tb-manual.torproject.org/make-tor-portable/ #: (content/make-tor-portable/contents+en.lrtopic.body) @@ -2363,15 +2362,14 @@ msgid "" "1. Plug in your removable media and format it. You *must* use macOS Extended" " (Journaled) format." msgstr "" -"1. Prijunkite keiÄiamÄ laikmenÄ ir suformatuokite jÄ . JÅ«s *privalote* " -"naudoti âmacOS Extendedâ (Journaled) formatÄ ." +"1. Prijunkite keiÄiamÄ jÄ laikmenÄ ir jÄ suformatuokite. JÅ«s *privalote* " +"naudoti \"macOS Extended (Journaled)\" formatÄ ." #: https//tb-manual.torproject.org/make-tor-portable/ #: (content/make-tor-portable/contents+en.lrtopic.body) msgid "3. Download the macOS `.dmg` file and save it directly to your media." msgstr "" -"3. Atsisiųskite âmacOSâ `.dmg` failÄ ir iÅ¡saugokite jį tiesiogiai savo " -"laikmenoje." +"3. Atsisiųskite macOS `.dmg` failÄ ir įraÅ¡ykite jį tiesiai į savo laikmenÄ ." #: https//tb-manual.torproject.org/make-tor-portable/ #: (content/make-tor-portable/contents+en.lrtopic.body) @@ -2379,16 +2377,16 @@ msgid "" "5. When the download is complete, click the `.dmg` file and begin the " "installation process." msgstr "" -"5. Kai atsisiuntimas bus baigtas, spustelÄkite failÄ `.dmg` ir pradÄkite " -"diegimo procesÄ ." +"5. Kai atsisiuntimas užbaigtas, spustelÄkite `.dmg` failÄ ir pradÄkite " +"įdiegimo procesÄ ." #: https//tb-manual.torproject.org/make-tor-portable/ #: (content/make-tor-portable/contents+en.lrtopic.body) msgid "" "3. Download the Linux `.tar.xz` file and save it directly to your media." msgstr "" -"3. Atsisiųskite âLinuxâ `.tar.xz` failÄ ir iÅ¡saugokite jį tiesiogiai savo " -"laikmenoje." +"3. Atsisiųskite Linux `.tar.xz` failÄ ir įraÅ¡ykite jį tiesiai į savo " +"laikmenÄ ." #: https//tb-manual.torproject.org/make-tor-portable/ #: (content/make-tor-portable/contents+en.lrtopic.body) @@ -2396,7 +2394,7 @@ msgid "" "5. When the download is complete, extract the archive onto the media as " "well." msgstr "" -"5. Kai atsisiuntimas bus baigtas, iÅ¡skleiskite archyvÄ
[tor-commits] [stem/master] Drop AuthorizedClient string method
commit b0738a9c72eb1d628a028a9298235f129a57ecab Author: Damian Johnson Date: Wed Dec 4 12:58:35 2019 -0800 Drop AuthorizedClient string method Oops. I added a string method on the assumption that I'd use it when creating descriptors but didn't. It's unused so simply dropping it so we have the option of adding a different string method later. --- stem/descriptor/hidden_service.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/stem/descriptor/hidden_service.py b/stem/descriptor/hidden_service.py index 249822f1..01f8b96f 100644 --- a/stem/descriptor/hidden_service.py +++ b/stem/descriptor/hidden_service.py @@ -428,9 +428,6 @@ class AuthorizedClient(object): self.iv = stem.util.str_tools._to_unicode(iv if iv else base64.b64encode(os.urandom(16)).rstrip(b'=')) self.cookie = stem.util.str_tools._to_unicode(cookie if cookie else base64.b64encode(os.urandom(16)).rstrip(b'=')) - def __str__(self): -return '%s %s %s' % (self.id, self.iv, self.cookie) - def __hash__(self): return stem.util._hash_attr(self, 'id', 'iv', 'cookie', cache = True) ___ tor-commits mailing list tor-commits@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits
[tor-commits] [translation/tpo-web] https://gitweb.torproject.org/translation.git/commit/?h=tpo-web
commit 01640f45c2c5e7453c67800609fcb6c8d9afbab8 Author: Translation commit bot Date: Wed Dec 4 20:52:58 2019 + https://gitweb.torproject.org/translation.git/commit/?h=tpo-web --- contents+nb.po | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/contents+nb.po b/contents+nb.po index 6035a6b09d..ae236c72fb 100644 --- a/contents+nb.po +++ b/contents+nb.po @@ -4,6 +4,7 @@ # Jørgen Moen Isaksen , 2019 # 490cdfb601cecc09e3640ad5913c, 2019 # erinm, 2019 +# Tim Sivertsen, 2019 # msgid "" msgstr "" @@ -11,7 +12,7 @@ msgstr "" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2019-11-15 12:00+CET\n" "PO-Revision-Date: 2019-03-09 10:41+\n" -"Last-Translator: erinm, 2019\n" +"Last-Translator: Tim Sivertsen, 2019\n" "Language-Team: Norwegian Bokmål (https://www.transifex.com/otf/teams/1519/nb/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -673,7 +674,7 @@ msgstr "" #: lego/templates/banner.html:10 templates/banner.html:10 msgid "Tracking, surveillance, and censorship are widespread online." -msgstr "" +msgstr "Sporing, overvåking og sensur er utbredt på nettet." #: lego/templates/banner.html:14 templates/banner.html:14 msgid "TAKE BACK THE INTERNET WITH TOR" @@ -685,7 +686,7 @@ msgstr "" #: lego/templates/banner.html:19 templates/banner.html:19 msgid "Give today, and Mozilla will match your donation." -msgstr "" +msgstr "Gi i dag, og Mozilla matcher donasjonen din." #: lego/templates/footer.html:9 lego/templates/footer.html:18 #: lego/templates/navbar.html:79 templates/footer.html:9 ___ tor-commits mailing list tor-commits@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits
[tor-commits] [translation/support-portal] https://gitweb.torproject.org/translation.git/commit/?h=support-portal
commit 31da2b5a39f873bd14f0837c5a5c189cdec78b16 Author: Translation commit bot Date: Wed Dec 4 20:53:29 2019 + https://gitweb.torproject.org/translation.git/commit/?h=support-portal --- contents+fa.po | 6 +++--- contents+nb.po | 7 --- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/contents+fa.po b/contents+fa.po index 2588bf2f2e..acc7847f9a 100644 --- a/contents+fa.po +++ b/contents+fa.po @@ -7501,7 +7501,7 @@ msgstr "" #: https//support.torproject.org/misc/misc-12/ #: (content/misc/misc-12/contents+en.lrquestion.title) msgid "How can I share files anonymously through Tor?" -msgstr "" +msgstr "ÚÚ¯ÙÙÙ Ù ÛâتÙاÙÙ ÙاÛÙ Ùا را ب٠طÙر Ú¯Ù Ùا٠در تÙر ب٠اشتراک بگذار٠Ø" #: https//support.torproject.org/misc/misc-12/ #: (content/misc/misc-12/contents+en.lrquestion.description) @@ -7590,7 +7590,7 @@ msgstr "ÚÚ¯ÙÙÙ Ù ÛâتÙاÙ٠ب٠پرÙÚ٠تÙر Ú©Ù Ú© Ú©ÙÙ Ø" #: https//support.torproject.org/misc/misc-15/ #: (content/misc/misc-15/contents+en.lrquestion.description) msgid "Thank you for your support!" -msgstr "" +msgstr "سپاس از پشتÛباÙÛ Ø´Ù Ø§!" #: https//support.torproject.org/misc/misc-15/ #: (content/misc/misc-15/contents+en.lrquestion.description) @@ -7602,7 +7602,7 @@ msgstr "" #: https//support.torproject.org/misc/misc-2/ #: (content/misc/misc-2/contents+en.lrquestion.title) msgid "Why don't you prevent bad people from doing bad things when using Tor?" -msgstr "" +msgstr "Úرا ش٠ا جÙÙÛ Ú©Ø§Ø±ÙØ§Û Ø¨Ø¯ بزÙکارا٠در تÙر را ÙÙ ÛâÚ¯ÛرÛØ¯Ø " #: https//support.torproject.org/misc/misc-2/ #: (content/misc/misc-2/contents+en.lrquestion.description) diff --git a/contents+nb.po b/contents+nb.po index 4305d614e6..fcaad9d08d 100644 --- a/contents+nb.po +++ b/contents+nb.po @@ -4,6 +4,7 @@ # a356f726dcd9c475642ac26af10009cc, 2019 # erinm, 2019 # 490cdfb601cecc09e3640ad5913c, 2019 +# Tim Sivertsen, 2019 # msgid "" msgstr "" @@ -11,7 +12,7 @@ msgstr "" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2019-11-14 16:04+CET\n" "PO-Revision-Date: 2018-10-02 22:41+\n" -"Last-Translator: 490cdfb601cecc09e3640ad5913c, 2019\n" +"Last-Translator: Tim Sivertsen, 2019\n" "Language-Team: Norwegian BokmÃ¥l (https://www.transifex.com/otf/teams/1519/nb/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -8205,7 +8206,7 @@ msgstr "" #: lego/templates/banner.html:10 templates/banner.html:10 msgid "Tracking, surveillance, and censorship are widespread online." -msgstr "" +msgstr "Sporing, overvÃ¥king og sensur er utbredt pÃ¥ nettet." #: lego/templates/banner.html:14 templates/banner.html:14 msgid "TAKE BACK THE INTERNET WITH TOR" @@ -8217,7 +8218,7 @@ msgstr "" #: lego/templates/banner.html:19 templates/banner.html:19 msgid "Give today, and Mozilla will match your donation." -msgstr "" +msgstr "Gi i dag, og Mozilla matcher donasjonen din." #: lego/templates/footer.html:9 lego/templates/footer.html:18 #: lego/templates/navbar.html:79 templates/footer.html:9 ___ tor-commits mailing list tor-commits@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits
[tor-commits] [translation/tor-launcher-network-settings] https://gitweb.torproject.org/translation.git/commit/?h=tor-launcher-network-settings
commit bad83fd41bbd1fb2380a673116ec4b34f0afa1ad Author: Translation commit bot Date: Wed Dec 4 20:52:40 2019 + https://gitweb.torproject.org/translation.git/commit/?h=tor-launcher-network-settings --- nb-NO/network-settings.dtd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nb-NO/network-settings.dtd b/nb-NO/network-settings.dtd index 145b427341..c623a8ee21 100644 --- a/nb-NO/network-settings.dtd +++ b/nb-NO/network-settings.dtd @@ -79,5 +79,5 @@ - + ___ tor-commits mailing list tor-commits@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits
[tor-commits] [translation/tbmanual-contentspot] https://gitweb.torproject.org/translation.git/commit/?h=tbmanual-contentspot
commit de2070f24bb8b86b0c9b48cd60dd012e09cad08b Author: Translation commit bot Date: Wed Dec 4 20:50:06 2019 + https://gitweb.torproject.org/translation.git/commit/?h=tbmanual-contentspot --- contents+lt.po| 44 ++-- contents+nb-NO.po | 7 --- 2 files changed, 26 insertions(+), 25 deletions(-) diff --git a/contents+lt.po b/contents+lt.po index 895dbd3e59..2641ec06dc 100644 --- a/contents+lt.po +++ b/contents+lt.po @@ -152,7 +152,7 @@ msgstr "Tapimas Tor vertÄju" #: https//tb-manual.torproject.org/menu/ #: (content/menu/contents+en.lrtopic.body) msgid "Making Tor Browser portable" -msgstr "NeÅ¡iojama Tor NarÅ¡yklÄ" +msgstr "Tor NarÅ¡yklÄs pavertimas perkeliama" #: https//tb-manual.torproject.org/menu/ #: (content/menu/contents+en.lrtopic.body) @@ -1876,9 +1876,9 @@ msgid "" "censoring connections to the Tor network. Read the " "[Circumvention](/circumvention) section for possible solutions." msgstr "" -"Jei vis tiek negalite prisijungti, jÅ«sų interneto paslaugų teikÄjas gali " -"cenzÅ«ruoti ryÅ¡ius su Tor tinklu. Perskaitykite skyrių " -"[ApÄjimas](/lt/circumvention), jei norite rasti galimus sprendimus." +"Jei vis tiek negalite prisijungti, gali bÅ«ti, kad jÅ«sų interneto paslaugų " +"teikÄjas cenzÅ«ruoja ryÅ¡ius su Tor tinklu. NorÄdami rasti galimus sprendimus," +" skaitykite skyrių [ApÄjimas](/lt/circumvention)." #: https//tb-manual.torproject.org/troubleshooting/ #: (content/troubleshooting/contents+en.lrtopic.body) @@ -2059,7 +2059,7 @@ msgstr "* IÅ¡trinkite Tor NarÅ¡yklÄs aplankÄ ar programÄ ." #: https//tb-manual.torproject.org/uninstalling/ #: (content/uninstalling/contents+en.lrtopic.body) msgid "* Empty your Trash." -msgstr "* IÅ¡valykite Å¡iukÅ¡liadÄžÄ." +msgstr "* IÅ¡valykite Å¡iukÅ¡linÄ." #: https//tb-manual.torproject.org/uninstalling/ #: (content/uninstalling/contents+en.lrtopic.body) @@ -2167,8 +2167,8 @@ msgid "" "Note that your operating systemâs standard \"Uninstall\" utility is not " "used." msgstr "" -"Atminkite, kad jÅ«sų operacinÄs sistemos standartinÄ \"Uninstall\" funkcija " -"nÄra naudojama." +"TurÄkite omenyje, kad nÄra naudojama jÅ«sų operacinÄs sistemos standartinÄ " +"\"Å alinimo\" paslaugų programa." #: https//tb-manual.torproject.org/known-issues/ #: (content/known-issues/contents+en.lrtopic.title) @@ -2180,8 +2180,8 @@ msgstr "ŽINOMOS PROBLEMOS" msgid "" "* Tor needs your system clock (and your time zone) set to the correct time." msgstr "" -"* Tam, kad nustatytų teisingÄ laikÄ , Tor reikia jÅ«sų sistemos laikrodžio (ir" -" laiko juostos)." +"* Tor reikia, kad jÅ«sų sistemos laikrodis (ir jÅ«sų laiko juosta) bÅ«tų " +"nustatyti į teisingÄ laikÄ ." #: https//tb-manual.torproject.org/known-issues/ #: (content/known-issues/contents+en.lrtopic.body) @@ -2190,7 +2190,7 @@ msgid "" "may need to be temporarily disabled:" msgstr "" "* Yra žinoma, kad Å¡ios užkardų programinÄs įrangos trukdo Tor ir jas gali " -"prireikti laikinai iÅ¡jungti:" +"tekti laikinai iÅ¡jungti:" #: https//tb-manual.torproject.org/known-issues/ #: (content/known-issues/contents+en.lrtopic.body) @@ -2219,7 +2219,7 @@ msgid "" "security reasons." msgstr "" "* Vaizdo įraÅ¡ai, kurie reikalauja Adobe Flash yra neprieinami. Flash yra " -"iÅ¡jungta saugumo sumetimais." +"iÅ¡jungtas saugumo sumetimais." #: https//tb-manual.torproject.org/known-issues/ #: (content/known-issues/contents+en.lrtopic.body) @@ -2234,9 +2234,9 @@ msgid "" "* The Tor Browser package is dated January 1, 2000 00:00:00 UTC. This is to " "ensure that each software build is exactly reproducible." msgstr "" -"* Tor NarÅ¡yklÄs paketo data yra 2000m. Sausio 1d. 00:00:00 UTC. Tai " -"užtikrina, kad kiekviena programinÄs įrangos versija bÅ«tų tiksliai " -"atkuriama." +"* Tor NarÅ¡yklÄs paketo data yra 2000 m. sausio 1 d. 00:00:00 UTC. Tai " +"užtikrina, kad kiekvienas programinÄs įrangos darinys yra tiksliai " +"atkuriamas." #: https//tb-manual.torproject.org/known-issues/ #: (content/known-issues/contents+en.lrtopic.body) @@ -2278,7 +2278,7 @@ msgstr "" #: https//tb-manual.torproject.org/make-tor-portable/ #: (content/make-tor-portable/contents+en.lrtopic.title) msgid "MAKE TOR BROWSER PORTABLE" -msgstr "PADARYKITE TOR NARÅ YKLÄ NEÅ IOJAMA" +msgstr "PAVERSKITE TOR NARÅ YKLÄ PERKELIAMA" #: https//tb-manual.torproject.org/make-tor-portable/ #: (content/make-tor-portable/contents+en.lrtopic.description) @@ -2291,9 +2291,9 @@ msgid "" "If preferred, Tor Browser may be made portable by extracting it from its " "archive directly onto removable media such as a USB stick or SD card." msgstr "" -"Jei pageidaujama, Tor NarÅ¡yklÄ gali bÅ«ti padaryta neÅ¡iojama, iÅ¡skleidžiant " -"jÄ iÅ¡ savo archyvo tiesiai į keiÄiamÄ jÄ laikmenÄ , tokiÄ kaip USB atmintinÄ " -"ar SD kortelÄ." +"Jei pageidaujama, Tor NarÅ¡yklÄ gali bÅ«ti paversta perkeliama, iÅ¡skleidžiant