Disallow opening a POSIX message queue for execute.

O_EXEC was formerly ignored, so equivalent to O_RDONLY.

Reject O_EXEC with [EINVAL] like the invalid mode 3.
This commit is contained in:
Jilles Tjoelker
2013-08-18 13:27:04 +00:00
parent 7b22b8da2f
commit 6fbdb9f4f1
+2 -2
View File
@@ -2046,7 +2046,7 @@ sys_kmq_open(struct thread *td, struct kmq_open_args *uap)
struct mq_attr attr;
int flags, error;
if ((uap->flags & O_ACCMODE) == O_ACCMODE)
if ((uap->flags & O_ACCMODE) == O_ACCMODE || uap->flags & O_EXEC)
return (EINVAL);
flags = FFLAGS(uap->flags);
if ((flags & O_CREAT) != 0 && uap->attr != NULL) {
@@ -2682,7 +2682,7 @@ freebsd32_kmq_open(struct thread *td, struct freebsd32_kmq_open_args *uap)
struct mq_attr32 attr32;
int flags, error;
if ((uap->flags & O_ACCMODE) == O_ACCMODE)
if ((uap->flags & O_ACCMODE) == O_ACCMODE || uap->flags & O_EXEC)
return (EINVAL);
flags = FFLAGS(uap->flags);
if ((flags & O_CREAT) != 0 && uap->attr != NULL) {