diff options
author | Thirumalai Nagalingam <thirumalai.nagalingam@multicorewareinc.com> | 2025-07-01 18:17:24 +0000 |
---|---|---|
committer | Jeremy Drake <cygwin@jdrake.com> | 2025-07-01 13:03:47 -0700 |
commit | 10380e9f446640c8d1bd4d60ec085bb31efa26f1 (patch) | |
tree | 05944e08456570d41158202bf90eb40269315acd /newlib/libc | |
parent | 476135a24506dd624eb46b50fd634fcd740008ba (diff) | |
download | newlib-master.zip newlib-master.tar.gz newlib-master.tar.bz2 |
This patch resolves issues related to unsafe access to deallocated
stack memory in the pthread wrapper for AArch64.
Key changes:
- Removed use of x19 by directly loading the thread function and
argument using LDP from [WRAPPER_ARG], freeing one register.
- Stored thread function and argument in x20 and x21 before
VirtualFree to preserve them across calls.
- Used x1 as a temporary register to load the stack base,
subtract CYGTLS, and update SP.
- Moved the thread argument back into x0 after VirtualFree and
before calling the thread function.
Earlier, `wrapper_arg` lived on the stack, which was freed via
`VirtualFree`, risking segfaults on later access. Now, the thread
`func` and `arg` are loaded before the stack is freed, stored in
callee-saved registers, and restored to `x0` before calling the
thread function.
Fixes: f4ba145056db ("Aarch64: Add inline assembly pthread wrapper")
Signed-off-by: Thirumalai Nagalingam <thirumalai.nagalingam@multicorewareinc.com>
Diffstat (limited to 'newlib/libc')
0 files changed, 0 insertions, 0 deletions