Skip to content

rustc segfault #59032

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
ghost opened this issue Mar 9, 2019 · 9 comments
Closed

rustc segfault #59032

ghost opened this issue Mar 9, 2019 · 9 comments
Labels
C-bug Category: This is a bug. I-crash Issue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@ghost
Copy link

ghost commented Mar 9, 2019

[]$ rustup update

$ cargo build
error: process didn't exit successfully: `rustc -vV` (signal: 11, SIGSEGV: invalid memory reference)
--- stdout
rustc 1.33.0 (2aa4c46cf 2019-02-28)
binary: rustc
commit-hash: 2aa4c46cfdd726e97360c2734835aa3515e8c858
commit-date: 2019-02-28
host: x86_64-unknown-linux-gnu
release: 1.33.0
[]$ rustup show
(...)
thread 'main' panicked at 'installed manifest should have a known target', src/libcore/option.rs:1038:5

[]$ rustup self uninstall

[]$ curl https://sh.rustup.rs -sSf | sh

[]$ rustup show
looked fine, no more error

[]$ rustc -v
Segmentation fault (core dumped)

[]$ rustup install nightly

[]$ rustup default nightly

[]$ cargo new --bin whyyousegfault

[]$ cd whyyousegfault/

[whyyousegfault]$ cargo build
error: process didn't exit successfully: `rustc -vV` (signal: 11, SIGSEGV: invalid memory reference)
--- stdout
rustc 1.35.0-nightly (88f755f8a 2019-03-07)
binary: rustc
commit-hash: 88f755f8a84df1d9e6b17cf10c96ae8b93481b2e
commit-date: 2019-03-07
host: x86_64-unknown-linux-gnu
release: 1.35.0-nightly

[whyyousegfault]$ rustup default stable

[whyyousegfault]$ cargo build
error: process didn't exit successfully: `rustc -vV` (signal: 11, SIGSEGV: invalid memory reference)
--- stdout
rustc 1.33.0 (2aa4c46cf 2019-02-28)
binary: rustc
commit-hash: 2aa4c46cfdd726e97360c2734835aa3515e8c858
commit-date: 2019-02-28
host: x86_64-unknown-linux-gnu
release: 1.33.0

[whyyousegfault]$

Fedora 29

@jonas-schievink jonas-schievink added I-crash Issue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. C-bug Category: This is a bug. labels Mar 9, 2019
@nagisa
Copy link
Member

nagisa commented Mar 9, 2019

Please provide a backtrace for the rustc itself. Make sure it is the rustc and not the wrapper from rustup.

@mnirfan
Copy link

mnirfan commented Mar 11, 2019

I experienced the same problem on Ubuntu 16.04

@mnirfan
Copy link

mnirfan commented Mar 11, 2019

In my case, I figured out that the reason my rustc become segfault was a preloaded library libesets_pac.so from ESET antivirus (my laptop is preinstaled with that). Here is my GDB backtrace:

$ gdb --args rustc --version

Starting program: /usr/local/bin/rustc --version
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

Program received signal SIGSEGV, Segmentation fault.
0x0000000000000000 in ?? ()
(gdb) bt
#0  0x0000000000000000 in ?? ()
#1  0x00007ffff7e8757c in ?? () from /usr/lib/libesets_pac.so
#2  0x00007ffff7e876a0 in fcntl () from /usr/lib/libesets_pac.so
#3  0x0000555555585656 in os_overcommits_proc ()
    at /rustc/2aa4c46cfdd726e97360c2734835aa3515e8c858/obj/build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-linux-gnu/release/build/jemalloc-sys-539c8a7040e7c5bc/out/jemalloc/src/pages.c:447
#4  _rjem_je_pages_boot ()
    at /rustc/2aa4c46cfdd726e97360c2734835aa3515e8c858/obj/build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-linux-gnu/release/build/jemalloc-sys-539c8a7040e7c5bc/out/jemalloc/src/pages.c:579
#5  0x0000555555561911 in malloc_init_hard_a0_locked ()
    at /rustc/2aa4c46cfdd726e97360c2734835aa3515e8c858/obj/build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-linux-gnu/release/build/jemalloc-sys-539c8a7040e7c5bc/out/jemalloc/src/jemalloc.c:1291
#6  0x000055555555c258 in malloc_init_hard ()
    at /rustc/2aa4c46cfdd726e97360c2734835aa3515e8c858/obj/build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-linux-gnu/release/build/jemalloc-sys-539c8a7040e7c5bc/out/jemalloc/src/jemalloc.c:1517
#7  malloc_init ()
    at /rustc/2aa4c46cfdd726e97360c2734835aa3515e8c858/obj/build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-linux-gnu/release/build/jemalloc-sys-539c8a7040e7c5bc/out/jemalloc/src/jemalloc.c:217
#8  imalloc (sopts=<optimized out>, dopts=<optimized out>)
    at /rustc/2aa4c46cfdd726e97360c2734835aa3515e8c858/obj/build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-linux-gnu/release/build/jemalloc-sys-539c8a7040e7c5bc/out/jemalloc/src/jemalloc.c:1986
#9  calloc (num=1, size=32)
    at /rustc/2aa4c46cfdd726e97360c2734835aa3515e8c858/obj/build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-linux-gnu/release/build/jemalloc-sys-539c8a7040e7c5bc/out/jemalloc/src/jemalloc.c:2138
