about summary refs log tree commit diff
path: root/compiler/rustc_codegen_gcc/src/errors.rs
diff options
context:
space:
mode:
authorjoboet <jonasboettiger@icloud.com>2025-05-03 19:39:13 +0200
committerjoboet <jonasboettiger@icloud.com>2025-05-05 15:18:52 +0200
commit84bb0f07e6c3e920db567ff95a5f8365cf042c75 (patch)
tree8c53c876e5dda6f394c9b50953ec15427050eb5b /compiler/rustc_codegen_gcc/src/errors.rs
parent097cd98869cf07a2860bef16c0d4a2b3b019b23a (diff)
downloadrust-84bb0f07e6c3e920db567ff95a5f8365cf042c75.tar.gz
rust-84bb0f07e6c3e920db567ff95a5f8365cf042c75.zip
std: stop using TLS in signal handler
TLS is not async-signal-safe, making its use in the signal handler used to detect stack overflows unsound (c.f. #133698). POSIX however lists two thread-specific identifiers that can be obtained in a signal handler: the current `pthread_t` and the address of `errno`. Since `pthread_equal` is not AS-safe, `pthread_t` should be considered opaque, so for our purposes, `&errno` is the only option. This however works nicely: we can use the address as a key into a map that stores information for each thread. This PR uses a `BTreeMap` protected by a spin lock to hold the guard page address and thread name and thus fixes #133698.
Diffstat (limited to 'compiler/rustc_codegen_gcc/src/errors.rs')
0 files changed, 0 insertions, 0 deletions