Fix MSan false positive in fiber stack memory#100138
Merged
alexey-milovidov merged 5 commits intomasterfrom Mar 22, 2026
Merged
Fix MSan false positive in fiber stack memory#100138alexey-milovidov merged 5 commits intomasterfrom
alexey-milovidov merged 5 commits intomasterfrom
Conversation
Fiber stacks are heap-allocated via `aligned_alloc`, so MSan considers them entirely uninitialized. Unlike the program's main stack (which the OS zero-initializes), fiber stack bytes that are never explicitly written to remain "uninitialized" in MSan's shadow. This causes false positives when stack slots are reused across function calls within the fiber — MSan traces the origin back to an earlier allocation in a completely unrelated function. The fix calls `__msan_unpoison` on the fiber stack after allocation. This is safe because MSan's per-variable lifetime tracking (via `__lifetime.start` / `__lifetime.end` compiler intrinsics) still properly resets shadow state for each local variable, so real uninitialized value bugs are still detected. https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=98677&sha=8536dc82c7ed23a6a5ebf073f36235f5be6ea9d7&name_0=PR&name_1=Stress%20test%20%28arm_msan%29 Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Contributor
|
Workflow [PR], commit [296cd06] Summary: ✅ AI ReviewSummaryThis PR fixes an MSan false positive by unpoisoning memory allocated for ClickHouse Rules
Final Verdict
|
This was referenced Mar 21, 2026
Contributor
LLVM Coverage Report
PR changed lines: PR changed-lines coverage: 100.00% (3/3, 0 noise lines excluded) |
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.
Fiber stacks are heap-allocated via
aligned_alloc, so MSan considers them entirely uninitialized. Unlike the program's main stack (which the OS zero-initializes), fiber stack bytes that are never explicitly written to remain "uninitialized" in MSan's shadow. This causes false positives when stack slots are reused across function calls within the fiber — MSan traces the origin back to an earlier allocation in a completely unrelated function.The fix calls
__msan_unpoisonon the fiber stack after allocation. This is safe because MSan's per-variable lifetime tracking (via__lifetime.start/__lifetime.endcompiler intrinsics) still properly resets shadow state for each local variable, so real uninitialized value bugs are still detected.https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=98677&sha=8536dc82c7ed23a6a5ebf073f36235f5be6ea9d7&name_0=PR&name_1=Stress%20test%20%28arm_msan%29
Changelog category (leave one):