diff options
| author | Christian Brauner <brauner@kernel.org> | 2026-10-02 15:52:44 +0200 |
|---|---|---|
| committer | Christian Brauner <brauner@kernel.org> | 2026-10-04 12:31:40 +0200 |
| commit | 67b69b8a6ea730b1ee8fe682bd22b9b7fd5d9820 (patch) | |
| tree | 3c08f22f8c601affabda439e0714e0a2f5598732 /scripts/Makefile.thinlto | |
| parent | 39796254f4458a532dcef8197ec84b7c80ad2b18 (diff) | |
| download | linux-next-67b69b8a6ea730b1ee8fe682bd22b9b7fd5d9820.tar.gz linux-next-67b69b8a6ea730b1ee8fe682bd22b9b7fd5d9820.zip | |
fhandle: decide the subtree check under mount_lock
may_decode_fh() lets a caller who is privileged over the mount
namespace of @root decode handles below @root->dentry as long as the
mount is mounted and no locked child covers something below it. The
three parts are read one after the other without a lock: is_mounted()
and capable_wrt_mount() read ->mnt_ns and has_locked_children() walks
->mnt_mounts under a mount_lock of its own.
Today the gaps are harmless. A lazy umount in between clears ->mnt_ns,
but the locked children stay attached to their unmounted parent, so the
walk still finds them and the decode is refused either way. The
following patches detach every unmounted mount from its parent. Then
an umount between is_mounted() and the walk makes the walk come back
empty and the caller decodes into what a locked child covered.
So take mount_lock once and answer all three questions under it.
is_mounted() is stable there, umount_tree() clears ->mnt_ns on the
write side, and a mounted mount still has its locked children on its
list. ns_capable() under the spinlock is fine, generic_permission()
calls it in RCU walk already. has_locked_children() loses its locking
wrapper, its other callers hold namespace_sem or mount_lock anyway.
Link: https://patch.msgid.link/20261002-work-mount-fixes-4-v1-13-dd44b89d44ce@kernel.org
Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
Diffstat (limited to 'scripts/Makefile.thinlto')
0 files changed, 0 insertions, 0 deletions
