Regression `-Zsanitizer=thread` crashes any program on arm64 in nightly.
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 48/100
Direzione di ricerca
Start by checking the compiler-builtins update and the AArch64 outlined atomic helpers mentioned in the issue, then reproduce with the supplied -Zsanitizer=thread -Zbuild-std command on aarch64. The backtrace points to __aarch64_swp1_acq during ThreadSanitizer initialization; verify whether that helper is instrumented and whether disabling its instrumentation addresses the crash. Done means the minimal program runs without a segmentation fault on nightly.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
-Zsanitizer=thread crashes any program on arm64 in nightly.
I found this while using Claude Code with Opus 5.5/Sonnet 5.5/Fable 5.2, output from the LLM will be clearly marked, other output is tested and verified by myself, every text here is written by myself if not otherwise marked :-)
Code
I tried this code with latest nightly:
fn main() {
println!("Hello, world!");
}
I expected to see this output when running the program:
Hello, world!
Instead, this happened:
Segmentation fault (core dumped) RUSTFLAGS=-Zsanitizer=thread cargo +nightly run -Zbuild-std --target aarch64-unknown-linux-gnu
Version it worked on
stable 1.100.0 (0ef1bc386 2026-11-09)
Claude Codes bisection for this, rewritten by myself
- stable 1.100.0 (0ef1bc386 2026-11-09) -> ok
- nightly-2026-09-01 (0dfb098f3) -> ok
- nightly-2026-10-13 (e9bbadf68) -> ok
- nightly-2026-10-15 (7df81381d) -> ok (last good)
- nightly-2026-10-16 (4ebd25825) -> Error (first bad)
- nightly-2026-10-28 (41089d07a) -> Error
- nightly-2026-11-17 (59cbdee2e) -> Error
It most recently worked on (by bisection by Claude Code): stable 1.100.0 (0ef1bc386 2026-11-09) and nightly-2026-10-15 (7df81381d)
Version with regression (by bisection by Claude Code):
nightly-2026-10-16 (4ebd25825), nightly-2026-10-28 (41089d07a), nightly-2026-11-17 (59cbdee2e)
checked myself: 1.102.0-nightly (59cbdee2e 2026-11-17)
rustc --version --verbose:
rustup run nightly rustc --version --verbose
rustc 1.102.0-nightly (59cbdee2e 2026-11-17)
binary: rustc
commit-hash: 59cbdee2e7b3ee50e44b460561c43c9e3023d9f0
commit-date: 2026-11-17
host: aarch64-unknown-linux-gnu
release: 1.102.0-nightly
LLVM version: 23.1.5
Setting vm.mmap_rnd_bits to either 28 or 32 did not change any output.
The compiler did not crash, the program produced did crash:
Backtrace of running the programm
gdb -batch -ex run -ex bt target/aarch64-unknown-linux-gnu/debug/tsan-repo
warning: Missing auto-load script at offset 0 in section .debug_gdb_scripts
of file [...]./target/aarch64-unknown-linux-gnu/debug/tsan-repo.
Use `info auto-load python-scripts [REGEXP]' to list them.
This GDB supports auto-downloading debuginfo from the following URLs:
<https://debuginfod.ubuntu.com>
Enable debuginfod for this session? (y or [n]) [answered N; input not from terminal]
Debuginfod has been disabled.
To make this setting permanent, add 'set debuginfod enabled off' to .gdbinit.
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/aarch64-linux-gnu/libthread_db.so.1".
Program received signal SIGSEGV, Segmentation fault.
0x0000aaaaaab314a8 in __tsan::TraceSwitchPart(__tsan::ThreadState*) ()
#0 0x0000aaaaaab314a8 in __tsan::TraceSwitchPart(__tsan::ThreadState*) ()
#1 0x0000aaaaaab3363c in __tsan::TraceRestartFuncEntry(__tsan::ThreadState*, unsigned long) ()
#2 0x0000aaaaaad18c78 in __aarch64_swp1_acq () at src/macros.rs:435
#3 0x0000aaaaaab51e78 in __sanitizer::MemoryMappingLayout::MemoryMappingLayout(bool) ()
#4 0x0000aaaaaab4693c in __tsan::CheckAndProtect(bool, bool, bool) ()
#5 0x0000aaaaaab45ff8 in __tsan::ReExecIfNeeded(bool) ()
#6 0x0000aaaaaab3053c in __tsan::Initialize(__tsan::ThreadState*) ()
#7 0x0000fffff7fc2e9c in _dl_init (main_map=0xfffff7fff340, argc=1, argv=0xffffffffe6c8, env=0xffffffffe6d8) at ./elf/dl-init.c:106
#8 0x0000fffff7fda648 in _start () at ../sysdeps/aarch64/dl-start.S:81
Claude Codes idea how it works currently:
Linking libgcc whole-archive makes it work:
Verified by me on that arm64:
RUSTFLAGS="-Zsanitizer=thread -Clink-arg=-Wl,--whole-archive -Clink-arg=$(cc -print-libgcc-file-name) -Clink-arg=-Wl,--no-whole-archive" cargo +nightly run -Zbuild-std --target aarch64-unknown-linux-gnu
outputs:
Hello, world!
LLM analysis (unverified by me beyond everything above)
The following is LLM-generated analysis, quoted as such.
The only change in the range touching the affected code is #164333 (compiler-builtins subtree update), which brings in rust-lang/compiler-builtins#1321 ("Rewrite AArch64 outlined atomic functions with asm"). Before it, the
__aarch64_{cas,swp,ldadd,…}*helpers were#[unsafe(naked)]functions, so sanitizer instrumentation never touched them. Now they are ordinary functions containingasm!plus a Rust load ofHAVE_LSE_ATOMICS. With-Zbuild-std,compiler_builtinsis compiled with-Zsanitizer=thread, so the helpers get__tsan_func_entry/__tsan_func_exit:$ objdump -d --no-show-raw-insn target/aarch64-unknown-linux-gnu/debug/tsan-repro | grep -A12 '<__aarch64_swp1_acq>:' <__aarch64_swp1_acq>: ... bl <__tsan_func_entry> bl <_RNvNtCs..._17compiler_builtins23aarch64_outline_atomics18___aarch64_swp1_acq> bl <__tsan_func_exit>The TSan runtime calls these helpers from
__tsan::Initializebefore its per-thread state exists, so the instrumented helper faults. rust-lang/compiler-builtins#1354 makes these the only implementation. A fix would be to keep the helpers uninstrumented again (naked, or#[sanitize(thread = "off")]).
Claude found related issues, didn't grasp those in their entirety:
Possibly related, but different: #151486, #161855.
@rustbot modify labels: +regression-from-stable-to-nightly -regression-untriaged
- Lingua principale
- Rust
- Stelle
- 122k
- Fork
- 16.7k
- Merge medio
- 2g 16h
- PR unite (30g)
- 515
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di rust-lang/rust
-
Remove unnecessary parentheses when suggesting to remove '&' from a patternForse già presa @BartSimpson001 l’ha presa 1 giorno fa. ApertaA-diagnostics D-invalid-suggestion T-compiler
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
I maintainer di solito rispondono entro 1 giorno
-
Windows `File::set_permissions` silently does nothing when clearing `readonly` leaves `FileAttributes == 0`Forse già presa @ChrisDenton l’ha presa 11 giorni fa. ApertaA-filesystem C-bug O-windows T-libs
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
I maintainer di solito rispondono entro 1 giorno
-
A-run-make relnotes relnotes-needs-review relnotes-tracking-issue T-lang T-libs
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
A-LLVM O-Arm O-UEFI O-x86_64 relnotes relnotes-needs-review relnotes-tracking-issue T-compiler
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 72/100
rust-lang/rust#165504 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
relnotes relnotes-tracking-issue T-libs
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di rust-lang/rust
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
antithesishq/bombadil#473 ·
I maintainer di solito rispondono entro 2 giorni
-
bench/api.sh exec test fails with curl exit 52, and --ignore-failure still records the timingsApertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
libracoder/kiri#669 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
I maintainer di solito rispondono entro 5 giorni
-
autofixer: follow-up
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
tursodatabase/turso#12217 ·
I maintainer di solito rispondono entro 1 giorno
-
Declare the CMS schema library in the optional recipients extraForse già presa Una pull request collegata a questa issue è aperta o già unita. Apertaarea:python in-progress
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
yhay81/pyropdf#1005 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno