CVE-2023-52659
Severity CVSS v4.0:
Pending analysis
Type:
Unavailable / Other
Publication date:
17/05/2024
Last modified:
25/09/2025
Description
In the Linux kernel, the following vulnerability has been resolved:<br />
<br />
x86/mm: Ensure input to pfn_to_kaddr() is treated as a 64-bit type<br />
<br />
On 64-bit platforms, the pfn_to_kaddr() macro requires that the input<br />
value is 64 bits in order to ensure that valid address bits don&#39;t get<br />
lost when shifting that input by PAGE_SHIFT to calculate the physical<br />
address to provide a virtual address for.<br />
<br />
One such example is in pvalidate_pages() (used by SEV-SNP guests), where<br />
the GFN in the struct used for page-state change requests is a 40-bit<br />
bit-field, so attempts to pass this GFN field directly into<br />
pfn_to_kaddr() ends up causing guest crashes when dealing with addresses<br />
above the 1TB range due to the above.<br />
<br />
Fix this issue with SEV-SNP guests, as well as any similar cases that<br />
might cause issues in current/future code, by using an inline function,<br />
instead of a macro, so that the input is implicitly cast to the<br />
expected 64-bit input type prior to performing the shift operation.<br />
<br />
While it might be argued that the issue is on the caller side, other<br />
archs/macros have taken similar approaches to deal with instances like<br />
this, such as ARM explicitly casting the input to phys_addr_t:<br />
<br />
e48866647b48 ("ARM: 8396/1: use phys_addr_t in pfn_to_kaddr()")<br />
<br />
A C inline function is even better though.<br />
<br />
[ mingo: Refined the changelog some more & added __always_inline. ]
Impact
Base Score 3.x
5.50
Severity 3.x
MEDIUM
Vulnerable products and versions
| CPE | From | Up to |
|---|---|---|
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 6.5 (including) | 6.6.23 (excluding) |
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 6.7 (including) | 6.7.11 (excluding) |
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 6.8 (including) | 6.8.2 (excluding) |
To consult the complete list of CPE names with products and versions, see this page
References to Advisories, Solutions, and Tools
- https://git.kernel.org/stable/c/325956b0173f11e98f90462be4829a8b8b0682ce
- https://git.kernel.org/stable/c/7e1471888a5e6e846e9b4d306e5327db2b58e64e
- https://git.kernel.org/stable/c/814305b5c23cb815ada68d43019f39050472b25f
- https://git.kernel.org/stable/c/8e5647a723c49d73b9f108a8bb38e8c29d3948ea
- https://git.kernel.org/stable/c/325956b0173f11e98f90462be4829a8b8b0682ce
- https://git.kernel.org/stable/c/7e1471888a5e6e846e9b4d306e5327db2b58e64e
- https://git.kernel.org/stable/c/814305b5c23cb815ada68d43019f39050472b25f
- https://git.kernel.org/stable/c/8e5647a723c49d73b9f108a8bb38e8c29d3948ea



