[tor-bugs] #6673 [- Select a component]: tor crashes silently with non-threaded openssl build

Tor Bug Tracker & Wiki torproject-admin at torproject.org
Fri Aug 24 10:02:30 UTC 2012


#6673: tor crashes silently with non-threaded openssl build
----------------------------------+-----------------------------------------
 Reporter:  darkk                 |          Owner:               
     Type:  defect                |         Status:  new          
 Priority:  normal                |      Milestone:               
Component:  - Select a component  |        Version:  Tor: 0.2.2.37
 Keywords:  openssl, ssl          |         Parent:               
   Points:                        |   Actualpoints:               
----------------------------------+-----------------------------------------
 I've seen lots of cryptic crashes of tor on my openwrt gateway:
 https://atlas.torproject.org/#details/F44DA505AD91CFC8D5745BB070909F20F21E06D9

 I've recently decided to debug this issue and run tor with --Daemon 0
 under tmux and I got assertion failure:
 {{{
 ...
 Aug 24 00:43:13.842 [notice] Performing bandwidth self-test...done.
 /usr/sbin/tor: md_rand.c: 325: ssleay_rand_add: Assertion `md_c[1] ==
 md_count[1]' failed.
 Aborted
 }}}

 Accoding to openssl code it means that openssl was built without
 OPENSSL_THREADS

 {{{
 crypto/rand/md_rand.c
 320-    if (entropy < ENTROPY_NEEDED) /* stop counting when we have enough
 */
 321-        entropy += add;
 322-    if (!do_not_lock) CRYPTO_w_unlock(CRYPTO_LOCK_RAND);
 323-
 324-#if !defined(OPENSSL_THREADS) && !defined(OPENSSL_SYS_WIN32)
 325:    assert(md_c[1] == md_count[1]);
 326-#endif
 327-    }
 328-
 329-static void ssleay_rand_seed(const void *buf, int num)
 330-    {
 }}}

 If OPENSSL_THREADS is required for tor to work, then tor should probably
 check for it in compile-time:

 {{{
 openssl-1.0.1/doc/crypto/threads.pod

 You can find out if OpenSSL was configured with thread support:

  #define OPENSSL_THREAD_DEFINES
  #include <openssl/opensslconf.h>
  #if defined(OPENSSL_THREADS)
    // thread support enabled
  #else
    // no thread support
  #endif
 }}}

 If OPENSSL_THREADS is not required, than it looks like either bug in tor
 itself or in tor<->openssl interaction.

 libopenssl - 1.0.1c-1
 tor - 0.2.2.37-1

 P.S. related OpenWrt ticket: https://dev.openwrt.org/ticket/12072

-- 
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/6673>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online


More information about the tor-bugs mailing list