Date: Sat, 16 Jan 2016 22:26:43 +0200 From: Konstantin Belousov <kostikbel@gmail.com> To: Chagin Dmitry <dchagin@freebsd.org> Cc: freebsd-hackers@freebsd.org Subject: Re: irrelevant locking Message-ID: <20160116202643.GL3942@kib.kiev.ua> In-Reply-To: <20160116195819.GA41610@chd.heemeyer.club> References: <20160116195819.GA41610@chd.heemeyer.club>
next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, Jan 16, 2016 at 10:58:19PM +0300, Chagin Dmitry wrote:
> hi, please, can someone explain the reason to take the process lock here:
There is no reason, I think that the PROC_LOCK() can be removed.
>
> 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);
> }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20160116202643.GL3942>
