{"id":"CVE-2026-139678","state":"PUBLISHED","title":"kernfs: don't hold kernfs_rwsem across notification delivery","description":"In the Linux kernel, the following vulnerability has been resolved:\n\nkernfs: don't hold kernfs_rwsem across notification delivery\n\nRecently at Meta we noticed that on multi-tenant systems, a workload\nunder extreme memory pressure negatively impacts unrelated workloads and\nsystem daemons like below [1] and fb-oomd [2]. Mainly we observed that\nsystem daemons were stuck on kernfs_rwsem in cgroup-related interfaces\nfor long periods of time.\n\nOn further inspection, we found that the workload under pressure had\nregistered inotify watches on its memory.events and was continuously\nreceiving limit-hitting notifications. The cgroup notification is done in\nkernfs_notify_workfn(), which holds kernfs_supers_rwsem and kernfs_rwsem\nand calls fsnotify(), which allocates the event with\nkmalloc(GFP_KERNEL_ACCOUNT|__GFP_RETRY_MAYFAIL) charged to the watching\ncgroup, which is already under memory pressure. So the notify worker\nended up in memory reclaim of a cgroup already under pressure, and itself\nkept triggering the limit notifications.\n\nThis notification path takes the locks in read mode, but a waiting writer\nblocks all future readers. That is exactly what is happening in the Meta\nfleet, and it leaves daemons that are critical to the reliability of the\nsystem stuck for long periods of time.\n\nCommit 400188ae361a (\"kernfs: Acquire kernfs_rwsem in\nkernfs_notify_workfn().\") added kernfs_rwsem just to safely read\nkernfs_node::name.  Let's sample the name once before the loop and drop\nthe lock.  kernfs_supers_rwsem still covers the list, and the removal\npaths take that one for reading too, so a stalled worker can still hold\na removal up once a mount or unmount is queued behind it.\n\nTwo things change for a watcher.  A name longer than NAME_MAX now gives\nan event with no name, where before it gave one with the full name;\nfsnotify() takes the name as optional, so the event still arrives.  And\nthe name and the parent are no longer sampled under one lock, so a rename\nbetween the two would name a file against the directory it moved to.\nThat cannot happen today: kernfs_notify() rejects anything that is not a\nfile, and no caller of kernfs_rename_ns() renames one.\n\n[1] https://github.com/facebookincubator/below\n[2] https://github.com/facebookincubator/oomd","publishedAt":"2026-11-30T13:36:58.178Z","updatedAt":"2026-11-30T13:36:58.178Z","severity":null,"assigner":"Linux","products":["Linux Linux"],"affected":[{"vendor":"Linux","product":"Linux","defaultStatus":"unaffected","versions":[{"version":"400188ae361a9d9a72a47a6cedaf2d2efcc84aa8","status":"affected","lessThan":"58d538ea9c854973999314a33a548c87743d1c18","versionType":"git"},{"version":"400188ae361a9d9a72a47a6cedaf2d2efcc84aa8","status":"affected","lessThan":"576c326a41e235b0c7fa916201ff8e4637b96e57","versionType":"git"},{"version":"400188ae361a9d9a72a47a6cedaf2d2efcc84aa8","status":"affected","lessThan":"23985e2b1f31623468244a2149b2388cda4925eb","versionType":"git"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["fs/kernfs/file.c"]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","versions":[{"version":"6.15","status":"affected"},{"version":"0","status":"unaffected","lessThan":"6.15","versionType":"semver"},{"version":"6.18.65","status":"unaffected","lessThanOrEqual":"6.18.*","versionType":"semver"},{"version":"7.3.6","status":"unaffected","lessThanOrEqual":"7.3.*","versionType":"semver"},{"version":"7.4-rc1","status":"unaffected","lessThanOrEqual":"*","versionType":"original_commit_for_fix"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["fs/kernfs/file.c"]}],"references":["https://git.kernel.org/stable/c/58d538ea9c854973999314a33a548c87743d1c18","https://git.kernel.org/stable/c/576c326a41e235b0c7fa916201ff8e4637b96e57","https://git.kernel.org/stable/c/23985e2b1f31623468244a2149b2388cda4925eb"],"weaknesses":[],"ingestedAt":"2026-11-30T13:54:04.526Z","source":{"repository":"CVEProject/cvelistV5","path":"cves/2026/139xxx/CVE-2026-139678.json","commit":"8c2c22940a0de21d18737df980299c0488d5dc73","baselineCommit":"556c9d3a8cd17e218bb8e452ba7cd619a384ff47"},"raw":{"dataType":"CVE_RECORD","dataVersion":"5.2","cveMetadata":{"cveId":"CVE-2026-139678","state":"PUBLISHED","datePublished":"2026-11-30T13:36:58.178Z","dateUpdated":"2026-11-30T13:36:58.178Z","assignerShortName":"Linux","assignerOrgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateReserved":"2026-11-30T13:22:15.947Z"},"containers":{"cna":{"title":"kernfs: don't hold kernfs_rwsem across notification delivery","descriptions":[{"lang":"en","value":"In the Linux kernel, the following vulnerability has been resolved:\n\nkernfs: don't hold kernfs_rwsem across notification delivery\n\nRecently at Meta we noticed that on multi-tenant systems, a workload\nunder extreme memory pressure negatively impacts unrelated workloads and\nsystem daemons like below [1] and fb-oomd [2]. Mainly we observed that\nsystem daemons were stuck on kernfs_rwsem in cgroup-related interfaces\nfor long periods of time.\n\nOn further inspection, we found that the workload under pressure had\nregistered inotify watches on its memory.events and was continuously\nreceiving limit-hitting notifications. The cgroup notification is done in\nkernfs_notify_workfn(), which holds kernfs_supers_rwsem and kernfs_rwsem\nand calls fsnotify(), which allocates the event with\nkmalloc(GFP_KERNEL_ACCOUNT|__GFP_RETRY_MAYFAIL) charged to the watching\ncgroup, which is already under memory pressure. So the notify worker\nended up in memory reclaim of a cgroup already under pressure, and itself\nkept triggering the limit notifications.\n\nThis notification path takes the locks in read mode, but a waiting writer\nblocks all future readers. That is exactly what is happening in the Meta\nfleet, and it leaves daemons that are critical to the reliability of the\nsystem stuck for long periods of time.\n\nCommit 400188ae361a (\"kernfs: Acquire kernfs_rwsem in\nkernfs_notify_workfn().\") added kernfs_rwsem just to safely read\nkernfs_node::name.  Let's sample the name once before the loop and drop\nthe lock.  kernfs_supers_rwsem still covers the list, and the removal\npaths take that one for reading too, so a stalled worker can still hold\na removal up once a mount or unmount is queued behind it.\n\nTwo things change for a watcher.  A name longer than NAME_MAX now gives\nan event with no name, where before it gave one with the full name;\nfsnotify() takes the name as optional, so the event still arrives.  And\nthe name and the parent are no longer sampled under one lock, so a rename\nbetween the two would name a file against the directory it moved to.\nThat cannot happen today: kernfs_notify() rejects anything that is not a\nfile, and no caller of kernfs_rename_ns() renames one.\n\n[1] https://github.com/facebookincubator/below\n[2] https://github.com/facebookincubator/oomd"}],"affected":[{"vendor":"Linux","product":"Linux","defaultStatus":"unaffected","versions":[{"version":"400188ae361a9d9a72a47a6cedaf2d2efcc84aa8","status":"affected","lessThan":"58d538ea9c854973999314a33a548c87743d1c18","versionType":"git"},{"version":"400188ae361a9d9a72a47a6cedaf2d2efcc84aa8","status":"affected","lessThan":"576c326a41e235b0c7fa916201ff8e4637b96e57","versionType":"git"},{"version":"400188ae361a9d9a72a47a6cedaf2d2efcc84aa8","status":"affected","lessThan":"23985e2b1f31623468244a2149b2388cda4925eb","versionType":"git"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["fs/kernfs/file.c"]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","versions":[{"version":"6.15","status":"affected"},{"version":"0","status":"unaffected","lessThan":"6.15","versionType":"semver"},{"version":"6.18.65","status":"unaffected","lessThanOrEqual":"6.18.*","versionType":"semver"},{"version":"7.3.6","status":"unaffected","lessThanOrEqual":"7.3.*","versionType":"semver"},{"version":"7.4-rc1","status":"unaffected","lessThanOrEqual":"*","versionType":"original_commit_for_fix"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["fs/kernfs/file.c"]}],"references":[{"url":"https://git.kernel.org/stable/c/58d538ea9c854973999314a33a548c87743d1c18"},{"url":"https://git.kernel.org/stable/c/576c326a41e235b0c7fa916201ff8e4637b96e57"},{"url":"https://git.kernel.org/stable/c/23985e2b1f31623468244a2149b2388cda4925eb"}],"providerMetadata":{"shortName":"Linux","orgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateUpdated":"2026-11-30T13:36:58.178Z"},"cpeApplicability":[{"nodes":[{"operator":"OR","negate":false,"cpeMatch":[{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"6.15","versionEndExcluding":"6.18.65"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"6.15","versionEndExcluding":"7.3.6"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"6.15","versionEndExcluding":"7.4-rc1"}]}]}],"x_generator":{"engine":"bippy-1.2.0"}}}}}