Skip to content

MSan segfaults under fat LTO #68367

Closed
@nikic

Description

@nikic

Running https://github.com/rust-lang/rust/blob/master/src/test/ui/sanitizer-memory.rs under -C lto=fat, the test segfaults with:

==11725==ERROR: MemorySanitizer: SEGV on unknown address 0x3ffe4b748058 (pc 0x5567fb27ac91 bp 0x000000000000 sp 0x7ffe4b747fe0 T11725)
==11725==The signal is caused by a READ memory access.
    #0 0x5567fb27ac90 in xor (/home/nikic/rust/sanitizer-memory+0x63c90)
    #1 0x5567fb27b19d in main (/home/nikic/rust/sanitizer-memory+0x6419d)
    #2 0x7f37be59cb96 in __libc_start_main /build/glibc-OTsEL5/glibc-2.27/csu/../csu/libc-start.c:310
    #3 0x5567fb21eff9 in _start (/home/nikic/rust/sanitizer-memory+0x7ff9)

I ran into this in #67759, because as of LLVM 10 the same happens with ThinLTO as well.

This issue is that __msan symbols gets internalized and DCEd, as they are not part of the exported symbol list.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-linkageArea: linking into static, shared libraries and binariesA-sanitizersArea: Sanitizers for correctness and code qualityC-bugCategory: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions