{"id":"CVE-2025-21851","state":"PUBLISHED","title":"bpf: Fix softlockup in arena_map_free on 64k page kernel","description":"In the Linux kernel, the following vulnerability has been resolved:\n\nbpf: Fix softlockup in arena_map_free on 64k page kernel\n\nOn an aarch64 kernel with CONFIG_PAGE_SIZE_64KB=y,\narena_htab tests cause a segmentation fault and soft lockup.\nThe same failure is not observed with 4k pages on aarch64.\n\nIt turns out arena_map_free() is calling\napply_to_existing_page_range() with the address returned by\nbpf_arena_get_kern_vm_start().  If this address is not page-aligned\nthe code ends up calling apply_to_pte_range() with that unaligned\naddress causing soft lockup.\n\nFix it by round up GUARD_SZ to PAGE_SIZE << 1 so that the\ndivision by 2 in bpf_arena_get_kern_vm_start() returns\na page-aligned value.","publishedAt":"2025-03-12T09:42:06.480Z","updatedAt":"2026-08-05T11:54:55.041Z","severity":{"score":7.8,"label":"High","version":"3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H","source":"Linux"},"assigner":"Linux","products":["Linux Linux"],"affected":[{"vendor":"Linux","product":"Linux","defaultStatus":"unaffected","versions":[{"version":"317460317a02a1af512697e6e964298dedd8a163","status":"affected","lessThan":"c1f3f3892d4526f18aaeffdb6068ce861e793ee3","versionType":"git"},{"version":"317460317a02a1af512697e6e964298dedd8a163","status":"affected","lessThan":"787d556a3de447e70964a4bdeba9196f62a62b1e","versionType":"git"},{"version":"317460317a02a1af512697e6e964298dedd8a163","status":"affected","lessThan":"517e8a7835e8cfb398a0aeb0133de50e31cae32b","versionType":"git"}],"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":"6.9","status":"affected"},{"version":"0","status":"unaffected","lessThan":"6.9","versionType":"semver"},{"version":"6.12.17","status":"unaffected","lessThanOrEqual":"6.12.*","versionType":"semver"},{"version":"6.13.5","status":"unaffected","lessThanOrEqual":"6.13.*","versionType":"semver"},{"version":"6.14","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/c1f3f3892d4526f18aaeffdb6068ce861e793ee3","https://git.kernel.org/stable/c/787d556a3de447e70964a4bdeba9196f62a62b1e","https://git.kernel.org/stable/c/517e8a7835e8cfb398a0aeb0133de50e31cae32b"],"weaknesses":["CWE-667"],"ingestedAt":"2026-10-29T20:08:39.238Z","source":{"repository":"CVEProject/cvelistV5","path":"cves/2025/21xxx/CVE-2025-21851.json","commit":"556c9d3a8cd17e218bb8e452ba7cd619a384ff47"},"raw":{"dataType":"CVE_RECORD","dataVersion":"5.2","cveMetadata":{"cveId":"CVE-2025-21851","state":"PUBLISHED","datePublished":"2025-03-12T09:42:06.480Z","dateUpdated":"2026-08-05T11:54:55.041Z","assignerShortName":"Linux","assignerOrgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateReserved":"2024-12-29T08:45:45.779Z"},"containers":{"cna":{"title":"bpf: Fix softlockup in arena_map_free on 64k page kernel","descriptions":[{"lang":"en","value":"In the Linux kernel, the following vulnerability has been resolved:\n\nbpf: Fix softlockup in arena_map_free on 64k page kernel\n\nOn an aarch64 kernel with CONFIG_PAGE_SIZE_64KB=y,\narena_htab tests cause a segmentation fault and soft lockup.\nThe same failure is not observed with 4k pages on aarch64.\n\nIt turns out arena_map_free() is calling\napply_to_existing_page_range() with the address returned by\nbpf_arena_get_kern_vm_start().  If this address is not page-aligned\nthe code ends up calling apply_to_pte_range() with that unaligned\naddress causing soft lockup.\n\nFix it by round up GUARD_SZ to PAGE_SIZE << 1 so that the\ndivision by 2 in bpf_arena_get_kern_vm_start() returns\na page-aligned value."}],"affected":[{"vendor":"Linux","product":"Linux","defaultStatus":"unaffected","versions":[{"version":"317460317a02a1af512697e6e964298dedd8a163","status":"affected","lessThan":"c1f3f3892d4526f18aaeffdb6068ce861e793ee3","versionType":"git"},{"version":"317460317a02a1af512697e6e964298dedd8a163","status":"affected","lessThan":"787d556a3de447e70964a4bdeba9196f62a62b1e","versionType":"git"},{"version":"317460317a02a1af512697e6e964298dedd8a163","status":"affected","lessThan":"517e8a7835e8cfb398a0aeb0133de50e31cae32b","versionType":"git"}],"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":"6.9","status":"affected"},{"version":"0","status":"unaffected","lessThan":"6.9","versionType":"semver"},{"version":"6.12.17","status":"unaffected","lessThanOrEqual":"6.12.*","versionType":"semver"},{"version":"6.13.5","status":"unaffected","lessThanOrEqual":"6.13.*","versionType":"semver"},{"version":"6.14","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/c1f3f3892d4526f18aaeffdb6068ce861e793ee3"},{"url":"https://git.kernel.org/stable/c/787d556a3de447e70964a4bdeba9196f62a62b1e"},{"url":"https://git.kernel.org/stable/c/517e8a7835e8cfb398a0aeb0133de50e31cae32b"}],"metrics":[{"cvssV3_1":{"version":"3.1","vectorString":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H","baseScore":7.8,"baseSeverity":"HIGH"},"scenarios":[{"lang":"en","value":"AV:L - The vulnerability is reached through the bpf(2) syscall — creating a BPF_MAP_TYPE_ARENA map, mmap()ing it, faulting in a page, and closing the fd. No network exposure is involved.\nAC:L - On an affected kernel (arm64 with 64K pages, a mainstream aarch64 distro/server configuration), the unaligned base address makes the non-terminating apply_to_pte_range() loop trigger 100% deterministically with a trivial 4-step sequence; there is no race or memory-layout condition to win.\nPR:L - Arena map creation requires CAP_BPF, but bpf_token_capable() resolves via ns_capable(token->userns, CAP_BPF), so a delegated BPF token or a container granted CAP_BPF lets an otherwise unprivileged user reach it; this is a delegatable capability, not init-namespace root.\nUI:N - The attacker performs the entire sequence — map create, mmap, page touch, fd close — in their own process. No victim action is required.\nS:U - The infinite loop, out-of-bounds page-table walk, and page frees all occur within the kernel's own security authority; no VM, IOMMU, or sandbox boundary is crossed.\nC:H - Once pte++ walks past the end of the PTE page, arbitrary kernel memory is read and interpreted as page-table entries, and __free_page() on garbage-derived struct pages releases in-use pages for reallocation, which is leverageable for disclosure of other tasks' data.\nI:H - existing_page_cb() calls __free_page() on struct page pointers decoded from out-of-bounds memory, corrupting page refcounts and prematurely freeing live pages — a use-after-free primitive suitable for heap grooming and control-flow hijacking.\nA:H - The `while (addr += PAGE_SIZE, addr != end)` loop can never terminate, producing a soft lockup/RCU stall inside a lazy-MMU section on a system workqueue, hanging the machine; the stray page frees compound this into a panic."}]}],"providerMetadata":{"shortName":"Linux","orgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateUpdated":"2026-08-05T11:54:55.041Z"},"cpeApplicability":[{"nodes":[{"operator":"OR","negate":false,"cpeMatch":[{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"6.9","versionEndExcluding":"6.12.17"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"6.9","versionEndExcluding":"6.13.5"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"6.9","versionEndExcluding":"6.14"}]}]}],"x_generator":{"engine":"bippy-1.2.0"}},"adp":[{"title":"CISA ADP Vulnrichment","metrics":[{"cvssV3_1":{"scope":"UNCHANGED","version":"3.1","baseScore":3.3,"attackVector":"LOCAL","baseSeverity":"LOW","vectorString":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:L","integrityImpact":"NONE","userInteraction":"NONE","attackComplexity":"LOW","availabilityImpact":"LOW","privilegesRequired":"LOW","confidentialityImpact":"NONE"}},{"other":{"type":"ssvc","content":{"id":"CVE-2025-21851","role":"CISA Coordinator","options":[{"Exploitation":"none"},{"Automatable":"no"},{"Technical Impact":"partial"}],"version":"2.0.3","timestamp":"2025-10-01T19:26:12.815420Z"}}}],"problemTypes":[{"descriptions":[{"cweId":"CWE-667","lang":"en","type":"CWE","description":"CWE-667 Improper Locking"}]}],"providerMetadata":{"shortName":"CISA-ADP","orgId":"134c704f-9b21-4f2e-91b3-4a467353bcc0","dateUpdated":"2025-10-01T19:26:38.747Z"}}]}}}