From: "Serge E. Hallyn" <serge@hallyn.com>
To: Kees Cook <kees.cook@canonical.com>
Cc: Tetsuo Handa <penguin-kernel@i-love.sakura.ne.jp>,
linux-kernel@vger.kernel.org,
linux-security-module@vger.kernel.org
Subject: Re: [PATCH] Yama: turn process ancestry check into function
Date: Tue, 13 Jul 2010 21:17:20 -0500 [thread overview]
Message-ID: <20100714021720.GA17686@hallyn.com> (raw)
In-Reply-To: <20100714003049.GO6104@outflux.net>
Quoting Kees Cook (kees.cook@canonical.com):
> On Wed, Jul 14, 2010 at 09:19:09AM +0900, Tetsuo Handa wrote:
> > > + if (mode == PTRACE_MODE_ATTACH &&
> > > + ptrace_scope &&
> > > + !task_is_descendant(current, child) &&
> > > + !capable(CAP_SYS_PTRACE))
> > > + rc = -EPERM;
> >
> > I don't know how heavy capable(CAP_SYS_PTRACE) is.
> > But checking !capable(CAP_SYS_PTRACE) before
> > !task_is_descendant(current, child) might be lighter.
>
> That's the order I had before, but in looking at some of the other code, it
> seemed like moving it to the end made more logical sense. Since checking
> PTRACE attach isn't a common or time-sensitive operation, I figured trying
> to tune it wasn't critical.
Yes the reason to keep it like this is that capable(CAP_SYS_PTRACE)
will set PF_SUPERPRIV if it passes. You don't want to do that unless
the capability was actually required.
-serge
next prev parent reply other threads:[~2010-07-14 2:15 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-07-13 17:33 [PATCH] Yama: turn process ancestry check into function Kees Cook
2010-07-14 0:19 ` Tetsuo Handa
2010-07-14 0:30 ` Kees Cook
2010-07-14 2:17 ` Serge E. Hallyn [this message]
2010-07-20 23:02 ` James Morris
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20100714021720.GA17686@hallyn.com \
--to=serge@hallyn.com \
--cc=kees.cook@canonical.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-security-module@vger.kernel.org \
--cc=penguin-kernel@i-love.sakura.ne.jp \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox