diff options
| author | Christian Brauner <brauner@kernel.org> | 2026-09-26 15:44:24 +0200 |
|---|---|---|
| committer | Christian Brauner <brauner@kernel.org> | 2026-09-26 15:47:40 +0200 |
| commit | 476ef286a7a5db8bda51325dc0c45887b4d99d9a (patch) | |
| tree | e7d7b466a19d6c880f87b08b2b8f4154a62aa954 /tools/perf/scripts/python/stackcollapse.py | |
| parent | 762a6411a5a7aa4119570bae590662312ccb4be3 (diff) | |
| download | linux-476ef286a7a5db8bda51325dc0c45887b4d99d9a.tar.gz linux-476ef286a7a5db8bda51325dc0c45887b4d99d9a.zip | |
namespace: reset the old parent's ->overmount in mnt_change_mountpoint()
__umount_mnt() resets ->overmount of the parent when it unmounts the
mount that overmounts it. mnt_change_mountpoint() doesn't. It moves the
mount to its new parent and leaves the old one pointing at it.
For a mount that is moved beneath in attach_recursive_mnt() that doesn't
matter. The new mount has already reset ->overmount of the old parent by
the time the old top mount is moved onto it.
It matters for reparent() though. propagate_umount() moves a surviving
overmount onto the first ancestor that isn't going to be unmounted. The
mount it was taken from is unmounted immediately afterwards. If a file
descriptor keeps that unmounted mount alive ->overmount points at the
moved mount. That's a dangling pointer and UAF as the moved mount is
unmounted and freed.
do_lock_mount() follows ->overmount from the target path under
mount_lock. With a file descriptor on such a mount as the target of a
mount beneath topmost_overmount() walks into the freed mount and
do_lock_mount() takes references on whatever it finds there.
So reset ->overmount of the old parent in mnt_change_mountpoint() the
same way __umount_mnt() does. A mount's ->overmount is then always a
mount that is attached to it.
Fixes: ffdc52fbbd58 ("prevent mount hash conflicts")
Cc: stable@vger.kernel.org # v6.17+
Link: https://patch.msgid.link/20260926-work-mount-fixes-2-v1-1-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
