Rustc --version segmentation fault


#1

Hello,
I would like to report behaviour I observe from rustc, and request help that may be available.

rust installs with (following info from here: https://github.com/rust-lang-nursery/rustup.rs/issues/695):

$ curl -sSf https://static.rust-lang.org/rustup.sh | sh

An error occurs with:

$ rustc --version
Segmentation fault

Normal behaviour (version displays) occurs with:

$ strace -o /dev/null rustc --version
rustc 1.27.2 (58cc626de 2018-07-18)

The system is:

$ uname --all
Linux s7netserver 3.12.5-301.fc20.i686+PAE #1 SMP Mon Dec 16 18:42:48 EST 2013 i686 i686 i386 GNU/Linux
$ cat /etc/*-release
Fedora release 20 (Heisenbug)

Is there any precedent or advice relating to this issue?


#2

I’m guessing this is out of your control on that s7 appliance, but a 2013 kernel will be missing many security updates, and the rest of userspace is probably outdated too. I use Fedora every day, but it’s a bad choice for a long-term consumer device if they have no plans to update it to newer releases. Even something with longer support like CentOS will still need to get updates. (disclaimer, I’m a Red Hat employee)

Anyway, it’s strange that strace apparently fixes it! You could run it in GDB instead, but the mysterious bug might still disappear with any kind of ptrace tool attached. GDB will be more helpful than strace if you do catch the segfault though, so you can see where the actual memory error is.

Note that by default, strace doesn’t follow threads or new processes, so here you’re only actually tracing rustup’s shim ~/.cargo/bin/rustc which will forward to the “real” thing. You could also try strace -f to follow everything, or try directly running ~/.rustup/toolchains/stable-i686-unknown-linux-gnu/bin/rustc --version.


#3

Thanks cuviper,
True, the kernel is beyond my control.

gdb outputs this:

$ gdb -quiet --args rustc --version
Reading symbols from rustc…(no debugging symbols found)…done.
(gdb) run
Starting program: /usr/local/bin/rustc --version
[Thread debugging using libthread_db enabled]
Using host libthread_db library “/lib/libthread_db.so.1”.

Program terminated with signal SIGSEGV, Segmentation fault.
The program no longer exists.
(gdb)

When running strace -f rustc --version, rustc function correctly.
Regarding directly running ~/.rustup/toolchains/stable-i686-unknown-linux-gnu/bin/rustc --version, this exectuable does not exist on the system here.


#4

What do you get for rustc --print sysroot ? (Under strace if you must to avoid the segfault…) I was just guessing your full toolchain path, but that will tell the true prefix to bin/rustc.


#5

I get:

$ strace -o /dev/null rustc --print sysroot
/usr/local

and:

$ /usr/local/bin/rustc --version
Segmentation fault


#6

Report relating to this issue, made by myself:
https://github.com/rust-lang/rust/issues/52772