Skip to content

Commit

Permalink
In do_execve(), use shared text vnode lock consistently.
Browse files Browse the repository at this point in the history
Reviewed by:	markj
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D21560
  • Loading branch information
kostikbel committed Sep 7, 2019
1 parent 6e4e344 commit df3d8d3
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions sys/kern/kern_exec.c
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,7 @@ do_execve(struct thread *td, struct image_args *args, struct mac *mac_p)
euip = uifind(attr.va_uid);
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)
change_egid(imgp->newcred, attr.va_gid);
/*
Expand Down Expand Up @@ -555,7 +555,7 @@ do_execve(struct thread *td, struct image_args *args, struct mac *mac_p)
oldcred->cr_svgid != oldcred->cr_gid) {
VOP_UNLOCK(imgp->vp, 0);
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_svgid(imgp->newcred, imgp->newcred->cr_gid);
}
Expand All @@ -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,
&imgp->freepath) != 0)
imgp->execpath = args->fname;
vn_lock(imgp->vp, LK_EXCLUSIVE | LK_RETRY);
vn_lock(imgp->vp, LK_SHARED | LK_RETRY);
}

/*
Expand Down

0 comments on commit df3d8d3

Please sign in to comment.