summaryrefslogtreecommitdiffstats
path: root/sys/dev/systrace.c
diff options
context:
space:
mode:
authorguenther <guenther@openbsd.org>2012-02-15 04:26:27 +0000
committerguenther <guenther@openbsd.org>2012-02-15 04:26:27 +0000
commit638f0017823ed0e106d01f08deef215e05f1e560 (patch)
treecba8201347fdd0e19f16ceee4f173da6d23b9754 /sys/dev/systrace.c
parent82571/82572 do not properly set byte enables 2 and 3 on MSI (diff)
downloadwireguard-openbsd-638f0017823ed0e106d01f08deef215e05f1e560.tar.xz
wireguard-openbsd-638f0017823ed0e106d01f08deef215e05f1e560.zip
Hold struct filedesc's fd_lock when writing to the fd_ofiles, fd_ofileflags,
or fd_{lo,hi}maps members, or when doing a read for a write. Fixes hangs when an rthreaded processes sleeps while copying the fd table for fork() and catches another thread with the lock. ok jsing@ tedu@
Diffstat (limited to 'sys/dev/systrace.c')
-rw-r--r--sys/dev/systrace.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/sys/dev/systrace.c b/sys/dev/systrace.c
index 09147c791a8..f48ffdec652 100644
--- a/sys/dev/systrace.c
+++ b/sys/dev/systrace.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: systrace.c,v 1.60 2011/09/18 23:24:14 matthew Exp $ */
+/* $OpenBSD: systrace.c,v 1.61 2012/02/15 04:26:27 guenther Exp $ */
/*
* Copyright 2002 Niels Provos <provos@citi.umich.edu>
* All rights reserved.
@@ -527,7 +527,9 @@ systraceioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p)
fst->p_ruid = p->p_cred->p_ruid;
fst->p_rgid = p->p_cred->p_rgid;
+ fdplock(p->p_fd);
error = falloc(p, &f, &fd);
+ fdpunlock(p->p_fd);
if (error) {
free(fst, M_XDATA);
return (error);