[tor-bugs] #15584 [Torsocks]: Linking libtorsocks with libtcmalloc results in SIGSEGV

Tor Bug Tracker & Wiki blackhole at torproject.org
Sat Apr 4 14:28:11 UTC 2015


#15584: Linking libtorsocks with libtcmalloc results in SIGSEGV
-------------------------------------------------+-------------------------
 Reporter:  post-factum                          |          Owner:  dgoulet
     Type:  defect                               |         Status:  new
 Priority:  normal                               |      Milestone:
Component:  Torsocks                             |        Version:
 Keywords:  sigsegv libtcmalloc libtorsocks      |  Actual Points:
  torsocks ld_preload                            |         Points:
Parent ID:                                       |
-------------------------------------------------+-------------------------
 Any application that is linked against libtcmalloc gets SISEGV if it's
 being run with libtorsocks preloaded. However, it depends on preloading
 order.

 If libtorsocks is preloaded first, app segfaults:

 {{{
 [~]$ LD_PRELOAD="/usr/lib64/torsocks/libtorsocks.so
 /usr/lib64/libtcmalloc_debug.so" uname -a
 [1]    7817 segmentation fault (core dumped)  LD_PRELOAD= uname -a
 }}}

 If, instead, libtcmalloc is preloaded first, everything is OK:

 {{{
 [~]$ LD_PRELOAD="/usr/lib64/libtcmalloc_debug.so
 /usr/lib64/torsocks/libtorsocks.so" uname -a
 Linux spock 3.19.0-pf3 #1 SMP PREEMPT Tue Mar 24 17:14:04 EET 2015 x86_64
 GNU/Linux
 }}}

 The problem is that if an app in question is linked against libtcmalloc,
 torifying it via "torify" or "torsocks" wrapper always leads to segfault
 because libtorsocks is loaded before libtcmalloc.

 Attempt made to debug any app leads to non-informative backtrace:

 {{{
 #0  0x0000000000000000 in ?? ()
 #1  0x00007ffff725e40c in ?? () from /usr/lib/libtcmalloc_debug.so.4
 #2  0x00007ffff725ed3f in ?? () from /usr/lib/libtcmalloc_debug.so.4
 #3  0x00007ffff725ef49 in NumCPUs() () from
 /usr/lib/libtcmalloc_debug.so.4
 #4  0x00007ffff723b439 in ?? () from /usr/lib/libtcmalloc_debug.so.4
 #5  0x00007ffff7dea1fa in call_init.part () from /lib64/ld-
 linux-x86-64.so.2
 #6  0x00007ffff7dea30b in _dl_init () from /lib64/ld-linux-x86-64.so.2
 #7  0x00007ffff7ddbdba in _dl_start_user () from /lib64/ld-
 linux-x86-64.so.2
 #8  0x0000000000000003 in ?? ()
 #9  0x00007fffffffe47a in ?? ()
 #10 0x00007fffffffe4aa in ?? ()
 #11 0x00007fffffffe4af in ?? ()
 #12 0x0000000000000000 in ?? ()
 }}}

 I use torsocks v2.0.0 and libtcmalloc v2.4.

 So my questions are:

 1. should this be libtorsocks or libtcmalloc issue?
 2. how should I get more info on this bug?
 3. what should be done to fix the issue?

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


More information about the tor-bugs mailing list