torsocks: enable again for aarch64
A couple of patches from master branch seem to fix syscall issues, investigated by @ladar.
This commit is contained in:
parent
94200bfbda
commit
c141dce4bc
94
packages/torsocks/01_getdents.patch
Normal file
94
packages/torsocks/01_getdents.patch
Normal file
@ -0,0 +1,94 @@
|
||||
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
|
||||
|
63
packages/torsocks/02_getpid.patch
Normal file
63
packages/torsocks/02_getpid.patch
Normal file
@ -0,0 +1,63 @@
|
||||
From 54db444d70b3307546e87c32658c58953a2b11b3 Mon Sep 17 00:00:00 2001
|
||||
From: Alejandro Alvarado <onirony@disroot.org>
|
||||
Date: Sat, 9 Mar 2019 01:51:33 -0600
|
||||
Subject: [PATCH] Add getpid support re ticket 29659
|
||||
|
||||
---
|
||||
src/common/compat.h | 4 ++++
|
||||
src/lib/syscall.c | 10 ++++++++++
|
||||
2 files changed, 14 insertions(+)
|
||||
|
||||
diff --git a/src/common/compat.h b/src/common/compat.h
|
||||
index d79301f..a92c651 100644
|
||||
--- a/src/common/compat.h
|
||||
+++ b/src/common/compat.h
|
||||
@@ -135,6 +135,9 @@ void tsocks_once(tsocks_once_t *o, void (*init_routine)(void));
|
||||
#ifndef __NR_getdents64
|
||||
#define __NR_getdents64 -21
|
||||
#endif
|
||||
+#ifndef __NR_getpid
|
||||
+#define __NR_getpid -22
|
||||
+#endif
|
||||
|
||||
#define TSOCKS_NR_SOCKET __NR_socket
|
||||
#define TSOCKS_NR_CONNECT __NR_connect
|
||||
@@ -157,6 +160,7 @@ void tsocks_once(tsocks_once_t *o, void (*init_routine)(void));
|
||||
#define TSOCKS_NR_MEMFD_CREATE __NR_memfd_create
|
||||
#define TSOCKS_NR_GETDENTS __NR_getdents
|
||||
#define TSOCKS_NR_GETDENTS64 __NR_getdents64
|
||||
+#define TSOCKS_NR_GETPID __NR_getpid
|
||||
|
||||
/*
|
||||
* Despite glibc providing wrappers for these calls for a long time
|
||||
diff --git a/src/lib/syscall.c b/src/lib/syscall.c
|
||||
index f793da7..38406da 100644
|
||||
--- a/src/lib/syscall.c
|
||||
+++ b/src/lib/syscall.c
|
||||
@@ -467,6 +467,13 @@ static LIBC_SYSCALL_RET_TYPE handle_getdents64(va_list args)
|
||||
|
||||
return tsocks_libc_syscall(TSOCKS_NR_GETDENTS64, fd, dirp, count);
|
||||
}
|
||||
+/*
|
||||
+ * Handle getpid(2) syscall.
|
||||
+ */
|
||||
+static LIBC_SYSCALL_RET_TYPE handle_getpid(void)
|
||||
+{
|
||||
+ return tsocks_libc_syscall(TSOCKS_NR_GETPID);
|
||||
+}
|
||||
|
||||
#endif /* __linux__ */
|
||||
|
||||
@@ -595,6 +602,9 @@ LIBC_SYSCALL_RET_TYPE tsocks_syscall(long int number, va_list args)
|
||||
case TSOCKS_NR_GETDENTS64:
|
||||
ret = handle_getdents64(args);
|
||||
break;
|
||||
+ case TSOCKS_NR_GETPID:
|
||||
+ ret = handle_getpid();
|
||||
+ break;
|
||||
#endif /* __linux__ */
|
||||
default:
|
||||
/*
|
||||
--
|
||||
GitLab
|
||||
|
32
packages/torsocks/03_passthrough_syscalls.patch
Normal file
32
packages/torsocks/03_passthrough_syscalls.patch
Normal file
@ -0,0 +1,32 @@
|
||||
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
|
||||
|
@ -3,11 +3,10 @@ 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=1
|
||||
TERMUX_PKG_REVISION=2
|
||||
TERMUX_PKG_SRCURL=https://github.com/dgoulet/torsocks/archive/v$TERMUX_PKG_VERSION.tar.gz
|
||||
TERMUX_PKG_SHA256=817c143e8a9d217f41a223a85139c6ca28e1b99556c547fcdb4c72dbc170b6c9
|
||||
TERMUX_PKG_DEPENDS="tor"
|
||||
TERMUX_PKG_BLACKLISTED_ARCHES="aarch64"
|
||||
|
||||
termux_step_pre_configure() {
|
||||
./autogen.sh
|
||||
|
@ -1,9 +1,8 @@
|
||||
diff -u -r ../torsocks-2.3.0/src/common/compat.h ./src/common/compat.h
|
||||
--- ../torsocks-2.3.0/src/common/compat.h 2018-11-19 15:42:40.000000000 +0000
|
||||
+++ ./src/common/compat.h 2018-11-21 22:39:33.390432043 +0000
|
||||
@@ -129,6 +129,9 @@
|
||||
#ifndef __NR_memfd_create
|
||||
#define __NR_memfd_create -19
|
||||
--- ./src/common/compat.h.orig 2021-12-03 17:39:26.195617589 +0100
|
||||
+++ ./src/common/compat.h 2021-12-03 17:40:03.868920411 +0100
|
||||
@@ -138,6 +138,9 @@
|
||||
#ifndef __NR_getpid
|
||||
#define __NR_getpid -22
|
||||
#endif
|
||||
+#ifndef __NR_clone
|
||||
+#define __NR_clone -19
|
||||
@ -11,10 +10,10 @@ diff -u -r ../torsocks-2.3.0/src/common/compat.h ./src/common/compat.h
|
||||
|
||||
#define TSOCKS_NR_SOCKET __NR_socket
|
||||
#define TSOCKS_NR_CONNECT __NR_connect
|
||||
@@ -149,6 +152,7 @@
|
||||
#define TSOCKS_NR_CLOCK_GETTIME __NR_clock_gettime
|
||||
#define TSOCKS_NR_FORK __NR_fork
|
||||
#define TSOCKS_NR_MEMFD_CREATE __NR_memfd_create
|
||||
@@ -161,6 +164,7 @@
|
||||
#define TSOCKS_NR_GETDENTS __NR_getdents
|
||||
#define TSOCKS_NR_GETDENTS64 __NR_getdents64
|
||||
#define TSOCKS_NR_GETPID __NR_getpid
|
||||
+#define TSOCKS_NR_CLONE __NR_clone
|
||||
|
||||
/*
|
||||
|
@ -1,11 +1,11 @@
|
||||
diff -u -r ../torsocks-2.3.0/src/lib/syscall.c ./src/lib/syscall.c
|
||||
--- ../torsocks-2.3.0/src/lib/syscall.c 2018-11-19 15:42:40.000000000 +0000
|
||||
+++ ./src/lib/syscall.c 2018-11-21 22:37:53.867404833 +0000
|
||||
@@ -437,6 +437,24 @@
|
||||
--- ./src/lib/syscall.c.orig 2021-12-03 18:08:08.498816181 +0100
|
||||
+++ ./src/lib/syscall.c 2021-12-03 18:34:27.357373075 +0100
|
||||
@@ -437,6 +437,26 @@
|
||||
|
||||
return tsocks_libc_syscall(TSOCKS_NR_MEMFD_CREATE, name, flags);
|
||||
}
|
||||
+
|
||||
+
|
||||
+/*
|
||||
+ * * Handle clone(2) syscall.
|
||||
+ * */
|
||||
@ -23,16 +23,7 @@ diff -u -r ../torsocks-2.3.0/src/lib/syscall.c ./src/lib/syscall.c
|
||||
+
|
||||
+ return tsocks_libc_syscall(TSOCKS_NR_CLONE, fn, child_stack, flags, arg);
|
||||
+}
|
||||
#endif /* __linux__ */
|
||||
|
||||
+
|
||||
/*
|
||||
@@ -558,6 +576,9 @@
|
||||
case TSOCKS_NR_MEMFD_CREATE:
|
||||
ret = handle_memfd_create(args);
|
||||
break;
|
||||
+ case TSOCKS_NR_CLONE:
|
||||
+ ret = handle_clone(args);
|
||||
+ break;
|
||||
#endif /* __linux__ */
|
||||
default:
|
||||
/*
|
||||
* Handle getdents(2) syscall.
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user