public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Serge E. Hallyn" <serue@us.ibm.com>
To: James Morris <jmorris@namei.org>
Cc: David Howells <dhowells@redhat.com>,
	Christoph Hellwig <hch@lst.de>,
	linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	linux-security-module@vger.kernel.org,
	Stephen Rothwell <sfr@canb.auug.org.au>,
	Andrew Morgan <morgan@kernel.org>
Subject: Re: [PATCH] CRED: Fix regression in cap_capable() as shown up by sys_faccessat() [ver #2]
Date: Sun, 4 Jan 2009 21:18:27 -0600	[thread overview]
Message-ID: <20090105031827.GA10185@us.ibm.com> (raw)
In-Reply-To: <alpine.LRH.1.10.0901051301590.14359@tundra.namei.org>

Quoting James Morris (jmorris@namei.org):
> On Wed, 31 Dec 2008, David Howells wrote:
> 
> > 
> > Here's an improved patch.  It differentiates the use of objective and
> > subjective capabilities by making capable() only check current's subjective
> > caps, but making has_capability() check only the objective caps of whatever
> > process is specified.
> > 
> > It's a bit more involved, but I think it's the right thing to do.
> 
> I think it's the right approach, too, and the patch seems ok to me.  I've 
> applied it to 
> git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/security-testing-2.6#next
> 
> and expect to push it to Linus in the next day or so.  It's not a trivial 
> change, and could do with more review (Serge?).

(Andrew Morgan cc'd for more review)

Yes, I'm sorry, I've been staring at it on and off all weekend...  From
a high level it looks right, but i think there's a problem with naming
here (which also could be said to have obfuscated the original bug).
The security_capable() should be security_capable_eff() or somesuch,
and security_task_capable() should be security_task_capable_real() or
something.  In fact the current-as-implicit optimization could be put
off for a kernel release or so while we just have
security_capable_eff(tsk, cap) and security_real_eff(tsk, cap), or
just security_capable(tsk, cap, flag) where flag is CAP_EFF or CAP_REAL.

I've been holding off on saying this since sat night bc when i read it
back it looks petty, but every time i read the patch i'm more convinced
that the type of capability checked must be made explicit to make this
maintainable (maybe even reviewable).

I'm also not thrilled about security_task_capable() and
security_ops->task_capable() having different args and semantics, but
of course I see the reason for it and figure if there's a way to improve
on that we can do it later.

Anyway David the patch on its own doesn't look incorrect.  So far
the only code which manipulates subjective caps is in fact
sys_faccessat through cap_set_effective() right?  If so this at
least looks safe, looking through capable/has_capability callers.

Finally, may i just say that i love the fact that a syscall is
checking the real user's access rights and so sets eff creds to
have the caps of the real user :)  Hmm, did you at one time call
the subjective creds 'working' or 'acting' creds?  Might be a good
name.  Subj/obj always makes me pause to think, and real/eff while
seemingly natural could be confusing in cases like this.
cap_set_acting() -  i like it...

thanks,
-serge

> It seems that more testing should be done in linux-next vs. waiting for 
> the merge window.
> 
> 
> - James
> -- 
> James Morris
> <jmorris@namei.org>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2009-01-05  3:18 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-30 13:42 access(2) regressions in current mainline Christoph Hellwig
2008-12-30 17:06 ` David Howells
2008-12-30 17:09   ` Christoph Hellwig
2008-12-30 17:20     ` David Howells
2008-12-30 17:29       ` Christoph Hellwig
2008-12-30 17:54         ` David Howells
2008-12-31  2:05           ` Dave Chinner
2008-12-31  3:28 ` [PATCH] CRED: Fix regression in cap_capable() as shown up by sys_faccessat() David Howells
2008-12-31 15:15   ` [PATCH] CRED: Fix regression in cap_capable() as shown up by sys_faccessat() [ver #2] David Howells
2008-12-31 23:24     ` James Morris
2009-01-01 23:53     ` J. Bruce Fields
2009-01-02  1:19       ` David Howells
2009-01-02  5:19         ` J. Bruce Fields
2009-01-02 11:59           ` David Howells
2009-01-02 16:45             ` J. Bruce Fields
2009-01-03 18:49               ` J. Bruce Fields
2009-01-03 23:03                 ` David Howells
2009-01-04  2:03                   ` J. Bruce Fields
2009-01-05 13:11                 ` David Howells
2009-01-05 15:57               ` David Howells
2009-01-05 16:48               ` David Howells
2009-01-05 17:19                 ` [PATCH] CRED: Fix NFSD regression David Howells
2009-01-05 22:22                   ` James Morris
2009-01-06 19:41                   ` J. Bruce Fields
2009-01-06 19:56                     ` David Howells
2009-01-06 20:08                       ` J. Bruce Fields
2009-01-02 16:48     ` [PATCH] CRED: Fix regression in cap_capable() as shown up by sys_faccessat() [ver #2] J. Bruce Fields
2009-01-02 19:18       ` David Howells
2009-01-05  2:07     ` James Morris
2009-01-05  3:18       ` Serge E. Hallyn [this message]
2009-01-05  3:37         ` Serge E. Hallyn
2009-01-05 12:43         ` David Howells
2009-01-05 19:07           ` Serge E. Hallyn
2009-01-05 21:12             ` David Howells
2009-01-06 16:47               ` Serge E. Hallyn
2009-01-06 20:39                 ` David Howells
2009-01-06 20:56                   ` Serge E. Hallyn
2009-01-06 22:27       ` [PATCH] CRED: Fix regression in cap_capable() as shown up by sys_faccessat() [ver #3] David Howells
2009-01-06 22:53         ` James Morris
2009-01-06 23:57           ` J. Bruce Fields
2009-01-07  0:09             ` 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=20090105031827.GA10185@us.ibm.com \
    --to=serue@us.ibm.com \
    --cc=dhowells@redhat.com \
    --cc=hch@lst.de \
    --cc=jmorris@namei.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=morgan@kernel.org \
    --cc=sfr@canb.auug.org.au \
    /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