CVE-2024-40974: powerpc/pseries: Enforce hcall result buffer validity and size
In the Linux kernel, the following vulnerability has been resolved:
powerpc/pseries: Enforce hcall result buffer validity and size
plparhcall(), plparhcall9(), and related functions expect callers to provide valid result buffers of certain minimum size. Currently this is communicated only through comments in the code and the compiler has no idea.
For example, if I write a bug like this:
long retbuf[PLPARHCALLBUFSIZE]; // should be PLPARHCALL9BUFSIZE plparhcall9(HALLOCATEVASWINDOW, retbuf, ...);
This compiles with no diagnostics emitted, but likely results in stack corruption at runtime when plparhcall9() stores results past the end of the array. (To be clear this is a contrived example and I have not found a real instance yet.)
To make this class of error less likely, we can use explicitly-sized array parameters instead of pointers in the declarations for the hcall APIs. When compiled with -Warray-bounds[1], the code above now provokes a diagnostic like this:
error: array argument is too small; is of size 32, callee requires at least 72 [-Werror,-Warray-bounds] 60 | plparhcall9(HALLOCATEVASWINDOW, retbuf, | ^ ~~~~~~
[1] Enabled for LLVM builds but not GCC for now. See commit 0da6e5fd6c37 ("gcc: disable '-Warray-bounds' for gcc-13 too") and related changes.
Other sources
Linux Kernel is vulnerable to a denial of service, caused by a flaw in powerpc/pseries. By sending a specially crafted request, a local authenticated attacker could exploit this vulnerability to cause a denial of service.
— IBM
Affected Software
Remediation
Event History
Frequently Asked Questions
What is the severity of CVE-2024-40974?
CVE-2024-40974 is considered a critical vulnerability due to its potential impact on kernel operations in Linux.
How do I fix CVE-2024-40974?
To fix CVE-2024-40974, update the kernel to at least version 4.19.317, 5.4.279, 5.10.221, 5.15.162, 6.1.96 or 6.6.36 on Red Hat, or corresponding patched versions on Debian.
What systems are affected by CVE-2024-40974?
CVE-2024-40974 affects multiple versions of the Linux kernel across various distributions including Red Hat and Debian.
What is the nature of CVE-2024-40974?
CVE-2024-40974 involves an issue where certain kernel functions do not adequately enforce result buffer validity, leading to potential security risks.
Was CVE-2024-40974 publicly disclosed?
CVE-2024-40974 was disclosed as part of a routine security update for the Linux kernel, ensuring the issue is addressed promptly.