Repository navigation
Unpoison fiber stack after context switch on AArch64 to fix MSan false positives - #102305
alexey-milovidov wants to merge 4 commits into
Conversation
…e positives 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 (e.g. STID 1478-2063 in `system.text_log`). The one-time `__msan_unpoison` at fiber allocation is insufficient because `BOOST_USE_MSAN` (added in #102158) now properly preserves shadow across context switches — including the dirty padding shadow. Fix by calling `__msan_unpoison` on the whole fiber stack after every `__msan_finish_switch_fiber` on AArch64. This clears accumulated dirty padding without affecting the main thread stack. Fixes: #102241 CI report: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=97744&sha=aa7dccac1cbacd8009ec368bdbf6045ff7bc3c29&name_0=PR&name_1=Stress%20test%20%28arm_msan%29 Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
|
Workflow [PR], commit [3169f58] Summary: ✅ AI ReviewSummaryThis PR updates ClickHouse Rules
Final Verdict
|
| @@ -1 +1 @@ | |||
| Subproject commit 8519680cb3ccd2246e4e5564b22492d288a53f4b | |||
| Subproject commit 2bbd74abb858eabc9d1ddc8de9b8cd7046085fd1 | |||
There was a problem hiding this comment.
❌ This submodule pointer currently cannot be fetched from https://github.com/ClickHouse/boost.
I verified with both GitHub API and local submodule update:
gh api repos/ClickHouse/boost/commits/2bbd74abb858eabc9d1ddc8de9b8cd7046085fd1returnsNo commit found.git submodule update --init contrib/boostfails withnot our reffor this SHA.
This is a merge blocker because fresh checkouts cannot initialize contrib/boost. Please push this commit to ClickHouse/boost (or update the gitlink to a published SHA).
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) <[email protected]>
Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
The previous commit added `__msan_unpoison` calls to fiber_ucontext.hpp for AArch64 but did not declare the function in `externc.hpp`, causing the arm_msan build to fail with "use of undeclared identifier". CI report: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=102305&sha=e87e73c4a31aa85a462c7f8bc22f319b6ce3d58a&name_0=PR&name_1=Build%20%28arm_msan%29 Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
LLVM Coverage Report
Changed lines: 100.00% (2/2) · Uncovered code |
|
Obsolete after #102344 |
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.
The one-time
__msan_unpoisonat fiber allocation (inFiberStack::allocate) is insufficient becauseBOOST_USE_MSAN(added in #102158) now properly preserves shadow across context switches — including the dirty padding shadow. This caused a spike from ~1-5 failures/day to 81 failures on April 9 for STID 1478-2063.Fix by calling
__msan_unpoisonon the whole fiber stack after every__msan_finish_switch_fiberon AArch64 infiber_ucontext.hpp. This clears accumulated dirty padding without affecting the main thread stack.CI report: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=97744&sha=aa7dccac1cbacd8009ec368bdbf6045ff7bc3c29&name_0=PR&name_1=Stress%20test%20%28arm_msan%29
Fixes: #102241
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
...
Documentation entry for user-facing changes