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 __GFP_NOFAIL allocations"), if gfp_flags includes __GFP_NOFAIL with high order in vm_area_alloc_pages() 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() vmappagesrangenoflush() _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.
[
{
"id": "CVE-2024-45022-334e2ef9",
"deprecated": false,
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@c91618816f4d21fc574d7577a37722adcd4075b2",
"target": {
"file": "mm/vmalloc.c",
"function": "vm_area_alloc_pages"
},
"signature_type": "Function",
"digest": {
"function_hash": "320624660319075472749325297270119544727",
"length": 1110.0
},
"signature_version": "v1"
},
{
"id": "CVE-2024-45022-3bdef1d0",
"deprecated": false,
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@61ebe5a747da649057c37be1c37eb934b4af79ca",
"target": {
"file": "mm/vmalloc.c"
},
"signature_type": "Line",
"digest": {
"line_hashes": [
"251324131135481406651150702848321081512",
"2187698480609136992073132016021979512",
"259828861321548123598493373985168955013",
"22700381961570513415913380283765380589",
"309725366348798655644513493799703923389",
"180991359154660650835998561896610235293",
"328304260748326550049182560183762326854",
"220702449560981777389897018197349425949",
"101968126659929370480028062396885998870",
"245742083715474412416380858513147375020"
],
"threshold": 0.9
},
"signature_version": "v1"
},
{
"id": "CVE-2024-45022-af2e61e5",
"deprecated": false,
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@c91618816f4d21fc574d7577a37722adcd4075b2",
"target": {
"file": "mm/vmalloc.c"
},
"signature_type": "Line",
"digest": {
"line_hashes": [
"251324131135481406651150702848321081512",
"2187698480609136992073132016021979512",
"259828861321548123598493373985168955013",
"22700381961570513415913380283765380589",
"309725366348798655644513493799703923389",
"180991359154660650835998561896610235293",
"328304260748326550049182560183762326854",
"220702449560981777389897018197349425949",
"101968126659929370480028062396885998870",
"245742083715474412416380858513147375020"
],
"threshold": 0.9
},
"signature_version": "v1"
},
{
"id": "CVE-2024-45022-bb5a83f1",
"deprecated": false,
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@61ebe5a747da649057c37be1c37eb934b4af79ca",
"target": {
"file": "mm/vmalloc.c",
"function": "vm_area_alloc_pages"
},
"signature_type": "Function",
"digest": {
"function_hash": "320624660319075472749325297270119544727",
"length": 1110.0
},
"signature_version": "v1"
},
{
"id": "CVE-2024-45022-bebbb60f",
"deprecated": false,
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@fd1ffbb50ef4da5e1378a46616b6d7407dc795da",
"target": {
"file": "mm/vmalloc.c"
},
"signature_type": "Line",
"digest": {
"line_hashes": [
"208120718850762285543719234044920143833",
"227912951110083637770901747882118213870",
"59368497829516874591798198193348970893",
"22700381961570513415913380283765380589",
"309725366348798655644513493799703923389",
"180991359154660650835998561896610235293",
"328304260748326550049182560183762326854",
"220702449560981777389897018197349425949",
"101968126659929370480028062396885998870",
"245742083715474412416380858513147375020"
],
"threshold": 0.9
},
"signature_version": "v1"
},
{
"id": "CVE-2024-45022-e9e5a444",
"deprecated": false,
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@fd1ffbb50ef4da5e1378a46616b6d7407dc795da",
"target": {
"file": "mm/vmalloc.c",
"function": "vm_area_alloc_pages"
},
"signature_type": "Function",
"digest": {
"function_hash": "320624660319075472749325297270119544727",
"length": 1110.0
},
"signature_version": "v1"
},
{
"id": "CVE-2024-45022-efe74625",
"deprecated": false,
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@de7bad86345c43cd040ed43e20d9fad78a3ee59f",
"target": {
"file": "mm/vmalloc.c"
},
"signature_type": "Line",
"digest": {
"line_hashes": [
"208120718850762285543719234044920143833",
"227912951110083637770901747882118213870",
"59368497829516874591798198193348970893",
"22700381961570513415913380283765380589",
"309725366348798655644513493799703923389",
"180991359154660650835998561896610235293",
"328304260748326550049182560183762326854",
"220702449560981777389897018197349425949",
"101968126659929370480028062396885998870",
"245742083715474412416380858513147375020"
],
"threshold": 0.9
},
"signature_version": "v1"
},
{
"id": "CVE-2024-45022-f40b4c50",
"deprecated": false,
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@de7bad86345c43cd040ed43e20d9fad78a3ee59f",
"target": {
"file": "mm/vmalloc.c",
"function": "vm_area_alloc_pages"
},
"signature_type": "Function",
"digest": {
"function_hash": "320624660319075472749325297270119544727",
"length": 1110.0
},
"signature_version": "v1"
}
]