LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Christoph Lameter <cl@linux.com>
To: "Serge E. Hallyn" <serge@hallyn.com>
Cc: Serge Hallyn <serge.hallyn@canonical.com>,
Andy Lutomirski <luto@amacapital.net>,
Jonathan Corbet <corbet@lwn.net>,
Aaron Jones <aaronmdjones@gmail.com>,
linux-security-module@vger.kernel.org,
linux-kernel@vger.kernel.org, akpm@linuxfoundation.org,
"Andrew G. Morgan" <morgan@kernel.org>,
Mimi Zohar <zohar@linux.vnet.ibm.com>,
Austin S Hemmelgarn <ahferroin7@gmail.com>,
Markku Savela <msa@moth.iki.fi>,
Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>,
linux-api@vger.kernel.org,
Michael Kerrisk <mtk.manpages@gmail.com>
Subject: Re: [PATCH] capabilities: Ambient capability set V2
Date: Thu, 5 Mar 2015 09:26:24 -0600 (CST) [thread overview]
Message-ID: <alpine.DEB.2.11.1503050917380.31001@gentwo.org> (raw)
In-Reply-To: <20150301233359.GA22196@mail.hallyn.com>
On Sun, 1 Mar 2015, Serge E. Hallyn wrote:
> > +++ linux/security/commoncap.c 2015-02-26 16:10:02.347913397 -0600
> > @@ -347,15 +347,17 @@ static inline int bprm_caps_from_vfs_cap
> > *has_cap = true;
> >
> > CAP_FOR_EACH_U32(i) {
> > + __u32 ambient = current_cred()->cap_ambient.cap[i];
> > __u32 permitted = caps->permitted.cap[i];
> > __u32 inheritable = caps->inheritable.cap[i];
> >
> > /*
> > - * pP' = (X & fP) | (pI & fI)
> > + * pP' = (X & fP) | (pI & (fI | pA))
> > */
> > new->cap_permitted.cap[i] =
> > (new->cap_bset.cap[i] & permitted) |
> > - (new->cap_inheritable.cap[i] & inheritable);
> > + (new->cap_inheritable.cap[i] &
> > + (inheritable | ambient));
>
> So I'd say drop this change ^
Then the ambient caps get ignored for a executables that have capabilities
seton the file? I think we need to keep this one.
> > @@ -453,8 +455,18 @@ 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)
> > + else if (rc == -ENODATA) {
> > rc = 0;
> > + if (!cap_isclear(current_cred()->cap_ambient)) {
> > + /*
> > + * The ambient caps are permitted for
> > + * files that have no caps
> > + */
> > + bprm->cred->cap_permitted =
> > + current_cred()->cap_ambient;
>
> and here set vcaps inheritable to current_cred()->ambient.
We do not call bprm_caps_from_vfs_cap() for files that have no caps so
this would have no effect. But we could set cap_inheritable here?
Fixup patch:
Subject: ambient_caps: Set inheritable bits too
We were not setting the inheritable bits as they ought to be set.
Signed-off-by: Christoph Lameter <cl@linux.com>
Index: linux/security/commoncap.c
===================================================================
--- linux.orig/security/commoncap.c 2015-03-05 09:22:32.123047869 -0600
+++ linux/security/commoncap.c 2015-03-05 09:22:32.119048001 -0600
@@ -461,6 +461,8 @@ static int get_file_caps(struct linux_bi
*/
bprm->cred->cap_permitted =
current_cred()->cap_ambient;
+ bprm->cred->cap_inheritable =
+ current_cred()->cap_ambient;
*effective = true;
}
}
next prev parent reply other threads:[~2015-03-05 15:26 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-26 22:14 Christoph Lameter
2015-03-01 4:44 ` Serge E. Hallyn
2015-03-02 15:43 ` Christoph Lameter
2015-03-01 23:33 ` Serge E. Hallyn
2015-03-05 15:26 ` Christoph Lameter [this message]
2015-03-05 17:13 ` Serge E. Hallyn
2015-03-05 18:41 ` Christoph Lameter
2015-03-05 23:07 ` Andy Lutomirski
2015-03-06 15:47 ` Christoph Lameter
2015-03-06 15:50 ` Christoph Lameter
2015-03-06 16:34 ` Serge E. Hallyn
2015-03-06 18:53 ` Christoph Lameter
2015-03-06 19:02 ` Andy Lutomirski
2015-03-06 20:08 ` Serge E. Hallyn
2015-03-07 15:09 ` Christoph Lameter
2015-03-07 21:35 ` Serge E. Hallyn
2015-03-09 12:05 ` Christoph Lameter
2015-03-09 14:36 ` Serge E. Hallyn
[not found] ` <CALQRfL4uG2v7SJWZhN2o=ARnSNLR9JAX6MMsCCsGaAz6JcZTsA@mail.gmail.com>
2015-03-10 15:47 ` Christoph Lameter
2015-03-07 15:06 ` Christoph Lameter
2015-03-07 21:35 ` Serge E. Hallyn
2015-03-14 19:04 ` 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=alpine.DEB.2.11.1503050917380.31001@gentwo.org \
--to=cl@linux.com \
--cc=aaronmdjones@gmail.com \
--cc=ahferroin7@gmail.com \
--cc=akpm@linuxfoundation.org \
--cc=corbet@lwn.net \
--cc=jarkko.sakkinen@linux.intel.com \
--cc=linux-api@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-security-module@vger.kernel.org \
--cc=luto@amacapital.net \
--cc=morgan@kernel.org \
--cc=msa@moth.iki.fi \
--cc=mtk.manpages@gmail.com \
--cc=serge.hallyn@canonical.com \
--cc=serge@hallyn.com \
--cc=zohar@linux.vnet.ibm.com \
--subject='Re: [PATCH] capabilities: Ambient capability set V2' \
/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
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).