linux/fs/overlayfs
Amir Goldstein 03fedf9359 ovl: skip getxattr of security labels
When inode has no listxattr op of its own (e.g. squashfs) vfs_listxattr
calls the LSM inode_listsecurity hooks to list the xattrs that LSMs will
intercept in inode_getxattr hooks.

When selinux LSM is installed but not initialized, it will list the
security.selinux xattr in inode_listsecurity, but will not intercept it
in inode_getxattr.  This results in -ENODATA for a getxattr call for an
xattr returned by listxattr.

This situation was manifested as overlayfs failure to copy up lower
files from squashfs when selinux is built-in but not initialized,
because ovl_copy_xattr() iterates the lower inode xattrs by
vfs_listxattr() and vfs_getxattr().

ovl_copy_xattr() skips copy up of security labels that are indentified by
inode_copy_up_xattr LSM hooks, but it does that after vfs_getxattr().
Since we are not going to copy them, skip vfs_getxattr() of the security
labels.

Reported-by: Michael Labriola <michael.d.labriola@gmail.com>
Tested-by: Michael Labriola <michael.d.labriola@gmail.com>
Link: https://lore.kernel.org/linux-unionfs/2nv9d47zt7.fsf@aldarion.sourceruckus.org/
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
2021-01-28 10:22:48 +01:00
..
copy_up.c ovl: skip getxattr of security labels 2021-01-28 10:22:48 +01:00
dir.c ovl: fix dentry leak in ovl_get_redirect 2021-01-28 10:22:48 +01:00
export.c ovl: propagate ovl_fs to ovl_decode_real_fh and ovl_encode_real_fh 2020-11-12 11:31:55 +01:00
file.c ovl: do not fail because of O_NOATIME 2020-12-14 15:26:14 +01:00
inode.c ovl: perform vfs_getxattr() with mounter creds 2021-01-28 10:22:48 +01:00
Kconfig docs: fix broken references to text files 2020-04-20 15:35:59 -06:00
Makefile treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
namei.c ovl: check privs before decoding file handle 2020-12-14 15:26:14 +01:00
overlayfs.h ovl: user xattr 2020-12-14 15:26:14 +01:00
ovl_entry.h ovl: user xattr 2020-12-14 15:26:14 +01:00
readdir.c ovl: avoid deadlock on directory ioctl 2021-01-28 10:22:48 +01:00
super.c ovl: add warning on user_ns mismatch 2021-01-28 10:22:48 +01:00
util.c ovl: do not get metacopy for userxattr 2020-12-14 15:26:14 +01:00