Move setugid() a little sooner to before we release tracing in case
crdup() or change_e*id() block on malloc() or mutex.
This commit is contained in:
parent
8d3428c0b4
commit
b85db19691
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=78371
@ -298,8 +298,10 @@ execve(p, uap)
|
||||
PROC_UNLOCK(p);
|
||||
/*
|
||||
* Turn off syscall tracing for set-id programs, except for
|
||||
* root.
|
||||
* root. Record any set-id flags first to make sure that
|
||||
* we do not regain any tracing during a possible block.
|
||||
*/
|
||||
setsugid(p);
|
||||
if (p->p_tracep && suser_xxx(oldcred, NULL, PRISON_ROOT)) {
|
||||
p->p_traceflag = 0;
|
||||
vrele(p->p_tracep);
|
||||
@ -313,7 +315,6 @@ execve(p, uap)
|
||||
change_euid(newcred, attr.va_uid);
|
||||
if (attr.va_mode & VSGID)
|
||||
change_egid(newcred, attr.va_gid);
|
||||
setsugid(p);
|
||||
setugidsafety(p);
|
||||
} else {
|
||||
if (oldcred->cr_uid == oldcred->cr_ruid &&
|
||||
|
Loading…
Reference in New Issue
Block a user