svn commit: r286309 - in head/sys: compat/linux kern sys
Ed Schouten
ed at FreeBSD.org
Wed Aug 5 07:36:52 UTC 2015
Author: ed
Date: Wed Aug 5 07:36:50 2015
New Revision: 286309
URL: https://svnweb.freebsd.org/changeset/base/286309
Log:
Allow the creation of kqueues with a restricted set of Capsicum rights.
On CloudABI we want to create file descriptors with just the minimal set
of Capsicum rights in place. The reason for this is that it makes it
easier to obtain uniform behaviour across different operating systems.
By explicitly whitelisting the operations, we can return consistent
error codes, but also prevent applications from depending OS-specific
behaviour.
Extend kern_kqueue() to take an additional struct filecaps that is
passed on to falloc_caps(). Update the existing consumers to pass in
NULL.
Differential Revision: https://reviews.freebsd.org/D3259
Modified:
head/sys/compat/linux/linux_event.c
head/sys/kern/kern_event.c
head/sys/sys/syscallsubr.h
Modified: head/sys/compat/linux/linux_event.c
==============================================================================
--- head/sys/compat/linux/linux_event.c Wed Aug 5 07:35:34 2015 (r286308)
+++ head/sys/compat/linux/linux_event.c Wed Aug 5 07:36:50 2015 (r286309)
@@ -205,7 +205,7 @@ epoll_create_common(struct thread *td, i
{
int error;
- error = kern_kqueue(td, flags);
+ error = kern_kqueue(td, flags, NULL);
if (error)
return (error);
Modified: head/sys/kern/kern_event.c
==============================================================================
--- head/sys/kern/kern_event.c Wed Aug 5 07:35:34 2015 (r286308)
+++ head/sys/kern/kern_event.c Wed Aug 5 07:36:50 2015 (r286309)
@@ -738,11 +738,11 @@ int
sys_kqueue(struct thread *td, struct kqueue_args *uap)
{
- return (kern_kqueue(td, 0));
+ return (kern_kqueue(td, 0, NULL));
}
int
-kern_kqueue(struct thread *td, int flags)
+kern_kqueue(struct thread *td, int flags, struct filecaps *fcaps)
{
struct filedesc *fdp;
struct kqueue *kq;
@@ -760,7 +760,7 @@ kern_kqueue(struct thread *td, int flags
}
fdp = p->p_fd;
- error = falloc(td, &fp, &fd, flags);
+ error = falloc_caps(td, &fp, &fd, flags, fcaps);
if (error)
goto done2;
Modified: head/sys/sys/syscallsubr.h
==============================================================================
--- head/sys/sys/syscallsubr.h Wed Aug 5 07:35:34 2015 (r286308)
+++ head/sys/sys/syscallsubr.h Wed Aug 5 07:36:50 2015 (r286309)
@@ -126,7 +126,7 @@ int kern_kevent(struct thread *td, int f
int kern_kevent_fp(struct thread *td, struct file *fp, int nchanges,
int nevents, struct kevent_copyops *k_ops,
const struct timespec *timeout);
-int kern_kqueue(struct thread *td, int flags);
+int kern_kqueue(struct thread *td, int flags, struct filecaps *fcaps);
int kern_kldload(struct thread *td, const char *file, int *fileid);
int kern_kldstat(struct thread *td, int fileid, struct kld_file_stat *stat);
int kern_kldunload(struct thread *td, int fileid, int flags);
More information about the svn-src-all
mailing list