Skip to content
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

[beta] armv7-unknown-linux-gnueabihf bootstrap SIGILL #41291

Closed
cuviper opened this issue Apr 14, 2017 · 11 comments · Fixed by #41369
Closed

[beta] armv7-unknown-linux-gnueabihf bootstrap SIGILL #41291

cuviper opened this issue Apr 14, 2017 · 11 comments · Fixed by #41369

Comments

@cuviper
Copy link
Member

cuviper commented Apr 14, 2017

While bootstrapping on Fedora 25 armv7l, I'm hitting a SIGILL when some beta-compiled programs are actually executed. This is with a purely default ./configure, no external LLVM or anything.

On beta (exactly ca3d118), I get a little ways into stage1, and then build scripts SIGILL, apparently from double-panics. I reckon that the stable stage0 builds a stage1 compiler that's fine, then that stage1 starts building things that don't even need to execute until we get to a build script. Then:

Copying stage1 compiler (armv7-unknown-linux-gnueabihf)
Building stage1 std artifacts (armv7-unknown-linux-gnueabihf -> armv7-unknown-linux-gnueabihf)
    Finished release [optimized] target(s) in 0.1 secs
Copying stage1 std from stage1 (armv7-unknown-linux-gnueabihf -> armv7-unknown-linux-gnueabihf / armv7-unknown-linux-gnueabihf)
Building stage1 test artifacts (armv7-unknown-linux-gnueabihf -> armv7-unknown-linux-gnueabihf)
    Finished release [optimized] target(s) in 0.0 secs
