[PATCH 2/2] ns: don't call the namespace LSM hooks for kernel-internal namespaces

sashiko-bot at kernel.org sashiko-bot at kernel.org
Fri Nov 20 12:33:55 UTC 2026


> mount_subtree() allocates a private anonymous mount namespace so that
> automounts triggered while it looks up the path have somewhere to go.
> That namespace never becomes anyone's namespace and it's gone again
> before mount_subtree() returns. btrfs goes through it on every mount:
> 
>   btrfs_get_tree()
>   -> btrfs_get_tree_subvol()
>      -> mount_subvol()
>         -> mount_subtree()
> 
> and NFS on every NFSv4 mount and whenever it follows a referral:
> 
>   nfs4_try_get_tree() / nfs4_get_referral_tree()
>   -> do_nfs4_mount()
>      -> mount_subtree()
> [ ... ]
> 
> Fixes: f675d2e95569 ("lsm: add LSM blob and hooks for namespaces")
> Reported-by: Zhiqi Zhang <zhiqizhangg at gmail.com>
> Closes: https://lore.kernel.org/20261114141323.19029-1-zhiqizhangg@gmail.com
> Signed-off-by: Christian Brauner (Amutable) <brauner at kernel.org>

Sashiko has reviewed this patch and found no issues.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261120-work-ns-mount_subtree-v1-0-06337377f94a@kernel.org?part=2




More information about the Linux-security-module-archive mailing list