Amir Goldstein 116826d615 ovl: skip getxattr of security labels
[ Upstream commit 03fedf93593c82538b18476d8c4f0e8f8435ea70 ]

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-17 11:02:22 +01:00
..
2020-10-16 11:11:22 -07:00
2021-01-09 13:46:24 +01:00
2020-11-19 22:38:29 -05:00
2020-11-14 11:26:04 -08:00
2020-09-10 14:03:31 -07:00
2021-01-17 14:17:03 +01:00
2020-10-19 14:28:30 -07:00
\n
2020-10-15 15:03:10 -07:00
2020-08-04 21:02:38 -04:00
2020-09-22 23:45:57 -04:00
2020-07-31 08:16:01 +02:00
2020-10-23 11:33:41 -07:00
2021-01-27 11:55:29 +01:00
2020-10-23 11:33:41 -07:00
2020-07-31 08:16:00 +02:00
2020-10-24 12:40:18 -07:00
2020-09-26 22:55:05 -04:00
2020-08-27 16:06:47 -04:00
2020-07-31 08:16:01 +02:00