diff options
author | ed <ed@FreeBSD.org> | 2015-08-01 07:51:48 +0000 |
---|---|---|
committer | ed <ed@FreeBSD.org> | 2015-08-01 07:51:48 +0000 |
commit | 34e22d4c50a1a274ec1e50b7ed40b411445df8cd (patch) | |
tree | 31b8822e2eeb93dacd36c5a2cf8810d8525d1227 /sys/compat | |
parent | 385a6dbe103dd390121f82f61ea3eea820e4efe8 (diff) | |
download | FreeBSD-src-34e22d4c50a1a274ec1e50b7ed40b411445df8cd.zip FreeBSD-src-34e22d4c50a1a274ec1e50b7ed40b411445df8cd.tar.gz |
Allow CloudABI processes to create shared memory objects.
Summary:
Use the newly created `kern_shm_open()` function to create objects with
just the rights that are actually needed.
Reviewers: jhb, kib
Subscribers: imp
Differential Revision: https://reviews.freebsd.org/D3260
Diffstat (limited to 'sys/compat')
-rw-r--r-- | sys/compat/cloudabi/cloudabi_fd.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/sys/compat/cloudabi/cloudabi_fd.c b/sys/compat/cloudabi/cloudabi_fd.c index 5a58cb3..d2004a9 100644 --- a/sys/compat/cloudabi/cloudabi_fd.c +++ b/sys/compat/cloudabi/cloudabi_fd.c @@ -30,6 +30,7 @@ __FBSDID("$FreeBSD$"); #include <sys/capsicum.h> #include <sys/filedesc.h> #include <sys/proc.h> +#include <sys/mman.h> #include <sys/socketvar.h> #include <sys/syscallsubr.h> #include <sys/sysproto.h> @@ -97,11 +98,16 @@ int cloudabi_sys_fd_create1(struct thread *td, struct cloudabi_sys_fd_create1_args *uap) { + struct filecaps fcaps = {}; struct socket_args socket_args = { .domain = AF_UNIX, }; switch (uap->type) { + case CLOUDABI_FILETYPE_SHARED_MEMORY: + cap_rights_init(&fcaps.fc_rights, CAP_FSTAT, CAP_FTRUNCATE, + CAP_MMAP_RWX); + return (kern_shm_open(td, SHM_ANON, O_RDWR, 0, &fcaps)); case CLOUDABI_FILETYPE_SOCKET_DGRAM: socket_args.type = SOCK_DGRAM; return (sys_socket(td, &socket_args)); |