[PATCH] ns: skip namespace_init LSM hook for internal namespaces

Christian Brauner brauner at kernel.org
Fri Nov 20 12:32:49 UTC 2026


On Sat, Nov 14, 2026 at 10:13:23PM +0800, Zhiqi Zhang wrote:
> Skip LSM initialization for kernel-internal namespaces.
> __ns_common_init() gains an lsm parameter, and a new
> ns_common_init_inum_internal() passes false.  It is used by
> mount_subtree() only; user-visible namespace allocations (clone,
> unshare, setns, open_tree, fsmount) keep calling the hook.

Thanks for the report! I wrote a different fix that skips both
namespace_init and namespace_free for such namespaces so the two hooks
stay paired:

https://patch.msgid.link/20261120-work-ns-mount_subtree-v1-0-06337377f94a@kernel.org



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