Skip to content

tests/ui/sanitize/leak.rs fails on Linux with sanitizers = true #111073

Closed
@danakj

Description

@danakj

Chromium bug discussion here: https://bugs.chromium.org/p/chromium/issues/detail?id=1441181#c5

We want to build rustc with sanitizers = true in config.toml in order to get sanitizer runtimes. However when we do, the leak.rs test fails with a CHECK failure in LLVM.

error: error pattern ' LeakSanitizer: detected memory leaks' not found!
status: exit status: 23
command: cd "/home/danakj/s/c/src/third_party/rust_src/src/build/x86_64-unknown-linux-gnu/test/ui/sanitize/leak" && RUST_TEST_THREADS="72" "/home/danakj/s/c/src/third_party/rust_src/src/build/x86_64-unknown-linux-gnu/test/ui/sanitize/leak/a"
stdout: none
--- stderr -------------------------------
LeakSanitizer: CHECK failed: lsan_interceptors.cpp:82 "((!lsan_init_is_running)) != (0)" (0x0, 0x0) (tid=309157)
------------------------------------------

Which is failing a check inside the ENSURE_LSAN_INITED macro here: https://github.com/llvm/llvm-project/blob/89a44b0faee0ca6b741e1f0ef31163374887b6ed/compiler-rt/lib/lsan/lsan_interceptors.cpp#L82

We're building against LLVM HEAD-ish, so I tried with upstream rustc and the test fails when compiled with that as well (reduced command line from the actual test invocation):

% rustc --version
rustc 1.71.0-nightly (9ecda8de8 2023-04-30)
% rustc ~/s/c/src/third_party/rust_src/src/tests/ui/sanitize/leak.rs -Zthreads=1 --target=x86_64-unknown-linux-gnu --error-format json --json future-incompat -Ccodegen-units=1 -Zui-testing -o ~/s/c/src/third_party/rust_src/src/build/x86_64-unknown-linux-gnu/test/ui/sanitize/leak/a -A unused -Crpath -Z sanitizer=leak -O
% cd ~/s/c/src/third_party/rust_src/src/build/x86_64-unknown-linux-gnu/test/ui/sanitize/leak && RUST_TEST_THREADS="72" ~/s/c/src/third_party/rust_src/src/build/x86_64-unknown-linux-gnu/test/ui/sanitize/leak/a
LeakSanitizer: CHECK failed: lsan_interceptors.cpp:82 "((!lsan_init_is_running)) != (0)" (0x0, 0x0) (tid=911869)

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-LLVMArea: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.A-sanitizersArea: Sanitizers for correctness and code qualityA-testsuiteArea: The testsuite used to check the correctness of rustcC-bugCategory: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.llvm-fixed-upstreamIssue expected to be fixed by the next major LLVM upgrade, or backported fixes

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions