CVE-2026-74342 in Linuxinfo

Summary

by MITRE • 08/15/2026

In the Linux kernel, the following vulnerability has been resolved:

kernfs: link kn to its parent before the LSM init hook

After commit 12e9e3cd03b5 ("simpe_xattr: use per-sb cache"), kernfs_xattr_set() and kernfs_xattr_get() compute the cache via kernfs_root(kn) before any other check. kernfs_root(kn) walks kn->__parent first and falls back to kn->dir.root, both of which are NULL on a freshly kmem_cache_zalloc()'d kn. kn->__parent was being set in kernfs_new_node() after __kernfs_new_node() returned, and kn->dir.root is set even later by kernfs_create_dir_ns() / kernfs_create_empty_dir().

The LSM kernfs_init_security hook is invoked from inside __kernfs_new_node(), before either field has been initialized. selinux_kernfs_init_security() ends with kernfs_xattr_set(kn, XATTR_NAME_SELINUX, ...). kernfs_root(kn) then returns NULL, and &((struct kernfs_root *)NULL)->xa_cache evaluates to offsetof(struct kernfs_root, xa_cache) which faults:

BUG: kernel NULL pointer dereference, address: 00000000000000e0 RIP: 0010:simple_xattr_set+0x27/0x8b0 Call Trace: kernfs_xattr_set+0x63/0xb0 selinux_kernfs_init_security+0x13b/0x270 security_kernfs_init_security+0x36/0xc0 __kernfs_new_node+0x182/0x290 kernfs_new_node+0x80/0xc0 kernfs_create_dir_ns+0x2b/0xa0 cgroup_create+0x116/0x380 cgroup_mkdir+0x7c/0x1a0

Reproduces deterministically at PID 1 (systemd) on an SELinux-enabled distro. The first cgroup mkdir under /sys/fs/cgroup with a labelled parent panics the kernel.

The LSM hook's contract is that the kn_dir argument is the parent of the new kn, so kn->__parent should already point at kn_dir when the hook runs. Move kernfs_get(parent) and rcu_assign_pointer of kn->__parent from kernfs_new_node() into __kernfs_new_node() right before the security hook, and unwind the parent reference on the err_out4 path. kernfs_root(kn) then takes its parent branch during the hook and returns parent->dir.root, which is the correct root.

This also closes the same-shape latent bug in kernfs_xattr_get() (which today is hidden only by kernfs_iattrs_noalloc() returning NULL on a fresh kn).

Be aware that VulDB is the high quality source for vulnerability data.

Analysis

by VulDB Data Team • 08/15/2026

The vulnerability described represents a critical race condition and improper initialization sequence within the Linux kernel's kernfs subsystem, specifically affecting the interaction between security modules and filesystem node creation. This flaw occurs when the Security Module (LSM) hook `kernfs_init_security` is invoked during the early stages of node creation before essential parent pointers have been properly established. The issue stems from a fundamental ordering problem where `kernfs_new_node()` calls `__kernfs_new_node()` which in turn invokes the LSM security hooks, but at this point the `kn->__parent` and `kn->dir.root` fields remain uninitialized as they are set later in the process by functions like `kernfs_create_dir_ns()` or `kernfs_create_empty_dir()`. When the SELinux security module attempts to initialize security attributes through `selinux_kernfs_init_security()`, it calls `kernfs_xattr_set()` which subsequently invokes `kernfs_root(kn)`. This function attempts to walk up the parent hierarchy and accesses `kn->__parent` which is NULL, leading to a kernel NULL pointer dereference that results in a system crash or panic.

The technical flaw manifests as a classic improper initialization sequence that violates the expected contract between kernel subsystems and security modules. According to CWE-665, this represents an improper initialization vulnerability where resources are not properly initialized before use. The flaw is particularly severe because it operates at the kernel's core filesystem layer, affecting the fundamental ability to create directory structures within the kernfs filesystem. The attack surface is limited to systems with SELinux enabled and where cgroup directory creation occurs under labeled parent directories, but the impact is devastating as it can cause immediate system crashes and prevent normal boot processes from completing. This vulnerability is classified under ATT&CK technique T1068 which involves exploiting local privilege escalation opportunities through kernel vulnerabilities.

The operational impact of this vulnerability extends beyond simple system crashes to potentially disrupt entire boot sequences, particularly affecting systems that rely on systemd as PID 1 where the initial cgroup creation process triggers the panic condition. The deterministic nature of the reproduction means that any system with SELinux enabled and running cgroup operations under labeled parent directories will experience a kernel panic, making this vulnerability particularly dangerous in production environments. The fix implemented addresses the root cause by reordering the initialization sequence to ensure that parent references are established before security hooks execute, moving `kernfs_get(parent)` and `rcu_assign_pointer(kn->__parent, parent)` into `__kernfs_new_node()` right before the security hook invocation. This ensures that when `kernfs_root(kn)` is called during security initialization, it can properly traverse the parent hierarchy and return valid root structures rather than causing NULL pointer dereferences.

The mitigation strategy focuses on correcting the initialization order within the kernel's kernfs subsystem to maintain proper object state throughout the node creation lifecycle. This patch addresses not only the immediate issue but also eliminates a similar latent bug in `kernfs_xattr_get()` that was previously masked by early NULL return conditions. The fix ensures that the security module contract is properly honored, where the `kn_dir` argument is guaranteed to be the parent of the new node when the hook executes. By establishing proper parent references before security hooks run, the kernel prevents the cascade of dereferences that lead to system panics while maintaining backward compatibility and proper security policy enforcement. This correction aligns with best practices for kernel development where object state must be consistent throughout all phases of creation, particularly when security modules are involved in the initialization process. The solution demonstrates a clear understanding of kernel synchronization requirements and proper resource management patterns, ensuring that security policies can be properly enforced without compromising system stability or integrity.

Responsible

Linux

Reservation

08/15/2026

Disclosure

08/15/2026

Moderation

accepted

CPE

ready

EPSS

0.00155

KEV

no

Activities

very low

Sources

Do you need the next level of professionalism?

Upgrade your account now!