1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-24 11:29:10 +00:00

In do_execve(), use shared text vnode lock consistently.

Reviewed by:	markj
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D21560
This commit is contained in:
Konstantin Belousov 2019-09-07 16:10:57 +00:00
parent 1c36b72874
commit 1040254b75
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=352017

View File

@ -526,7 +526,7 @@ do_execve(struct thread *td, struct image_args *args, struct mac *mac_p)
euip = uifind(attr.va_uid); euip = uifind(attr.va_uid);
change_euid(imgp->newcred, euip); change_euid(imgp->newcred, euip);
} }
vn_lock(imgp->vp, LK_EXCLUSIVE | LK_RETRY); vn_lock(imgp->vp, LK_SHARED | LK_RETRY);
if (attr.va_mode & S_ISGID) if (attr.va_mode & S_ISGID)
change_egid(imgp->newcred, attr.va_gid); change_egid(imgp->newcred, attr.va_gid);
/* /*
@ -555,7 +555,7 @@ do_execve(struct thread *td, struct image_args *args, struct mac *mac_p)
oldcred->cr_svgid != oldcred->cr_gid) { oldcred->cr_svgid != oldcred->cr_gid) {
VOP_UNLOCK(imgp->vp, 0); VOP_UNLOCK(imgp->vp, 0);
imgp->newcred = crdup(oldcred); imgp->newcred = crdup(oldcred);
vn_lock(imgp->vp, LK_EXCLUSIVE | LK_RETRY); vn_lock(imgp->vp, LK_SHARED | LK_RETRY);
change_svuid(imgp->newcred, imgp->newcred->cr_uid); change_svuid(imgp->newcred, imgp->newcred->cr_uid);
change_svgid(imgp->newcred, imgp->newcred->cr_gid); change_svgid(imgp->newcred, imgp->newcred->cr_gid);
} }
@ -572,7 +572,7 @@ do_execve(struct thread *td, struct image_args *args, struct mac *mac_p)
if (vn_fullpath(td, imgp->vp, &imgp->execpath, if (vn_fullpath(td, imgp->vp, &imgp->execpath,
&imgp->freepath) != 0) &imgp->freepath) != 0)
imgp->execpath = args->fname; imgp->execpath = args->fname;
vn_lock(imgp->vp, LK_EXCLUSIVE | LK_RETRY); vn_lock(imgp->vp, LK_SHARED | LK_RETRY);
} }
/* /*