mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-04 09:09:56 +00:00
Temporarily unlock vnode for new image being executed to avoid lock order
reversals that can lead to deadlocks. Normally vn_close(), namei() or vrele() should not be called while holding vnode locks.
This commit is contained in:
parent
e9b54d9c8f
commit
d302786c87
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=158324
@ -487,7 +487,9 @@ do_execve(td, args, mac_p)
|
||||
}
|
||||
|
||||
/* close files on exec */
|
||||
VOP_UNLOCK(imgp->vp, 0, td);
|
||||
fdcloseexec(td);
|
||||
vn_lock(imgp->vp, LK_EXCLUSIVE | LK_RETRY, td);
|
||||
|
||||
/* Get a reference to the vnode prior to locking the proc */
|
||||
VREF(ndp->ni_vp);
|
||||
@ -582,7 +584,9 @@ do_execve(td, args, mac_p)
|
||||
*/
|
||||
PROC_UNLOCK(p);
|
||||
setugidsafety(td);
|
||||
VOP_UNLOCK(imgp->vp, 0, td);
|
||||
error = fdcheckstd(td);
|
||||
vn_lock(imgp->vp, LK_EXCLUSIVE | LK_RETRY, td);
|
||||
if (error != 0)
|
||||
goto done1;
|
||||
PROC_LOCK(p);
|
||||
@ -714,6 +718,7 @@ do_execve(td, args, mac_p)
|
||||
crfree(oldcred);
|
||||
else
|
||||
crfree(newcred);
|
||||
VOP_UNLOCK(imgp->vp, 0, td);
|
||||
/*
|
||||
* Handle deferred decrement of ref counts.
|
||||
*/
|
||||
@ -732,6 +737,7 @@ do_execve(td, args, mac_p)
|
||||
if (tracecred != NULL)
|
||||
crfree(tracecred);
|
||||
#endif
|
||||
vn_lock(imgp->vp, LK_EXCLUSIVE | LK_RETRY, td);
|
||||
if (oldargs != NULL)
|
||||
pargs_drop(oldargs);
|
||||
if (newargs != NULL)
|
||||
|
Loading…
Reference in New Issue
Block a user