Re: [PATCH 1/1] overlayfs: apply device cgroup and securitypermissions to overlay files

From: Andy Whitcroft
Date: Tue Mar 06 2012 - 11:12:26 EST


On Mon, Mar 05, 2012 at 06:18:23PM +0100, Miklos Szeredi wrote:
> Andy Whitcroft <apw@xxxxxxxxxxxxx> writes:
>
> > When checking permissions on an overlayfs inode we do not take into
> > account either device cgroup restrictions nor security permissions.
> > This allows a user to mount an overlayfs layer over a restricted device
> > directory and by pass those permissions to open otherwise restricted
> > files.
> >
> > Use devcgroup_inode_permission() and security_inode_permission() against
> > the underlying inodes when calculating ovl_permission().
>
> Andy,
>
> Thanks for the patch.
>
> __devcgroup_inode_permission() and security_inode_permission() are not
> exported to modules, so this will not work if overlayfs is a module.
>
> We could export those but I think a better solution is to split out the
> part of inode_permission() that doesn't check for a read-only fs and
> export that.

Yeah that makes much more sense. I got caught out by some exports
required for aufs3 which was also applied in my test environment.

How about the following pair of patches?

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