Copying stage1 test from stage1 (armv7-unknown-linux-gnueabihf -> armv7-unknown-linux-gnueabihf / armv7-unknown-linux-gnueabihf)
Building stage1 compiler artifacts (armv7-unknown-linux-gnueabihf -> armv7-unknown-linux-gnueabihf)
   Compiling rustdoc v0.0.0 (file:///root/rust/src/librustdoc)
   Compiling flate v0.0.0 (file:///root/rust/src/libflate)
   Compiling rustc_llvm v0.0.0 (file:///root/rust/src/librustc_llvm)
   Compiling syntax v0.0.0 (file:///root/rust/src/libsyntax)
error: failed to run custom build command for `rustdoc v0.0.0 (file:///root/rust/src/librustdoc)`
process didn't exit successfully: `/root/rust/build/armv7-unknown-linux-gnueabihf/stage1-rustc/release/build/rustdoc-d21a2a025c4fade3/build-script-build` (signal: 4, SIGILL: illegal instruction)
--- stderr
thread panicked while processing panic. aborting.

Build failed, waiting for other jobs to finish...
error: failed to run custom build command for `flate v0.0.0 (file:///root/rust/src/libflate)`
process didn't exit successfully: `/root/rust/build/armv7-unknown-linux-gnueabihf/stage1-rustc/release/build/flate-45efc5f9b5c983fe/build-script-build` (signal: 4, SIGILL: illegal instruction)
--- stderr
thread panicked while processing panic. aborting.

Build failed, waiting for other jobs to finish...
error: failed to run custom build command for `rustc_llvm v0.0.0 (file:///root/rust/src/librustc_llvm)`
process didn't exit successfully: `/root/rust/build/armv7-unknown-linux-gnueabihf/stage1-rustc/release/build/rustc_llvm-95b19f11b71e673a/build-script-build` (signal: 4, SIGILL: illegal instruction)
--- stderr
thread panicked while processing panic. aborting.

Build failed, waiting for other jobs to finish...

So I also tried the master branch (exactly 43ef63d), and that fails as soon as it executes rustc at the start of stage1. Here it seems that the downloaded beta stage0 compiler builds all of its stuff fine, which presumably includes executing some builds scripts like above. But the stage1 rustc it creates seems to be bad:

Copying stage0 rustc from stage0 (armv7-unknown-linux-gnueabihf -> armv7-unknown-linux-gnueabihf / armv7-unknown-linux-gnueabihf)
executing step Step { name: "librustc", stage: 0, host: "armv7-unknown-linux-gnueabihf", target: "armv7-unknown-linux-gnueabihf" }
executing step Step { name: "rustc", stage: 1, host: "armv7-unknown-linux-gnueabihf", target: "armv7-unknown-linux-gnueabihf" }
Copying stage1 compiler (armv7-unknown-linux-gnueabihf)
executing step Step { name: "startup-objects", stage: 1, host: "armv7-unknown-linux-gnueabihf", target: "armv7-unknown-linux-gnueabihf" }
executing step Step { name: "build-crate-std", stage: 1, host: "armv7-unknown-linux-gnueabihf", target: "armv7-unknown-linux-gnueabihf" }
Building stage1 std artifacts (armv7-unknown-linux-gnueabihf -> armv7-unknown-linux-gnueabihf)
running: "/root/rust-nightly/build/armv7-unknown-linux-gnueabihf/stage0/bin/cargo" "build" "-j" "4" "--target" "armv7-unknown-linux-gnueabihf" "-v" "--release" "--features" "panic-unwind jemalloc backtrace" "--manifest-path" "/root/rust-nightly/src/libstd/Cargo.toml"
error: process didn't exit successfully: `/root/rust-nightly/build/bootstrap/debug/rustc -vV` (signal: 4, SIGILL: illegal instruction)
--- stderr
thread panicked while processing panic. aborting.



command did not execute successfully: "/root/rust-nightly/build/armv7-unknown-linux-gnueabihf/stage0/bin/cargo" "build" "-j" "4" "--target" "armv7-unknown-linux-gnueabihf" "-v" "--release" "--features" "panic-unwind jemalloc backtrace" "--manifest-path" "/root/rust-nightly/src/libstd/Cargo.toml"
expected success, got: exit code: 101

I traced through with gdb, and it's not actually bootstrap/debug/rustc crashing, rather the stage1/bin/rustc that it execs into. Here's the backtrace:

#0  0xb6e65e00 in std::panicking::rust_panic_with_hook::hcf91b7c3478664b3 () from /root/rust-nightly/build/armv7-unknown-linux-gnueabihf/stage1/bin/../lib/libstd-8ba26b786e55861e.so
#1  0xb6e65d30 in std::panicking::begin_panic::h8a671f9e65f4cf12 () from /root/rust-nightly/build/armv7-unknown-linux-gnueabihf/stage1/bin/../lib/libstd-8ba26b786e55861e.so
#2  0xb6e65ce4 in std::panicking::begin_panic_fmt::h9f922d1d569b2ea6 () from /root/rust-nightly/build/armv7-unknown-linux-gnueabihf/stage1/bin/../lib/libstd-8ba26b786e55861e.so
#3  0xb6e65c94 in rust_begin_unwind () from /root/rust-nightly/build/armv7-unknown-linux-gnueabihf/stage1/bin/../lib/libstd-8ba26b786e55861e.so
#4  0xb6e7d7f4 in core::panicking::panic_fmt::h9106bacc40a4f5cd () from /root/rust-nightly/build/armv7-unknown-linux-gnueabihf/stage1/bin/../lib/libstd-8ba26b786e55861e.so
#5  0xb6e3fa7c in core::result::unwrap_failed::h8d064d4d03caecd3 () from /root/rust-nightly/build/armv7-unknown-linux-gnueabihf/stage1/bin/../lib/libstd-8ba26b786e55861e.so
#6  0xb6e5ab10 in std::sys_common::thread_info::ThreadInfo::with::_$u7b$$u7b$closure$u7d$$u7d$::haa3976f926a1414d () from /root/rust-nightly/build/armv7-unknown-linux-gnueabihf/stage1/bin/../lib/libstd-8ba26b786e55861e.so
#7  0xb6e65750 in std::panicking::default_hook::hd83360e73457e19b () from /root/rust-nightly/build/armv7-unknown-linux-gnueabihf/stage1/bin/../lib/libstd-8ba26b786e55861e.so
#8  0xb6e65ebc in std::panicking::rust_panic_with_hook::hcf91b7c3478664b3 () from /root/rust-nightly/build/armv7-unknown-linux-gnueabihf/stage1/bin/../lib/libstd-8ba26b786e55861e.so
#9  0xb6e65d30 in std::panicking::begin_panic::h8a671f9e65f4cf12 () from /root/rust-nightly/build/armv7-unknown-linux-gnueabihf/stage1/bin/../lib/libstd-8ba26b786e55861e.so
#10 0xb6e65ce4 in std::panicking::begin_panic_fmt::h9f922d1d569b2ea6 () from /root/rust-nightly/build/armv7-unknown-linux-gnueabihf/stage1/bin/../lib/libstd-8ba26b786e55861e.so
#11 0xb6e65c94 in rust_begin_unwind () from /root/rust-nightly/build/armv7-unknown-linux-gnueabihf/stage1/bin/../lib/libstd-8ba26b786e55861e.so
#12 0xb6e7d7f4 in core::panicking::panic_fmt::h9106bacc40a4f5cd () from /root/rust-nightly/build/armv7-unknown-linux-gnueabihf/stage1/bin/../lib/libstd-8ba26b786e55861e.so
#13 0xb6e3fa7c in core::result::unwrap_failed::h8d064d4d03caecd3 () from /root/rust-nightly/build/armv7-unknown-linux-gnueabihf/stage1/bin/../lib/libstd-8ba26b786e55861e.so
#14 0xb6e5ab10 in std::sys_common::thread_info::ThreadInfo::with::_$u7b$$u7b$closure$u7d$$u7d$::haa3976f926a1414d () from /root/rust-nightly/build/armv7-unknown-linux-gnueabihf/stage1/bin/../lib/libstd-8ba26b786e55861e.so
#15 0xb6e65750 in std::panicking::default_hook::hd83360e73457e19b () from /root/rust-nightly/build/armv7-unknown-linux-gnueabihf/stage1/bin/../lib/libstd-8ba26b786e55861e.so
#16 0xb6e65ebc in std::panicking::rust_panic_with_hook::hcf91b7c3478664b3 () from /root/rust-nightly/build/armv7-unknown-linux-gnueabihf/stage1/bin/../lib/libstd-8ba26b786e55861e.so
#17 0xb6e65d30 in std::panicking::begin_panic::h8a671f9e65f4cf12 () from /root/rust-nightly/build/armv7-unknown-linux-gnueabihf/stage1/bin/../lib/libstd-8ba26b786e55861e.so
#18 0xb6e65ce4 in std::panicking::begin_panic_fmt::h9f922d1d569b2ea6 () from /root/rust-nightly/build/armv7-unknown-linux-gnueabihf/stage1/bin/../lib/libstd-8ba26b786e55861e.so
#19 0xb6e65c94 in rust_begin_unwind () from /root/rust-nightly/build/armv7-unknown-linux-gnueabihf/stage1/bin/../lib/libstd-8ba26b786e55861e.so
#20 0xb6e7d7f4 in core::panicking::panic_fmt::h9106bacc40a4f5cd () from /root/rust-nightly/build/armv7-unknown-linux-gnueabihf/stage1/bin/../lib/libstd-8ba26b786e55861e.so
#21 0xb6e3fa7c in core::result::unwrap_failed::h8d064d4d03caecd3 () from /root/rust-nightly/build/armv7-unknown-linux-gnueabihf/stage1/bin/../lib/libstd-8ba26b786e55861e.so
#22 0xb6e66a6c in std::rt::lang_start::h0d05e03c29910bbb () from /root/rust-nightly/build/armv7-unknown-linux-gnueabihf/stage1/bin/../lib/libstd-8ba26b786e55861e.so
#23 0xb6c6d73c in __libc_start_main () from /lib/libc.so.6
#24 0x7f5556f8 in _start ()

That looks like a triple panic!

The actual SIGILL is delivered for a udf instruction:

Dump of assembler code for function _ZN3std9panicking20rust_panic_with_hook17hcf91b7c3478664b3E:
   0xb6e65d78 <+0>:     push    {r4, r5, r6, r7, r8, r9, r11, lr}
   0xb6e65d7c <+4>:     sub     sp, sp, #72     ; 0x48
   0xb6e65d80 <+8>:     mov     r8, r0
   0xb6e65d84 <+12>:    ldr     r0, [pc, #544]  ; 0xb6e65fac <_ZN3std9panicking20rust_panic_with_hook17hcf91b7c3478664b3E+564>
   0xb6e65d88 <+16>:    ldr     r7, [r2]
   0xb6e65d8c <+20>:    ldmib   r2, {r4, r5}
   0xb6e65d90 <+24>:    mov     r9, r1
   0xb6e65d94 <+28>:    add     r0, pc, r0
   0xb6e65d98 <+32>:    bl      0xb6e3d8c8 <__tls_get_addr@plt>
   0xb6e65d9c <+36>:    ldr     r0, [r0]
   0xb6e65da0 <+40>:    cmp     r0, #0
   0xb6e65da4 <+44>:    beq     0xb6e65e04 <_ZN3std9panicking20rust_panic_with_hook17hcf91b7c3478664b3E+140>
   0xb6e65da8 <+48>:    ldr     r0, [pc, #512]  ; 0xb6e65fb0 <_ZN3std9panicking20rust_panic_with_hook17hcf91b7c3478664b3E+568>
   0xb6e65dac <+52>:    add     r0, pc, r0
   0xb6e65db0 <+56>:    bl      0xb6e3d8c8 <__tls_get_addr@plt>
   0xb6e65db4 <+60>:    ldr     r1, [r0, #4]
   0xb6e65db8 <+64>:    add     r6, r1, #1
   0xb6e65dbc <+68>:    str     r6, [r0, #4]
   0xb6e65dc0 <+72>:    cmp     r6, #2
   0xb6e65dc4 <+76>:    bls     0xb6e65e24 <_ZN3std9panicking20rust_panic_with_hook17hcf91b7c3478664b3E+172>
   0xb6e65dc8 <+80>:    ldr     r0, [pc, #484]  ; 0xb6e65fb4 <_ZN3std9panicking20rust_panic_with_hook17hcf91b7c3478664b3E+572>
   0xb6e65dcc <+84>:    ldr     r1, [pc, #484]  ; 0xb6e65fb8 <_ZN3std9panicking20rust_panic_with_hook17hcf91b7c3478664b3E+576>
   0xb6e65dd0 <+88>:    add     r0, pc, r0
   0xb6e65dd4 <+92>:    add     r1, pc, r1
   0xb6e65dd8 <+96>:    str     r0, [sp, #4]
   0xb6e65ddc <+100>:   mov     r0, #1
   0xb6e65de0 <+104>:   str     r0, [sp, #8]
   0xb6e65de4 <+108>:   mov     r0, #0
   0xb6e65de8 <+112>:   str     r0, [sp, #16]
   0xb6e65dec <+116>:   str     r0, [sp, #12]
   0xb6e65df0 <+120>:   str     r1, [sp, #20]
   0xb6e65df4 <+124>:   str     r0, [sp, #24]
   0xb6e65df8 <+128>:   add     r0, sp, #4
   0xb6e65dfc <+132>:   bl      0xb6e5ae8c <_ZN3std10sys_common4util10dumb_print17h91e4eccb0a94ba40E>
=> 0xb6e65e00 <+136>:   udf     #65006  ; 0xfdee
   0xb6e65e04 <+140>:   ldr     r0, [pc, #432]  ; 0xb6e65fbc <_ZN3std9panicking20rust_panic_with_hook17hcf91b7c3478664b3E+580>
   0xb6e65e08 <+144>:   add     r0, pc, r0
   0xb6e65e0c <+148>:   bl      0xb6e3d8c8 <__tls_get_addr@plt>
@cuviper
Copy link
Member Author

cuviper commented Apr 14, 2017

(side note: on the beta branch I have also applied #41152, or else you have to configure with an explicit --build to get armv7.)

@cuviper
Copy link
Member Author

cuviper commented Apr 14, 2017

I tried to build a debug nightly, but it can't link to panic in stage0's librustc_const_math:

  = note: /root/rust-nightly/build/armv7-unknown-linux-gnueabihf/stage0-rustc/armv7-unknown-linux-gnueabihf/debug/deps/rustc_const_math-3be4e5551d2ff493.0.o: In function `core::num::{{impl}}::overflowing_neg':
          /root/rust-nightly/src/libcore/num/mod.rs:1092: undefined reference to `core::panicking::panic::hcd3f9134398a073e'
          /root/rust-nightly/build/armv7-unknown-linux-gnueabihf/stage0-rustc/armv7-unknown-linux-gnueabihf/debug/deps/rustc_const_math-3be4e5551d2ff493.0.o: In function `core::num::{{impl}}::overflowing_shl':
          /root/rust-nightly/src/libcore/num/mod.rs:1124: undefined reference to `core::panicking::panic::hcd3f9134398a073e'
          /root/rust-nightly/build/armv7-unknown-linux-gnueabihf/stage0-rustc/armv7-unknown-linux-gnueabihf/debug/deps/rustc_const_math-3be4e5551d2ff493.0.o: In function `core::num::{{impl}}::overflowing_shr':
          /root/rust-nightly/src/libcore/num/mod.rs:1155: undefined reference to `core::panicking::panic::hcd3f9134398a073e'
          /root/rust-nightly/build/armv7-unknown-linux-gnueabihf/stage0-rustc/armv7-unknown-linux-gnueabihf/debug/deps/rustc_const_math-3be4e5551d2ff493.0.o: In function `core::num::{{impl}}::overflowing_shl':
          /root/rust-nightly/src/libcore/num/mod.rs:2245: undefined reference to `core::panicking::panic::hcd3f9134398a073e'
          /root/rust-nightly/build/armv7-unknown-linux-gnueabihf/stage0-rustc/armv7-unknown-linux-gnueabihf/debug/deps/rustc_const_math-3be4e5551d2ff493.0.o: In function `core::num::{{impl}}::overflowing_shr':
          /root/rust-nightly/src/libcore/num/mod.rs:2277: undefined reference to `core::panicking::panic::hcd3f9134398a073e'
          /root/rust-nightly/build/armv7-unknown-linux-gnueabihf/stage0-rustc/armv7-unknown-linux-gnueabihf/debug/deps/rustc_const_math-3be4e5551d2ff493.0.o:/root/rust-nightly/src/libcore/num/mod.rs:1092: more undefined references to `core::panicking::panic::hcd3f9134398a073e' follow
          collect2: error: ld returned 1 exit status

@parched
Copy link
Contributor

parched commented Apr 14, 2017

Looking at it, it seems SIGILL is expected because of the intriinsics::abort(). The questions are then, why did it panic in the first place and why did the default hook panic?

@parched
Copy link
Contributor

parched commented Apr 14, 2017

Here is where the default hook is panicking.

@cuviper
Copy link
Member Author

cuviper commented Apr 14, 2017

Yes, I agree the SIGILL is just a symptom of the nested panics, not something to fix in itself.

While I couldn't get a debug build, I got a release build with debuginfo. Here's a better backtrace from running stage1/bin/rustc -Vv:

#0  std::panicking::rust_panic_with_hook (msg=..., file_line=<optimized out>) at /root/rust-nightly/src/libstd/panicking.rs:536
#1  0xb6e63924 in std::panicking::begin_panic<collections::string::String> (msg=..., file_line=0xbeffeb94) at /root/rust-nightly/src/libstd/panicking.rs:511
#2  0xb6e638d4 in std::panicking::begin_panic_fmt (msg=<optimized out>, file_line=0x0) at /root/rust-nightly/src/libstd/panicking.rs:495
#3  0xb6e63880 in std::panicking::rust_begin_panic (msg=..., file=..., line=859) at /root/rust-nightly/src/libstd/panicking.rs:471
#4  0xb6e7b910 in core::panicking::panic_fmt (fmt=..., file_line=<optimized out>) at /root/rust-nightly/src/libcore/panicking.rs:69
#5  0xb6e3cafc in core::result::unwrap_failed<core::cell::BorrowMutError> (msg=..., error=...) at /root/rust-nightly/src/libcore/macros.rs:29
#6  0xb6e58340 in core::result::Result<core::cell::RefMut<core::option::Option<std::sys_common::thread_info::ThreadInfo>>, core::cell::BorrowMutError>::expect<core::cell::RefMut<core::option::Option<std::sys_common::thread_info::ThreadInfo>>,core::cell::BorrowMutError> (msg=..., self=...) at /root/rust-nightly/src/libcore/result.rs:761
#7  core::cell::RefCell<core::option::Option<std::sys_common::thread_info::ThreadInfo>>::borrow_mut<core::option::Option<std::sys_common::thread_info::ThreadInfo>> (self=<optimized out>) at /root/rust-nightly/src/libcore/cell.rs:736
#8  std::sys_common::thread_info::{{impl}}::with::{{closure}}<std::thread::Thread,closure> (c=<optimized out>) at /root/rust-nightly/src/libstd/sys_common/thread_info.rs:32
#9  0xb6e6332c in std::thread::local::LocalKey<core::cell::RefCell<core::option::Option<std::sys_common::thread_info::ThreadInfo>>>::with<core::cell::RefCell<core::option::Option<std::sys_common::thread_info::ThreadInfo>>,closure,core::option::Option<std::thread::Thread>> (self=<optimized out>, f=...) at /root/rust-nightly/src/libstd/thread/local.rs:253
#10 std::sys_common::thread_info::ThreadInfo::with<std::thread::Thread,closure> (f=...) at /root/rust-nightly/src/libstd/sys_common/thread_info.rs:30
#11 std::sys_common::thread_info::current_thread () at /root/rust-nightly/src/libstd/sys_common/thread_info.rs:43
#12 std::panicking::default_hook (info=<optimized out>) at /root/rust-nightly/src/libstd/panicking.rs:341
#13 0xb6e63ab8 in std::panicking::rust_panic_with_hook (msg=..., file_line=<optimized out>) at /root/rust-nightly/src/libstd/panicking.rs:549
#14 0xb6e63924 in std::panicking::begin_panic<collections::string::String> (msg=..., file_line=0xbeffed84) at /root/rust-nightly/src/libstd/panicking.rs:511
#15 0xb6e638d4 in std::panicking::begin_panic_fmt (msg=<optimized out>, file_line=0x0) at /root/rust-nightly/src/libstd/panicking.rs:495
#16 0xb6e63880 in std::panicking::rust_begin_panic (msg=..., file=..., line=859) at /root/rust-nightly/src/libstd/panicking.rs:471
#17 0xb6e7b910 in core::panicking::panic_fmt (fmt=..., file_line=<optimized out>) at /root/rust-nightly/src/libcore/panicking.rs:69
#18 0xb6e3cafc in core::result::unwrap_failed<core::cell::BorrowMutError> (msg=..., error=...) at /root/rust-nightly/src/libcore/macros.rs:29
#19 0xb6e58340 in core::result::Result<core::cell::RefMut<core::option::Option<std::sys_common::thread_info::ThreadInfo>>, core::cell::BorrowMutError>::expect<core::cell::RefMut<core::option::Option<std::sys_common::thread_info::ThreadInfo>>,core::cell::BorrowMutError> (msg=..., self=...) at /root/rust-nightly/src/libcore/result.rs:761
#20 core::cell::RefCell<core::option::Option<std::sys_common::thread_info::ThreadInfo>>::borrow_mut<core::option::Option<std::sys_common::thread_info::ThreadInfo>> (self=<optimized out>) at /root/rust-nightly/src/libcore/cell.rs:736
#21 std::sys_common::thread_info::{{impl}}::with::{{closure}}<std::thread::Thread,closure> (c=<optimized out>) at /root/rust-nightly/src/libstd/sys_common/thread_info.rs:32
#22 0xb6e6332c in std::thread::local::LocalKey<core::cell::RefCell<core::option::Option<std::sys_common::thread_info::ThreadInfo>>>::with<core::cell::RefCell<core::option::Option<std::sys_common::thread_info::ThreadInfo>>,closure,core::option::Option<std::thread::Thread>> (self=<optimized out>, f=...) at /root/rust-nightly/src/libstd/thread/local.rs:253
#23 std::sys_common::thread_info::ThreadInfo::with<std::thread::Thread,closure> (f=...) at /root/rust-nightly/src/libstd/sys_common/thread_info.rs:30
#24 std::sys_common::thread_info::current_thread () at /root/rust-nightly/src/libstd/sys_common/thread_info.rs:43
#25 std::panicking::default_hook (info=<optimized out>) at /root/rust-nightly/src/libstd/panicking.rs:341
#26 0xb6e63ab8 in std::panicking::rust_panic_with_hook (msg=..., file_line=<optimized out>) at /root/rust-nightly/src/libstd/panicking.rs:549
#27 0xb6e63924 in std::panicking::begin_panic<collections::string::String> (msg=..., file_line=0xbeffef74) at /root/rust-nightly/src/libstd/panicking.rs:511
#28 0xb6e638d4 in std::panicking::begin_panic_fmt (msg=<optimized out>, file_line=0x0) at /root/rust-nightly/src/libstd/panicking.rs:495
#29 0xb6e63880 in std::panicking::rust_begin_panic (msg=..., file=..., line=859) at /root/rust-nightly/src/libstd/panicking.rs:471
#30 0xb6e7b910 in core::panicking::panic_fmt (fmt=..., file_line=<optimized out>) at /root/rust-nightly/src/libcore/panicking.rs:69
#31 0xb6e3cafc in core::result::unwrap_failed<core::cell::BorrowMutError> (msg=..., error=...) at /root/rust-nightly/src/libcore/macros.rs:29
#32 0xb6e64678 in core::result::Result<core::cell::RefMut<core::option::Option<std::sys_common::thread_info::ThreadInfo>>, core::cell::BorrowMutError>::expect<core::cell::RefMut<core::option::Option<std::sys_common::thread_info::ThreadInfo>>,core::cell::BorrowMutError> (self=..., msg=...) at /root/rust-nightly/src/libcore/result.rs:761
#33 core::cell::RefCell<core::option::Option<std::sys_common::thread_info::ThreadInfo>>::borrow_mut<core::option::Option<std::sys_common::thread_info::ThreadInfo>> (self=<optimized out>) at /root/rust-nightly/src/libcore/cell.rs:736
#34 std::sys_common::thread_info::set::{{closure}} (c=<optimized out>) at /root/rust-nightly/src/libstd/sys_common/thread_info.rs:52
#35 std::thread::local::LocalKey<core::cell::RefCell<core::option::Option<std::sys_common::thread_info::ThreadInfo>>>::with<core::cell::RefCell<core::option::Option<std::sys_common::thread_info::ThreadInfo>>,closure,()> (self=<optimized out>, f=...) at /root/rust-nightly/src/libstd/thread/local.rs:253
#36 std::sys_common::thread_info::set (stack_guard=..., thread=...) at /root/rust-nightly/src/libstd/sys_common/thread_info.rs:52
#37 std::rt::lang_start (main=<optimized out>, argc=<optimized out>, argv=<optimized out>) at /root/rust-nightly/src/libstd/rt.rs:51
#38 0xb6c6a73c in __libc_start_main () from /lib/libc.so.6
#39 0x7f5556f8 in _start ()

So the first panic comes from the failed borrow_mut() at frame #33 called from here. The line right before got a shared borrow() -- maybe something isn't marking this released properly?

Then the nested panics come from thread_info::current_thread() trying to read this same broken THREAD_INFO, with frames #21 and #8 also trying to borrow_mut() here.

@arielb1
Copy link
Contributor

arielb1 commented Apr 16, 2017

@cuviper

Looks like you are using an LLVM without the fix in #40779. That will blatantly miscompile rustc and lead to severe problems.

@cuviper
Copy link
Member Author

cuviper commented Apr 16, 2017

@arielb1 While it does sound the same, unfortunately no, this is with the rust-bundled LLVM, including your fix. :/

@cuviper
Copy link
Member Author

cuviper commented Apr 17, 2017

That said, there must be something local going wrong, as the official (cross-build) armv7 compiler seems to work fine, at least with the same simple reproducer, e.g. rustc +nightly -Vv.

I'm going to try a fresh build on a fresh system with absolutely no local LLVM present...

@cuviper
Copy link
Member Author

cuviper commented Apr 18, 2017

So -- that worked, both beta and nightly. I'll make sure to update our distro LLVM patches.

What tripped me up on nightly was that stage0 is still 1.17.0-beta.2, which doesn't have the LLVM fix. I bumped that to beta.3, and then it worked. This doesn't affect the official nightly builds because only the host compiler goes through stages, and AIUI the cross-compiled targets only use the host stage2. But doing a native arm compile, the bugged stage0 gave me an unusable stage1.

On beta, I don't know what happened before. I think perhaps somewhere when I was jumping between local and rust-llvm and testing different branches, I must have gotten a build of the still-broken rust-llvm, with a timestamp such that rustbuild didn't think it needed rebuilding on the fixed sources. I still have that build directory tarballed here, so I may poke at it when I get a free moment.

@cuviper cuviper closed this as completed Apr 18, 2017
@arielb1
Copy link
Contributor

arielb1 commented Apr 18, 2017

So we should update 1.18's stage0?

@arielb1 arielb1 reopened this Apr 18, 2017
cuviper added a commit to cuviper/rust that referenced this issue Apr 18, 2017
There was a serious ARM codegen bug in LLVM that was fixed by rust-lang#40779,
also backported to beta.  This updates stage0 to 1.17.0-beta.3 to pick
up that change, so ARM can bootstrap natively again.

Fixes rust-lang#41291
cc @arielb1
@cuviper
Copy link
Member Author

cuviper commented Apr 18, 2017

OK, see #41369 to bump stage0.

frewsxcv added a commit to frewsxcv/rust that referenced this issue Apr 18, 2017
Bump stage0 to fix ARM LLVM

There was a serious ARM codegen bug in LLVM that was fixed by rust-lang#40779,
also backported to beta.  This updates stage0 to 1.17.0-beta.3 to pick
up that change, so ARM can bootstrap natively again.

Fixes rust-lang#41291
cc @arielb1
frewsxcv added a commit to frewsxcv/rust that referenced this issue Apr 18, 2017
Bump stage0 to fix ARM LLVM

There was a serious ARM codegen bug in LLVM that was fixed by rust-lang#40779,
also backported to beta.  This updates stage0 to 1.17.0-beta.3 to pick
up that change, so ARM can bootstrap natively again.

Fixes rust-lang#41291
cc @arielb1
frewsxcv added a commit to frewsxcv/rust that referenced this issue Apr 18, 2017
Bump stage0 to fix ARM LLVM

There was a serious ARM codegen bug in LLVM that was fixed by rust-lang#40779,
also backported to beta.  This updates stage0 to 1.17.0-beta.3 to pick
up that change, so ARM can bootstrap natively again.

Fixes rust-lang#41291
cc @arielb1
frewsxcv added a commit to frewsxcv/rust that referenced this issue Apr 18, 2017
Bump stage0 to fix ARM LLVM

There was a serious ARM codegen bug in LLVM that was fixed by rust-lang#40779,
also backported to beta.  This updates stage0 to 1.17.0-beta.3 to pick
up that change, so ARM can bootstrap natively again.

Fixes rust-lang#41291
cc @arielb1
frewsxcv added a commit to frewsxcv/rust that referenced this issue Apr 19, 2017
Bump stage0 to fix ARM LLVM

There was a serious ARM codegen bug in LLVM that was fixed by rust-lang#40779,
also backported to beta.  This updates stage0 to 1.17.0-beta.3 to pick
up that change, so ARM can bootstrap natively again.

Fixes rust-lang#41291
cc @arielb1
frewsxcv added a commit to frewsxcv/rust that referenced this issue Apr 20, 2017
Bump stage0 to fix ARM LLVM

There was a serious ARM codegen bug in LLVM that was fixed by rust-lang#40779,
also backported to beta.  This updates stage0 to 1.17.0-beta.3 to pick
up that change, so ARM can bootstrap natively again.

Fixes rust-lang#41291
cc @arielb1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants