1
0
mirror of https://git.FreeBSD.org/src.git synced 2025-01-02 12:20:51 +00:00

Conditionally acquire Giant when dropping a reference on the ktrace vnode

during execve() when turning off tracing due to executing a setuid binary
as non-root.  Previously this could fail to acquire Giant and fail an
assertion if the ktrace file was on a non-MPSAFE filesystem and the
executable was on an MPSAFE filesystem.

MFC after:	3 days
Reported by:	kris
This commit is contained in:
John Baldwin 2007-06-13 19:41:47 +00:00
parent d143a3d971
commit ce0be64687
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=170684

View File

@ -736,8 +736,13 @@ do_execve(td, args, mac_p)
if (ndp->ni_vp && error != 0)
vrele(ndp->ni_vp);
#ifdef KTRACE
if (tracevp != NULL)
if (tracevp != NULL) {
int tvfslocked;
tvfslocked = VFS_LOCK_GIANT(tracevp->v_mount);
vrele(tracevp);
VFS_UNLOCK_GIANT(tvfslocked);
}
if (tracecred != NULL)
crfree(tracecred);
#endif