Re: [PATCH 3/7] SELinux: Stub in copy-up handling

From: David Howells
Date: Fri Nov 07 2014 - 17:09:00 EST


Paul Moore <paul@xxxxxxxxxxxxxx> wrote:

> > +static int selinux_inode_copy_up_xattr(struct dentry *src, struct dentry
> > ...*dst,
> > + const char *name, void *value, size_t *size)
> > +{
> > + if (strcmp(name, XATTR_NAME_SELINUX) == 0)
> > + return 1; /* Discard */
>
> I understand that this is just a stub, but I we need to discuss this at some
> point and I figure better in this patch than elsewhere where it might get
> lost.
>
> For the docker, context= mount use case (similar to SELinux/sVirt) dropping
> the SELinux xattr is probably an okay behavior. However, I would expect that
> ultimately this is something we would want to control by policy and/or the
> presence of a context= label.

The problem is that the label you actually want has already been set and you
have to be careful not to overwrite it.

The other hook (->inode_copy_up) is called first to label the destination
inode - and that has access to the source file also so it can label the
destination with consideration of the attributes on the source. Normally, the
attributes on the source will be in memory attached to the source inode, I
would imagine.

David
--
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/