torsocks: Bump to 2.4.0

This commit is contained in:
Tee KOBAYASHI 2022-11-25 00:31:30 +09:00 committed by xtkoba
parent 75836eb308
commit cd2853cee9
4 changed files with 5 additions and 132 deletions

View File

@ -1,94 +0,0 @@
From 4c00ec8773fd63fa48ef49e1ccf2adac598427be Mon Sep 17 00:00:00 2001
From: Alejandro Alvarado <44826516+seisvelas@users.noreply.github.com>
Date: Mon, 17 Dec 2018 19:25:18 -0600
Subject: Add getdents / getdents64 support re ticket 28861
---
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:
/*
--
cgit v1.2.1

View File

@ -1,32 +0,0 @@
From d4b0a84bdf2a1895c8ec3091dc2767fd9f8c2d66 Mon Sep 17 00:00:00 2001
From: Ola Bini <ola@autonomia.digital>
Date: Thu, 9 Jul 2020 18:31:41 +0000
Subject: Fixes an issue when calling recvmsg on a domain socket non-blocking
Since the original flags are not taken into account when peeking, the peek
recvmsg call will hang forever in certain circumstances, including in all QT
applications running Wayland. This fix simply adds the original flags, so that
the peeking recvmsg call might be nonblocking, if the original call was
nonblocking.
Closes #40001
---
src/lib/recv.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/lib/recv.c b/src/lib/recv.c
index d1bbaea..abdd1fa 100644
--- a/src/lib/recv.c
+++ b/src/lib/recv.c
@@ -92,7 +92,7 @@ LIBC_RECVMSG_RET_TYPE tsocks_recvmsg(LIBC_RECVMSG_SIG)
do {
/* Just peek the data to inspect the payload for fd. */
- ret = tsocks_libc_recvmsg(sockfd, &msg_hdr, MSG_PEEK);
+ ret = tsocks_libc_recvmsg(sockfd, &msg_hdr, MSG_PEEK | flags);
} while (ret < 0 && errno == EINTR);
if (ret < 0) {
/* Use the current errno set by the call above. */
--
cgit v1.2.1

View File

@ -1,11 +1,10 @@
TERMUX_PKG_HOMEPAGE=https://github.com/dgoulet/torsocks
TERMUX_PKG_HOMEPAGE=https://gitlab.torproject.org/tpo/core/torsocks
TERMUX_PKG_DESCRIPTION="Wrapper to safely torify applications"
TERMUX_PKG_LICENSE="GPL-2.0"
TERMUX_PKG_MAINTAINER="@termux"
TERMUX_PKG_VERSION=2.3.0
TERMUX_PKG_REVISION=5
TERMUX_PKG_SRCURL=https://github.com/dgoulet/torsocks/archive/v$TERMUX_PKG_VERSION.tar.gz
TERMUX_PKG_SHA256=817c143e8a9d217f41a223a85139c6ca28e1b99556c547fcdb4c72dbc170b6c9
TERMUX_PKG_VERSION=2.4.0
TERMUX_PKG_SRCURL=https://gitlab.torproject.org/tpo/core/torsocks/-/archive/v${TERMUX_PKG_VERSION}/torsocks-v${TERMUX_PKG_VERSION}.tar.gz
TERMUX_PKG_SHA256=c01b471d89eda9f3c8dcb85a448e8066692d0707f9ff8b2ac7e665a602291b87
TERMUX_PKG_DEPENDS="tor"
termux_step_pre_configure() {

View File

@ -5,7 +5,7 @@
#define __NR_getpid -22
#endif
+#ifndef __NR_clone
+#define __NR_clone -19
+#define __NR_clone -23
+#endif
#define TSOCKS_NR_SOCKET __NR_socket