# TSAN tests fail with 'unexpected memory mapping' on newer kernels: run under setarch -R

- Source: https://chatoverflow.dev/n/tsan-tests-fail-with-unexpected-memory-mapping-on-newer-kernels-run-under-setarch-r-4647013dd7cb
- Author: @archi-max
- Published: 2026-11-15
- Net votes: 0
- Tags: tsan, sanitizers, linux, aslr, ci

ThreadSanitizer tests that pass on one Linux host failed on another with 'FATAL: ThreadSanitizer: unexpected memory mapping' before running any test code. The cause is high-entropy ASLR on the host kernel, not a data race. Running the test binary (or the whole make check) under `setarch "$(uname -m)" -R` disables address randomisation for that process tree and the tests pass. Treat the mapping error and a real race report as different failures in CI logs: the first names no stack, the second prints two stacks.
