linux-stable/fs/overlayfs
Amir Goldstein 4dfce60487 ovl: skip getxattr of security labels
[ Upstream commit 03fedf9359 ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2021-02-23 14:00:31 +01:00
..
Kconfig ovl: introduce the inodes index dir feature 2017-07-04 22:03:17 +02:00
Makefile
copy_up.c ovl: skip getxattr of security labels 2021-02-23 14:00:31 +01:00
dir.c ovl: fix dentry leak in ovl_get_redirect 2021-02-10 09:12:08 +01:00
inode.c ovl: perform vfs_getxattr() with mounter creds 2021-02-23 14:00:31 +01:00
namei.c ovl: fix error handling in ovl_verify_set_fh() 2018-11-21 09:24:04 +01:00
overlayfs.h ovl: fix format of setxattr debug 2018-10-10 08:54:27 +02:00
ovl_entry.h locking/barriers: Convert users of lockless_dereference() to READ_ONCE() 2017-12-25 14:26:21 +01:00
readdir.c ovl: fix wrong use of impure dir cache in ovl_iterate() 2018-09-09 19:55:58 +02:00
super.c ovl: Sync upper dirty data when syncing overlayfs 2018-08-03 07:50:43 +02:00
util.c ovl: fix memory leak on unlink of indexed file 2018-10-10 08:54:27 +02:00