Re: ÐÑÐÐÑ: VFS, NFS security bug? Should CAP_MKNOD and CAP_LINUX_IMMUTABLE be added toCAP_FS_MASK?
From: Serge E. Hallyn
Date: Wed Mar 18 2009 - 12:47:36 EST
Quoting Stephen Smalley (sds@xxxxxxxxxxxxx):
> On Tue, 2009-03-17 at 13:23 -0500, Serge E. Hallyn wrote:
> > But in cap_inode_setxattr, any security.* xattrs are controlled by
> > CAP_SYS_ADMIN. So do you think that this should be changed to a
> > CAP_XATTR_SECURITY capability which can be added to CAP_FS_MASK?
>
> I think that would be preferable to CAP_SYS_ADMIN, yes.
>
> > Or do you think it's ok that fsuid=0 does not allow you to set
> > security.selinux (or security.SMACK64, etc) xattrs when selinux is
> > not compiled in?
>
> Just to be clear, at present fsuid is irrelevant to setting the
> security.* xattrs since it doesn't affect the CAP_SYS_ADMIN capability
> at all, so it all depends on the initial capability state prior to using
> setfsuid(), typically the full capability set.
Right.
> > (You may have already answered this with your EOPNOTSUPP comment, but
> > I want to make sure I understand right)
> >
> > > > Does anyone know what the trusted xattrs are used for?
> > >
> > > Not beyond what attr(5) says about them.
> >
> > Well, if attr(5) says CAP_SYS_ADMIN being needed is the very
> > thing that defines these xattrs, then changing that seems a
> > bigger deal. That really does seem akin to changing kernel-user
> > API.
>
> Perhaps, although it isn't clear that this API is in use by anyone or in
> use in a way that would actually distinguish based on individual
> capability.
>
> But if you were to add CAP_SYS_ADMIN to CAP_FS_MASK in order to ensure
> that setfsuid() does in fact affect all filesystem accesses, how much
> meaningful difference remains between fsuid==0 and euid==0? It
> obviously takes you far afield of only affecting filesystem accesses.
Ok, thanks for time. It's all pretty clear to me now:
CAP_MKNOD and CAP_LINUX_IMMUTABLE need to be added to the CAP_FS_MASK
because, in 2.0 timeframe, fsuid==0 gave you those privileges.
xattrs didn't exist back then, so the setting of security.* and
trusted.* xattrs doesn't need to be enabled by fsuid==0. So really
CAP_SETFCAP also doesn't need to be added to CAP_FS_MASK either.
I'll send out a patch later today for 2.6, unless Igor wants to
do it (since he's the one who found this originally).
thanks,
-serge
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/