Fix from PR #2757:
execve() clears the P_SUGID process flag in execve() if the binary executed does not have suid or sgid permission bits set. This also happens when the effective uid is different from the real uid or the effective gid is different from the real gid. Under these circumstances, the process still has set id privileges and the P_SUGID flag should not be cleared. Submitted by: Tor Egge <Tor.Egge@idt.ntnu.no>
This commit is contained in:
parent
5dfbf82ffb
commit
e47bda0730
@ -285,7 +285,9 @@ execve(p, uap, retval)
|
||||
p->p_ucred->cr_groups[0] = attr.va_gid;
|
||||
p->p_flag |= P_SUGID;
|
||||
} else {
|
||||
p->p_flag &= ~P_SUGID;
|
||||
if (p->p_ucred->cr_uid == p->p_cred->p_ruid &&
|
||||
p->p_ucred->cr_gid == p->p_cred->p_rgid)
|
||||
p->p_flag &= ~P_SUGID;
|
||||
}
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user