Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/kern fail with EINVAL if flags not are not O_CLOEXEC|O_N...



details:   https://anonhg.NetBSD.org/src/rev/6f75843bdce5
branches:  trunk
changeset: 767326:6f75843bdce5
user:      christos <christos%NetBSD.org@localhost>
date:      Fri Jul 15 14:50:19 2011 +0000

description:
fail with EINVAL if flags not are not O_CLOEXEC|O_NONBLOCK in pipe2(2) and
dup3(2)

diffstat:

 sys/kern/kern_descrip.c  |  6 ++++--
 sys/kern/sys_pipe.c      |  6 ++++--
 sys/kern/uipc_syscalls.c |  6 ++++--
 3 files changed, 12 insertions(+), 6 deletions(-)

diffs (81 lines):

diff -r 1c072ecf2959 -r 6f75843bdce5 sys/kern/kern_descrip.c
--- a/sys/kern/kern_descrip.c   Fri Jul 15 14:00:41 2011 +0000
+++ b/sys/kern/kern_descrip.c   Fri Jul 15 14:50:19 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_descrip.c,v 1.215 2011/06/26 16:42:41 christos Exp $      */
+/*     $NetBSD: kern_descrip.c,v 1.216 2011/07/15 14:50:19 christos Exp $      */
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -70,7 +70,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_descrip.c,v 1.215 2011/06/26 16:42:41 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_descrip.c,v 1.216 2011/07/15 14:50:19 christos Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -735,6 +735,8 @@
        fdfile_t *ff;
        fdtab_t *dt;
 
+       if (flags & ~(O_CLOEXEC|O_NONBLOCK))
+               return EINVAL;
        /*
         * Ensure there are enough slots in the descriptor table,
         * and allocate an fdfile_t up front in case we need it.
diff -r 1c072ecf2959 -r 6f75843bdce5 sys/kern/sys_pipe.c
--- a/sys/kern/sys_pipe.c       Fri Jul 15 14:00:41 2011 +0000
+++ b/sys/kern/sys_pipe.c       Fri Jul 15 14:50:19 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sys_pipe.c,v 1.131 2011/06/26 16:42:42 christos Exp $  */
+/*     $NetBSD: sys_pipe.c,v 1.132 2011/07/15 14:50:19 christos Exp $  */
 
 /*-
  * Copyright (c) 2003, 2007, 2008, 2009 The NetBSD Foundation, Inc.
@@ -68,7 +68,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sys_pipe.c,v 1.131 2011/06/26 16:42:42 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sys_pipe.c,v 1.132 2011/07/15 14:50:19 christos Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -251,6 +251,8 @@
        int fd, error;
        proc_t *p;
 
+       if (flags & ~(O_CLOEXEC|O_NONBLOCK))
+               return EINVAL;
        p = curproc;
        rpipe = wpipe = NULL;
        if (pipe_create(&rpipe, pipe_rd_cache) ||
diff -r 1c072ecf2959 -r 6f75843bdce5 sys/kern/uipc_syscalls.c
--- a/sys/kern/uipc_syscalls.c  Fri Jul 15 14:00:41 2011 +0000
+++ b/sys/kern/uipc_syscalls.c  Fri Jul 15 14:50:19 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uipc_syscalls.c,v 1.144 2011/06/26 16:42:42 christos Exp $     */
+/*     $NetBSD: uipc_syscalls.c,v 1.145 2011/07/15 14:50:19 christos Exp $     */
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -61,7 +61,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uipc_syscalls.c,v 1.144 2011/06/26 16:42:42 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_syscalls.c,v 1.145 2011/07/15 14:50:19 christos Exp $");
 
 #include "opt_pipe.h"
 
@@ -1021,6 +1021,8 @@
        int             fd, error;
        proc_t          *p;
 
+       if (flags & ~(O_CLOEXEC|O_NONBLOCK))
+               return EINVAL;
        p = curproc;
        if ((error = socreate(AF_LOCAL, &rso, SOCK_STREAM, 0, l, NULL)) != 0)
                return (error);



Home | Main Index | Thread Index | Old Index