net/torsocks: Fix unsupported syscall errors in version 2.3.0

PR:		233736
Submitted by:	Stefan Ehmann <shoesoft@gmx.net>
This commit is contained in:
Yuri Victorovich 2019-03-06 05:00:27 +00:00
parent ace87f762a
commit 3c0cf53a95
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=494775
2 changed files with 53 additions and 0 deletions

View File

@ -3,6 +3,7 @@
PORTNAME= torsocks
DISTVERSION= 2.3.0
PORTREVISION= 1
CATEGORIES= net security
MASTER_SITES= https://people.torproject.org/~dgoulet/${PORTNAME}/

View File

@ -0,0 +1,52 @@
Patch by Stefan Ehmann, see https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=233736
--- src/lib/syscall.c.orig 2018-04-20 15:41:42 UTC
+++ src/lib/syscall.c
@@ -84,7 +84,7 @@ static LIBC_ACCEPT_RET_TYPE handle_accep
return tsocks_accept(sockfd, addr, &addrlen);
}
-#if !((defined(__NetBSD__) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__)) && defined(__x86_64))
+#if defined(__FreeBSD__)
/*
* Handle mmap(2) syscall.
*/
@@ -457,7 +457,7 @@ LIBC_SYSCALL_RET_TYPE tsocks_syscall(lon
ret = handle_close(args);
break;
case TSOCKS_NR_MMAP:
-#if (defined(__NetBSD__) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__)) && defined(__x86_64)
+#if defined(badbadbad)
/*
* On an 64 bit *BSD system, __syscall(2) should be used for mmap().
* This is NOT suppose to happen but for protection we deny that call.
@@ -559,6 +559,14 @@ LIBC_SYSCALL_RET_TYPE tsocks_syscall(lon
ret = handle_memfd_create(args);
break;
#endif /* __linux__ */
+#if defined(__FreeBSD__)
+ case TSOCKS_NR_FORK:
+ ret = tsocks_libc_syscall(TSOCKS_NR_FORK);
+ break;
+ case TSOCKS_NR_GETPID:
+ ret = tsocks_libc_syscall(TSOCKS_NR_GETPID);
+ break;
+#endif
default:
/*
* Because of the design of syscall(), we can't pass a va_list to it so
@@ -633,6 +641,14 @@ LIBC___SYSCALL_RET_TYPE tsocks___syscall
*/
ret = handle_bsd_mmap(args);
break;
+#if defined(__FreeBSD__)
+ case TSOCKS_NR_FORK:
+ ret = tsocks_libc_syscall(TSOCKS_NR_FORK);
+ break;
+ case TSOCKS_NR_GETPID:
+ ret = tsocks_libc_syscall(TSOCKS_NR_GETPID);
+ break;
+#endif
default:
/*
* Because of the design of syscall(), we can't pass a va_list to it so