Skip to content

rustc segfaults with mimalloc #85076

Open
@thomasfsteeples

Description

@thomasfsteeples

I have rustc installed via rustup. Additionally, I'm using mimalloc as my allocator, loaded with the LD_PRELOAD environment variable. Taking a hello-world program and saving it as main.rs, running rustc main.rs yields:

fish: Job 1, 'rustc main.rs' terminated by signal SIGSEGV (Address boundary error)

Running gdb -ex run --args rustc main.rs gives me the following output:

Reading symbols from rustc...
Starting program: /home/[REDACTED]/.cargo/bin/rustc main.rs
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".
process 8078 is executing new program: /home/[REDACTED]/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/rustc
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".
[New Thread 0x7fffee1ff640 (LWP 8089)]

Thread 2 "rustc" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fffee1ff640 (LWP 8089)]
free (ptr=0x50ddf412300) at ../jemalloc/src/jemalloc.c:2393
2393	../jemalloc/src/jemalloc.c: No such file or directory.

If instead, I run env LD_PRELOAD="" rustc main.rs, then everything works as expected. I would expect rustc to work with a custom allocator.

Meta

rustc --version --verbose:

rustc 1.52.0 (88f19c6da 2021-05-03)
binary: rustc
commit-hash: 88f19c6dab716c6281af7602e30f413e809c5974
commit-date: 2021-05-03
host: x86_64-unknown-linux-gnu
release: 1.52.0
LLVM version: 12.0.0

Running on Arch Linux 5.11.6

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-allocatorsArea: Custom and system allocatorsA-linkageArea: linking into static, shared libraries and binariesC-bugCategory: This is a bug.I-crashIssue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.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