serpent-os / moss-container

2 stars 3 forks source link

Upstream rustc segfaults (SIGSEGV) #1

Open livingsilver94 opened 1 year ago

livingsilver94 commented 1 year ago

Observed behavior

rustc segfaults. See backtrace:

/root/rustc/bin/../lib/librustc_driver-a7bf53640eed303a.so(+0x4e58d3)[0x7f29df2e58d3]
/usr/lib/libc.so.6(+0x3b4b0)[0x7f29de8434b0]
./bin/rustc(+0x9473)[0x562774009473]
/root/rustc/bin/../lib/libstd-7ca39ac42651c3df.so(_ZN3std3sys4unix2fs12canonicalize17h357e9fe7c04c495fE+0xf5)[0x7f29deaa5b25]
/root/rustc/bin/../lib/librustc_driver-a7bf53640eed303a.so(_RNvNtCsbgWHAv0gsHz_13rustc_session10filesearch22get_or_default_sysroot+0x15b)[0x7f29e1bee1ab]
/root/rustc/bin/../lib/librustc_driver-a7bf53640eed303a.so(_RNvNtCsbgWHAv0gsHz_13rustc_session6config21build_session_options+0x234c)[0x7f29e1be320c]
/root/rustc/bin/../lib/librustc_driver-a7bf53640eed303a.so(_RNvMs_CshwliCTHxCrl_12rustc_driverNtB4_11RunCompiler3run+0x114)[0x7f29e1373984]
/root/rustc/bin/../lib/librustc_driver-a7bf53640eed303a.so(+0x254e230)[0x7f29e134e230]
/root/rustc/bin/../lib/librustc_driver-a7bf53640eed303a.so(_RNvCshwliCTHxCrl_12rustc_driver4main+0x16d)[0x7f29e137807d]
./bin/rustc(+0x5c4d)[0x562774005c4d]
./bin/rustc(+0x5c93)[0x562774005c93]
./bin/rustc(+0x5c89)[0x562774005c89]
/root/rustc/bin/../lib/libstd-7ca39ac42651c3df.so(_ZN3std2rt19lang_start_internal17h1899cfd715ca6829E+0x30e)[0x7f29dea80abe]
./bin/rustc(+0x5c71)[0x562774005c71]
/usr/lib/libc.so.6(+0x234bb)[0x7f29de82b4bb]
/usr/lib/libc.so.6(__libc_start_main+0x89)[0x7f29de82b579]
./bin/rustc(+0x5b39)[0x562774005b39]
Segmentation fault (core dumped)
bash-5.1# ./bin/rustc  -Wrust_2018_idioms 
/root/rustc/bin/../lib/librustc_driver-a7bf53640eed303a.so(+0x4e58d3)[0x7f0f628e58d3]
/usr/lib/libc.so.6(+0x3b4b0)[0x7f0f61e434b0]
./bin/rustc(+0x9473)[0x559c6e609473]
/root/rustc/bin/../lib/libstd-7ca39ac42651c3df.so(_ZN3std3sys4unix2fs12canonicalize17h357e9fe7c04c495fE+0xf5)[0x7f0f620a5b25]
/root/rustc/bin/../lib/librustc_driver-a7bf53640eed303a.so(_RNvNtCsbgWHAv0gsHz_13rustc_session10filesearch22get_or_default_sysroot+0x15b)[0x7f0f651ee1ab]
/root/rustc/bin/../lib/librustc_driver-a7bf53640eed303a.so(_RNvNtCsbgWHAv0gsHz_13rustc_session6config21build_session_options+0x234c)[0x7f0f651e320c]
/root/rustc/bin/../lib/librustc_driver-a7bf53640eed303a.so(_RNvMs_CshwliCTHxCrl_12rustc_driverNtB4_11RunCompiler3run+0x114)[0x7f0f64973984]
/root/rustc/bin/../lib/librustc_driver-a7bf53640eed303a.so(+0x254e230)[0x7f0f6494e230]
/root/rustc/bin/../lib/librustc_driver-a7bf53640eed303a.so(_RNvCshwliCTHxCrl_12rustc_driver4main+0x16d)[0x7f0f6497807d]
./bin/rustc(+0x5c4d)[0x559c6e605c4d]
./bin/rustc(+0x5c93)[0x559c6e605c93]
./bin/rustc(+0x5c89)[0x559c6e605c89]
/root/rustc/bin/../lib/libstd-7ca39ac42651c3df.so(_ZN3std2rt19lang_start_internal17h1899cfd715ca6829E+0x30e)[0x7f0f62080abe]
./bin/rustc(+0x5c71)[0x559c6e605c71]
/usr/lib/libc.so.6(+0x234bb)[0x7f0f61e2b4bb]
/usr/lib/libc.so.6(__libc_start_main+0x89)[0x7f0f61e2b579]
./bin/rustc(+0x5b39)[0x559c6e605b39]
Segmentation fault (core dumped)

