lkml.org 
[lkml]   [2015]   [Feb]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [capabilities] Allow normal inheritance for a configurable set of capabilities
On Wed, Feb 4, 2015 at 8:12 AM, Andrew G. Morgan <morgan@kernel.org> wrote:
> I was thinking more like this:
>
> int override = secure(SECURE_AMBIENT_PRIVS) &&
> cap_isclear(caps->inheritable.cap);
>
> CAP_FOR_EACH_U32(i) {
> __u32 permitted = caps->permitted.cap[i];
> __u32 inheritable = override ? new->cap_bset.cap[i] :
> caps->inheritable.cap[i];
> [...]

To elaborate on my objection:

For better or for worse, as a practical matter, if you drop a cap from
pP but keep it in pI, there's no way to get that cap back on the
average system to get that cap back using execve because nothing will
have that bit set in fI. I am not at all confident that changing this
is safe at this point, since there's lots of legacy code out there.

So, how about:

__u32 inheritable = override ? (new->cap_bset.cap[i] & permitted) :
caps->inheritable.cap[i];

instead?

This still doesn't address the effective set adequately, I think. I
suspect that we'll want to always start with pE' == pP' in the new
mode, or perhaps pE' = (pP' & pE). This latter part is also a bit
dangerous and furthers my desire to restrict this to no_new_privs.

--Andy


\
 
 \ /
  Last update: 2015-02-04 17:41    [W:0.088 / U:0.348 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site