Repository navigation
Wire up LeakSanitizer support - #828
Merged
Merged
Conversation
helly25
requested review from
dzbarsky,
fmeum,
jsharpe and
rrbutani
as code owners
August 16, 2026 14:23
helly25
enabled auto-merge (squash)
August 16, 2026 14:52
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.
Fixes #826.
Summary
Wire rules_cc's stock
lsanfeature into the same augmentation path as asan, ubsan, and tsan://toolchain/config:use_lsanand include it inuse_common_sanitizerlibclang_rt.lsan_osx_dynamic.dylibfilegroup and route it throughdynamic_runtime_lib//:lsan_testand run it with the Linux sanitizer testsThe Darwin version pin is deliberate. On current macOS, LLVM 19.1.7, 20.1.8, and 21.1.8 all run
mainand then deadlock during LSan's exit check. The leak-check thread callsdyld_shared_cache_iterate_text, which lazily loads dyld introspection code and allocates while LSan holds its allocator lock. LLVM compiler-rt #182943 switched this path to_dyld_get_dyld_header; that fix was backported to LLVM 22, and LLVM 22.1.8 exits normally.The configured action graph now contains a
SolibSymlinkwhose declared input islibclang_rt.lsan_osx_dynamic.dylib, so the runtime is provisioned rather than merely found incidentally in the local execroot.Verification
On macOS arm64:
mainmainmain//:lsan_testpasses//:sanitizer_combo_flags_testpassesactionlintandgit diff --checkpassUpstream fix: llvm/llvm-project#182943