[tor-bugs] #6623 [Core Tor/Tor]: --enable-static-tor cannot succeed

Tor Bug Tracker & Wiki blackhole at torproject.org
Thu Sep 20 01:46:19 UTC 2018


#6623: --enable-static-tor cannot succeed
-------------------------------------------------+-------------------------
 Reporter:  tmpname0901                          |          Owner:  (none)
     Type:  defect                               |         Status:
                                                 |  needs_review
 Priority:  Medium                               |      Milestone:  Tor:
                                                 |  unspecified
Component:  Core Tor/Tor                         |        Version:  Tor:
                                                 |  0.2.3.20-rc
 Severity:  Normal                               |     Resolution:
 Keywords:  tor-relay autotools build link       |  Actual Points:
  static                                         |
Parent ID:                                       |         Points:
 Reviewer:                                       |        Sponsor:
-------------------------------------------------+-------------------------
Changes (by sysrqb):

 * status:  new => needs_review


Comment:

 Okay, I have a branch for this. The reason this was failing is because
 library order was partially reversed for linking. There are three
 remaining issues that need some clarification. Please see branch `bug6623`
 in my public user repo.

 However, overall, I wonder if there is any benefit in supporting static
 linking at this point. (To be clear, I don't actually have a use for this)

 ----

 The backtrace unit tests fail because the symbols are not shown/available.
 This needs further investigation.

 Statically linked:
 {{{
 $ ./src/test/test-bt-cl crash

 ============================================================ T= 1537399469
 Tor died: Caught signal 11
 [0x4074c9]
 [0x400df8]
 [0x400df8]
 [0x400e4d]
 [0x400e9d]
 [0x400eed]
 [0x4007d3]
 [0x41aac6]
 [0x41aec1]
 [0x400cca]
 Aborted (core dumped)
 }}}
 {{{
 $ ./src/test/test-bt-cl assert
 Sep 19 23:25:07.037 [err] tor_assertion_failed_(): Bug:
 src/test/test_bt_cl.c:46: crash: Assertion 1 == 0 failed; aborting. (on
 Tor 0.3.5.0-alpha-dev 274ad5d643e969a6)
 Sep 19 23:25:07.037 [err] Bug: Assertion 1 == 0 failed in crash at
 src/test/test_bt_cl.c:46. Stack trace: (on Tor 0.3.5.0-alpha-dev
 274ad5d643e969a6)
 Sep 19 23:25:07.037 [err] Bug:     [0x4075a5] (on Tor 0.3.5.0-alpha-dev
 274ad5d643e969a6)
 Sep 19 23:25:07.037 [err] Bug:     [0x404294] (on Tor 0.3.5.0-alpha-dev
 274ad5d643e969a6)
 Sep 19 23:25:07.037 [err] Bug:     [0x400e29] (on Tor 0.3.5.0-alpha-dev
 274ad5d643e969a6)
 Sep 19 23:25:07.037 [err] Bug:     [0x400e4d] (on Tor 0.3.5.0-alpha-dev
 274ad5d643e969a6)
 Sep 19 23:25:07.037 [err] Bug:     [0x400e9d] (on Tor 0.3.5.0-alpha-dev
 274ad5d643e969a6)
 Sep 19 23:25:07.037 [err] Bug:     [0x400eed] (on Tor 0.3.5.0-alpha-dev
 274ad5d643e969a6)
 Sep 19 23:25:07.037 [err] Bug:     [0x4007d3] (on Tor 0.3.5.0-alpha-dev
 274ad5d643e969a6)
 Sep 19 23:25:07.037 [err] Bug:     [0x41aac6] (on Tor 0.3.5.0-alpha-dev
 274ad5d643e969a6)
 Sep 19 23:25:07.037 [err] Bug:     [0x41aec1] (on Tor 0.3.5.0-alpha-dev
 274ad5d643e969a6)
 Sep 19 23:25:07.037 [err] Bug:     [0x400cca] (on Tor 0.3.5.0-alpha-dev
 274ad5d643e969a6)
 Aborted (core dumped)
 }}}

 vs. Dynamically linked:

 {{{
 $ ./src/test/test-bt-cl crash

 ============================================================ T= 1537404853
 Tor died: Caught signal 11
 ./src/test/test-bt-cl(+0xa2a9)[0x576acdd052a9]
 ./src/test/test-bt-cl(crash+0x48)[0x576acdcfebd8]
 ./src/test/test-bt-cl(crash+0x48)[0x576acdcfebd8]
 ./src/test/test-bt-cl(oh_what+0x1d)[0x576acdcfec2d]
 ./src/test/test-bt-cl(a_tangled_web+0x1d)[0x576acdcfec7d]
 ./src/test/test-bt-cl(we_weave+0x1d)[0x576acdcfeccd]
 ./src/test/test-bt-cl(main+0xa3)[0x576acdcfe9d3]
 /lib64/libc.so.6(__libc_start_main+0xea)[0x726f7219d88a]
 ./src/test/test-bt-cl(_start+0x2a)[0x576acdcfeaaa]
 Aborted (core dumped)
 }}}
 {{{
 $ ./src/test/test-bt-cl assert
 Sep 20 00:47:26.187 [err] tor_assertion_failed_(): Bug:
 src/test/test_bt_cl.c:46: crash: Assertion 1 == 0 failed; aborting. (on
 Tor 0.3.5.0-alpha-dev 274ad5d643e969a6)
 Sep 20 00:47:26.188 [err] Bug: Assertion 1 == 0 failed in crash at
 src/test/test_bt_cl.c:46. Stack trace: (on Tor 0.3.5.0-alpha-dev
 274ad5d643e969a6)
 Sep 20 00:47:26.188 [err] Bug:     ./src/test/test-bt-
 cl(log_backtrace_impl+0x45) [0x5b334ff78385] (on Tor 0.3.5.0-alpha-dev
 274ad5d643e969a6)
 Sep 20 00:47:26.188 [err] Bug:     ./src/test/test-bt-
 cl(tor_assertion_failed_+0x94) [0x5b334ff75074] (on Tor 0.3.5.0-alpha-dev
 274ad5d643e969a6)
 Sep 20 00:47:26.188 [err] Bug:     ./src/test/test-bt-cl(crash+0x79)
 [0x5b334ff71c09] (on Tor 0.3.5.0-alpha-dev 274ad5d643e969a6)
 Sep 20 00:47:26.188 [err] Bug:     ./src/test/test-bt-cl(oh_what+0x1d)
 [0x5b334ff71c2d] (on Tor 0.3.5.0-alpha-dev 274ad5d643e969a6)
 Sep 20 00:47:26.188 [err] Bug:     ./src/test/test-bt-
 cl(a_tangled_web+0x1d) [0x5b334ff71c7d] (on Tor 0.3.5.0-alpha-dev
 274ad5d643e969a6)
 Sep 20 00:47:26.188 [err] Bug:     ./src/test/test-bt-cl(we_weave+0x1d)
 [0x5b334ff71ccd] (on Tor 0.3.5.0-alpha-dev 274ad5d643e969a6)
 Sep 20 00:47:26.188 [err] Bug:     ./src/test/test-bt-cl(main+0xa3)
 [0x5b334ff719d3] (on Tor 0.3.5.0-alpha-dev 274ad5d643e969a6)
 Sep 20 00:47:26.188 [err] Bug:
 /lib64/libc.so.6(__libc_start_main+0xea) [0x7fcc6186a88a] (on Tor 0.3.5.0
 -alpha-dev 274ad5d643e969a6)
 Sep 20 00:47:26.188 [err] Bug:     ./src/test/test-bt-cl(_start+0x2a)
 [0x5b334ff71aaa] (on Tor 0.3.5.0-alpha-dev 274ad5d643e969a6)
 Aborted (core dumped)
 }}}

 ----

 The util/pwdb unit test is failing because of the static linking (I think)
 - see next section, too:

 Statically linked:
 {{{
 $ ./src/test/test util/pwdb
 util/pwdb: [forking]
 ============================================================ T= 1537406368
 Tor 0.3.5.0-alpha-dev (git-274ad5d643e969a6) died: Caught signal 11
 [0x85d1e9]
 /lib64/libnss_systemd.so.2(+0x18f5d)[0x75a3c39bef5d]
 /lib64/libnss_systemd.so.2(+0x18f5d)[0x75a3c39bef5d]
 /lib64/libnss_systemd.so.2(+0x26d90)[0x75a3c39ccd90]
 /lib64/libnss_systemd.so.2(_nss_systemd_getpwnam_r+0x3b0)[0x75a3c39cea50]
 [0xab5775]
 [0xab53aa]
 [0x842f29]
 [0x6645c1]
 [0x6c0856]
 [0x6c0ba1]
 [0x6c115c]
 [0x407105]
 [0xa4dff6]
 [0xa4e3f1]
 [0x40765a]
 [Lost connection!]
   [pwdb FAILED]
 1/1 TESTS FAILED. (0 skipped)
 }}}
 vs. Dynamically linked:
 {{{
 $ ./src/test/test util/pwdb
 util/pwdb: [forking] OK
 1 tests ok.  (0 skipped)
 }}}

 -----

 During linking, the following messages are emitted:

 {{{
   CCLD     src/app/tor
 /usr/lib64/libcrypto.a(fips.o): In function `verify_checksums':
 (.text+0x4fb): warning: Using 'dlopen' in statically linked applications
 requires at runtime the shared libraries from the glibc version used for
 linking
 src/lib/libtor-fs.a(dir.o): In function `check_private_dir':
 /home/user/tor/src/lib/fs/dir.c:216: warning: Using 'getgrgid' in
 statically linked applications requires at runtime the shared libraries
 from the glibc version used for linking
 src/lib/libtor-fs.a(userdb.o): In function `tor_getpwnam':
 /home/user/tor/src/lib/fs/userdb.c:80: warning: Using 'getpwnam' in
 statically linked applications requires at runtime the shared libraries
 from the glibc version used for linking
 src/lib/libtor-fs.a(userdb.o): In function `tor_getpwuid':
 /home/user/tor/src/lib/fs/userdb.c:110: warning: Using 'getpwuid' in
 statically linked applications requires at runtime the shared libraries
 from the glibc version used for linking
 src/lib/libtor-net.a(resolve.o): In function `tor_addr_lookup':
 /home/user/tor/src/lib/net/resolve.c:102: warning: Using 'getaddrinfo' in
 statically linked applications requires at runtime the shared libraries
 from the glibc version used for linking
 /usr/lib64/libcrypto.a(b_sock.o): In function `BIO_gethostbyname':
 (.text+0x71): warning: Using 'gethostbyname' in statically linked
 applications requires at runtime the shared libraries from the glibc
 version used for linking
 /home/user/repos/libevent/.libs/libevent.a(evutil.o): In function
 `evutil_unparse_protoname':
 /home/user/repos/libevent/evutil.c:911: warning: Using 'getprotobynumber'
 in statically linked applications requires at runtime the shared libraries
 from the glibc version used for linking
 /home/user/repos/libevent/.libs/libevent.a(evutil.o): In function
 `evutil_parse_servname':
 /home/user/repos/libevent/evutil.c:883: warning: Using 'getservbyname' in
 statically linked applications requires at runtime the shared libraries
 from the glibc version used for linking
 }}}

 ----

 I configured and tested the branch with:
 {{{
 $ ./autogen.sh && ./configure --disable-asciidoc --enable-pic --enable-
 android --enable-fatal-warnings --enable-static-openssl --with-ssl-
 dir=/usr/lib64 --enable-static-zlib --with-zlib-dir=/usr/lib64 --enable-
 static-libevent --with-libevent-dir=../libevent/.libs --enable-static-tor
 }}}

 On Fedora I installed openssl-static, zlib-static, glibc-static. I
 compiled libevent (release-2.1.8-stable) from source.

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


More information about the tor-bugs mailing list