CVE-2024-57945: riscv: mm: Fix the out of bound issue of vmemmap address
In the Linux kernel, the following vulnerability has been resolved:
riscv: mm: Fix the out of bound issue of vmemmap address
In sparse vmemmap model, the virtual address of vmemmap is calculated as: ((struct page )VMEMMAPSTART - (physrambase >> PAGESHIFT)). And the struct page's va can be calculated with an offset: (vmemmap + (pfn)).
However, when initializing struct pages, kernel actually starts from the first page from the same section that physrambase belongs to. If the first page's physical address is not (physrambase >> PAGESHIFT), then we get an va below VMEMMAPSTART when calculating va for it's struct page.
For example, if physrambase starts from 0x82000000 with pfn 0x82000, the first page in the same section is actually pfn 0x80000. During initunavailablerange(), we will initialize struct page for pfn 0x80000 with virtual address ((struct page )VMEMMAPSTART - 0x2000), which is below VMEMMAPSTART as well as PCIIOEND.
This commit fixes this bug by introducing a new variable 'vmemmapstartpfn' which is aligned with memory section size and using it to calculate vmemmap address instead of physrambase.
Other sources
This CVE was automatically created from a reference found in an email or other text. If you are reading this, then this CVE entry is probably erroneous, since this text should be replaced by the official CVE description automatically.
— Launchpad
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
debian/linuxto a version that resolves this vulnerability.Fixed in 6.12.27-1
Event History
Frequently Asked Questions
What is the severity of CVE-2024-57945?
CVE-2024-57945 is classified as a medium severity vulnerability affecting the Linux kernel.
How do I fix CVE-2024-57945?
To fix CVE-2024-57945, upgrade to the latest stable version of the Linux kernel that includes the security patches.
Which systems are affected by CVE-2024-57945?
CVE-2024-57945 affects systems running certain versions of the Linux kernel that use the sparse vmemmap model.
What are the potential impacts of CVE-2024-57945?
The potential impacts of CVE-2024-57945 include possible system crashes or instability due to out-of-bounds memory access.
Is there a workaround for CVE-2024-57945?
There is no widely recommended workaround for CVE-2024-57945; updating the kernel is the best course of action.