linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andy Lutomirski <luto@amacapital.net>
To: "Serge E. Hallyn" <serge@hallyn.com>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Andrew Morton <akpm@linuxfoundation.org>,
	Aaron Jones <aaronmdjones@gmail.com>,
	LSM List <linux-security-module@vger.kernel.org>,
	"Ted Ts'o" <tytso@mit.edu>,
	Serge Hallyn <serge.hallyn@ubuntu.com>,
	"Andrew G. Morgan" <morgan@kernel.org>,
	Christoph Lameter <cl@linux.com>,
	Serge Hallyn <serge.hallyn@canonical.com>,
	Jonathan Corbet <corbet@lwn.net>
Subject: Re: [capabilities] Allow normal inheritance for a configurable set of capabilities
Date: Wed, 4 Feb 2015 08:27:19 -0800	[thread overview]
Message-ID: <CALCETrV29STWueUTTttN5e8t0ee-QO3iVv43m05YJJ6AP2Qa+A@mail.gmail.com> (raw)
In-Reply-To: <20150204155617.GE16726@mail.hallyn.com>

On Feb 4, 2015 7:56 AM, "Serge E. Hallyn" <serge@hallyn.com> wrote:
>
> Quoting Christoph Lameter (cl@linux.com):
> > On Wed, 4 Feb 2015, Andrew G. Morgan wrote:
> >
> > > I'm not generally in favor of this. Mostly because this seems to be a
> > > mini-root kind of inheritance that propagates privilege to binaries
> > > that aren't prepared for privilege. I don't really buy the mmap code
> > > concern because the model as it stands says that you trust the binary
> > > (and all of the various ways it was programmed to execute code) with
> > > specific privileges. If the binary mmap's some code (PAM modules come
> > > to mind) then that is part of what it was programmed to/allowed to do.
> > >
> > > That being said, if you really really want this kind of thing, then
> > > make it a single secure bit (with another lock on/off bit) which, when
> > > set, makes: fI default to X.
> > >
> > >    pP' = (X & fP) | (pI & fI)
> > >
> > > That way the per-process bounding set still works as advertised and
> > > you don't need to worry about the existing semantics being violated.
> >
> > Ok but then also fI needs to be set to X so that the binary f invokes
> > can also inherit.  So if we copy the inheritable flags to fI then we
> > wont be needing the bounding set anymore.
> >
> > The changes to brpm_caps_from_vfs_cap would then
> > be only the following? (substitute capable(CAP_INHERIT_BY_DEFAULT through
> > any other means like PRCTL if wanted).
> >
> >
> > Index: linux/security/commoncap.c
> > ===================================================================
> > --- linux.orig/security/commoncap.c   2015-02-04 09:44:25.000000000 -0600
> > +++ linux/security/commoncap.c        2015-02-04 09:45:59.381572756 -0600
> > @@ -350,6 +350,9 @@ static inline int bprm_caps_from_vfs_cap
> >               __u32 permitted = caps->permitted.cap[i];
> >               __u32 inheritable = caps->inheritable.cap[i];
> >
> > +             if (capable(CAP_INHERIT_BY_DEFAULT)
> > +                     new->cap_inheritable.cap[i] = inheritable;
> > +
> >               /*
> >                * pP' = (X & fP) | (pI & fI)
> >                */
>
> Not quite - I think more like
>
>         if (secure(SECURE_AMBIENT_PRIVS))
>                 new->cap_inheritable.cap[i] = inheritable;

I *still* think this should be inheritable & permitted.

>
> Then ns_capable(CAP_INHERIT_BY_DEFAULT), or perhaps rather
> ns_capable(CAP_SETPCAP), would be required in order to set
> SECURE_AMBIENT_PRIVS, which is off by default.

Can we make this depend on no_new_privs instead of a new cap?  I don't
want to see people leaking this securebit into the environment for
reasons they think are good a la CVE-2014-3215.  I sincerely doubt
that running, say, sendmail or exim with this bit set and no_new_privs
off is a good idea.

Hmm.  On an unrelated note, we should consider allowing no_new_privs
to be cleared in conjunction with unsharing userns.

--Andy

  parent reply	other threads:[~2015-02-04 16:27 UTC|newest]

Thread overview: 57+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-02 16:21 [capabilities] Allow normal inheritance for a configurable set of capabilities Christoph Lameter
2015-02-02 17:12 ` Serge Hallyn
2015-02-02 17:18   ` Andy Lutomirski
2015-02-02 18:09     ` Serge Hallyn
2015-02-03 15:16     ` Christoph Lameter
2015-02-03 15:23   ` Christoph Lameter
2015-02-03 15:55     ` Serge E. Hallyn
2015-02-03 17:18       ` Christoph Lameter
2015-02-03 17:26         ` Serge E. Hallyn
2015-02-04 15:15           ` Andrew G. Morgan
2015-02-04 15:50             ` Christoph Lameter
2015-02-04 15:56               ` Serge E. Hallyn
2015-02-04 16:12                 ` Andrew G. Morgan
2015-02-04 16:34                   ` Andy Lutomirski
2015-02-04 16:54                     ` Andrew G. Morgan
2015-02-04 17:34                       ` Serge E. Hallyn
2015-02-04 18:12                         ` Christoph Lameter
2015-02-04 16:43                   ` Christoph Lameter
2015-02-04 16:27                 ` Andy Lutomirski [this message]
2015-02-05  0:34             ` Serge E. Hallyn
2015-02-05 15:23               ` Serge E. Hallyn
2015-02-25 21:50     ` Pavel Machek
2015-02-25 23:59       ` Christoph Lameter
2015-02-26 12:27         ` Pavel Machek
2015-02-27 20:15           ` Andy Lutomirski
2015-02-27 20:48             ` Pavel Machek
2015-02-27 20:56               ` Andy Lutomirski
2015-02-27 22:47                 ` Pavel Machek
2015-02-02 17:54 ` Casey Schaufler
2015-02-02 18:08   ` Serge Hallyn
2015-02-02 18:47     ` Mimi Zohar
2015-02-02 19:05       ` Austin S Hemmelgarn
2015-02-02 20:35         ` Casey Schaufler
2015-02-03 16:04       ` Serge E. Hallyn
2015-02-02 19:00     ` Casey Schaufler
2015-02-05  0:20       ` Serge E. Hallyn
2015-02-02 20:37     ` Andy Lutomirski
2015-02-02 20:54       ` Casey Schaufler
2015-02-03 15:51         ` Serge E. Hallyn
2015-02-03 16:37           ` Casey Schaufler
2015-02-03 17:28             ` Serge E. Hallyn
2015-02-03 17:50               ` Casey Schaufler
2015-02-03 19:45                 ` Christoph Lameter
2015-02-03 20:13                   ` Andy Lutomirski
2015-02-03 23:14                     ` Christoph Lameter
2015-02-03 23:17                       ` Andy Lutomirski
2015-02-04  2:27                         ` Christoph Lameter
2015-02-04  6:05                         ` Markku Savela
2015-02-04 13:17                           ` Christoph Lameter
2015-02-04 13:41                             ` Markku Savela
2015-02-04 14:56                               ` Jarkko Sakkinen
2015-02-03 15:17       ` Christoph Lameter
2015-02-03 15:40         ` Casey Schaufler
2015-02-03 15:46       ` Serge E. Hallyn
2015-02-03 17:19         ` Christoph Lameter
2015-02-03 17:29           ` Serge E. Hallyn
2015-02-25 21:50     ` Pavel Machek

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=CALCETrV29STWueUTTttN5e8t0ee-QO3iVv43m05YJJ6AP2Qa+A@mail.gmail.com \
    --to=luto@amacapital.net \
    --cc=aaronmdjones@gmail.com \
    --cc=akpm@linuxfoundation.org \
    --cc=cl@linux.com \
    --cc=corbet@lwn.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=morgan@kernel.org \
    --cc=serge.hallyn@canonical.com \
    --cc=serge.hallyn@ubuntu.com \
    --cc=serge@hallyn.com \
    --cc=tytso@mit.edu \
    /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;
as well as URLs for NNTP newsgroup(s).