Unpoison fiber stack after context switch on AArch64#46
Open
alexey-milovidov wants to merge 2 commits intoclickhouse-1.90.0from
Open
Unpoison fiber stack after context switch on AArch64#46alexey-milovidov wants to merge 2 commits intoclickhouse-1.90.0from
alexey-milovidov wants to merge 2 commits intoclickhouse-1.90.0from
Conversation
alexey-milovidov
added a commit
to ClickHouse/ClickHouse
that referenced
this pull request
Apr 10, 2026
Point to ClickHouse/boost#46 which adds __msan_unpoison after every fiber context switch on AArch64, fixing MSan false positives caused by struct-padding shadow accumulation on fiber stacks (STID 1478-2063). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
On AArch64, LLVM loses MSan shadow for struct-padding bytes in return values (llvm/llvm-project#54476). On heap-allocated fiber stacks the dirty shadow accumulates across context switches and propagates via stack-slot reuse, triggering false positives in unrelated code. Unpoison the entire fiber stack after each __msan_finish_switch_fiber to clear accumulated dirty padding shadow. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
c0df245 to
a6da369
Compare
The AArch64 fiber stack unpoison code uses `__msan_unpoison` but it was not declared in the extern "C" block alongside the other MSan functions. This caused a build failure on arm_msan. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
On AArch64, LLVM loses MSan shadow for struct-padding bytes in return values
(llvm/llvm-project#54476).
On heap-allocated fiber stacks the dirty shadow accumulates across context
switches and propagates via stack-slot reuse, triggering false positives in
unrelated code.
Fix by calling
__msan_unpoisonon the whole fiber stack after every__msan_finish_switch_fiberon AArch64. Themain_ctxguard ensures weonly unpoison fiber stacks, not the main thread stack.
See ClickHouse/ClickHouse#102305 for the corresponding main repo PR.