summaryrefslogtreecommitdiffstats
path: root/sys/compat
diff options
context:
space:
mode:
authorpjd <pjd@FreeBSD.org>2013-08-18 13:37:54 +0000
committerpjd <pjd@FreeBSD.org>2013-08-18 13:37:54 +0000
commita1397643f3f883bb473e149598d74e14070f2c5c (patch)
tree6b9ad5dcff5858311f66e4271f9bbe1c9c4f0981 /sys/compat
parent999f81be5b44b280d1139e3f2099bc28f7d5675d (diff)
downloadFreeBSD-src-a1397643f3f883bb473e149598d74e14070f2c5c.zip
FreeBSD-src-a1397643f3f883bb473e149598d74e14070f2c5c.tar.gz
The cap_rights_limit(2) system calls needs a wrapper for 32bit binaries
running under 64bit kernels as the 'rights' argument has to be split into two registers or the half of the rights will disappear. Reported by: jilles Sponsored by: The FreeBSD Foundation
Diffstat (limited to 'sys/compat')
-rw-r--r--sys/compat/freebsd32/freebsd32_capability.c21
-rw-r--r--sys/compat/freebsd32/syscalls.master9
2 files changed, 28 insertions, 2 deletions
diff --git a/sys/compat/freebsd32/freebsd32_capability.c b/sys/compat/freebsd32/freebsd32_capability.c
index 078d949..e17c394 100644
--- a/sys/compat/freebsd32/freebsd32_capability.c
+++ b/sys/compat/freebsd32/freebsd32_capability.c
@@ -38,9 +38,11 @@ __FBSDID("$FreeBSD$");
#include <sys/malloc.h>
#include <sys/proc.h>
#include <sys/syscallsubr.h>
+#include <sys/sysproto.h>
#include <security/audit/audit.h>
+#include <compat/freebsd32/freebsd32_misc.h>
#include <compat/freebsd32/freebsd32_proto.h>
#ifdef CAPABILITIES
@@ -48,6 +50,17 @@ __FBSDID("$FreeBSD$");
MALLOC_DECLARE(M_FILECAPS);
int
+freebsd32_cap_rights_limit(struct thread *td,
+ struct freebsd32_cap_rights_limit_args *uap)
+{
+ struct cap_rights_limit_args ap;
+
+ ap.fd = uap->fd;
+ ap.rights = PAIR32TO64(uint64_t, uap->rights);
+ return (sys_cap_rights_limit(td, &ap));
+}
+
+int
freebsd32_cap_ioctls_limit(struct thread *td,
struct freebsd32_cap_ioctls_limit_args *uap)
{
@@ -135,6 +148,14 @@ out:
#else /* !CAPABILITIES */
int
+freebsd32_cap_rights_limit(struct thread *td,
+ struct freebsd32_cap_rights_limit_args *uap)
+{
+
+ return (ENOSYS);
+}
+
+int
freebsd32_cap_ioctls_limit(struct thread *td,
struct freebsd32_cap_ioctls_limit_args *uap)
{
diff --git a/sys/compat/freebsd32/syscalls.master b/sys/compat/freebsd32/syscalls.master
index 1a0828a..a2e3e78 100644
--- a/sys/compat/freebsd32/syscalls.master
+++ b/sys/compat/freebsd32/syscalls.master
@@ -1016,6 +1016,10 @@
int *status, int options, \
struct wrusage32 *wrusage, \
siginfo_t *info); }
+533 AUE_CAP_RIGHTS_LIMIT STD { \
+ int freebsd32_cap_rights_limit(int fd, \
+ int pad, \
+ uint32_t rights1, uint32_t rights2); }
#else
530 AUE_NULL STD { int freebsd32_posix_fallocate(int fd,\
uint32_t offset1, uint32_t offset2,\
@@ -1029,9 +1033,10 @@
int *status, int options, \
struct wrusage32 *wrusage, \
siginfo_t *info); }
+533 AUE_CAP_RIGHTS_LIMIT STD { \
+ int freebsd32_cap_rights_limit(int fd, \
+ uint32_t rights1, uint32_t rights2); }
#endif
-533 AUE_CAP_RIGHTS_LIMIT NOPROTO { int cap_rights_limit(int fd, \
- uint64_t rights); }
534 AUE_CAP_IOCTLS_LIMIT STD { \
int freebsd32_cap_ioctls_limit(int fd, \
const uint32_t *cmds, size_t ncmds); }
OpenPOWER on IntegriCloud