How to reproduce

  1. Run a systemd-nspawn container following this guide
  2. Enter bash for convenience
  3. curl -L https://static.rust-lang.org/dist/2022-06-30/rustc-1.62.0-x86_64-unknown-linux-gnu.tar.xz > rust.tar.xz
  4. Extract rust.tar.xz using host system's tools since the container doesn't have the tar command
  5. Run ./bin/rustc -Wrust_2018_idioms
livingsilver94 commented 1 year ago

This is the error preventing me to package rust. I managed to reproduce it in a container, so that we may run gdb or any other debugging tool.

sunnyflunk commented 1 year ago

What are the deps readelf -d of the binary.

This could be a case of mixing gcc and llvm unwind etc, so I'd want to redo the toolchain to see if the problem still exists afterwards.

livingsilver94 commented 1 year ago
 0x0000000000000001 (NEEDED)             Shared library: [librustc_driver-a7bf53640eed303a.so]
 0x0000000000000001 (NEEDED)             Shared library: [libstd-7ca39ac42651c3df.so]
 0x0000000000000001 (NEEDED)             Shared library: [libdl.so.2]
 0x0000000000000001 (NEEDED)             Shared library: [libpthread.so.0]
 0x0000000000000001 (NEEDED)             Shared library: [librt.so.1]
 0x0000000000000001 (NEEDED)             Shared library: [libc.so.6]
 0x000000000000000f (RPATH)              Library rpath: [$ORIGIN/../lib]
 0x000000000000000c (INIT)               0x5938
 0x000000000000000d (FINI)               0x4ca6c
 0x0000000000000019 (INIT_ARRAY)         0x25a9d8
 0x000000000000001b (INIT_ARRAYSZ)       16 (bytes)
 0x000000000000001a (FINI_ARRAY)         0x25a9e8
 0x000000000000001c (FINI_ARRAYSZ)       8 (bytes)
 0x0000000000000004 (HASH)               0x2b0
 0x000000006ffffef5 (GNU_HASH)           0x600
 0x0000000000000005 (STRTAB)             0xe10
 0x0000000000000006 (SYMTAB)             0x6d8
 0x000000000000000a (STRSZ)              1232 (bytes)
 0x000000000000000b (SYMENT)             24 (bytes)
 0x0000000000000015 (DEBUG)              0x0
 0x0000000000000003 (PLTGOT)             0x25de00
 0x0000000000000007 (RELA)               0x1450
 0x0000000000000008 (RELASZ)             17640 (bytes)
 0x0000000000000009 (RELAENT)            24 (bytes)
 0x0000000000000018 (BIND_NOW)           
 0x000000006ffffffb (FLAGS_1)            Flags: NOW ORIGIN PIE
 0x000000006ffffffe (VERNEED)            0x1380
 0x000000006fffffff (VERNEEDNUM)         4
 0x000000006ffffff0 (VERSYM)             0x12e0
 0x000000006ffffff9 (RELACOUNT)          678
 0x0000000000000000 (NULL)               0x0

