In the Linux kernel, the following vulnerability has been resolved:
mm/vmalloc: fix page mapping if vmareaalloc_pages() with high order fallback to order 0
The _vmappagesrangenoflush() assumes its argument pages** contains pages with the same page shift. However, since commit e9c3cda4d86e ("mm, vmalloc: fix high order __GFPNOFAIL allocations"), if gfpflags includes __GFPNOFAIL with high order in vmareaallocpages() and page allocation failed for high order, the pages** may contain two different page shifts (high order and order-0). This could lead _vmappagesrangenoflush() to perform incorrect mappings, potentially resulting in memory corruption.
Users might encounter this as follows (vmapallowhuge = true, 2M is for PMD_SIZE):
kvmalloc(2M, __GFPNOFAIL|GFPX) __vmallocnoderangenoprof(vmflags=VMALLOWHUGEVMAP) vmareaallocpages(order=9) ---> order-9 allocation failed and fallback to order-0 vmappagesrange() vmappagesrange_noflush() __vmappagesrangenoflush(pageshift = 21) ----> wrong mapping happens
We can remove the fallback code because if a high-order allocation fails, _vmallocnoderangenoprof() will retry with order-0. Therefore, it is unnecessary to fallback to order-0 here. Therefore, fix this by removing the fallback code.
{
"cna_assigner": "Linux",
"osv_generated_from": "https://github.com/CVEProject/cvelistV5/tree/main/cves/2024/45xxx/CVE-2024-45022.json"
}[
{
"digest": {
"length": 1110.0,
"function_hash": "320624660319075472749325297270119544727"
},
"signature_version": "v1",
"deprecated": false,
"signature_type": "Function",
"id": "CVE-2024-45022-334e2ef9",
"target": {
"function": "vm_area_alloc_pages",
"file": "mm/vmalloc.c"
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@c91618816f4d21fc574d7577a37722adcd4075b2"
},
{
"signature_version": "v1",
"digest": {
"threshold": 0.9,
"line_hashes": [
"251324131135481406651150702848321081512",
"2187698480609136992073132016021979512",
"259828861321548123598493373985168955013",
"22700381961570513415913380283765380589",
"309725366348798655644513493799703923389",
"180991359154660650835998561896610235293",
"328304260748326550049182560183762326854",
"220702449560981777389897018197349425949",
"101968126659929370480028062396885998870",
"245742083715474412416380858513147375020"
]
},
"deprecated": false,
"signature_type": "Line",
"id": "CVE-2024-45022-af2e61e5",
"target": {
"file": "mm/vmalloc.c"
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@c91618816f4d21fc574d7577a37722adcd4075b2"
}
]
"https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2024-45022.json"