diff options
author | njl <njl@FreeBSD.org> | 2002-09-14 18:55:11 +0000 |
---|---|---|
committer | njl <njl@FreeBSD.org> | 2002-09-14 18:55:11 +0000 |
commit | 8b6282f88a8d75c4f7b8a8528b3ef7e2b44e9a1c (patch) | |
tree | 63835f60c2220969817dd8399ae04ca1765913c1 /sys/kern/kern_exec.c | |
parent | 72ca599da8f5817cafe0a099badc41c9ee3dd5d4 (diff) | |
download | FreeBSD-src-8b6282f88a8d75c4f7b8a8528b3ef7e2b44e9a1c.zip FreeBSD-src-8b6282f88a8d75c4f7b8a8528b3ef7e2b44e9a1c.tar.gz |
Move setugidsafety() call outside of process lock. This prevents a lock
recursion when closef() calls pfind() which also wants the proc lock.
This case only occurred when setugidsafety() needed to close unsafe files.
Reviewed by: truckman
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) |