diff options
Diffstat (limited to 'sys/kern/kern_exec.c')
-rw-r--r-- | sys/kern/kern_exec.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c index 2ac4486..3bad18a 100644 --- a/sys/kern/kern_exec.c +++ b/sys/kern/kern_exec.c @@ -435,15 +435,17 @@ interpret: mtx_unlock(&ktrace_mtx); } #endif - /* Close any file descriptors 0..2 that reference procfs */ - setugidsafety(td); /* - * Make sure file descriptors 0..2 are in use. + * Close any file descriptors 0..2 that reference procfs, + * then make sure file descriptors 0..2 are in use. * + * setugidsafety() may call closef() and then pfind() + * which may grab the process lock. * fdcheckstd() may call falloc() which may block to * allocate memory, so temporarily drop the process lock. */ PROC_UNLOCK(p); + setugidsafety(td); error = fdcheckstd(td); PROC_LOCK(p); if (error != 0) |