Re: [PATCH 1/1] file caps: update selinux xattr hooks

From: Serge E. Hallyn
Date: Tue Jul 03 2007 - 09:33:42 EST


Quoting Stephen Smalley (sds@xxxxxxxxxxxxx):
> On Mon, 2007-07-02 at 17:06 -0500, Serge E. Hallyn wrote:
> > Thanks Stephen, does the following version appear correct? It just
> > checks for a different cap for security.capability, then if granted
> > goes on to check FILE__GETATTR before granting setxattr or removexattr
> > on any security.* xattr.
> >
> > thanks,
> > -serge
> >
> > >From 5ec50bc22d3320565002658433829f7dc5bc0aa5 Mon Sep 17 00:00:00 2001
> > From: Serge E. Hallyn <serue@xxxxxxxxxx>
> > Date: Mon, 2 Jul 2007 14:07:51 -0400
> > Subject: [PATCH 1/1] file caps: update selinux xattr hooks (v2)
> >
> > SELinux does not call out to it's secondary module for setxattr
> > or removexattr mediation, as the secondary module would
> > incorrectly prevent writing of selinux xattrs. This means
> > that when selinux and capability are both loaded, admins will
> > be able to write file capabilities with CAP_SYS_ADMIN as before,
> > not with CAP_SETFCAP.
> >
> > Update the selinux hooks to hardcode logic for the special
> > consideration for file caps.
> >
> > Note that the setxattr and removexattr logic for non selinux
> > attrs appears to be identical. So I do have another patch
> > where selinux_inode_setotherxattr takes an extra argument
> > u32 av (in case removexattr ever gets its own av permission)
> > so removexattr can shrink and just use that. But first I
> > thought I'd see if this version is even close correct :)
>
> Yes, looks sane, and feel free to have both hooks use a common helper
> for non-selinux attributes. I don't think you even need to bother with
> the u32 av argument; if we later split the check, we can change it then
> (it isn't as though these functions need to have a stable interface).

Great, here is the new patch then.

thanks,
-serge