irrelevant locking

Chagin Dmitry dchagin at freebsd.org
Sat Jan 16 19:58:23 UTC 2016


hi, please, can someone explain the reason to take the process lock here:

int
sys_issetugid(register struct thread *td, struct issetugid_args *uap)
{
	struct proc *p = td->td_proc;

	/*
	 * Note: OpenBSD sets a P_SUGIDEXEC flag set at execve() time,
	 * we use P_SUGID because we consider changing the owners as
	 * "tainting" as well.
	 * This is significant for procs that start as root and "become"
	 * a user without an exec - programs cannot know *everything*
	 * that libc *might* have put in their data segment.
	 */
	PROC_LOCK(p);
	td->td_retval[0] = (p->p_flag & P_SUGID) ? 1 : 0;
	PROC_UNLOCK(p);
	return (0);
}
 


More information about the freebsd-hackers mailing list