mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Serge E. Hallyn" <serue@us.ibm.com>
To: Andrew Morgan <morgan@kernel.org>
Cc: casey@schaufler-ca.com, "Serge E. Hallyn" <serue@us.ibm.com>,
	"Serge E. Hallyn" <serge@hallyn.com>,
	Chris Wright <chrisw@sous-sol.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Stephen Smalley <sds@tycho.nsa.gov>,
	James Morris <jmorris@namei.org>,
	linux-security-module@vger.kernel.org,
	lkml <linux-kernel@vger.kernel.org>
Subject: Re: implement-file-posix-capabilities.patch
Date: Fri, 29 Jun 2007 08:24:31 -0500	[thread overview]
Message-ID: <20070629132431.GC30458@sergelap.austin.ibm.com> (raw)
In-Reply-To: <468498F3.5040001@kernel.org>

Quoting Andrew Morgan (morgan@kernel.org):
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Casey Schaufler wrote:
> >> Would there be a difference between that and setting either fI or fP
> >> (depending on your intent) to those caps, and setting fE=1 in Andrew's
> >> scheme?
> > 
> > Arg, you're making me think. The POSIX group went through this,
> > let me see if I can reconstruct the logic.
> > 
> > The main issue is one if there being a possible case where you
> > have a capability ignorant program that you want to exec with
> > a different fP and fE. On first glance it seems that since the
> > program is capability ignorant it can't matter. But what if your
> > capability ignorant program exec's a capability aware program
> > to perform a helper function? You may well want the first program
> > to have a capability that it does not use in fP (but not fE)
> > to pass along to the helper program. True, you could probably
> 
> I'm not sure I've quite flogged this horse to death yet.. :-)
> 
> In my other reply, I quoted the rules. Here they are again:
> 
>     pI' = pI
>     pP' = (X & fP) | (pI & fI)
>     pE' = pP' & fE
>
> If program A exec()utes helper program B, then the only capabilities
> (p*') that B can get from A are a subset of A's pI set.
> 
> If A doesn't know about capabilities, then nothing about the fE value
> associated with the A program file can alter A's pI set and thus affect
> B. That is, nothing about the fE or fP value used to exec()ute A gets
> propagated through a subsequent exec() to B.
> 
> So far as I can see, to achieve the helper program support you are
> describing, the value of pI that program A (and thus program B) inherits
> will have to contain the relevant capabilities, and B will have to have
> a sufficient fI value to pick them up...
> 
> Incidentally, this is also where my request that we require (pP' >= fP)
> be true comes in. If a helper program (which may also be a legacy

That was going to be my next thing to look at, btw.

> program) is used in a way that it is configured (via fP) to have powers
> that are denied to it (via X=cap_bset etc.,) then it should simply not
> be permitted to run (-EPERM). It should not have the opportunity to
> silently confuse itself (as was the case with sendmail when we tried to
> emulate setuid-0 behavior with capabilities a few years back).
> 
> > come up with a way to set the capabilities on the helper program
> > to account for this use, but there may be design and security
> > constraints that make doing so complicated. 
> 
> I've not seen anything yet to make be believe there is a case for a
> non-single bit fE value... Its a little ironic that I read all of the
> rationale I've been espousing in POSIX drafts - so far as I'm aware the
> only detail I'm mixing in there is the (pP' >= fP), -EPERM, thing.
> 
> If you or anyone can cite some counter examples, please do!

Not really.

But, your argument is:

fE can only be used to create a different initial pE' than pP'.

If the binary doesn't know about capabilities, then you would never want
to do that since it won't change it's pE', and therefore it's pP' is
meaningless once pE' is set.

If the binary does know about capabilities, then it can change it's pE'
within the bounds of it's pP' whenever it wants, so we may want to set
pE' to 0 at start, but having pE' be just a subset of pP' has no
advantage since the binary can set pE' to the subset when it wants.

Now, *my* argument :) is that:

While there is no particular advantage (that I can think of) to having
the bitmap pE', there is also no disadvantage, and it produces kernel
code closer to the actual equations usually seen.

In the course of this discussion, the two advantages I've seen which
I'll concede to you are:

	1. the resulting equations may be easier to read/understand,
	   just bc it's one less bitmask operation whose purpose to try
	   to understand.  But I'm not certain.
	2. Improper setting of fE *could* in theory cause another
	   hard to diagnose sendmail-type vulnerability, by having fP
	   set to the right value, but fE to the wrong value.  Though
	   that is stretching things a bit.

The change in xattr format offsets those, which is why I like the idea of
just having the setfcaps program understand 'on=e' and 'off=e' (where on
is of course just an alias for 'all'), but keeping the kernel code the
same.

-serge

  reply	other threads:[~2007-06-29 13:24 UTC|newest]

