Re: named + capset = EPERM [Was: 2.6.24-rc3-mm2]

From: Serge E. Hallyn
Date: Wed Nov 28 2007 - 19:17:31 EST


Quoting Serge E. Hallyn (serue@xxxxxxxxxx):
> Quoting Serge E. Hallyn (serue@xxxxxxxxxx):
> > Quoting Casey Schaufler (casey@xxxxxxxxxxxxxxxx):
> > >
> > > --- Jiri Slaby <jirislaby@xxxxxxxxx> wrote:
> > >
> > > > On 11/28/2007 12:41 PM, Andrew Morton wrote:
> > > > >
> > > >
> > > ftp://ftp.kernel.org/pub/linux/kernel/people/akpm/patches/2.6/2.6.24-rc3/2.6.24-rc3-mm2/
> > > > [...]
> > > > > +capabilities-introduce-per-process-capability-bounding-set.patch
> > > >
> > > > A regression against -mm1. This patch breaks bind (9.5.0-18.a7.fc8):
> > > > capset(0x19980330, 0,
> > > >
> > > {CAP_DAC_READ_SEARCH|CAP_SETGID|CAP_SETUID|CAP_NET_BIND_SERVICE|CAP_SYS_CHROOT|CAP_SYS_RESOURCE,
> > > >
> > > CAP_DAC_READ_SEARCH|CAP_SETGID|CAP_SETUID|CAP_NET_BIND_SERVICE|CAP_SYS_CHROOT|CAP_SYS_RESOURCE,
> > > > 0}) = -1 EPERM (Operation not permitted)
> > > >
> > > > $ grep SEC .config
> > > > CONFIG_SECCOMP=y
> > > > # CONFIG_NETWORK_SECMARK is not set
> > > > CONFIG_RPCSEC_GSS_KRB5=m
> > > > # CONFIG_RPCSEC_GSS_SPKM3 is not set
> > > > # CONFIG_SECURITY is not set
> > > > # CONFIG_SECURITY_FILE_CAPABILITIES is not set
> > > >
> > > > probably this hunk?:
> > > > @@ -133,6 +119,12 @@ int cap_capset_check (struct task_struct
> > > > /* incapable of using this inheritable set */
> > > > return -EPERM;
> > > > }
> > > > + if (!!cap_issubset(*inheritable,
> > > > + cap_combine(target->cap_inheritable,
> > > > + current->cap_bset))) {
> > > > + /* no new pI capabilities outside bounding set */
> > > > + return -EPERM;
> > > > + }
> >
> > That shouldn't be it, since you can't lower cap_bset since
> > CONFIG_SECURITY_FILE_CAPABILITIES=n.
>
> Hmm, but sure enough that appears to be it.
>
> Still trying to figure out why.

No. Seriously. You're kidding me.

Patch attached :(

Thanks for spotting this, Jiri. I don't know where I introduced this
since I thought all my tests had passed...

thanks,
-serge