Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 20 Sep 2013 21:14:45 +0400
From:      Sergey Kandaurov <pluknet@freebsd.org>
To:        John Baldwin <jhb@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:  <CAE-mSOKsB=p3KP55JHz2YZqQfapBdBBDXDM_YZCcDT2_0eACow@mail.gmail.com>
In-Reply-To: <201309201605.r8KG59qQ063892@svn.freebsd.org>
References:  <201309201605.r8KG59qQ063892@svn.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
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;
       }

-- 
wbr,
pluknet



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAE-mSOKsB=p3KP55JHz2YZqQfapBdBBDXDM_YZCcDT2_0eACow>