Local code intelligence for developers and AI agents. Connect code, docs and infrastructure in a persistent graph, with CBM Lens, MCP tools, agent integrations and change-aware test selection.
C aiderastclaude-codecode-analysiscode-intelligencecodexcursorcypherdeveloper-toolsgemini-cligraph-visualizationkilocodeknowledge-graphmcpmcp-servermodel-context-protocolopencodesqlitetree-sitterwindsurf
fix(ci): unbreak the MSan and diag lanes on x86-64
Martin Vogel7d390c512089
diff --git a/.github/workflows/_test.yml b/.github/workflows/_test.ymlindex 2a20d1bba..b6a4116b0 100644--- a/.github/workflows/_test.yml+++ b/.github/workflows/_test.yml@@ -213,14 +213,15 @@ jobs:ccache-diag-# Also enables the ASan checks that are off by default in every other- # lane: stack-use-after-return, stack-use-after-scope, invalid pointer- # pairs, and strict string checks. Mirrors `make -f Makefile.cbm diag`.+ # lane: stack-use-after-return, stack-use-after-scope, and strict string+ # checks. Mirrors `make -f Makefile.cbm diag`, including its reasoning+ # for leaving detect_invalid_pointer_pairs out.- name: Test (clang-22, ASan+UBSan + off-by-default ASan checks)env:- ASAN_OPTIONS: "detect_stack_use_after_return=1:detect_invalid_pointer_pairs=2:strict_string_checks=1:detect_stack_use_after_scope=1"+ ASAN_OPTIONS: "detect_stack_use_after_return=1:strict_string_checks=1:detect_stack_use_after_scope=1"run: |scripts/test.sh CC=clang-22 CXX=clang++-22 \- SANITIZE="-fsanitize=address,undefined,pointer-compare,pointer-subtract -fno-omit-frame-pointer -fno-optimize-sibling-calls"+ SANITIZE="-fsanitize=address,undefined -fno-omit-frame-pointer -fno-optimize-sibling-calls"- name: Compiler cache (save)if: always()diff --git a/Makefile.cbm b/Makefile.cbmindex 367d1b085..bb9678c11 100644--- a/Makefile.cbm+++ b/Makefile.cbm@@ -1090,11 +1090,18 @@ lint-ci: lint-cppcheck lint-format lint-no-suppress# else, which is the difference between running ASan and running all of it:# detect_stack_use_after_return a returned-to stack frame reused later# detect_stack_use_after_scope a pointer outliving its enclosing block-# detect_invalid_pointer_pairs comparing/subtracting pointers into-# different objects (needs the matching-# -fsanitize=pointer-compare,pointer-subtract-# instrumentation, hence the SANITIZE below)# strict_string_checks str* reads validated over the whole buffer+#+# detect_invalid_pointer_pairs is deliberately NOT here. It fires during+# static initialisation inside vendored simplecpp -- a std::string global at+# simplecpp.cpp:101 -- reporting a pair whose second "pointer" is the+# sentinel 0xfffffffffffffff3, i.e. libstdc++ string internals rather than+# anything this codebase wrote. The option is a process-wide runtime flag+# with no per-file scoping, so it cannot be aimed away from vendored code the+# way the analyzer's path filter can. Enabling it would mean a permanently+# red lane reporting a non-defect, which teaches people to ignore the lane.+# The instrumentation it requires (-fsanitize=pointer-compare,pointer-+# subtract) comes out with it, since it is dead weight without the check.# They stay on the diagnostic lane rather than the gating ones until they have# a clean history here; promoting them is a separate, deliberate step.DIAG_LLVM_BIN ?= /opt/homebrew/opt/llvm/bin@@ -1102,8 +1109,8 @@ diag:@echo "=== diagnostic lane: $(shell $(DIAG_LLVM_BIN)/clang --version | head -1) ==="$(MAKE) -f Makefile.cbm build/diag/test-runner \CC=$(DIAG_LLVM_BIN)/clang CXX=$(DIAG_LLVM_BIN)/clang++ BUILD_DIR=build/diag \- SANITIZE="-fsanitize=address,undefined,pointer-compare,pointer-subtract -fno-omit-frame-pointer -fno-optimize-sibling-calls"- ASAN_OPTIONS="detect_stack_use_after_return=1:detect_invalid_pointer_pairs=2:strict_string_checks=1:detect_stack_use_after_scope=1" \+ SANITIZE="-fsanitize=address,undefined -fno-omit-frame-pointer -fno-optimize-sibling-calls"+ ASAN_OPTIONS="detect_stack_use_after_return=1:strict_string_checks=1:detect_stack_use_after_scope=1" \./build/diag/test-runner# ── macOS leak detection ─────────────────────────────────────────diff --git a/scripts/msan.sh b/scripts/msan.shindex 7ecc598c2..8d42390ab 100755--- a/scripts/msan.sh+++ b/scripts/msan.sh@@ -41,7 +41,19 @@ if [ "$MSAN_ORIGINS" = "0" ]; thenelseMSAN_ORIGIN_FLAG="-fsanitize-memory-track-origins=$MSAN_ORIGINS"fi-MSAN_SAN="-fsanitize=memory $MSAN_ORIGIN_FLAG -fno-omit-frame-pointer -isystem $MSAN_PREFIX/include"+# -include stdint.h: vendored zstd carries an MSan-only block (guarded by+# MEMORY_SANITIZER) that declares __msan_test_shadow returning intptr_t. It+# reaches for the type with the usual+# #define ZSTD_DEPS_NEED_STDINT+# #include "zstd_deps.h"+# idiom, but the amalgamator that produced zstd.c collapsed that second+# include into a "skipping file" comment, so the define never pulls anything+# in and intptr_t is undeclared. Only this lane compiles that block, and only+# where <stddef.h> does not happen to drag stdint.h in transitively -- which+# is why it builds on aarch64 glibc and fails on x86-64. Forcing the header+# is a lane-local fix; patching the vendored amalgamation would be undone by+# the next re-vendor.+MSAN_SAN="-fsanitize=memory $MSAN_ORIGIN_FLAG -fno-omit-frame-pointer -include stdint.h -isystem $MSAN_PREFIX/include"# Always clean: make does not encode flags into dependencies, so a build dir# populated under different stdlib/sanitizer flags silently mixes objects