{"dataType":"CVE_RECORD","dataVersion":"5.2","cveMetadata":{"cveId":"CVE-2024-39477","assignerOrgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","state":"PUBLISHED","assignerShortName":"Linux","dateReserved":"2024-06-25T14:23:23.746Z","datePublished":"2024-07-05T06:55:07.268Z","dateUpdated":"2026-08-05T11:33:30.787Z"},"containers":{"cna":{"providerMetadata":{"orgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","shortName":"Linux","dateUpdated":"2026-08-05T11:33:30.787Z"},"descriptions":[{"lang":"en","value":"In the Linux kernel, the following vulnerability has been resolved:\n\nmm/hugetlb: do not call vma_add_reservation upon ENOMEM\n\nsysbot reported a splat [1] on __unmap_hugepage_range().  This is because\nvma_needs_reservation() can return -ENOMEM if\nallocate_file_region_entries() fails to allocate the file_region struct\nfor the reservation.\n\nCheck for that and do not call vma_add_reservation() if that is the case,\notherwise region_abort() and region_del() will see that we do not have any\nfile_regions.\n\nIf we detect that vma_needs_reservation() returned -ENOMEM, we clear the\nhugetlb_restore_reserve flag as if this reservation was still consumed, so\nfree_huge_folio() will not increment the resv count.\n\n[1] https://lore.kernel.org/linux-mm/0000000000004096100617c58d54@google.com/T/#ma5983bc1ab18a54910da83416b3f89f3c7ee43aa"}],"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 vulnerable path is reached only through local syscalls on the attacker's own address space — mmap(MAP_HUGETLB), madvise(MADV_DONTNEED), munmap, or process exit driving __unmap_hugepage_range(). There is no network- or adjacent-reachable trigger.\nAC:L - Every element of the trigger is attacker-controlled and deterministic — the private anonymous hugetlb VMA, the merged reservation region, the drained region_cache, and the middle-page unmap that forces region_del()'s split path; only the file_region kmalloc failure must be induced, which an attacker does by driving memory exhaustion (hugetlb hosts are already memory-tight, and a task that becomes an OOM victim has its GFP_KERNEL allocations fail while exit_mmap runs this exact code). Once the single ENOMEM lands, adds_in_progress stays at -1 permanently and the corruption repeats on ordinary faults without further allocation failures, so the attempt can be retried indefinitely.\nPR:L - A plain unprivileged local user suffices: hugetlb_file_setup() gates only SHM_HUGETLB on CAP_IPC_LOCK, so anonymous MAP_PRIVATE|MAP_HUGETLB mmap and MADV_DONTNEED on the resulting VMA require no capability. A non-zero hugepage pool is an administrator-side configuration, standard on database, KVM, DPDK and HPC hosts, not a privilege held by the attacker.\nUI:N - The attacker's own process performs the entire sequence — mmap, fault-in, madvise/munmap — with no action by any other user or victim process.\nS:U - The corruption is confined to kernel heap objects (struct resv_map and the slab freelist) within the same security authority; no VM, hypervisor, or IOMMU boundary is crossed.\nC:H - region_del() and get_file_region_entry_from_cache() fabricate a file_region pointing at the resv_map itself and then kfree() that interior pointer while the object is still live, producing overlapping slab objects and a freelist containing a misaligned pointer — a well-known route to reading adjacent kernel heap contents. The corrupted rw_semaphore also breaks the serialization of hugetlb page-table walks against unmapping, widening the disclosure surface.\nI:H - The bogus file_region overlays struct resv_map, so nrg->from/nrg->to and copy_hugetlb_cgroup_uncharge_info() perform out-of-bounds writes over region_cache_count and the rw_semaphore (count, owner, wait_lock) that guards private hugetlb page tables, and kfree() of an interior pointer corrupts the SLUB freelist — a controllable heap-grooming primitive toward arbitrary write and control-flow hijack. The reservation accounting is also permanently falsified, letting one process steal huge pages reserved by another.\nA:H - On CONFIG_DEBUG_VM kernels this is an immediate panic via VM_BUG_ON(!resv->region_cache_count) in region_abort() and VM_BUG_ON(adds_in_progress) in resv_map_release() — precisely the syzbot splat. Without DEBUG_VM the list poisoning, wrecked rw_semaphore (hangs/deadlock in hugetlb faults), slab corruption, and permanently inflated h->resv_huge_pages produce oopses and SIGBUS-level denial of hugepages for every user on the system."}]}],"affected":[{"product":"Linux","vendor":"Linux","defaultStatus":"unaffected","repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["mm/hugetlb.c"],"versions":[{"version":"df7a6d1f64056aec572162c5d35ed9ff86ece6f3","lessThan":"aa998f9dcb34c28448f86e8f5490f20d5eb0eac7","status":"affected","versionType":"git"},{"version":"df7a6d1f64056aec572162c5d35ed9ff86ece6f3","lessThan":"8daf9c702ee7f825f0de8600abff764acfedea13","status":"affected","versionType":"git"}]},{"product":"Linux","vendor":"Linux","defaultStatus":"affected","repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["mm/hugetlb.c"],"versions":[{"version":"6.9","status":"affected"},{"version":"0","lessThan":"6.9","status":"unaffected","versionType":"semver"},{"version":"6.9.5","lessThanOrEqual":"6.9.*","status":"unaffected","versionType":"semver"},{"version":"6.10","lessThanOrEqual":"*","status":"unaffected","versionType":"original_commit_for_fix"}]}],"cpeApplicability":[{"nodes":[{"operator":"OR","negate":false,"cpeMatch":[{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"6.9","versionEndExcluding":"6.9.5"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"6.9","versionEndExcluding":"6.10"}]}]}],"references":[{"url":"https://git.kernel.org/stable/c/aa998f9dcb34c28448f86e8f5490f20d5eb0eac7"},{"url":"https://git.kernel.org/stable/c/8daf9c702ee7f825f0de8600abff764acfedea13"}],"title":"mm/hugetlb: do not call vma_add_reservation upon ENOMEM","x_generator":{"engine":"bippy-1.2.0"}},"adp":[{"providerMetadata":{"orgId":"af854a3a-2127-422b-91ae-364da2661108","shortName":"CVE","dateUpdated":"2024-08-02T04:26:15.943Z"},"title":"CVE Program Container","references":[{"url":"https://git.kernel.org/stable/c/aa998f9dcb34c28448f86e8f5490f20d5eb0eac7","tags":["x_transferred"]},{"url":"https://git.kernel.org/stable/c/8daf9c702ee7f825f0de8600abff764acfedea13","tags":["x_transferred"]}]},{"metrics":[{"other":{"type":"ssvc","content":{"id":"CVE-2024-39477","role":"CISA Coordinator","options":[{"Exploitation":"none"},{"Automatable":"no"},{"Technical Impact":"partial"}],"version":"2.0.3","timestamp":"2024-09-10T17:07:38.781989Z"}}}],"title":"CISA ADP Vulnrichment","providerMetadata":{"orgId":"134c704f-9b21-4f2e-91b3-4a467353bcc0","shortName":"CISA-ADP","dateUpdated":"2024-09-11T17:34:39.612Z"}}]}}