[tor-commits] [tor/maint-0.4.1] backtrace: avoid undefined behaviour on re-initialisation

nickm at torproject.org nickm at torproject.org
Tue Oct 22 16:14:20 UTC 2019


commit 315f14c709d019c55731faedb19a97b771f9c42f
Author: teor <teor at torproject.org>
Date:   Fri Sep 20 11:40:05 2019 +1000

    backtrace: avoid undefined behaviour on re-initialisation
    
    cb_buf_mutex is statically initialised, so we can not destroy it when
    we are shutting down the err subsystem. If we destroy it, and then
    re-initialise tor, all our backtraces will fail.
    
    Part of 31736, but committed in this branch to avoid merge conflicts.
---
 src/lib/err/backtrace.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/lib/err/backtrace.c b/src/lib/err/backtrace.c
index bf833c162..2a956e611 100644
--- a/src/lib/err/backtrace.c
+++ b/src/lib/err/backtrace.c
@@ -251,6 +251,10 @@ remove_bt_handler(void)
      * It's not a fatal error, so we just ignore it. */
     (void)sigaction(trap_signals[i], &sa, NULL);
   }
+
+  /* cb_buf_mutex is statically initialised, so we can not destroy it.
+   * If we destroy it, and then re-initialise tor, all our backtraces will
+   * fail. */
 }
 #endif /* defined(USE_BACKTRACE) */
 





More information about the tor-commits mailing list