mirror of
https://git.FreeBSD.org/src.git
synced 2025-01-28 16:43:09 +00:00
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
This commit is contained in:
parent
e47c217844
commit
c1e2d3866f
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=103326
@ -435,15 +435,17 @@ execve(td, uap)
|
||||
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)
|
||||
|
Loading…
Reference in New Issue
Block a user