CVE-2026-139677: kernfs: don't hold kernfs_rwsem across dir_emit()

Published Nov 30, 2026
·
Updated

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

kernfs: don't hold kernfsrwsem across diremit()

kernfsfopreaddir() holds kernfsrwsem for reading across the whole listing, diremit() included. diremit() copies to userspace, so it can fault into reclaim while holding the lock that every create, remove and rename in the hierarchy needs. sysfs and cgroupfs have one per machine.

Under memory pressure the monitoring daemons fault on their own getdents(2) buffer with it held:

below: page allocation stall for 120 secs: order:0, mode:0x140dca(GFPHIGHUSERMOVABLE|GFPZERO|GFPCOMP) nodemask=(null),cpuset=hostcritical.slice,memsallowed=0 Call Trace: <TASK> dumpstacklvl+0x5d/0x80 allocfrozenpagesnoprof+0x5f4d/0x6300 ? memcglistlrualloc+0x73/0x320 ? imafilecheck+0xd0/0x7d0 vmaallocfolionoprof+0x145/0x560 handlemmfault+0x17c9/0x2720 ? findvma+0x27/0x30 douseraddrfault+0x39f/0x6e0 excpagefault+0x8f/0x110 asmexcpagefault+0x22/0x30 RIP: 0010:filldir64+0xd7/0x1a0 [Code:/RSP:/RAX:..R15: register block elided] kernfsfopreaddir+0x2de/0x420 iteratedir+0x8c/0x1f0 sesysgetdents64+0x61/0xe0 ? copypagefromiter+0x860/0x860 dosyscall64+0x6a/0x250 entrySYSCALL64afterhwframe+0x4b/0x53 </TASK>

Commit 9aab10a0249e ("kernfs: Don't re-lock kernfsroot::kernfsrwsem in kernfsfopreaddir().") took the lock drop out because diremit() was handed kernfsnode::name, which a rename can free. The previous patch emits a copy instead, so drop the lock around diremit().

A listing is no longer atomic within one getdents(2) call, which for most sysfs and cgroup directories is all of it. POSIX leaves that unspecified for an entry added or removed since opendir(3).

Affected Software

1 affected component
Linux Linux kernel

Event History

Nov 30, 2026
CVE Published
via MITRE·01:36 PM
Data Sourced
via MITRE·01:36 PM
Description

Frequently Asked Questions

1

Which systems are most exposed to this issue?

Systems using sysfs or cgroupfs are affected by the relevant kernfs hierarchy behavior. The described failure is most likely under memory pressure when monitoring daemons list these filesystems with getdents(2).

2

What is the likely operational impact?

A userspace directory listing can fault while kernfs_rwsem is held, blocking create, remove, and rename operations in the affected hierarchy. The report shows page-allocation stalls lasting 120 seconds during kernfs_fop_readdir().

3

Is a mitigation provided for systems that cannot immediately apply the fix?

No alternative mitigation is described. The provided references are stable kernel commits resolving the locking issue.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203