#10 0x00007ffff726b627 in ?? () from /lib/x86_64-linux-gnu/libdl.so.2
#11 0x00007ffff726b088 in dlsym () from /lib/x86_64-linux-gnu/libdl.so.2
#12 0x00007ffff7e847c9 in ?? () from /usr/lib/libesets_pac.so
#13 0x00007ffff7e85aa7 in ?? () from /usr/lib/libesets_pac.so
---Type <return> to continue, or q <return> to quit---
#14 0x00007ffff7eb1256 in ?? () from /usr/lib/libesets_pac.so
#15 0x0000000000000002 in ?? ()
#16 0x00007ffff7fd7000 in ?? ()
#17 0x0000000000000002 in ?? ()
#18 0x00007ffff7e8389b in ?? () from /usr/lib/libesets_pac.so
#19 0x0000000000000002 in ?? ()
#20 0x00007ffff7de767a in ?? () from /lib64/ld-linux-x86-64.so.2
#21 0x00007ffff7de77cb in ?? () from /lib64/ld-linux-x86-64.so.2
#22 0x00007ffff7dd7c6a in ?? () from /lib64/ld-linux-x86-64.so.2
#23 0x0000000000000002 in ?? ()
#24 0x00007fffffffe028 in ?? ()
#25 0x00007fffffffe03d in ?? ()
#26 0x0000000000000000 in ?? ()

after removing the preloaded library from /etc/ld.so.preload, the rustc runs perfectly.
So, maybe ESET was blocked the rustc, but it doesn't give any notification.

@pnkfelix
Copy link
Member

incompatibilities with ESET were previously noted (or at least hypothesized) over here

@ghost
Copy link
Author

ghost commented Mar 12, 2019

(I'm currently using my distro's version of rust to complete some work, will update this issue with the backtrace when time allows)

@glittershark
Copy link
Contributor

glittershark commented Apr 26, 2019

This is happening to me with LD_PRELOAD=/usr/lib/libjemalloc.so.2 on Arch

@nfm
Copy link

nfm commented Apr 27, 2019

I'm hitting this too on Ubuntu 18.10 when trying to compile the first 'hello world' example from the Rust Programming Language book.

I also have LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libjemalloc.so.2, and when I unset LD_PRELOAD, I can compile without segfaulting.

I don't have ESET installed, it looks like this only relates to jemalloc for me.

@RelayrMA
Copy link

Same here on gentoo with ESET.

Program received signal SIGSEGV, Segmentation fault.
0x0000000000000000 in ?? ()
(gdb) bt
#0  0x0000000000000000 in ?? ()
#1  0x00007ffff7e3f2d9 in ?? () from /usr/lib64/libesets_pac.so
#2  0x00007ffff7e3f3fd in fcntl () from /usr/lib64/libesets_pac.so
#3  0x00005555555856f6 in os_overcommits_proc () at ../jemalloc/src/pages.c:447
#4  _rjem_je_pages_boot () at ../jemalloc/src/pages.c:579
#5  0x0000555555561931 in malloc_init_hard_a0_locked () at ../jemalloc/src/jemalloc.c:1291
#6  0x000055555555c248 in malloc_init_hard () at ../jemalloc/src/jemalloc.c:1517
#7  malloc_init () at ../jemalloc/src/jemalloc.c:217
#8  imalloc (sopts=<optimized out>, dopts=<optimized out>) at ../jemalloc/src/jemalloc.c:1986
#9  calloc (num=num@entry=1, size=size@entry=32) at ../jemalloc/src/jemalloc.c:2138
#10 0x00007ffff77e7bc9 in _dlerror_run (operate=operate@entry=0x7ffff77e7450 <dlsym_doit>, args=args@entry=0x7fffffffd8d0) at dlerror.c:141
#11 0x00007ffff77e74ff in __dlsym (handle=<optimized out>, name=<optimized out>) at dlsym.c:70
#12 0x00007ffff7e3c69c in ?? () from /usr/lib64/libesets_pac.so
#13 0x00007ffff7e3d91c in ?? () from /usr/lib64/libesets_pac.so
#14 0x00007ffff7e68dc6 in ?? () from /usr/lib64/libesets_pac.so
#15 0x0000000000000001 in ?? ()
#16 0x00007ffff7f8f000 in ?? ()
#17 0x0000000000000001 in ?? ()
#18 0x00007ffff7e3b89b in ?? () from /usr/lib64/libesets_pac.so
#19 0x0000000000000001 in ?? ()
#20 0x00007ffff7fe327a in call_init (l=0x7ffff7f79000, argc=-9856, argc@entry=1, argv=argv@entry=0x7fffffffda18, env=env@entry=0x7fffffffda28) at dl-init.c:58
#21 0x00007ffff7fe33b4 in call_init (env=0x7fffffffda28, argv=0x7fffffffda18, argc=1, l=<optimized out>) at dl-init.c:30
#22 _dl_init (main_map=0x7ffff7ffe130, argc=1, argv=0x7fffffffda18, env=0x7fffffffda28) at dl-init.c:119
#23 0x00007ffff7fd50ca in _dl_start_user () from /lib64/ld-linux-x86-64.so.2
#24 0x0000000000000001 in ?? ()
#25 0x00007fffffffddc6 in ?? ()
#26 0x0000000000000000 in ?? ()
(gdb) quit

@Enselic
Copy link
Member

Enselic commented Nov 25, 2023

Triage: Thank you for reporting.

In the provided backtraces it is libesets_pac.so that is crashing, so it is the libesets_pac.so people that needs to fix the crash. Since there is no action to take on the rustc side, I will close this now.

@Enselic Enselic closed this as not planned Won't fix, can't repro, duplicate, stale Nov 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. I-crash Issue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

8 participants