CVE-2023-4039
gcc: -fstack-protector fails to guard dynamic stack allocations on ARM64
Severity
LowRed Hat Product Security
CVSS 3.1
Review impact separately from score.
Published · September 13, 2023
Updated · August 7, 2026
Description
A vulnerability was found in GCC. The GCC's stack protection feature, enabled with the flag -fstack-protector, aims to detect buffer overflows in C/C++ function local variables that might allow an attacker to overwrite saved registers on the stack. If an attacker can modify saved register values, it may be possible for them to subvert program flow control. The feature operates by placing a canary value between local variables and saved registers on the stack on function entry and triggers an error handler on function exit if the canary value has been unexpectedly modified.
When targeting AArch64, this feature did not protect the saved registers from overflows in C99-style dynamically-sized local variables and alloca() objects. Other local variables, including statically-sized local arrays, are not affected because of their different placement on the stack relative to saved registers.
Statement
According to the GCC security policy, both upstream and Red Hat Product Security do not consider this to be a vulnerability. Please refer to the following URLs for more information:
- https://gcc.gnu.org/git/?p=gcc.git;a=blob_plain;f=SECURITY.txt
- https://gcc.gnu.org/pipermail/gcc-patches/2023-October/634066.html
- https://inbox.sourceware.org/gcc-patches/[email protected]/
CVSS score applicability
The CVSS score(s) listed for this vulnerability do not reflect the associated product's status, and are included for informational purposes to better understand the severity of this vulnerability.
Mitigation
Mitigation for this issue is either not available or the currently available options do not meet the Red Hat Product Security criteria comprising ease of use and deployment, applicability to widespread installation base or stability.
CVSS / CWE
CVSS 3.1 · 0CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:N/A:N
CWE-788 · Access of Memory Location After End of Buffer