diff options
author | Philip Guenthe <guenther@cvs.openbsd.org> | 2012-02-15 04:26:28 +0000 |
---|---|---|
committer | Philip Guenthe <guenther@cvs.openbsd.org> | 2012-02-15 04:26:28 +0000 |
commit | b861cd7b54c3de28426491f9752a022262f3dc88 (patch) | |
tree | 1d33033d095b99ded617a883d8dd5c8770958218 /sys/dev/systrace.c | |
parent | 9db6da3ecdf09727884dc8eb4e22146c7707b98b (diff) |
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.c | 4 |
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); |