Commit 770afc6e authored by Seth Forshee's avatar Seth Forshee Committed by Greg Kroah-Hartman
Browse files

fs: require CAP_SYS_ADMIN in target namespace for idmapped mounts



[ Upstream commit bf1ac16e ]

Idmapped mounts should not allow a user to map file ownsership into a
range of ids which is not under the control of that user. However, we
currently don't check whether the mounter is privileged wrt to the
target user namespace.

Currently no FS_USERNS_MOUNT filesystems support idmapped mounts, thus
this is not a problem as only CAP_SYS_ADMIN in init_user_ns is allowed
to set up idmapped mounts. But this could change in the future, so add a
check to refuse to create idmapped mounts when the mounter does not have
CAP_SYS_ADMIN in the target user namespace.

Fixes: bd303368 ("fs: support mapped mounts of mapped filesystems")
Signed-off-by: default avatarSeth Forshee <sforshee@digitalocean.com>
Reviewed-by: default avatarChristian Brauner (Microsoft) <brauner@kernel.org>
Link: https://lore.kernel.org/r/20220816164752.2595240-1-sforshee@digitalocean.com


Signed-off-by: default avatarChristian Brauner (Microsoft) <brauner@kernel.org>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 96f2758a
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment