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
This commit is contained in:
Pawel Jakub Dawidek 2013-08-18 13:37:54 +00:00
parent d6f6b87647
commit 32536142f6
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=254491
2 changed files with 28 additions and 2 deletions

View File

@ -38,15 +38,28 @@ __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
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)
@ -134,6 +147,14 @@ freebsd32_cap_ioctls_get(struct thread *td,
#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)

View File

@ -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); }