diff options
Diffstat (limited to 'sys/kern')
-rw-r--r-- | sys/kern/vfs_syscalls.c | 14 | ||||
-rw-r--r-- | sys/kern/vfs_vnops.c | 2 |
2 files changed, 14 insertions, 2 deletions
diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c index 8829a9c..c20b6e6 100644 --- a/sys/kern/vfs_syscalls.c +++ b/sys/kern/vfs_syscalls.c @@ -1018,9 +1018,19 @@ kern_open(struct thread *td, char *path, enum uio_seg pathseg, int flags, AUDIT_ARG(fflags, flags); AUDIT_ARG(mode, mode); - if ((flags & O_ACCMODE) == O_ACCMODE) + /* XXX: audit dirfd */ + /* + * Only one of the O_EXEC, O_RDONLY, O_WRONLY and O_RDWR may + * be specified. + */ + if (flags & O_EXEC) { + if (flags & O_ACCMODE) + return (EINVAL); + } else if ((flags & O_ACCMODE) == O_ACCMODE) return (EINVAL); - flags = FFLAGS(flags); + else + flags = FFLAGS(flags); + error = falloc(td, &nfp, &indx); if (error) return (error); diff --git a/sys/kern/vfs_vnops.c b/sys/kern/vfs_vnops.c index 1b08156..c00d66a 100644 --- a/sys/kern/vfs_vnops.c +++ b/sys/kern/vfs_vnops.c @@ -212,6 +212,8 @@ restart: } if (fmode & FREAD) mode |= VREAD; + if (fmode & FEXEC) + mode |= VEXEC; if (fmode & O_APPEND) mode |= VAPPEND; #ifdef MAC |