Skip to content

Commit 2dc7b70

Browse files
bigfootedclaude
andauthored
Fix TSan CI build for develop, cantera (#2991)
## Proposed Changes The "FATAL: ThreadSanitizer: unexpected memory mapping" message comes from the TSan runtime. It happens when the kernel's ASLR randomization is too high for TSan's fixed shadow-memory layout (vm.mmap_rnd_bits=32). That is the default on recent GitHub runner images and kernels. The failing step is the bootstrap of ninja, because the Cantera subproject builds its own ninja when none is on the PATH. The TSan flags from the job are inherited by that bootstrap. The freshly built ./ninja is therefore TSan-instrumented and dies on startup with exit status 66, which gives the Python traceback you see. ## Related Work *Resolve any issues (bug fix or feature request), note any related PRs, or mention interactions with the work of others, if any.* ## PR Checklist *Put an X by all that apply. You can fill this out after submitting the PR. If you have any questions, don't hesitate to ask! We want to help. These are a guide for you to know what the reviewers will be looking for in your contribution.* - [x] I am submitting my contribution to the develop branch. - [ ] My contribution generates no new compiler warnings (try with --warnlevel=3 when using meson). - [ ] My contribution is commented and consistent with SU2 style (https://su2code.github.io/docs_v7/Style-Guide/). - [ ] I used the pre-commit hook to prevent dirty commits and used `pre-commit run --all` to format old commits. - [ ] I have added a test case that demonstrates my contribution, if necessary. - [ ] I have updated appropriate documentation (Tutorials, Docs Page, config_template.cpp), if necessary. Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
1 parent a25e0ec commit 2dc7b70

2 files changed

Lines changed: 11 additions & 0 deletions

File tree

‎.github/workflows/regression.yml‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,8 @@ jobs:
122122
with:
123123
entrypoint: /bin/rm
124124
args: -rf install install_bin.tgz src ccache ${{ matrix.config_set }}
125+
- name: Lower ASLR entropy for TSan
126+
run: sudo sysctl vm.mmap_rnd_bits=28
125127
- name: Build
126128
uses: docker://ghcr.io/su2code/su2/build-su2-tsan:261011-1107
127129
with:
@@ -324,6 +326,8 @@ jobs:
324326
done
325327
chmod a+x $BIN_FOLDER/*
326328
ls -lahR $BIN_FOLDER
329+
- name: Lower ASLR entropy for TSan
330+
run: sudo sysctl vm.mmap_rnd_bits=28
327331
- name: Run Tests in Container
328332
uses: docker://ghcr.io/su2code/su2/test-su2-tsan:261011-1107
329333
env:

‎preconfigure.py‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,13 @@ def build_ninja():
7373
# Specify C++17
7474
env = os.environ.copy()
7575
env["CXXFLAGS"] = env.get("CXXFLAGS", "") + " -std=c++17"
76+
# ninja is a build tool and must not be instrumented by sanitizers
77+
for var in ("CFLAGS", "CXXFLAGS", "LDFLAGS"):
78+
env[var] = " ".join(
79+
f
80+
for f in env.get(var, "").split()
81+
if not f.startswith("-fsanitize")
82+
)
7683
subprocess.run(
7784
["python3", "configure.py", "--bootstrap"], cwd=ninjapath, env=env
7885
)

0 commit comments

Comments
 (0)