kho: fix size calculation in kho_preserved_memory_reserve()
Linux
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
| No fix yet |
| Linux Linux |
|
|
Linux
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
| No fix yet |
| Linux Linux |
|
|
6.18.577.2.47.3In the Linux kernel, the following vulnerability has been resolved:
kho: fix size calculation in kho_preserved_memory_reserve()
kho_preserved_memory_reserve() calculates the size of a preservation by doing 1 << (order + PAGE_SHIFT). Since the '1' is a 32-bit integer, it can only be shifted by 31. That is, it will only work for preservations up to 2 GiB. Larger preservations will trigger undefined behaviour.
While preservations larger than 2 GiB can't be obtained via folios currently, they can be obtained via kho_preserve_pages().
For example, memblock reserve_mem uses kho_preserve_pages(). Reservations larger than 2 GiB are valid and will trigger this bug if properly aligned.
Fix it by using 1UL for shifting.
From the CVE record · Linux
The Linux kernel's kho_preserved_memory_reserve() uses a 32-bit shift to calculate preservation size, causing undefined behavior for properly aligned reservations larger than 2 GiB made through kho_preserve_pages(). The input does not describe an attacker path or specify whether network access, authentication, or user interaction is required.
Engineers running Linux kernels that use kho_preserve_pages() for properly aligned reservations larger than 2 GiB should check whether their kernel includes the fix; affected versions are not specified.