Author: pjd
Date: Sun Aug 18 13:37:54 2013
New Revision: 254491
URL: http://svnweb.freebsd.org/changeset/base/254491

Log:
  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

Modified:
  head/sys/compat/freebsd32/freebsd32_capability.c
  head/sys/compat/freebsd32/syscalls.master

Modified: head/sys/compat/freebsd32/freebsd32_capability.c
==============================================================================
--- head/sys/compat/freebsd32/freebsd32_capability.c    Sun Aug 18 13:34:11 
2013        (r254490)
+++ head/sys/compat/freebsd32/freebsd32_capability.c    Sun Aug 18 13:37:54 
2013        (r254491)
@@ -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)
 {

Modified: head/sys/compat/freebsd32/syscalls.master
==============================================================================
--- head/sys/compat/freebsd32/syscalls.master   Sun Aug 18 13:34:11 2013        
(r254490)
+++ head/sys/compat/freebsd32/syscalls.master   Sun Aug 18 13:37:54 2013        
(r254491)
@@ -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); }
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "[email protected]"

Reply via email to