From owner-svn-src-head@FreeBSD.ORG Fri Sep 20 21:30:10 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id CEBDDEB5; Fri, 20 Sep 2013 21:30:10 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id A59BF231A; Fri, 20 Sep 2013 21:30:10 +0000 (UTC) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id B317CB943; Fri, 20 Sep 2013 17:30:08 -0400 (EDT) From: John Baldwin To: Sergey Kandaurov Subject: Re: svn commit: r255731 - head/usr.bin/protect Date: Fri, 20 Sep 2013 14:42:39 -0400 User-Agent: KMail/1.13.5 (FreeBSD/8.4-CBSD-20130906; KDE/4.5.5; amd64; ; ) References: <201309201605.r8KG59qQ063892@svn.freebsd.org> In-Reply-To: MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201309201442.39702.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Fri, 20 Sep 2013 17:30:08 -0400 (EDT) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 20 Sep 2013 21:30:10 -0000 On Friday, September 20, 2013 1:14:45 pm Sergey Kandaurov wrote: > On 20 September 2013 20:05, John Baldwin 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