Date: Fri, 20 Sep 2013 14:42:39 -0400 From: John Baldwin <jhb@freebsd.org> To: Sergey Kandaurov <pluknet@freebsd.org> Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r255731 - head/usr.bin/protect Message-ID: <201309201442.39702.jhb@freebsd.org> In-Reply-To: <CAE-mSOKsB=p3KP55JHz2YZqQfapBdBBDXDM_YZCcDT2_0eACow@mail.gmail.com> References: <201309201605.r8KG59qQ063892@svn.freebsd.org> <CAE-mSOKsB=p3KP55JHz2YZqQfapBdBBDXDM_YZCcDT2_0eACow@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Friday, September 20, 2013 1:14:45 pm Sergey Kandaurov wrote: > On 20 September 2013 20:05, John Baldwin <jhb@freebsd.org> wrote: > > Author: jhb > > Date: Fri Sep 20 16:05:09 2013 > > New Revision: 255731 > > URL: http://svnweb.freebsd.org/changeset/base/255731 > > > > Log: > > Correct stale comments. > > > > Approved by: re (joel) > > > > Modified: > > head/usr.bin/protect/protect.1 > > > > Modified: head/usr.bin/protect/protect.1 > > ============================================================================== > > --- head/usr.bin/protect/protect.1 Fri Sep 20 15:57:50 2013 (r255730) > > +++ head/usr.bin/protect/protect.1 Fri Sep 20 16:05:09 2013 (r255731) > > @@ -83,9 +83,7 @@ Remove protection from all current and f > > .Pp > > .Dl "protect -cdi -p 1" > > .Sh SEE ALSO > > -.Xr pprotect 2 > > +.Xr procctl 2 > > .Sh BUGS > > If you protect a runaway process that allocates all memory the system will > > deadlock. > > -.Pp > > -Inheritance of the protected state is not yet implemented. > > I wanted to report you about this stale sentence, but after looking > at the change once more now I think it is still relevant. > > + if (p1->p_flag2 & P2_INHERIT_PROTECTED) { > + p2->p_flag |= P_PROTECTED; > + p2->p_flag2 |= P2_INHERIT_PROTECTED; > + } > + > > The protected state is not really inherited in terms that it is rather > explicitly conditionally enabled. Consider the following process state: > > p1->p_flag != P_PROTECTED > p1->p_flag2 == P2_INHERIT_PROTECTED > > Ok, this is not an option currently because protect_setchild() resets > both flags on PPROT_CLEAR. Anyway the following looks more sane to me: > > if (p1->p_flag2 & P2_INHERIT_PROTECTED) { > p2->p_flag |= p1->p_flag & P_PROTECTED; > p2->p_flag2 |= P2_INHERIT_PROTECTED; > } By design P_PROTECTED is always set if P2_INHERIT_PROTECTED is set. It mimics the way ktrace -i works. -- John Baldwin
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201309201442.39702.jhb>