linux/fs/overlayfs
Miklos Szeredi 4f11ada10d ovl: fail on invalid uid/gid mapping at copy up
If st_uid/st_gid doesn't have a mapping in the mounter's user_ns, then
copy-up should fail, just like it would fail if the mounter task was doing
the copy using "cp -a".

There's a corner case where the "cp -a" would succeed but copy up fail: if
there's a mapping of the invalid uid/gid (65534 by default) in the user
namespace.  This is because stat(2) will return this value if the mapping
doesn't exist in the current user_ns and "cp -a" will in turn be able to
create a file with this uid/gid.

This behavior would be inconsistent with POSIX ACL's, which return -1 for
invalid uid/gid which result in a failed copy.

For consistency and simplicity fail the copy of the st_uid/st_gid are
invalid.

Fixes: 459c7c565a ("ovl: unprivieged mounts")
Cc: <stable@vger.kernel.org> # v5.11
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Reviewed-by: Christian Brauner <brauner@kernel.org>
Reviewed-by: Seth Forshee <sforshee@kernel.org>
2023-01-27 16:17:19 +01:00
..
copy_up.c ovl: fail on invalid uid/gid mapping at copy up 2023-01-27 16:17:19 +01:00
dir.c overlayfs update for 6.2 2022-12-12 20:18:26 -08:00
export.c ovl: do not reconnect upper index records in ovl_indexdir_cleanup() 2022-12-08 10:49:46 +01:00
file.c overlayfs update for 6.2 2022-12-12 20:18:26 -08:00
inode.c ovl: call posix_acl_release() after error checking 2022-11-03 08:18:46 +01:00
Kconfig ovl: Kconfig: Fix spelling mistake "undelying" -> "underlying" 2022-12-08 10:49:46 +01:00
Makefile treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
namei.c ovl: Add comment on upperredirect reassignment 2022-12-08 10:49:46 +01:00
overlayfs.h overlayfs update for 6.2 2022-12-12 20:18:26 -08:00
ovl_entry.h ovl: support idmapped layers 2022-04-28 16:31:12 +02:00
readdir.c ovl: use inode instead of dentry where possible 2022-12-08 10:49:46 +01:00
super.c overlayfs update for 6.2 2022-12-12 20:18:26 -08:00
util.c ovl: use inode instead of dentry where possible 2022-12-08 10:49:46 +01:00