summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--regress/sys/kern/pledge/filedescriptor/Makefile8
-rw-r--r--sys/kern/kern_descrip.c4
2 files changed, 7 insertions, 5 deletions
diff --git a/regress/sys/kern/pledge/filedescriptor/Makefile b/regress/sys/kern/pledge/filedescriptor/Makefile
index 638b96e8be0..2baf7a795ef 100644
--- a/regress/sys/kern/pledge/filedescriptor/Makefile
+++ b/regress/sys/kern/pledge/filedescriptor/Makefile
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile,v 1.1 2018/04/10 23:00:53 bluhm Exp $
+# $OpenBSD: Makefile,v 1.2 2018/04/11 16:47:17 bluhm Exp $
# Copyright (c) 2018 Alexander Bluhm <bluhm@openbsd.org>
#
@@ -14,6 +14,10 @@
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+# Check that a file descriptor's plegde flag is correctly propagated.
+# The test covers the system calls dup, dup2, dup3, open /dev/fd, and
+# file descriptor passing. The fstat(1) output is analysed.
+
PROGS = dup dup2 dup3 dev pass
WARNINGS = yes
CLEANFILES = *.fstat
@@ -74,7 +78,7 @@ run-regress-dup3: dup3.fstat
run-regress-dev: dev.fstat
# file descriptor 5 has been open(2)ed from pre-pledge /dev/fd/3
- grep ' 5 /.* rp ' dev.fstat
+ grep ' 5 /.* r ' dev.fstat
# file descriptor 6 has been open(2)ed from post-pledge /dev/fd/4
grep ' 6 /.* rp ' dev.fstat
diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c
index 5c80fc47d4b..64222af3df1 100644
--- a/sys/kern/kern_descrip.c
+++ b/sys/kern/kern_descrip.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_descrip.c,v 1.147 2018/04/09 13:59:03 mpi Exp $ */
+/* $OpenBSD: kern_descrip.c,v 1.148 2018/04/11 16:47:17 bluhm Exp $ */
/* $NetBSD: kern_descrip.c,v 1.42 1996/03/30 22:24:38 christos Exp $ */
/*
@@ -1310,8 +1310,6 @@ dupfdopen(struct proc *p, int indx, int mode)
fdp->fd_ofiles[indx] = wfp;
fdp->fd_ofileflags[indx] = (fdp->fd_ofileflags[indx] & UF_EXCLOSE) |
(fdp->fd_ofileflags[dupfd] & ~UF_EXCLOSE);
- if (ISSET(p->p_p->ps_flags, PS_PLEDGE))
- fdp->fd_ofileflags[indx] |= UF_PLEDGED;
wfp->f_count++;
fd_used(fdp, indx);
return (0);