Repository navigation
Application crash with debug symbols stripped out #39468
Description
Activity
cc @segevfiner
I tried building the following with
rustc 1.16.0-beta.1 (5276ba72e 2017-01-31)(installed via rustup):fn main() { println!("Hello, world!"); panic!(); }
And stripped using
strip -sfrom MSYS2 (up-to-date using pacman -Syu), in both debug and release, and it didn't crash for me. (Obviously printing "<unknown>" because the binary is stripped).Don't you love those kind of crashes? 😝
@dpelevin Can you try and be more specific about what you did to cause this? Here are some ideas although they do sound a bit far fetched... Maybe someone else has a better idea.
- Maybe it's dependent on your implementation of hello world?
- Maybe it's your version of
strip? - Maybe it's the linker used by rustc? (I think rustc always uses it's own bundled copy of gcc/ld on Windows regardless of PATH though)
- Maybe PATH/rustup messed with you and it used some other rustc where the bug can be reproduced?
Hm, I think I've reproduced it.
we@we-pc MINGW64 ~ $ cat test.rs fn main() { println!("Hello, world!"); panic!(); } we@we-pc MINGW64 ~ $ rustc --version rustc 1.16.0-nightly (24055d0f2 2017-01-31) we@we-pc MINGW64 ~ $ rustc -g test.rs we@we-pc MINGW64 ~ $ RUST_BACKTRACE=1 ./test.exe Hello, world! thread 'main' panicked at 'explicit panic', test.rs:3 stack backtrace: 0: 0x4288ba - std::sys::imp::backtrace::_write::he5498b02db7db530 1: 0x432f57 - std::panicking::default_hook::{{closure}}::h67a5fa5600945646 2: 0x432b13 - std::panicking::default_hook::hf8a9629fab063fa5 3: 0x4334de - std::panicking::rust_panic_with_hook::hf599e44aaa8545b8 4: 0x4015d2 - std::panicking::begin_panic::h9a6bae97ed4f65b2 at C:\bot\slave\nightly-dist-rustc-win-gnu-64\build\src\libstd/panicking.rs:517 5: 0x401871 - test::main::ha6bc039bc682a0db at C:\msys64\home\we/test.rs:3 6: 0x433168 - std::panicking::try::do_call::h4c4de3903bc7c076 7: 0x43d178 - _rust_maybe_catch_panic 8: 0x433c83 - std::rt::lang_start::h177832d72b1c79c7 9: 0x4018aa - main 10: 0x4013b4 - _tmainCRTStartup 11: 0x4014e7 - mainCRTStartup 12: 0x7ffc73cf13d1 - unit_addrs_search we@we-pc MINGW64 ~ $ which strip /c/mingw-w64/x86_64-6.2.0-win32-seh-rt_v5-rev1/mingw64/bin/strip we@we-pc MINGW64 ~ $ strip ./test.exe we@we-pc MINGW64 ~ $ RUST_BACKTRACE=1 ./test.exe Hello, world! thread 'main' panicked at 'explicit panic', test.rs:3 stack backtrace: we@we-pc MINGW64 ~ $ RUST_BACKTRACE=1 gdb ./test.exe GNU gdb (GDB) 7.9 Copyright (C) 2015 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "x86_64-pc-msys". Type "show configuration" for configuration details. For bug reporting instructions, please see: <http://www.gnu.org/software/gdb/bugs/>. Find the GDB manual and other documentation resources online at: <http://www.gnu.org/software/gdb/documentation/>. For help, type "help". Type "apropos word" to search for commands related to "word"... Traceback (most recent call last): File "<string>", line 3, in <module> ImportError: No module named libstdcxx.v6.printers /etc/gdbinit:6: Error in sourced command file: Error while executing Python code. Reading symbols from ./test.exe...(no debugging symbols found)...done. (gdb) run Starting program: /home/we/test.exe [New Thread 6068.0x126c] Hello, world! thread 'main' panicked at 'explicit panic', test.rs:3 stack backtrace: warning: Critical error detected c0000374 Program received signal SIGTRAP, Trace/breakpoint trap. 0x00007ffc74361b30 in ntdll!RtlpNtMakeTemporaryKey () from /c/Windows/SYSTEM32/ntdll.dll (gdb) c Continuing. gdb: unknown target exception 0xc0000374 at 0x7ffc74361b70 Program received signal ?, Unknown signal. 0x00007ffc74361b70 in ntdll!RtlpNtMakeTemporaryKey () from /c/Windows/SYSTEM32/ntdll.dll (gdb) c Continuing. [Inferior 1 (process 6068) exited with code 030000001564] (gdb) q-
Here is the HelloWorld I can reproduce problem with: https://github.com/dpelevin/helloworld
-
I've uploaded strip.exe I was using: https://github.com/dpelevin/helloworld/tree/master/misc
C:\MinGW\bin>strip.exe --version
GNU strip (GNU Binutils) 2.24
Copyright 2013 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License version 3 or (at your option) any later version.
This program has absolutely no warranty. -
I have the same MinGW version in the PATH as Rust uses:
C:\MinGW\bin>ld.exe --version
GNU ld (GNU Binutils) 2.24
Copyright 2013 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License version 3 or (at your option) a later version.
This program has absolutely no warranty.
C:\MinGW\bin>gcc.exe --version
gcc.exe (x86_64-posix-seh-rev3, Built by MinGW-W64 project) 4.9.1
Copyright (C) 2014 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Additionally I've renamed C:\MinGW to C:\MinGW_ to remove it from PATH and the problem were still in place.
- I've tried to reinstall beta version:
rustup toolchain remove beta-x86_64-pc-windows-gnu
...
rustup toolchain install beta-x86_64-pc-windows-gnu
....
beta-x86_64-pc-windows-gnu installed - rustc 1.16.0-beta.1 (5276ba7 2017-01-31)
rustup default beta-gnu
...
beta-x86_64-pc-windows-gnu unchanged - rustc 1.16.0-beta.1 (5276ba7 2017-01-31)
Still crashes.
UPD: Look like you've already caught it :)
-
@petrochenkov
It looks like heap corruption (STATUS_HEAP_CORRUPTION - 0xC0000374)
You can try application verifier on the executable (Win+R appverif.exe if you have some Windows SDK installed), it is often able to break on the error exactly , but I'm not sure how well it works with GNU stuff.Sadly it still doesn't reproduce on my machine, so I can't debug myself. 😞
Some other stuff I can think of that might be the reason why it doesn't reproduce on my computer:
I'm on Windows 10.0.14393.693 64-bit
I don't have any dbghelp.dll on PATH besides the one in C:\Windows\System32Usual
free(uninitialized_pointer), move along, nothing to see here.
Fixed in #39509cc @fitzgen libbacktrace crash
- added a commit that references this issue
on Jul 25, 2017 - added a commit that references this issue
on Jul 17, 2020 - added a commit that references this issue
on Jul 18, 2022 - added a commit that references this issue
on Oct 18, 2022 - added a commit that references this issue
on Apr 8, 2024
With current implementation of the fix for #33985, application crashes in the case of panic, if debug info is stripped out with (strip -s helloworld.exe) and RUST_BACKTRACE is set to 1.
It can be reproduced with: beta-x86_64-pc-windows-gnu - rustc 1.16.0-beta.1 (5276ba7 2017-01-31)