Files
Martin Vogel d6c8d1dd0a fix(msan): split the known-red block by cause; fix the RSS one properly
The x86-64 leg runs this lane without exclusions on purpose, to settle
which limits are architectural. It has now run, and it disproves part of
what the previous block asserted. That block claimed all seven excluded
suites "abort with stack-overflow". Five do. Two do not, and lumping
them together hid two different problems behind one rationale.

  (A) stack-overflow, five suites: grammar_regression grammar_labels
      pipeline lang_contract grammar_probe_e. Confirmed on BOTH arm64 and
      x86-64 (CI logged 5), so it is not the aarch64 artifact an earlier
      note claimed. The recursion guards bound DEPTH while the resource
      exhausted is BYTES; that follow-up stands unchanged.

  (B) cli: no overflow at all. On x86-64 it runs to completion, 253
      passed / 5 failed, every failure in the install or activation path,
      with "agent_config agent=OpenClaw op=mcp_install" above them. Green
      on every other venue. MSan reported zero use-of-uninitialized-value
      in it, so the exclusion costs no uninit coverage. Recorded as
      undiagnosed rather than guessed at: the local lane is arm64 where
      these suites hit (A) before reaching this code, so there is no
      faithful venue to iterate in and each attempt is a ~30min round
      trip. That is a follow-up with an owner, not a dismissal.

  (C) incremental: an RSS BUDGET failure, 3054MB against a 2304MB limit
      -- not an overflow either. MSan maps shadow (and origin) memory for
      every allocation, so the budget cannot separate a leak from shadow.
      FIXED rather than excluded: the assertion is now skipped under
      __has_feature(memory_sanitizer) only, so the guard keeps its teeth
      on every other platform, where inflating the budget would have
      blinded it. The suite stays IN the lane.

Verified: with (C) fixed, incremental is 163 passed / 0 failed and ZERO
stack-overflows under the local arm64 MSan container -- so it never
belonged in the overflow list on either architecture.

msan-lane.sh no longer forces MSAN_EXCLUDE empty. That override existed
to ask the architectural question; it is answered, and keeping it would
re-red the gate for causes already recorded. Both venues now read the one
authoritative list in scripts/msan.sh, which still warns loudly that the
lane is partial.

Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
2026-08-04 04:58:44 +02:00

58 lines
2.4 KiB
Bash
Executable File

#!/usr/bin/env bash
# MemorySanitizer lane — the canonical entry, used by every venue.
#
# MSan needs every linked library instrumented or reads of memory those
# libraries wrote report as uninitialized, so the lane runs inside an image
# carrying an MSan-built libc++/libc++abi/libunwind and zlib
# (test-infrastructure/Dockerfile.msan). Building that image is the expensive
# part, hence the buildx layer cache.
#
# Locally the same lane is reached through the compose service:
# ./test-infrastructure/run.sh msan
# which shares scripts/msan.sh with this path — one harness, both venues.
#
# Usage: scripts/ci/msan-lane.sh [build|run|all] (default: all)
set -euo pipefail
cd "$(dirname "$0")/../.."
CACHE_DIR="${MSAN_BUILDX_CACHE:-/tmp/.buildx-msan}"
IMAGE="${MSAN_IMAGE:-cbm-msan:ci}"
BUILDER="${MSAN_BUILDER:-msan-builder}"
MODE="${1:-all}"
build_image() {
echo "=== MSan image (buildx, cached layers) ==="
# A builder may already exist from a previous step or a retried job.
docker buildx create --use --name "$BUILDER" 2>/dev/null || docker buildx use "$BUILDER"
docker buildx build \
--cache-from "type=local,src=$CACHE_DIR" \
--cache-to "type=local,dest=$CACHE_DIR,mode=max" \
-f test-infrastructure/Dockerfile.msan \
-t "$IMAGE" --load test-infrastructure/
}
run_suite() {
# MSAN_EXCLUDE is intentionally NOT passed, so the container inherits the
# single authoritative list defined in scripts/msan.sh (which documents each
# excluded suite and the cause it is excluded for).
#
# This leg used to force it empty to settle whether the local arm64
# exclusions were an aarch64 artifact. It answered that: the five
# deep-recursion suites overflow on x86-64 too, `cli` fails for an unrelated
# install-path reason, and `incremental` was a shadow-memory RSS artifact
# that is now fixed in the test rather than skipped. Keeping the override
# would re-red the gate for causes already recorded, so the question is
# closed and the venues share one list. scripts/msan.sh still warns loudly
# that the lane is partial, which is the honest signal to keep.
echo "=== MSan suite (exclusions per scripts/msan.sh) ==="
docker run --rm -v "$PWD:/src" -w /src "$IMAGE"
}
case "$MODE" in
build) build_image ;;
run) run_suite ;;
all) build_image; run_suite ;;
*) echo "usage: $0 [build|run|all]" >&2; exit 2 ;;
esac