The following is librustc_driver-a7bf53640eed303a.so

  Tag        Type                         Name/Value
 0x0000000000000001 (NEEDED)             Shared library: [libstd-7ca39ac42651c3df.so]
 0x0000000000000001 (NEEDED)             Shared library: [libLLVM-14-rust-1.62.0-stable.so]
 0x0000000000000001 (NEEDED)             Shared library: [libdl.so.2]
 0x0000000000000001 (NEEDED)             Shared library: [libgcc_s.so.1]
 0x0000000000000001 (NEEDED)             Shared library: [libpthread.so.0]
 0x0000000000000001 (NEEDED)             Shared library: [libm.so.6]
 0x0000000000000001 (NEEDED)             Shared library: [libc.so.6]
 0x0000000000000001 (NEEDED)             Shared library: [ld-linux-x86-64.so.2]
 0x000000000000000f (RPATH)              Library rpath: [$ORIGIN/../lib]
 0x000000000000000c (INIT)               0x4b9728
 0x000000000000000d (FINI)               0x2e47f6c
 0x0000000000000019 (INIT_ARRAY)         0x3d97230
 0x000000000000001b (INIT_ARRAYSZ)       72 (bytes)
 0x000000000000001a (FINI_ARRAY)         0x3d97278
 0x000000000000001c (FINI_ARRAYSZ)       8 (bytes)
 0x0000000000000004 (HASH)               0x1c8
 0x000000006ffffef5 (GNU_HASH)           0x158d8
 0x0000000000000005 (STRTAB)             0x8f7d8
 0x0000000000000006 (SYMTAB)             0x2cc58
 0x000000000000000a (STRSZ)              1689376 (bytes)
 0x000000000000000b (SYMENT)             24 (bytes)
 0x0000000000000003 (PLTGOT)             0x3f5f5f0
 0x0000000000000007 (RELA)               0x2343c8
 0x0000000000000008 (RELASZ)             2642784 (bytes)
 0x0000000000000009 (RELAENT)            24 (bytes)
 0x000000000000001e (FLAGS)              ORIGIN BIND_NOW STATIC_TLS
 0x000000006ffffffb (FLAGS_1)            Flags: NOW ORIGIN
 0x000000006ffffffe (VERNEED)            0x234298
 0x000000006fffffff (VERNEEDNUM)         7
 0x000000006ffffff0 (VERSYM)             0x22bef8
 0x000000006ffffff9 (RELACOUNT)          96741
 0x0000000000000000 (NULL)               0x0
livingsilver94 commented 1 year ago

The output above comes from host's readelf. This is what I get from the guest readelf:

Dynamic section at offset 0x77098 contains 33 entries:
  Tag        Type                         Name/Value
 0x000000000000001d (RUNPATH)            Library runpath: [$ORIGIN/../lib]
 0x0000000000000001 (NEEDED)             Shared library: [librustc_driver-ecd9222d1327d717.so]
 0x0000000000000001 (NEEDED)             Shared library: [libstd-005d707108103aba.so]
 0x0000000000000001 (NEEDED)             Shared library: [libdl.so.2]
 0x0000000000000001 (NEEDED)             Shared library: [librt.so.1]
 0x0000000000000001 (NEEDED)             Shared library: [libpthread.so.0]
 0x0000000000000001 (NEEDED)             Shared library: [libc.so.6]
 0x000000000000001e (FLAGS)              ORIGIN BIND_NOW
 0x000000006ffffffb (FLAGS_1)            Flags: NOW ORIGIN PIE
 0x0000000000000015 (DEBUG)              0x0
 0x0000000000000007 (RELA)               0x1140
 0x0000000000000008 (RELASZ)             24456 (bytes)
 0x0000000000000009 (RELAENT)            24 (bytes)
 0x000000006ffffff9 (RELACOUNT)          1011
 0x0000000000000017 (JMPREL)             0x70c8
 0x0000000000000002 (PLTRELSZ)           1272 (bytes)
 0x0000000000000003 (PLTGOT)             0x79328
 0x0000000000000014 (PLTREL)             RELA
 0x0000000000000006 (SYMTAB)             0x320
 0x000000000000000b (SYMENT)             24 (bytes)
 0x0000000000000005 (STRTAB)             0xc28
 0x000000000000000a (STRSZ)              1300 (bytes)
 0x000000006ffffef5 (GNU_HASH)           0xbb0
 0x0000000000000019 (INIT_ARRAY)         0x74630
 0x000000000000001b (INIT_ARRAYSZ)       16 (bytes)
 0x000000000000001a (FINI_ARRAY)         0x74628
 0x000000000000001c (FINI_ARRAYSZ)       8 (bytes)
 0x000000000000000c (INIT)               0x7284c
 0x000000000000000d (FINI)               0x72868
 0x000000006ffffff0 (VERSYM)             0xa28
 0x000000006ffffffe (VERNEED)            0xac0
 0x000000006fffffff (VERNEEDNUM)         4
 0x0000000000000000 (NULL)               0x0
