summaryrefslogtreecommitdiffstats
path: root/lib/libc
diff options
context:
space:
mode:
authorvisa <visa@openbsd.org>2018-06-25 16:06:27 +0000
committervisa <visa@openbsd.org>2018-06-25 16:06:27 +0000
commit66ffb022a139ec2d1d12367235554aba25c7382c (patch)
tree8a5f8b228a2222d5e0342b8f9c44777bff9d200e /lib/libc
parentCount $MAILCHECK with the monotonic clock. (diff)
downloadwireguard-openbsd-66ffb022a139ec2d1d12367235554aba25c7382c.tar.xz
wireguard-openbsd-66ffb022a139ec2d1d12367235554aba25c7382c.zip
During open(2), release the fdp lock before calling vn_open(9).
This lets other threads of the process modify the file descriptor table even if the vn_open(9) call blocks. The change has an effect on dup2(2) and dup3(2). If the new descriptor is the same as the one reserved by an unfinished open(2), the system call will fail with error EBUSY. The accept(2) system call already behaves like this. Issue pointed out by art@ via mpi@ Tested in a bulk build by ajacoutot@ OK mpi@
Diffstat (limited to 'lib/libc')
-rw-r--r--lib/libc/sys/dup.26
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/libc/sys/dup.2 b/lib/libc/sys/dup.2
index 2928890bb3a..948f1082a80 100644
--- a/lib/libc/sys/dup.2
+++ b/lib/libc/sys/dup.2
@@ -1,4 +1,4 @@
-.\" $OpenBSD: dup.2,v 1.19 2018/05/28 08:55:11 mpi Exp $
+.\" $OpenBSD: dup.2,v 1.20 2018/06/25 16:06:27 visa Exp $
.\" $NetBSD: dup.2,v 1.4 1995/02/27 12:32:21 cgd Exp $
.\"
.\" Copyright (c) 1980, 1991, 1993
@@ -30,7 +30,7 @@
.\"
.\" @(#)dup.2 8.1 (Berkeley) 6/4/93
.\"
-.Dd $Mdocdate: May 28 2018 $
+.Dd $Mdocdate: June 25 2018 $
.Dt DUP 2
.Os
.Sh NAME
@@ -160,6 +160,8 @@ limit.
.It Bq Er EBUSY
A race condition with
.Xr accept 2
+or
+.Xr open 2
has been detected.
.It Bq Er EINTR
An interrupt was received.