Disable SimSIMD SVE under MSAN to fix false-positive sanitizer reports#100862
Disable SimSIMD SVE under MSAN to fix false-positive sanitizer reports#100862groeneai wants to merge 1 commit intoClickHouse:masterfrom
Conversation
MSAN cannot instrument ARM SVE intrinsics, causing false "use-of-uninitialized-value" reports in simsimd_cos_f32_sve during capability probing. This disables SVE compilation targets under MSAN so SimSIMD falls back to NEON/scalar implementations that MSAN tracks correctly. Fixes STID 1003-358c (arm_msan variant). Co-Authored-By: Claude Opus 4.6 <[email protected]>
Pre-PR Validation Gate (Session 1c5e457a)a) Deterministic repro? b) Root cause explained? ✅ YES c) Fix matches root cause? ✅ YES d) Test intent preserved? ✅ YES e) Both directions demonstrated?
|
|
cc @rschu1ze — could you review this? It disables SimSIMD SVE compilation targets under MemorySanitizer to eliminate false-positive 'use-of-uninitialized-value' reports caused by MSAN's inability to instrument ARM SVE intrinsics. Falls back to NEON/scalar which MSAN can track correctly. |
|
For contrib changes you should open PRs directly in ClickHouse/contrib repos (e.g. https://github.com/ClickHouse/SimSIMD) |
|
Closing per @pufit's review feedback — contrib changes should go to the upstream repo directly. Resubmitted the fix as ClickHouse/SimSIMD#17 (targets |
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
Summary
MemorySanitizer: use-of-uninitialized-valueinsimsimd_cos_f32_sve(STID 1003-358c) fires on ARM MSAN builds because MSAN has no SVE-specific shadow propagation. Evensvdupq_n_f32(0.f, 0.f, 0.f, 0.f)— a literal zero constant — is flagged as uninitialized.The existing mitigations from PRs #98699 and #98966 (zero-initialized probe buffer +
SIMSIMD_UNPOISONon results) are insufficient: MSAN reports the error inside the SVE kernel during vector operations (svld1_f32,svmla_f32_x,svaddv_f32), before control returns to the dispatch wrapper where unpoisoning happens.Root cause
ARM SVE intrinsics are opaque to MSAN's instrumentation. MSAN tracks initialization at the LLVM IR level, but SVE instructions are lowered to machine code that MSAN cannot follow. Every SVE operation produces "uninitialized" shadow regardless of actual input values. This is a known MSAN limitation — not a real bug.
Fix
Disable all SVE compilation targets (
SIMSIMD_TARGET_SVE,SVE2,SVE_F16,SVE_BF16,SVE_I8) when building with MSAN. SimSIMD automatically falls back to NEON/scalar implementations that MSAN can track correctly.Evidence that NEON fallback is safe: Zero NEON-related MSAN false positives in 90 days of CIDB data.
CIDB evidence
simsimd_cos_f32_svestack trace atspatial.h:818Phase 3 limitation
This bug requires ARM hardware with SVE + MSAN build to reproduce. Verified the fix compiles on x86. The fix is compile-time only (preprocessor guards) and provably safe — it only affects MSAN builds and only restricts capability selection to NEON/scalar paths that are already proven clean.