{"id":"CVE-2026-139547","state":"PUBLISHED","title":"bpf: arena: Allocate the fault-in page outside the lock","description":"In the Linux kernel, the following vulnerability has been resolved:\n\nbpf: arena: Allocate the fault-in page outside the lock\n\narena_vm_fault() allocated the page while holding arena->spinlock, so it\ncould only use the non-blocking allocator, which never reclaims. Once the\nmemcg is at memory.max that allocation just fails, the fault turns into\nVM_FAULT_SIGSEGV, and the process gets a SIGSEGV on a perfectly valid\narena address. Hitting memory.max is routine (e.g. page cache from\nreading a big file), so this kills innocent processes over memory that\nreclaim could have freed.\n\nRework the fault handler:\n\n- Preallocate the page before taking the lock, like do_anonymous_page()\n  does, so it can sleep and reclaim, instead of turning a routine\n  memory.max into a fake segfault. The allocation uses\n  __GFP_RETRY_MAYFAIL so it never invokes the OOM killer: the page is\n  charged to the map's memcg, which need not be the faulting task's, so\n  an OOM there could kill unrelated tasks in the map's cgroup while a\n  foreign faulter could never be its victim. map->numa_node is always\n  NUMA_NO_NODE for an arena (BPF_F_NUMA_NODE is rejected), so the page\n  comes from the local node, as before.\n\n- On allocation failure fall through to the locked recheck rather than\n  failing right away: a page a concurrent allocator installed meanwhile\n  is used, otherwise the non-blocking fallback fails and we return\n  VM_FAULT_SIGBUS. Not VM_FAULT_OOM: nothing ran the OOM killer, and the\n  fault path would just retry it forever.\n\n- A lockless probe skips that preallocation when a page is already mapped\n  (e.g. allocated by the bpf program), so the common case wastes no\n  allocation. The rare race where such a page is freed before we take the\n  lock falls back to the non-blocking allocator under the lock.\n\n- Return VM_FAULT_SIGBUS for the other non-recoverable errors\n  (allocation, range-tree and page-table failures) instead of\n  VM_FAULT_SIGSEGV; the lock failure already did. Only\n  BPF_F_SEGV_ON_FAULT, and a scratch-page hole under that flag, is a\n  real user addressing error and keeps VM_FAULT_SIGSEGV.\n\n- Tidy up the error labels.","publishedAt":"2026-11-30T13:35:46.285Z","updatedAt":"2026-11-30T13:35:46.285Z","severity":null,"assigner":"Linux","products":["Linux Linux"],"affected":[{"vendor":"Linux","product":"Linux","defaultStatus":"unaffected","versions":[{"version":"1da177e4c3f41524e886b7f1b8a0c1fc7321cac2","status":"affected","lessThan":"321b0dc5e8ad65ed5a2400000702071b86cbfc2c","versionType":"git"},{"version":"1da177e4c3f41524e886b7f1b8a0c1fc7321cac2","status":"affected","lessThan":"c7cd8be3d72f9b03454424fff31542b8a0122437","versionType":"git"},{"version":"0","status":"affected","lessThan":"7.3.6","versionType":"semver"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["kernel/bpf/arena.c"]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","versions":[{"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":["kernel/bpf/arena.c"]}],"references":["https://git.kernel.org/stable/c/321b0dc5e8ad65ed5a2400000702071b86cbfc2c","https://git.kernel.org/stable/c/c7cd8be3d72f9b03454424fff31542b8a0122437"],"weaknesses":[],"ingestedAt":"2026-11-30T13:52:04.503Z","source":{"repository":"CVEProject/cvelistV5","path":"cves/2026/139xxx/CVE-2026-139547.json","commit":"8c2c22940a0de21d18737df980299c0488d5dc73","baselineCommit":"556c9d3a8cd17e218bb8e452ba7cd619a384ff47"},"raw":{"dataType":"CVE_RECORD","dataVersion":"5.2","cveMetadata":{"cveId":"CVE-2026-139547","state":"PUBLISHED","datePublished":"2026-11-30T13:35:46.285Z","dateUpdated":"2026-11-30T13:35:46.285Z","assignerShortName":"Linux","assignerOrgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateReserved":"2026-11-30T13:22:15.939Z"},"containers":{"cna":{"title":"bpf: arena: Allocate the fault-in page outside the lock","descriptions":[{"lang":"en","value":"In the Linux kernel, the following vulnerability has been resolved:\n\nbpf: arena: Allocate the fault-in page outside the lock\n\narena_vm_fault() allocated the page while holding arena->spinlock, so it\ncould only use the non-blocking allocator, which never reclaims. Once the\nmemcg is at memory.max that allocation just fails, the fault turns into\nVM_FAULT_SIGSEGV, and the process gets a SIGSEGV on a perfectly valid\narena address. Hitting memory.max is routine (e.g. page cache from\nreading a big file), so this kills innocent processes over memory that\nreclaim could have freed.\n\nRework the fault handler:\n\n- Preallocate the page before taking the lock, like do_anonymous_page()\n  does, so it can sleep and reclaim, instead of turning a routine\n  memory.max into a fake segfault. The allocation uses\n  __GFP_RETRY_MAYFAIL so it never invokes the OOM killer: the page is\n  charged to the map's memcg, which need not be the faulting task's, so\n  an OOM there could kill unrelated tasks in the map's cgroup while a\n  foreign faulter could never be its victim. map->numa_node is always\n  NUMA_NO_NODE for an arena (BPF_F_NUMA_NODE is rejected), so the page\n  comes from the local node, as before.\n\n- On allocation failure fall through to the locked recheck rather than\n  failing right away: a page a concurrent allocator installed meanwhile\n  is used, otherwise the non-blocking fallback fails and we return\n  VM_FAULT_SIGBUS. Not VM_FAULT_OOM: nothing ran the OOM killer, and the\n  fault path would just retry it forever.\n\n- A lockless probe skips that preallocation when a page is already mapped\n  (e.g. allocated by the bpf program), so the common case wastes no\n  allocation. The rare race where such a page is freed before we take the\n  lock falls back to the non-blocking allocator under the lock.\n\n- Return VM_FAULT_SIGBUS for the other non-recoverable errors\n  (allocation, range-tree and page-table failures) instead of\n  VM_FAULT_SIGSEGV; the lock failure already did. Only\n  BPF_F_SEGV_ON_FAULT, and a scratch-page hole under that flag, is a\n  real user addressing error and keeps VM_FAULT_SIGSEGV.\n\n- Tidy up the error labels."}],"affected":[{"vendor":"Linux","product":"Linux","defaultStatus":"unaffected","versions":[{"version":"1da177e4c3f41524e886b7f1b8a0c1fc7321cac2","status":"affected","lessThan":"321b0dc5e8ad65ed5a2400000702071b86cbfc2c","versionType":"git"},{"version":"1da177e4c3f41524e886b7f1b8a0c1fc7321cac2","status":"affected","lessThan":"c7cd8be3d72f9b03454424fff31542b8a0122437","versionType":"git"},{"version":"0","status":"affected","lessThan":"7.3.6","versionType":"semver"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["kernel/bpf/arena.c"]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","versions":[{"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":["kernel/bpf/arena.c"]}],"references":[{"url":"https://git.kernel.org/stable/c/321b0dc5e8ad65ed5a2400000702071b86cbfc2c"},{"url":"https://git.kernel.org/stable/c/c7cd8be3d72f9b03454424fff31542b8a0122437"}],"providerMetadata":{"shortName":"Linux","orgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateUpdated":"2026-11-30T13:35:46.285Z"},"cpeApplicability":[{"nodes":[{"operator":"OR","negate":false,"cpeMatch":[{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionEndExcluding":"7.3.6"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionEndExcluding":"7.4-rc1"}]}]}],"x_generator":{"engine":"bippy-1.2.0"}}}}}