diffstat for torsocks-2.3.0 torsocks-2.3.0 changelog | 14 +++ control | 10 +- patches/Add-getdents-getdents64-support.patch | 95 ++++++++++++++++++++++++++ patches/series | 1 4 files changed, 117 insertions(+), 3 deletions(-) diff -Nru torsocks-2.3.0/debian/changelog torsocks-2.3.0/debian/changelog --- torsocks-2.3.0/debian/changelog 2018-11-27 13:00:20.000000000 +0100 +++ torsocks-2.3.0/debian/changelog 2019-04-03 20:14:40.000000000 +0200 @@ -1,3 +1,17 @@ +torsocks (2.3.0-2) unstable; urgency=medium + + [ intrigeri & Sandro Knauß ] + * Cherry-pick patch from upstream Git, to fix Totem crashing when run + under torsocks, by adding support for the getdents and getdents64 + syscalls. (Closes: Tails#16618, which would be severity: important + in a Debian context.) + + [ Ulrike Uhlig ] + * Update package description: don't make safety promises that upstream + prefers not to. (Closes: #870763) + + -- intrigeri Wed, 03 Apr 2019 18:14:40 +0000 + torsocks (2.3.0-1) unstable; urgency=medium * New upstream version. diff -Nru torsocks-2.3.0/debian/control torsocks-2.3.0/debian/control --- torsocks-2.3.0/debian/control 2018-11-27 13:00:20.000000000 +0100 +++ torsocks-2.3.0/debian/control 2019-04-03 20:14:40.000000000 +0200 @@ -19,6 +19,10 @@ ${misc:Depends} Recommends: tor Description: use SOCKS-friendly applications with Tor - 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. + Torsocks allows you to redirect network traffic of individual SOCKS-friendly + applications through the Tor network. It also ensures DNS queries are handled + correctly and explicitly blocks all UDP traffic from the application in + question. + It is possible that a given application can leak user/system data at a level + that neither Tor nor torsocks can control, a 100% guarantee of being safe to + operate with Tor can not be given for applications. diff -Nru torsocks-2.3.0/debian/patches/Add-getdents-getdents64-support.patch torsocks-2.3.0/debian/patches/Add-getdents-getdents64-support.patch --- torsocks-2.3.0/debian/patches/Add-getdents-getdents64-support.patch 1970-01-01 01:00:00.000000000 +0100 +++ torsocks-2.3.0/debian/patches/Add-getdents-getdents64-support.patch 2019-04-03 20:14:40.000000000 +0200 @@ -0,0 +1,95 @@ +From: Alejandro Alvarado <44826516+seisvelas@users.noreply.github.com> +Date: Mon, 17 Dec 2018 19:25:18 -0600 +Subject: Add getdents / getdents64 support + +This fixes Totem, which otherwise crashes when under torsocks in +some configurations. + +Bug: https://trac.torproject.org/projects/tor/ticket/28861 +Bug-Tails: https://redmine.tails.boum.org/code/issues/16618 +--- + src/common/compat.h | 8 ++++++++ + src/lib/syscall.c | 37 +++++++++++++++++++++++++++++++++++++ + 2 files changed, 45 insertions(+) + +diff --git a/src/common/compat.h b/src/common/compat.h +index a9b73c2..d79301f 100644 +--- a/src/common/compat.h ++++ b/src/common/compat.h +@@ -129,6 +129,12 @@ void tsocks_once(tsocks_once_t *o, void (*init_routine)(void)); + #ifndef __NR_memfd_create + #define __NR_memfd_create -19 + #endif ++#ifndef __NR_getdents ++#define __NR_getdents -20 ++#endif ++#ifndef __NR_getdents64 ++#define __NR_getdents64 -21 ++#endif + + #define TSOCKS_NR_SOCKET __NR_socket + #define TSOCKS_NR_CONNECT __NR_connect +@@ -149,6 +155,8 @@ void tsocks_once(tsocks_once_t *o, void (*init_routine)(void)); + #define TSOCKS_NR_CLOCK_GETTIME __NR_clock_gettime + #define TSOCKS_NR_FORK __NR_fork + #define TSOCKS_NR_MEMFD_CREATE __NR_memfd_create ++#define TSOCKS_NR_GETDENTS __NR_getdents ++#define TSOCKS_NR_GETDENTS64 __NR_getdents64 + + /* + * Despite glibc providing wrappers for these calls for a long time +diff --git a/src/lib/syscall.c b/src/lib/syscall.c +index 7fba580..f793da7 100644 +--- a/src/lib/syscall.c ++++ b/src/lib/syscall.c +@@ -437,6 +437,37 @@ static LIBC_SYSCALL_RET_TYPE handle_memfd_create(va_list args) + + return tsocks_libc_syscall(TSOCKS_NR_MEMFD_CREATE, name, flags); + } ++/* ++ * Handle getdents(2) syscall. ++ */ ++static LIBC_SYSCALL_RET_TYPE handle_getdents(va_list args) ++{ ++ unsigned int fd; ++ struct linux_dirent *dirp; ++ unsigned int count; ++ ++ fd = va_arg(args, __typeof__(fd)); ++ dirp = va_arg(args, __typeof__(dirp)); ++ count = va_arg(args, __typeof__(count)); ++ ++ return tsocks_libc_syscall(TSOCKS_NR_GETDENTS, fd, dirp, count); ++} ++/* ++ * Handle getdents64(2) syscall. ++ */ ++static LIBC_SYSCALL_RET_TYPE handle_getdents64(va_list args) ++{ ++ unsigned int fd; ++ struct linux_dirent64 *dirp; ++ unsigned int count; ++ ++ fd = va_arg(args, __typeof__(fd)); ++ dirp = va_arg(args, __typeof__(dirp)); ++ count = va_arg(args, __typeof__(count)); ++ ++ return tsocks_libc_syscall(TSOCKS_NR_GETDENTS64, fd, dirp, count); ++} ++ + #endif /* __linux__ */ + + /* +@@ -558,6 +589,12 @@ LIBC_SYSCALL_RET_TYPE tsocks_syscall(long int number, va_list args) + case TSOCKS_NR_MEMFD_CREATE: + ret = handle_memfd_create(args); + break; ++ case TSOCKS_NR_GETDENTS: ++ ret = handle_getdents(args); ++ break; ++ case TSOCKS_NR_GETDENTS64: ++ ret = handle_getdents64(args); ++ break; + #endif /* __linux__ */ + default: + /* diff -Nru torsocks-2.3.0/debian/patches/series torsocks-2.3.0/debian/patches/series --- torsocks-2.3.0/debian/patches/series 2018-11-27 13:00:20.000000000 +0100 +++ torsocks-2.3.0/debian/patches/series 2019-04-03 20:14:40.000000000 +0200 @@ -1 +1,2 @@ exclude_test_requiring_network.patch +Add-getdents-getdents64-support.patch