Kernel Kit / Infix / v26.10.0latest
CVE-2026-74342
—unknownlinux6.18.60 · 6.18.54 · 6.18.8 · 6.12.21in 4 of 4 releases
Not yet analysed by NVD. Matched on the vendor's record; this may change when NVD has analysed it.
Reach linux · 8 builds in 4 of 4 releases
full reviewcross-check✓ a member decided
Description · NVD
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: 00000000000000e0kernel log · 11 lines
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).
Published 2026-08-15NVD
The CVE is a regression introduced by commit 12e9e3cd03b5 ("simpe_xattr: use per-sb cache"), and that change is not in the 6.18.60 source this build uses. Here kernfs_xattr_set() and kernfs_xattr_get() still use the per-node attrs->xattrs and never call kernfs_root(kn), and there is no xa_cache anywhere in fs/kernfs, so the NULL dereference cannot occur.
Independently, the only trigger path is also absent: CONFIG_SECURITY is off, so security_kernfs_init_security() is an inline stub returning 0 and no SELinux objects were built.
I chose FALSE_POSITIVE over NOT_AFFECTED because the version match itself looks wrong, but NVD has published no range yet (status Received) and I could not read the upstream commits, so that is inferred from the source alone. Either way the build is not affected.
Evidence 10
`kernfs_xattr_set()` calls `kernfs_iattrs(kn)` and then `simple_xattr_set(&attrs->xattrs, ...)`; it does not call `kernfs_root(kn)`, so the faulting expression from the CVE does not exist here.
output/build/linux-6.18.60/fs/kernfs/inode.c:307-323
`kernfs_xattr_get()` likewise uses the per-node `attrs->xattrs` after `kernfs_iattrs_noalloc()`, with no root lookup.
output/build/linux-6.18.60/fs/kernfs/inode.c:297-305
`struct kernfs_iattrs` still embeds `struct simple_xattrs xattrs`. A grep for `xa_cache` in `fs/kernfs`, `include/linux/kernfs.h`, `include/linux/xattr.h` and `fs/xattr.c` returns nothing, so the per-sb cache change is absent.
output/build/linux-6.18.60/fs/kernfs/kernfs-internal.h:29
`__kernfs_new_node()` calls the LSM hook before the parent is linked (the pre-fix ordering), and has only `err_out1` to `err_out3`. The fix unwinds on an `err_out4` label, which suggests it targets a newer code base.
output/build/linux-6.18.60/fs/kernfs/dir.c:678-694
`kn->__parent` is assigned in `kernfs_new_node()` after `__kernfs_new_node()` returns. This ordering is harmless here because nothing in the hook path dereferences `kernfs_root(kn)`.
output/build/linux-6.18.60/fs/kernfs/dir.c:718-721
`# CONFIG_SECURITY is not set` (and `CONFIG_SECURITYFS` unset at 4317); only `CONFIG_DEFAULT_SECURITY_DAC=y` at 4320. No LSM, and so no SELinux, is built.
output/build/linux-6.18.60/.config:4316
With `CONFIG_SECURITY` off, `security_kernfs_init_security()` is a static inline stub returning 0, so `selinux_kernfs_init_security()` is never reached.
output/build/linux-6.18.60/include/linux/security.h:1124-1128
Zero entries match `security/selinux/`, confirming no SELinux objects were produced.
output/objects.txt
No `SECURITY` or `SELINUX` symbols are set in the kernel defconfig.
board/x86_64/linux_defconfig
No applied patch name matches `kernfs`, `xattr` or `selinux`, so the build neither backports the per-sb cache change nor carries the fix.
output/build/linux-6.18.60/.applied_patches_list
Version and patches
The source is 6.18.60 (output/build/linux-6.18.60/Makefile: VERSION 6, PATCHLEVEL 18, SUBLEVEL 60). The bug exists only in kernels that contain commit 12e9e3cd03b5 (per-sb simple_xattr cache); this tree does not, as shown by the absence of xa_cache and by kernfs_xattr_set() using attrs->xattrs. The fix commits 319b82e8b46e and 6cccc49b027c are not applied and are not needed. NVD has published no affected range, and I could not consult the upstream commits offline, so the range is inferred from the source.
Recommendation
Document as not applicable; no upgrade or backport is needed for this CVE.
Re-check if the kernel is later moved to a version that contains the per-sb simple_xattr cache (look for xa_cache in struct kernfs_root). Even then, the crash needs an LSM that implements kernfs_init_security (SELinux), which this build does not enable.
Open questions
The exact affected range from the kernel CNA record could not be confirmed from the tree: NVD lists none yet and the tree has no network access or kernel git history. If the CNA record turns out to list 6.18.y as affected (meaning 12e9e3cd03b5 was backported to a later 6.18 stable release), the conclusion for 6.18.60 still holds from the source, but the verdict label would more properly be NOT_AFFECTED.
One shell command was denied by the sandbox (a compound cd ... && grep); I re-ran the same searches without cd, so nothing was left unchecked.
Members of Kernel Kit decide. Sign in if you are one.