Thread overview: 63+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20070611123714.GA2063@sergelap.austin.ibm.com>
     [not found] ` <878322.98602.qm@web36606.mail.mud.yahoo.com>
     [not found]   ` <afff21250706110926l244ddc28i44289cb08a6721e2@mail.gmail.com>
     [not found]     ` <20070617135239.GA17689@sergelap>
     [not found]       ` <4676007F.7060503@kernel.org>
     [not found]         ` <20070618044017.GW3723@sequoia.sous-sol.org>
     [not found]           ` <20070620171037.GA28670@sergelap.ibm.com>
     [not found]             ` <20070620174613.GF3723@sequoia.sous-sol.org>
2007-06-21 16:00               ` implement-file-posix-capabilities.patch Serge E. Hallyn
2007-06-23  8:13                 ` implement-file-posix-capabilities.patch Andrew Morgan
2007-06-24 15:51                   ` implement-file-posix-capabilities.patch Serge E. Hallyn
2007-06-24 16:18                     ` implement-file-posix-capabilities.patch James Morris
2007-06-24 20:58                       ` [PATCH][RFC] security: Convert LSM into a static interface James Morris
2007-06-24 22:09                         ` Chris Wright
2007-06-24 22:37                           ` James Morris
2007-06-25  1:38                             ` Chris Wright
2007-06-24 23:40                           ` Casey Schaufler
2007-06-25  1:39                             ` Chris Wright
2007-06-25  3:37                               ` Casey Schaufler
2007-06-25  3:57                                 ` Chris Wright
2007-06-25 13:02                                   ` Casey Schaufler
2007-06-25 14:24                                 ` Roberto De Ioris
2007-06-25  4:33                           ` [PATCH try #2] " James Morris
2007-06-25  4:48                             ` Petr Vandrovec
2007-06-25  4:58                               ` James Morris
2007-06-25 16:59                             ` Stephen Smalley
2007-06-25 23:56                               ` [PATCH try #3] " James Morris
2007-06-25 20:37                             ` [PATCH try #2] " Andreas Gruenbacher
2007-06-25 21:14                               ` James Morris
2007-06-26  3:57                                 ` Serge E. Hallyn
2007-06-26 13:15                                   ` Adrian Bunk
2007-06-26 14:06                                     ` Serge E. Hallyn
2007-06-26 14:59                                       ` Adrian Bunk
2007-06-26 15:53                                         ` Serge E. Hallyn
2007-06-26 18:52                                           ` Adrian Bunk
2007-06-26 18:18                                       ` Greg KH
2007-06-26 18:40                                         ` Serge E. Hallyn
2007-06-26  4:09                               ` Kyle Moffett
2007-06-26  4:25                                 ` Kyle Moffett
2007-06-26 13:47                                 ` Serge E. Hallyn
2007-06-27  0:07                                   ` Kyle Moffett
2007-06-27  0:57                                     ` Crispin Cowan
2007-06-27  1:22                                       ` Kyle Moffett
2007-06-27  4:24                                       ` Chris Wright
2007-06-27 13:41                                     ` Serge E. Hallyn
2007-06-27 14:36                                       ` James Morris
2007-06-27 17:21                                         ` Serge E. Hallyn
2007-06-27 18:51                                           ` Serge E. Hallyn
2007-06-27 19:28                                             ` James Morris
2007-06-28  2:48                                               ` Serge E. Hallyn
2007-06-25  3:57                         ` [PATCH][RFC] " Serge E. Hallyn
2007-06-25  4:10                           ` Chris Wright
2007-06-25  4:54                             ` Serge E. Hallyn
2007-06-25 13:50                           ` Casey Schaufler
2007-06-25 13:54                             ` James Morris
2007-06-25 14:32                             ` Serge E. Hallyn
2007-06-25 15:08                               ` Casey Schaufler
2007-06-27  5:00                     ` implement-file-posix-capabilities.patch Andrew Morgan
2007-06-27 13:16                       ` implement-file-posix-capabilities.patch Serge E. Hallyn
2007-06-28  6:19                         ` implement-file-posix-capabilities.patch Andrew Morgan
2007-06-28 13:36                           ` implement-file-posix-capabilities.patch Serge E. Hallyn
2007-06-28 15:14                           ` implement-file-posix-capabilities.patch Casey Schaufler
2007-06-28 15:38                             ` implement-file-posix-capabilities.patch Serge E. Hallyn
2007-06-28 15:56                               ` implement-file-posix-capabilities.patch Casey Schaufler
2007-06-29  5:30                                 ` implement-file-posix-capabilities.patch Andrew Morgan
2007-06-29 13:24                                   ` Serge E. Hallyn [this message]
2007-06-29 14:46                                   ` implement-file-posix-capabilities.patch Casey Schaufler
2007-06-28 15:50                             ` implement-file-posix-capabilities.patch Andrew Morgan
2007-07-02 14:38                   ` implement-file-posix-capabilities.patch Serge E. Hallyn
2007-07-04 21:29                     ` implement-file-posix-capabilities.patch Andrew Morgan
2007-07-04 23:00                       ` implement-file-posix-capabilities.patch Casey Schaufler

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=20070629132431.GC30458@sergelap.austin.ibm.com \
    --to=serue@us.ibm.com \
    --cc=akpm@linux-foundation.org \
    --cc=casey@schaufler-ca.com \
    --cc=chrisw@sous-sol.org \
    --cc=jmorris@namei.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=morgan@kernel.org \
    --cc=sds@tycho.nsa.gov \
    --cc=serge@hallyn.com \
    /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

all inboxes | Powered by JetHome®