[tor-commits] [torsocks/master] Pass through non-blacklisted syscalls

jnewsome at torproject.org jnewsome at torproject.org
Thu Feb 25 18:49:22 UTC 2021


commit b2c1132dfca74a7dc33f0f3c0617008a16421285
Author: Jim Newsome <jnewsome at torproject.org>
Date:   Fri Feb 5 13:52:35 2021 -0600

    Pass through non-blacklisted syscalls
---
 src/lib/syscall.c | 19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)

diff --git a/src/lib/syscall.c b/src/lib/syscall.c
index f793da7..c941730 100644
--- a/src/lib/syscall.c
+++ b/src/lib/syscall.c
@@ -470,6 +470,16 @@ static LIBC_SYSCALL_RET_TYPE handle_getdents64(va_list args)
 
 #endif /* __linux__ */
 
+static LIBC_SYSCALL_RET_TYPE handle_passthrough(long n, va_list args) {
+	long arg1 = va_arg(args, long);
+	long arg2 = va_arg(args, long);
+	long arg3 = va_arg(args, long);
+	long arg4 = va_arg(args, long);
+	long arg5 = va_arg(args, long);
+	long arg6 = va_arg(args, long);
+	return tsocks_libc_syscall(n, arg1, arg2, arg3, arg4, arg5, arg6);
+}
+
 /*
  * Torsocks call for syscall(2)
  */
@@ -597,14 +607,7 @@ LIBC_SYSCALL_RET_TYPE tsocks_syscall(long int number, va_list args)
 		break;
 #endif /* __linux__ */
 	default:
-		/*
-		 * Because of the design of syscall(), we can't pass a va_list to it so
-		 * we are constraint to use a whitelist scheme and denying the rest.
-		 */
-		WARN("[syscall] Unsupported syscall number %ld. Denying the call",
-				number);
-		ret = -1;
-		errno = ENOSYS;
+		ret = handle_passthrough(number, args);
 		break;
 	}
 





More information about the tor-commits mailing list