Skip to content

Commit 05af250

Browse files
author
CKI KWF Bot
committed
Merge: CVE-2025-38499: clone_private_mnt(): make sure that caller has CAP_SYS_ADMIN in the right userns
MR: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-9/-/merge_requests/7611 JIRA: https://issues.redhat.com/browse/RHEL-129257 CVE: CVE-2025-38499 ``` commit c28f922 Author: Al Viro <viro@zeniv.linux.org.uk> Date: Sun Jun 1 20:11:06 2025 -0400 clone_private_mnt(): make sure that caller has CAP_SYS_ADMIN in the right userns What we want is to verify there is that clone won't expose something hidden by a mount we wouldn't be able to undo. "Wouldn't be able to undo" may be a result of MNT_LOCKED on a child, but it may also come from lacking admin rights in the userns of the namespace mount belongs to. clone_private_mnt() checks the former, but not the latter. There's a number of rather confusing CAP_SYS_ADMIN checks in various userns during the mount, especially with the new mount API; they serve different purposes and in case of clone_private_mnt() they usually, but not always end up covering the missing check mentioned above. Reviewed-by: Christian Brauner <brauner@kernel.org> Reported-by: "Orlando, Noah" <Noah.Orlando@deshaw.com> Fixes: 427215d ("ovl: prevent private clone if bind mount is not allowed") Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> ``` Signed-off-by: CKI Backport Bot <cki-ci-bot+cki-gitlab-backport-bot@redhat.com> Signed-off-by: Abhi Das <adas@redhat.com> --- <small>Created 2025-11-18 13:54 UTC by backporter - [KWF FAQ](https://red.ht/kernel_workflow_doc) - [Slack #team-kernel-workflow](https://redhat-internal.slack.com/archives/C04LRUPMJQ5) - [Source](https://gitlab.com/cki-project/kernel-workflow/-/blob/main/webhook/utils/backporter.py) - [Documentation](https://gitlab.com/cki-project/kernel-workflow/-/blob/main/docs/README.backporter.md) - [Report an issue](https://issues.redhat.com/secure/CreateIssueDetails!init.jspa?pid=12334433&issuetype=1&priority=4&summary=backporter+webhook+issue&components=kernel-workflow+/+backporter)</small> Approved-by: Abhi Das <adas@redhat.com> Approved-by: Bruno Meneguele <bmeneg@redhat.com> Approved-by: CKI KWF Bot <cki-ci-bot+kwf-gitlab-com@redhat.com> Merged-by: CKI GitLab Kmaint Pipeline Bot <26919896-cki-kmaint-pipeline-bot@users.noreply.gitlab.com>
2 parents 6e12a72 + 65dfbbb commit 05af250

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

fs/namespace.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2013,6 +2013,11 @@ struct vfsmount *clone_private_mount(const struct path *path)
20132013
if (!check_mnt(old_mnt))
20142014
goto invalid;
20152015

2016+
if (!ns_capable(old_mnt->mnt_ns->user_ns, CAP_SYS_ADMIN)) {
2017+
up_read(&namespace_sem);
2018+
return ERR_PTR(-EPERM);
2019+
}
2020+
20162021
if (__has_locked_children(old_mnt, path->dentry))
20172022
goto invalid;
20182023

0 commit comments

Comments
 (0)