summaryrefslogtreecommitdiff
path: root/tools/perf/scripts/python/stackcollapse.py
diff options
context:
space:
mode:
authorChristian Brauner <brauner@kernel.org>2026-09-26 15:44:28 +0200
committerChristian Brauner <brauner@kernel.org>2026-09-26 15:47:41 +0200
commit08f4288a37ef4b3d19b4a9599ec3048219cac828 (patch)
tree111da91b60b730c92f4e46fe8516c4613060c145 /tools/perf/scripts/python/stackcollapse.py
parent8bacbf6be959973b28b691713a872c12eae69eec (diff)
downloadlinux-08f4288a37ef4b3d19b4a9599ec3048219cac828.tar.gz
linux-08f4288a37ef4b3d19b4a9599ec3048219cac828.zip
namespace: check the target before walking it in do_mount_setattr()
When mount_setattr() changes the propagation type to MS_SHARED do_mount_setattr() takes namespace_sem and calls invent_group_ids() which walks the whole target tree with next_mnt() and allocates a peer group id for every mount that doesn't have one. Whether the caller may touch the target at all is only checked afterwards under mount_lock. If it may not, cleanup_group_ids() walks the tree a second time on the way out to free the ids again. A detached tree that a file descriptor keeps alive, a mount in another mount namespace or a mount below the root of an anonymous mount namespace does a bunch of allocation work that is completely useless because it will fail and revert right after. Do the right thing and check the target right after taking namespace_sem instead. A mount leaves its namespace only under namespace_sem so the mount stays stable. The check under mount_lock stays for the case where no propagation change is requested and namespace_sem isn't taken. Callers get the same EINVAL as before. Fixes: 2a1867219c7b ("fs: add mount_setattr()") Cc: stable@vger.kernel.org Link: https://patch.msgid.link/20260926-work-mount-fixes-2-v1-5-f357abf3d17b@kernel.org Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
Diffstat (limited to 'tools/perf/scripts/python/stackcollapse.py')
0 files changed, 0 insertions, 0 deletions