From: Christoph Lameter <cl@linux.com>
To: "Serge E. Hallyn" <serge@hallyn.com>
Cc: Andy Lutomirski <luto@amacapital.net>,
"Andrew G. Morgan" <morgan@kernel.org>,
Serge Hallyn <serge.hallyn@ubuntu.com>,
Serge Hallyn <serge.hallyn@canonical.com>,
Jonathan Corbet <corbet@lwn.net>,
Aaron Jones <aaronmdjones@gmail.com>, "Ted Ts'o" <tytso@mit.edu>,
LSM List <linux-security-module@vger.kernel.org>,
lkml <linux-kernel@vger.kernel.org>,
Andrew Morton <akpm@linuxfoundation.org>
Subject: Re: [RFC] Implement ambient capability set.
Date: Wed, 4 Feb 2015 15:51:53 -0600 (CST) [thread overview]
Message-ID: <alpine.DEB.2.11.1502041542260.19035@gentwo.org> (raw)
In-Reply-To: <20150204211617.GA20787@mail.hallyn.com>
On Wed, 4 Feb 2015, Serge E. Hallyn wrote:
> > task_no_new_privs(current) instead of ns_capable(current_user_ns(),
>
> .... I'm ok with that. And iiuc it shouldn't get in the way of
> Christoph's use case. I'd just rather not have one set of convoluted
> new rules now, and the have to relax them later bc it turns out ppl
> needed that.
>
> Christoph, would your code run ok under NNP?
There are still binaries invoked that need more priviledges. Does not
work.
> > In fact, even with your proposal of writing a tool that does this and
> > then calls a helper, that helper might try to use privilege separation
> > and open a big hole because clearing pP is no longer sufficient to
> > drop privileges. Changing the evolution rule as above would fix this.
>
> Yeah... "because clearing pP is no longer sufficient to drop privileges"
> is reasonably convincing.
Well I'd rather have a way to avoid writing a tool. The best would be if
you could just set some caps and that would do it.
> > <bikeshed>
> > I don't like calling these "ambient". I'd prefer something like
> > "ambiently inheritable," although that's a bit long-winded.
> > </bikeshed>
amb_inh?
Fixup patch:
Index: linux/security/commoncap.c
===================================================================
--- linux.orig/security/commoncap.c
+++ linux/security/commoncap.c
@@ -351,9 +351,10 @@ static inline int bprm_caps_from_vfs_cap
__u32 inheritable = caps->inheritable.cap[i];
/*
- * pP' = (X & fP) | (pI & fI)
+ * pP' = (fA & fP) | (X & fP) | (pI & fI)
*/
- new->cap_permitted.cap[i] = current_cred()->cap_ambient.cap[i] |
+ new->cap_permitted.cap[i] =
+ (current_cred()->cap_ambient.cap[i] & permitted) |
(new->cap_bset.cap[i] & permitted) |
(new->cap_inheritable.cap[i] & inheritable);
@@ -453,9 +454,13 @@ static int get_file_caps(struct linux_bi
if (rc == -EINVAL)
printk(KERN_NOTICE "%s: get_vfs_caps_from_disk returned %d for %s\n",
__func__, rc, bprm->filename);
- else if (rc == -ENODATA)
- rc = 0;
- goto out;
+ else if (rc != -ENODATA)
+ goto out;
+ rc = 0;
+ if (!cap_isclear(current_cred()->cap_ambient))
+ goto out;
+ *effective = true;
+ *has_cap = true;
}
rc = bprm_caps_from_vfs_caps(&vcaps, bprm, effective, has_cap);
@@ -941,7 +946,10 @@ int cap_task_prctl(int option, unsigned
if (!cap_valid(arg2))
return -EINVAL;
- new =prepare_creds();
+ if (!ns_capable(current_user_ns(), arg2))
+ return -EPERM;
+
+ new = prepare_creds();
if (arg3 == 0)
cap_lower(new->cap_ambient, arg2);
else
next prev parent reply other threads:[~2015-02-04 21:51 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-04 18:49 Christoph Lameter
2015-02-04 20:44 ` Andy Lutomirski
2015-02-04 21:16 ` Serge E. Hallyn
2015-02-04 21:24 ` Andy Lutomirski
2015-02-04 21:27 ` Serge E. Hallyn
2015-02-04 21:31 ` Andy Lutomirski
2015-02-04 21:51 ` Serge E. Hallyn
2015-02-04 22:02 ` Serge E. Hallyn
2015-02-04 22:32 ` Andy Lutomirski
2015-02-05 0:03 ` Serge E. Hallyn
2015-02-04 21:57 ` Christoph Lameter
2015-02-04 22:29 ` Andy Lutomirski
2015-02-04 21:51 ` Christoph Lameter [this message]
2015-02-04 21:56 ` Andy Lutomirski
2015-02-04 22:01 ` Christoph Lameter
2015-02-04 22:02 ` [RFC] Implement ambient capability set V2 Christoph Lameter
2015-02-05 7:20 ` [RFC] Implement ambient capability set Michael Kerrisk
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=alpine.DEB.2.11.1502041542260.19035@gentwo.org \
--to=cl@linux.com \
--cc=aaronmdjones@gmail.com \
--cc=akpm@linuxfoundation.org \
--cc=corbet@lwn.net \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-security-module@vger.kernel.org \
--cc=luto@amacapital.net \
--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
all inboxes | Powered by JetHome®