readelf: Warning: Unrecognized form: 0x23
readelf: Warning: Unrecognized form: 0x22
readelf: Warning: Unrecognized form: 0x22
readelf: Warning: Bogus end-of-siblings marker detected at offset 2b7 in .debug_info section
readelf: Warning: Unrecognized form: 0x22
readelf: Warning: Bogus end-of-siblings marker detected at offset 2c3 in .debug_info section
readelf: Warning: Unrecognized form: 0x22
readelf: Warning: Bogus end-of-siblings marker detected at offset 2cf in .debug_info section
readelf: Warning: Further warnings about bogus end-of-sibling markers suppressed
readelf: Warning: Unrecognized form: 0x23
readelf: Warning: Unrecognized form: 0x22
readelf: Warning: Unrecognized form: 0x23
readelf: Warning: Unrecognized form: 0x23
readelf: Warning: Unrecognized form: 0x22
readelf: Warning: Unrecognized form: 0x22
readelf: Warning: Unrecognized form: 0x23
readelf: Warning: Unrecognized form: 0x22
readelf: Warning: Unrecognized form: 0x22
readelf: Warning: Unrecognized form: 0x22
readelf: Warning: Unrecognized form: 0x23
readelf: Warning: Unrecognized form: 0x22
readelf: Warning: Unrecognized form: 0x23
readelf: Warning: Unrecognized form: 0x23
readelf: Warning: Unrecognized form: 0x22
readelf: Warning: Unrecognized form: 0x22
readelf: Warning: Unrecognized form: 0x22
readelf: Warning: Unrecognized form: 0x23
readelf: Warning: Unrecognized form: 0x22
readelf: Warning: Unrecognized form: 0x22
readelf: Warning: Unrecognized form: 0x22
readelf: Warning: Unrecognized form: 0x22
readelf: Warning: Unrecognized form: 0x22
readelf: Warning: Unrecognized form: 0x22
readelf: Warning: Unrecognized form: 0x23
readelf: Warning: Unrecognized form: 0x22
readelf: Warning: Unrecognized form: 0x22
readelf: Warning: Unrecognized form: 0x22
readelf: Warning: Unrecognized form: 0x22
readelf: Warning: Unrecognized form: 0x22
readelf: Warning: Unrecognized form: 0x23
readelf: Warning: Unrecognized form: 0x22
readelf: Warning: Unrecognized form: 0x22
readelf: Warning: Unrecognized form: 0x22
readelf: Warning: Unrecognized form: 0x22
readelf: Warning: Unrecognized form: 0x22
readelf: Warning: Unrecognized form: 0x22
readelf: Warning: Unrecognized form: 0x22
readelf: Warning: Unrecognized form: 0x23
readelf: Warning: Unrecognized form: 0x22
readelf: Warning: Unrecognized form: 0x23
readelf: Warning: Unrecognized form: 0x22
readelf: Warning: Unrecognized form: 0x22
readelf: Warning: Unrecognized form: 0x22
readelf: Warning: Unrecognized form: 0x22
readelf: Warning: Unrecognized form: 0x22
readelf: Warning: Unrecognized form: 0x23
readelf: Warning: Unrecognized form: 0x22
readelf: Warning: Unrecognized form: 0x23
readelf: Warning: Unrecognized form: 0x22
readelf: Warning: Unrecognized form: 0x22
readelf: Warning: Unrecognized form: 0x22
readelf: Warning: Unrecognized form: 0x22
readelf: Warning: Unrecognized form: 0x22
readelf: Warning: Unrecognized form: 0x22
readelf: Warning: Unrecognized form: 0x22
readelf: Warning: Unrecognized form: 0x23
readelf: Warning: Unrecognized form: 0x22
readelf: Warning: Unrecognized form: 0x23
readelf: Warning: Unrecognized form: 0x22
readelf: Warning: Unrecognized form: 0x22
readelf: Warning: Unrecognized form: 0x22
readelf: Warning: Unrecognized form: 0x22
readelf: Warning: Unrecognized form: 0x22
readelf: Warning: Unrecognized form: 0x22
readelf: Warning: Unrecognized form: 0x22
readelf: Warning: Unrecognized form: 0x23
readelf: Warning: Unrecognized form: 0x23
readelf: Warning: Unrecognized form: 0x22
readelf: Warning: Unrecognized form: 0x22
readelf: Warning: Unrecognized form: 0x23
readelf: Warning: Unrecognized form: 0x23
readelf: Warning: Unrecognized form: 0x22
readelf: Warning: Unrecognized form: 0x22
readelf: Warning: Unrecognized form: 0x23
readelf: Warning: Unrecognized form: 0x22
readelf: Warning: Unrecognized form: 0x23
readelf: Warning: Unrecognized form: 0x22
readelf: Warning: Unrecognized form: 0x22
readelf: Warning: Unrecognized form: 0x22
readelf: Warning: Unrecognized form: 0x22
readelf: Warning: Unrecognized form: 0x22
readelf: Warning: Unrecognized form: 0x23
readelf: Warning: Unrecognized form: 0x22
readelf: Warning: Unrecognized form: 0x22
readelf: Warning: Unrecognized form: 0x22
readelf: Warning: Unrecognized form: 0x23
readelf: Warning: Unrecognized form: 0x22
readelf: Warning: Unrecognized form: 0x22
readelf: Warning: Unrecognized form: 0x22
readelf: Warning: Unrecognized form: 0x22
readelf: Warning: Unrecognized form: 0x23
readelf: Warning: Unrecognized form: 0x22
readelf: Warning: Unrecognized form: 0x22
readelf: Warning: Unrecognized form: 0x22
readelf: Warning: Unrecognized form: 0x23
readelf: Warning: Unrecognized form: 0x22
readelf: Warning: Unrecognized form: 0x22
readelf: Warning: Unrecognized form: 0x22
readelf: Warning: Unrecognized form: 0x22
readelf: Warning: Unrecognized form: 0x22
readelf: Warning: Unrecognized form: 0x22
readelf: Warning: Unrecognized form: 0x23
readelf: Warning: Unrecognized form: 0x22
readelf: Warning: Unrecognized form: 0x23
readelf: Warning: Unrecognized form: 0x22
readelf: Warning: Unrecognized form: 0x22
readelf: Warning: Unrecognized form: 0x22
readelf: Warning: Unrecognized form: 0x22
readelf: Warning: Unrecognized form: 0x22
readelf: Warning: Unrecognized form: 0x22
readelf: Warning: Unrecognized form: 0x22
readelf: Warning: Unrecognized form: 0x23
readelf: Warning: Unrecognized form: 0x22
readelf: Warning: Unrecognized form: 0x23
readelf: Warning: Unrecognized form: 0x22
readelf: Warning: Unrecognized form: 0x22
readelf: Warning: Unrecognized form: 0x22
readelf: Warning: Unrecognized form: 0x22
readelf: Warning: Unrecognized form: 0x22
readelf: Warning: Unrecognized form: 0x22
readelf: Warning: Unrecognized form: 0x23
readelf: Warning: Unrecognized form: 0x22
readelf: Warning: Unrecognized form: 0x23
readelf: Warning: Unrecognized form: 0x22
readelf: Warning: Unrecognized form: 0x22
readelf: Warning: Unrecognized form: 0x22
readelf: Warning: Unrecognized form: 0x22
readelf: Warning: Unrecognized form: 0x22
readelf: Warning: Unrecognized form: 0x22
readelf: Warning: Unrecognized form: 0x22
readelf: Warning: Unrecognized form: 0x23
readelf: Warning: Unrecognized form: 0x22
readelf: Warning: Unrecognized form: 0x22
readelf: Warning: Unrecognized form: 0x23
readelf: Warning: Unrecognized form: 0x22
readelf: Warning: Unrecognized form: 0x22
readelf: Warning: Unrecognized form: 0x22
readelf: Warning: Unrecognized form: 0x22
readelf: Warning: Unrecognized form: 0x23
readelf: Warning: Unrecognized form: 0x22
readelf: Warning: Unrecognized form: 0x23
readelf: Warning: Unrecognized form: 0x22
readelf: Warning: Unrecognized form: 0x23
readelf: Warning: Unrecognized form: 0x22
readelf: Warning: Unrecognized form: 0x22
readelf: Warning: Unrecognized form: 0x22
readelf: Warning: Unrecognized form: 0x22
readelf: Warning: Unrecognized form: 0x22
readelf: Warning: Unrecognized form: 0x22
readelf: Warning: Unrecognized form: 0x22
readelf: Warning: Unrecognized form: 0x22
readelf: Warning: Unrecognized form: 0x22
readelf: Warning: Unrecognized form: 0x23
readelf: Warning: Unrecognized form: 0x22
readelf: Warning: Unrecognized form: 0x23
readelf: Warning: Unrecognized form: 0x23
readelf: Warning: Unrecognized form: 0x22
readelf: Warning: Unrecognized form: 0x22
readelf: Warning: Unrecognized form: 0x23
readelf: Warning: Unrecognized form: 0x22
readelf: Warning: Unrecognized form: 0x22
readelf: Warning: Unrecognized form: 0x22
readelf: Warning: Unrecognized form: 0x22
readelf: Warning: Unrecognized form: 0x22
readelf: Warning: Unrecognized form: 0x23
readelf: Warning: Unrecognized form: 0x22
readelf: Warning: Unrecognized form: 0x22
readelf: Warning: Unrecognized form: 0x22
readelf: Warning: Unrecognized form: 0x23
readelf: Warning: Unrecognized form: 0x22
readelf: Warning: Unrecognized form: 0x22
readelf: Warning: Unrecognized form: 0x22
readelf: Warning: Unrecognized form: 0x23
readelf: Warning: Unrecognized form: 0x22
readelf: Warning: Unrecognized form: 0x22
readelf: Warning: Unrecognized form: 0x22
readelf: Warning: Unrecognized form: 0x22
readelf: Warning: Unrecognized form: 0x22
readelf: Warning: Unrecognized form: 0x22
readelf: Warning: Unrecognized form: 0x22
readelf: Warning: Unrecognized form: 0x22
readelf: Warning: Unrecognized form: 0x22
readelf: Warning: Unrecognized form: 0x22
readelf: Warning: Unrecognized form: 0x22
readelf: Warning: Unrecognized form: 0x22
readelf: Warning: Unrecognized form: 0x22
readelf: Warning: Unrecognized form: 0x23
readelf: Warning: Unrecognized form: 0x22
readelf: Warning: Unrecognized form: 0x23
readelf: Warning: Unrecognized form: 0x22
readelf: Warning: Unrecognized form: 0x22
readelf: Warning: Unrecognized form: 0x22
readelf: Warning: Unrecognized form: 0x23
readelf: Warning: Unrecognized form: 0x23
readelf: Warning: Unrecognized form: 0x22
readelf: Warning: Unrecognized form: 0x22
readelf: Warning: Unrecognized form: 0x22
readelf: Warning: Unrecognized form: 0x23
readelf: Warning: Unrecognized form: 0x22
readelf: Warning: Unrecognized form: 0x22
readelf: Warning: Unrecognized form: 0x22
readelf: Warning: Unrecognized form: 0x23
readelf: Warning: Unrecognized form: 0x22
readelf: Warning: Unrecognized form: 0x22
readelf: Warning: Unrecognized form: 0x22
readelf: Warning: Unrecognized form: 0x23
readelf: Warning: DIE at offset 0x1234 refers to abbreviation number 14170 which does not exist

So many warnings. Host has binutils 2.39; SerpentOS has 2.38. It seems though that these warnings are harmless,