Add MemorySanitizer build to CI #67

Closed
weaselbot wants to merge 3 commits from weaselbot/conflict-set:weaselbot/issue-66 into main
3 Commits
Author SHA1 Message Date
weaselbot 9adf6f44f4 Install mc in the msan CI job
CI / pre-commit (pull_request) Successful in 1m59s
CI / test (-DCMAKE_BUILD_TYPE=Debug, debug) (pull_request) Successful in 3m16s
CI / test (-DCMAKE_CXX_FLAGS=-DUSE_64_BIT=1, 64-bit-versions) (pull_request) Successful in 3m10s
CI / test (-DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++, gcc) (pull_request) Successful in 3m6s
CI / test (-DUSE_SIMD_FALLBACK=ON, simd-fallback) (pull_request) Successful in 3m10s
CI / release (amd64, ubuntu-latest-amd64) (pull_request) Successful in 5m5s
CI / release (arm64, ubuntu-latest-arm64) (pull_request) Successful in 2m15s
CI / coverage (pull_request) Successful in 3m42s
CI / msan (pull_request) Failing after 3m38s
The msan job uploads test results to MinIO with `mc cp`, but unlike the
test/release/coverage jobs it never installed the mc binary.  When
MinIO credentials are configured (i.e. after merge) the upload step
would fail.  Install mc to match the other jobs.
2026-07-22 18:48:49 -04:00
weaselbot 321a23f1dc Avoid reading uninitialized end.p for point writes/reads
For point writes and point reads (end.len == 0), end.p is not part of
the API contract and callers may leave it uninitialized -- both the C
and C++ API smoke tests and the fuzz test driver do so.  However,
insertPointWritesOrSorted and check::Job::init unconditionally built a
TrivialSpan from end.p, reading the uninitialized pointer even though
it is never used for point operations.

Move the end span construction into the range-write/range-read branches
so end.p is only read when end.len > 0.  This is semantically identical
but removes the uninitialized reads that MemorySanitizer reports.
2026-07-22 18:48:46 -04:00
andrewandweaselbot 0510f01fe1 ci: add MemorySanitizer CI job
Add build_msan_toolchain.sh to produce a tarball containing an
MSan-instrumented libc++/libc++abi/libunwind toolchain, and add an msan
CI job that downloads the tarball and runs the test suite under MSan.

Also add USE_MSAN CMake option that disables conflicting sanitizers,
switches to lld, and propagates -fsanitize=memory to the shared library
and fuzz_driver targets.
2026-07-22 18:42:10 -04:00