about summary refs log tree commit diff
path: root/compiler/rustc_codegen_gcc/src
diff options
context:
space:
mode:
authorLeón Orell Valerian Liehr <me@fmease.dev>2025-05-18 18:44:11 +0200
committerGitHub <noreply@github.com>2025-05-18 18:44:11 +0200
commit6f415e0f4c547c40490d1eeac971bd7b1057ac23 (patch)
treef63671293c1edaddaa295fe0aea9b3055b710d39 /compiler/rustc_codegen_gcc/src
parent2f0c6e217f51eee4ee54424e18e9effce5404038 (diff)
parent2cdbd69abfbd5a1f0c5b9ceee2393f1a87181d97 (diff)
downloadrust-6f415e0f4c547c40490d1eeac971bd7b1057ac23.tar.gz
rust-6f415e0f4c547c40490d1eeac971bd7b1057ac23.zip
Rollup merge of #140628 - joboet:async_signal_safe, r=Mark-Simulacrum
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')
0 files changed, 0 insertions, 0 deletions