[Pkg-privacy-maintainers] Bug#902792: torsocks: does not support and fails catastrophically with muliarch

Yuriy M. Kaminskiy yumkam+debian at gmail.com
Sat Jun 30 22:42:51 BST 2018


Package: torsocks
Version: 2.2.0-1+deb9u1
Severity: important
Tags: patch

Dear Maintainer,

On multi-arch systems, torsocks fails catastrophically with
other-arch binaries.

E.g. with torsocks:i386 and wget:amd64,

    torsocks wget https://check.torproject.org

just spits

ERROR: ld.so: object '/usr/lib/i386-linux-gnu/torsocks/libtorsocks.so'
from LD_PRELOAD cannot be preloaded (wrong ELF class: ELFCLASS32):
ignored.

and happily continue connecting bypassing tor.

    * What outcome did you expect instead?

It should be possible to co-install torsocks:i386 and torsocks:amd64,
and then it should work with both :amd64 and :i386 binaries.
(I'd like to point out to glibc ld.so feature to replace '$LIB' in
LD_PRELOAD and LD_LIBRARY_PATH with path to multi-arched /lib/ directory).
Some (very rough) patch attached (warning: only checked on linux; I have 
no idea if this will work on hurd or kfreebsd).

-- System Information:
Debian Release: 9.4
   APT prefers stable-updates
   APT policy: (500, 'stable-updates'), (500, 'stable-debug'), (500, 
'proposed-updates-debug'), (500, 'proposed-updates'), (500, 'stable')
Architecture: i386 (x86_64)
Foreign Architectures: amd64

Kernel: Linux 4.9.0-6-amd64 (SMP w/2 CPU cores)
Locale: LANG=ru_RU.KOI8-R, LC_CTYPE=ru_RU.KOI8-R (charmap=KOI8-R), 
LANGUAGE=ru_RU.KOI8-R (charmap=KOI8-R)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages torsocks depends on:
ii  libc6  2.24-11+deb9u3

Versions of packages torsocks recommends:
ii  tor  0.3.3.7-1~bpo9+1

torsocks suggests no packages.

-- no debconf information

-------------- next part --------------
diff -Nru torsocks-2.2.0/debian/control torsocks-2.2.0/debian/control
--- torsocks-2.2.0/debian/control	2017-08-04 22:09:04.000000000 +0300
+++ torsocks-2.2.0/debian/control	2018-06-30 23:50:37.000000000 +0300
@@ -15,6 +15,8 @@
 
 Package: torsocks
 Architecture: any
+Multi-Arch: same
+Pre-Depends: ${misc:Pre-Depends}
 Depends: ${shlibs:Depends},
          ${misc:Depends}
 Recommends: tor
@@ -22,3 +24,7 @@
  Torsocks allows you to use most SOCKS-friendly applications in a safe way with
  Tor. It ensures that DNS requests are handled safely and explicitly rejects
  UDP traffic from the application you're using.
+ .
+ WARNING: on multi-arch systems, this package should be installed in all
+ enabled architectures.
+ 
diff -Nru torsocks-2.2.0/debian/patches/remove-M-A-conflicting-check.patch torsocks-2.2.0/debian/patches/remove-M-A-conflicting-check.patch
--- torsocks-2.2.0/debian/patches/remove-M-A-conflicting-check.patch	1970-01-01 03:00:00.000000000 +0300
+++ torsocks-2.2.0/debian/patches/remove-M-A-conflicting-check.patch	2018-06-30 23:52:29.000000000 +0300
@@ -0,0 +1,17 @@
+Index: torsocks-2.2.0/src/bin/torsocks.in
+===================================================================
+--- torsocks-2.2.0.orig/src/bin/torsocks.in
++++ torsocks-2.2.0/src/bin/torsocks.in
+@@ -219,10 +219,12 @@ if [ $# -eq 0 ] ; then
+ fi
+ 
+ # Ensure libtorsocks exists,
++if false; then
+ if [ ! -f $SHLIB ]; then
+    echo "$0: $SHLIB does not exist! Try re-installing torsocks."
+    exit
+ fi
++fi
+ 
+ while true;
+ do
diff -Nru torsocks-2.2.0/debian/patches/series torsocks-2.2.0/debian/patches/series
--- torsocks-2.2.0/debian/patches/series	2017-08-04 22:09:04.000000000 +0300
+++ torsocks-2.2.0/debian/patches/series	2018-06-30 23:52:29.000000000 +0300
@@ -1,2 +1,3 @@
 Fix-check_addr-to-return-either-0-or-1.patch
 exclude_test_requiring_network.patch
+remove-M-A-conflicting-check.patch
diff -Nru torsocks-2.2.0/debian/rules torsocks-2.2.0/debian/rules
--- torsocks-2.2.0/debian/rules	2017-08-04 22:09:04.000000000 +0300
+++ torsocks-2.2.0/debian/rules	2018-06-30 23:52:29.000000000 +0300
@@ -14,6 +14,7 @@
 
 override_dh_auto_install:
 	dh_auto_install
+	sed -i 's,lib/$(DEB_HOST_MULTIARCH),\\$$LIB,' $(DESTDIR)/usr/bin/$(PACKAGE)
 	dh_bash-completion
 	rm $(DESTDIR)/usr/share/doc/torsocks/DEBUG
 	rm $(DESTDIR)/usr/share/doc/torsocks/socks-extensions.txt



More information about the Pkg-privacy-maintainers mailing list