CVE-2024-40974
Severity CVSS v4.0:
Pending analysis
Type:
CWE-787
Out-of-bounds Write
Publication date:
12/07/2024
Last modified:
03/11/2025
Description
In the Linux kernel, the following vulnerability has been resolved:<br />
<br />
powerpc/pseries: Enforce hcall result buffer validity and size<br />
<br />
plpar_hcall(), plpar_hcall9(), and related functions expect callers to<br />
provide valid result buffers of certain minimum size. Currently this<br />
is communicated only through comments in the code and the compiler has<br />
no idea.<br />
<br />
For example, if I write a bug like this:<br />
<br />
long retbuf[PLPAR_HCALL_BUFSIZE]; // should be PLPAR_HCALL9_BUFSIZE<br />
plpar_hcall9(H_ALLOCATE_VAS_WINDOW, retbuf, ...);<br />
<br />
This compiles with no diagnostics emitted, but likely results in stack<br />
corruption at runtime when plpar_hcall9() stores results past the end<br />
of the array. (To be clear this is a contrived example and I have not<br />
found a real instance yet.)<br />
<br />
To make this class of error less likely, we can use explicitly-sized<br />
array parameters instead of pointers in the declarations for the hcall<br />
APIs. When compiled with -Warray-bounds[1], the code above now<br />
provokes a diagnostic like this:<br />
<br />
error: array argument is too small;<br />
is of size 32, callee requires at least 72 [-Werror,-Warray-bounds]<br />
60 | plpar_hcall9(H_ALLOCATE_VAS_WINDOW, retbuf,<br />
| ^ ~~~~~~<br />
<br />
[1] Enabled for LLVM builds but not GCC for now. See commit<br />
0da6e5fd6c37 ("gcc: disable &#39;-Warray-bounds&#39; for gcc-13 too") and<br />
related changes.
Impact
Base Score 3.x
7.80
Severity 3.x
HIGH
Vulnerable products and versions
| CPE | From | Up to |
|---|---|---|
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 4.19.317 (excluding) | |
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 4.20 (including) | 5.4.279 (excluding) |
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 5.5 (including) | 5.10.221 (excluding) |
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 5.11 (including) | 5.15.162 (excluding) |
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 5.16 (including) | 6.1.96 (excluding) |
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 6.2 (including) | 6.6.36 (excluding) |
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 6.7 (including) | 6.9.7 (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/19c166ee42cf16d8b156a6cb4544122d9a65d3ca
- https://git.kernel.org/stable/c/262e942ff5a839b9e4f3302a8987928b0c8b8a2d
- https://git.kernel.org/stable/c/3ad0034910a57aa88ed9976b1431b7b8c84e0048
- https://git.kernel.org/stable/c/8aa11aa001576bf3b00dcb8559564ad7a3113588
- https://git.kernel.org/stable/c/a8c988d752b3d98d5cc1e3929c519a55ef55426c
- https://git.kernel.org/stable/c/aa6107dcc4ce9a3451f2d729204713783b657257
- https://git.kernel.org/stable/c/acf2b80c31c37acab040baa3cf5f19fbd5140b18
- https://git.kernel.org/stable/c/ff2e185cf73df480ec69675936c4ee75a445c3e4
- https://git.kernel.org/stable/c/19c166ee42cf16d8b156a6cb4544122d9a65d3ca
- https://git.kernel.org/stable/c/262e942ff5a839b9e4f3302a8987928b0c8b8a2d
- https://git.kernel.org/stable/c/3ad0034910a57aa88ed9976b1431b7b8c84e0048
- https://git.kernel.org/stable/c/8aa11aa001576bf3b00dcb8559564ad7a3113588
- https://git.kernel.org/stable/c/a8c988d752b3d98d5cc1e3929c519a55ef55426c
- https://git.kernel.org/stable/c/aa6107dcc4ce9a3451f2d729204713783b657257
- https://git.kernel.org/stable/c/acf2b80c31c37acab040baa3cf5f19fbd5140b18
- https://git.kernel.org/stable/c/ff2e185cf73df480ec69675936c4ee75a445c3e4
- https://lists.debian.org/debian-lts-announce/2025/01/msg00001.html



