Skip to content

rustc 1.56.0 : double free on OpenBSD sparc64 #90064

Open
@semarie

Description

@semarie
Contributor

I am currently preparing packaging of rustc 1.56.0 for OpenBSD.

On sparc64, while compiling alloc, the build aborts due to double free (OpenBSD libc detects it and abort).

If I correctly understand the place, the double free occurs with stage1, which is 1.56.0 code built using 1.55.0.

It is a regression from previous stable, as building 1.55.0 was fine.

Any pointer would be appreciate.

The build log for alloc is the following:

   Compiling alloc v0.0.0 (/home/semarie/repos/ports/pobj/rust-1.56.0/rustc-1.56.0-src/library/alloc)
     Running `/home/semarie/repos/ports/pobj/rust-1.56.0/build-sparc64/build/bootstrap/debug/rustc --crate-name alloc --edition=2018 library/alloc/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts --crate-type lib --emit=dep-info,metadata,link -C opt-level=3 -C embed-bitcode=no -C debuginfo=0 --cfg 'feature="compiler-builtins-c"' -C metadata=a2d2e271a66d2a4c -C extra-filename=-a2d2e271a66d2a4c --out-dir /home/semarie/repos/ports/pobj/rust-1.56.0/build-sparc64/build/sparc64-unknown-openbsd/stage1-std/sparc64-unknown-openbsd/release/deps --target sparc64-unknown-openbsd -L dependency=/home/semarie/repos/ports/pobj/rust-1.56.0/build-sparc64/build/sparc64-unknown-openbsd/stage1-std/sparc64-unknown-openbsd/release/deps -L dependency=/home/semarie/repos/ports/pobj/rust-1.56.0/build-sparc64/build/sparc64-unknown-openbsd/stage1-std/release/deps --extern compiler_builtins=/home/semarie/repos/ports/pobj/rust-1.56.0/build-sparc64/build/sparc64-unknown-openbsd/stage1-std/sparc64-unknown-openbsd/release/deps/libcompiler_builtins-7b676bd92d7e6db5.rmeta --extern core=/home/semarie/repos/ports/pobj/rust-1.56.0/build-sparc64/build/sparc64-unknown-openbsd/stage1-std/sparc64-unknown-openbsd/release/deps/libcore-b2a58fb9eb0abee9.rmeta -Zmacro-backtrace -Zsave-analysis -Cprefer-dynamic -Cembed-bitcode=yes '-Zcrate-attr=doc(html_root_url="https://doc.rust-lang.org/1.56.0/")' -Z binary-dep-depinfo -L native=/usr/lib`
[RUSTC-SHIM] rustc alloc env[0]: "CARGO"="/home/semarie/repos/ports/pobj/rust-1.56.0/rustc-bootstrap-sparc64-1.55.0-20210907/bin/cargo.bin"
[RUSTC-SHIM] rustc alloc env[1]: "CARGO_CRATE_NAME"="alloc"
[RUSTC-SHIM] rustc alloc env[2]: "CARGO_HOME"="/home/semarie/repos/ports/pobj/rust-1.56.0/build-sparc64/cargo-home"
[RUSTC-SHIM] rustc alloc env[3]: "CARGO_INCREMENTAL"="0"
[RUSTC-SHIM] rustc alloc env[4]: "CARGO_MAKEFLAGS"="-j --jobserver-fds=5,6 --jobserver-auth=5,6"
[RUSTC-SHIM] rustc alloc env[5]: "CARGO_MANIFEST_DIR"="/home/semarie/repos/ports/pobj/rust-1.56.0/rustc-1.56.0-src/library/alloc"
[RUSTC-SHIM] rustc alloc env[6]: "CARGO_PKG_AUTHORS"=""
[RUSTC-SHIM] rustc alloc env[7]: "CARGO_PKG_DESCRIPTION"="The Rust core allocation and collections library"
[RUSTC-SHIM] rustc alloc env[8]: "CARGO_PKG_HOMEPAGE"=""
[RUSTC-SHIM] rustc alloc env[9]: "CARGO_PKG_LICENSE"="MIT OR Apache-2.0"
[RUSTC-SHIM] rustc alloc env[10]: "CARGO_PKG_LICENSE_FILE"=""
[RUSTC-SHIM] rustc alloc env[11]: "CARGO_PKG_NAME"="alloc"
[RUSTC-SHIM] rustc alloc env[12]: "CARGO_PKG_REPOSITORY"="https://github.com/rust-lang/rust.git"
[RUSTC-SHIM] rustc alloc env[13]: "CARGO_PKG_VERSION"="0.0.0"
[RUSTC-SHIM] rustc alloc env[14]: "CARGO_PKG_VERSION_MAJOR"="0"
[RUSTC-SHIM] rustc alloc env[15]: "CARGO_PKG_VERSION_MINOR"="0"
[RUSTC-SHIM] rustc alloc env[16]: "CARGO_PKG_VERSION_PATCH"="0"
[RUSTC-SHIM] rustc alloc env[17]: "CARGO_PKG_VERSION_PRE"=""
[RUSTC-SHIM] rustc alloc env[18]: "CARGO_PROFILE_RELEASE_DEBUG"="0"
[RUSTC-SHIM] rustc alloc env[19]: "CARGO_PROFILE_RELEASE_DEBUG_ASSERTIONS"="false"
[RUSTC-SHIM] rustc alloc env[20]: "CARGO_PROFILE_RELEASE_OVERFLOW_CHECKS"="false"
[RUSTC-SHIM] rustc alloc env[21]: "CARGO_TARGET_DIR"="/home/semarie/repos/ports/pobj/rust-1.56.0/build-sparc64/build/sparc64-unknown-openbsd/stage1-std"
[RUSTC-SHIM] rustc alloc env[22]: "RUSTBUILD_NATIVE_DIR"="/home/semarie/repos/ports/pobj/rust-1.56.0/build-sparc64/build/sparc64-unknown-openbsd/native"
[RUSTC-SHIM] rustc alloc env[23]: "RUSTC"="/home/semarie/repos/ports/pobj/rust-1.56.0/build-sparc64/build/bootstrap/debug/rustc"
[RUSTC-SHIM] rustc alloc env[24]: "RUSTC_BOOTSTRAP"="1"
[RUSTC-SHIM] rustc alloc env[25]: "RUSTC_BREAK_ON_ICE"="1"
[RUSTC-SHIM] rustc alloc env[26]: "RUSTC_ERROR_METADATA_DST"="/home/semarie/repos/ports/pobj/rust-1.56.0/build-sparc64/build/tmp/extended-error-metadata"
[RUSTC-SHIM] rustc alloc env[27]: "RUSTC_FORCE_UNSTABLE"="1"
[RUSTC-SHIM] rustc alloc env[28]: "RUSTC_INSTALL_BINDIR"="bin"
[RUSTC-SHIM] rustc alloc env[29]: "RUSTC_LIBDIR"="/home/semarie/repos/ports/pobj/rust-1.56.0/build-sparc64/build/sparc64-unknown-openbsd/stage1/lib"
[RUSTC-SHIM] rustc alloc env[30]: "RUSTC_LINT_FLAGS"="-Wrust_2018_idioms -Wunused_lifetimes -Wsemicolon_in_expressions_from_macros -Dwarnings"
[RUSTC-SHIM] rustc alloc env[31]: "RUSTC_REAL"="/home/semarie/repos/ports/pobj/rust-1.56.0/build-sparc64/build/sparc64-unknown-openbsd/stage1/bin/rustc"
[RUSTC-SHIM] rustc alloc env[32]: "RUSTC_SNAPSHOT"="/home/semarie/repos/ports/pobj/rust-1.56.0/rustc-bootstrap-sparc64-1.55.0-20210907/bin/rustc"
[RUSTC-SHIM] rustc alloc env[33]: "RUSTC_SNAPSHOT_LIBDIR"="/home/semarie/repos/ports/pobj/rust-1.56.0/rustc-bootstrap-sparc64-1.55.0-20210907/lib"
[RUSTC-SHIM] rustc alloc env[34]: "RUSTC_STAGE"="1"
[RUSTC-SHIM] rustc alloc env[35]: "RUSTC_SYSROOT"="/home/semarie/repos/ports/pobj/rust-1.56.0/build-sparc64/build/sparc64-unknown-openbsd/stage1"
[RUSTC-SHIM] rustc alloc env[36]: "RUSTC_VERBOSE"="2"
[RUSTC-SHIM] rustc alloc env[37]: "RUSTDOC"="/home/semarie/repos/ports/pobj/rust-1.56.0/build-sparc64/build/bootstrap/debug/rustdoc"
[RUSTC-SHIM] rustc alloc env[38]: "RUSTDOCFLAGS"="-Dwarnings -Wrustdoc::invalid_codeblock_attributes --crate-version 1.56.0 -Zcrate-attr=doc(html_root_url=\"https://doc.rust-lang.org/1.56.0/\")"
[RUSTC-SHIM] rustc alloc env[39]: "RUSTDOC_REAL"="/path/to/nowhere/rustdoc/not/required"
[RUSTC-SHIM] rustc alloc env[40]: "RUSTFLAGS"="-Zmacro-backtrace -Zsave-analysis -Cprefer-dynamic -Cembed-bitcode=yes -Zcrate-attr=doc(html_root_url=\"https://doc.rust-lang.org/1.56.0/\")"
[RUSTC-SHIM] rustc alloc env[41]: "RUST_COMPILER_RT_ROOT"="/home/semarie/repos/ports/pobj/rust-1.56.0/rustc-1.56.0-src/src/llvm-project/compiler-rt"
[RUSTC-SHIM] rustc alloc env[42]: "RUST_SAVE_ANALYSIS_CONFIG"="{\"output_file\": null,\"full_docs\": false,\"pub_only\": true,\"reachable_only\": false,\"distro_crate\": true,\"signatures\": false,\"borrow_data\": false}"
[RUSTC-SHIM] rustc alloc env[43]: "RUST_TEST_THREADS"="1"
[RUSTC-SHIM] rustc alloc working directory: /home/semarie/repos/ports/pobj/rust-1.56.0/rustc-1.56.0-src
[RUSTC-SHIM] rustc alloc command: "LD_LIBRARY_PATH"="/home/semarie/repos/ports/pobj/rust-1.56.0/build-sparc64/build/sparc64-unknown-openbsd/stage1/lib:/home/semarie/repos/ports/pobj/rust-1.56.0/build-sparc64/build/sparc64-unknown-openbsd/stage1-std/release/deps:/home/semarie/repos/ports/pobj/rust-1.56.0/rustc-bootstrap-sparc64-1.55.0-20210907/lib:/home/semarie/repos/ports/pobj/rust-1.56.0/rustc-bootstrap-sparc64-1.55.0-20210907/bin/../lib" "/home/semarie/repos/ports/pobj/rust-1.56.0/build-sparc64/build/sparc64-unknown-openbsd/stage1/bin/rustc" "--crate-name" "alloc" "--edition=2018" "library/alloc/src/lib.rs" "--error-format=json" "--json=diagnostic-rendered-ansi,artifacts" "--crate-type" "lib" "--emit=dep-info,metadata,link" "-C" "opt-level=3" "-C" "embed-bitcode=no" "-C" "debuginfo=0" "--cfg" "feature=\"compiler-builtins-c\"" "-C" "metadata=a2d2e271a66d2a4c" "-C" "extra-filename=-a2d2e271a66d2a4c" "--out-dir" "/home/semarie/repos/ports/pobj/rust-1.56.0/build-sparc64/build/sparc64-unknown-openbsd/stage1-std/sparc64-unknown-openbsd/release/deps" "--target" "sparc64-unknown-openbsd" "-L" "dependency=/home/semarie/repos/ports/pobj/rust-1.56.0/build-sparc64/build/sparc64-unknown-openbsd/stage1-std/sparc64-unknown-openbsd/release/deps" "-L" "dependency=/home/semarie/repos/ports/pobj/rust-1.56.0/build-sparc64/build/sparc64-unknown-openbsd/stage1-std/release/deps" "--extern" "compiler_builtins=/home/semarie/repos/ports/pobj/rust-1.56.0/build-sparc64/build/sparc64-unknown-openbsd/stage1-std/sparc64-unknown-openbsd/release/deps/libcompiler_builtins-7b676bd92d7e6db5.rmeta" "--extern" "core=/home/semarie/repos/ports/pobj/rust-1.56.0/build-sparc64/build/sparc64-unknown-openbsd/stage1-std/sparc64-unknown-openbsd/release/deps/libcore-b2a58fb9eb0abee9.rmeta" "-Zmacro-backtrace" "-Zsave-analysis" "-Cprefer-dynamic" "-Cembed-bitcode=yes" "-Zcrate-attr=doc(html_root_url=\"https://doc.rust-lang.org/1.56.0/\")" "-Z" "binary-dep-depinfo" "-L" "native=/usr/lib" "-Wrust_2018_idioms" "-Wunused_lifetimes" "-Wsemicolon_in_expressions_from_macros" "-Dwarnings" "--sysroot" "/home/semarie/repos/ports/pobj/rust-1.56.0/build-sparc64/build/sparc64-unknown-openbsd/stage1" "-Z" "force-unstable-if-unmarked"
[RUSTC-SHIM] rustc alloc sysroot: "/home/semarie/repos/ports/pobj/rust-1.56.0/build-sparc64/build/sparc64-unknown-openbsd/stage1"
[RUSTC-SHIM] rustc alloc libdir: "/home/semarie/repos/ports/pobj/rust-1.56.0/build-sparc64/build/sparc64-unknown-openbsd/stage1/lib"
rustc(46711) in free(): double free 0xf71c807970

Did not run successfully: signal: 6 (core dumped)
"/home/semarie/repos/ports/pobj/rust-1.56.0/build-sparc64/build/sparc64-unknown-openbsd/stage1/bin/rustc" "--crate-name" "alloc" "--edition=2018" "library/alloc/src/lib.rs" "--error-format=json" "--json=diagnostic-rendered-ansi,artifacts" "--crate-type" "lib" "--emit=dep-info,metadata,link" "-C" "opt-level=3" "-C" "embed-bitcode=no" "-C" "debuginfo=0" "--cfg" "feature=\"compiler-builtins-c\"" "-C" "metadata=a2d2e271a66d2a4c" "-C" "extra-filename=-a2d2e271a66d2a4c" "--out-dir" "/home/semarie/repos/ports/pobj/rust-1.56.0/build-sparc64/build/sparc64-unknown-openbsd/stage1-std/sparc64-unknown-openbsd/release/deps" "--target" "sparc64-unknown-openbsd" "-L" "dependency=/home/semarie/repos/ports/pobj/rust-1.56.0/build-sparc64/build/sparc64-unknown-openbsd/stage1-std/sparc64-unknown-openbsd/release/deps" "-L" "dependency=/home/semarie/repos/ports/pobj/rust-1.56.0/build-sparc64/build/sparc64-unknown-openbsd/stage1-std/release/deps" "--extern" "compiler_builtins=/home/semarie/repos/ports/pobj/rust-1.56.0/build-sparc64/build/sparc64-unknown-openbsd/stage1-std/sparc64-unknown-openbsd/release/deps/libcompiler_builtins-7b676bd92d7e6db5.rmeta" "--extern" "core=/home/semarie/repos/ports/pobj/rust-1.56.0/build-sparc64/build/sparc64-unknown-openbsd/stage1-std/sparc64-unknown-openbsd/release/deps/libcore-b2a58fb9eb0abee9.rmeta" "-Zmacro-backtrace" "-Zsave-analysis" "-Cprefer-dynamic" "-Cembed-bitcode=yes" "-Zcrate-attr=doc(html_root_url=\"https://doc.rust-lang.org/1.56.0/\")" "-Z" "binary-dep-depinfo" "-L" "native=/usr/lib" "-Wrust_2018_idioms" "-Wunused_lifetimes" "-Wsemicolon_in_expressions_from_macros" "-Dwarnings" "--sysroot" "/home/semarie/repos/ports/pobj/rust-1.56.0/build-sparc64/build/sparc64-unknown-openbsd/stage1" "-Z" "force-unstable-if-unmarked"
rustc exited with signal: 6 (core dumped)
-------------
error: could not compile `alloc`

Caused by:
  process didn't exit successfully: `/home/semarie/repos/ports/pobj/rust-1.56.0/build-sparc64/build/bootstrap/debug/rustc --crate-name alloc --edition=2018 library/alloc/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts --crate-type lib --emit=dep-info,metadata,link -C opt-level=3 -C embed-bitcode=no -C debuginfo=0 --cfg 'feature="compiler-builtins-c"' -C metadata=a2d2e271a66d2a4c -C extra-filename=-a2d2e271a66d2a4c --out-dir /home/semarie/repos/ports/pobj/rust-1.56.0/build-sparc64/build/sparc64-unknown-openbsd/stage1-std/sparc64-unknown-openbsd/release/deps --target sparc64-unknown-openbsd -L dependency=/home/semarie/repos/ports/pobj/rust-1.56.0/build-sparc64/build/sparc64-unknown-openbsd/stage1-std/sparc64-unknown-openbsd/release/deps -L dependency=/home/semarie/repos/ports/pobj/rust-1.56.0/build-sparc64/build/sparc64-unknown-openbsd/stage1-std/release/deps --extern compiler_builtins=/home/semarie/repos/ports/pobj/rust-1.56.0/build-sparc64/build/sparc64-unknown-openbsd/stage1-std/sparc64-unknown-openbsd/release/deps/libcompiler_builtins-7b676bd92d7e6db5.rmeta --extern core=/home/semarie/repos/ports/pobj/rust-1.56.0/build-sparc64/build/sparc64-unknown-openbsd/stage1-std/sparc64-unknown-openbsd/release/deps/libcore-b2a58fb9eb0abee9.rmeta -Zmacro-backtrace -Zsave-analysis -Cprefer-dynamic -Cembed-bitcode=yes '-Zcrate-attr=doc(html_root_url="https://doc.rust-lang.org/1.56.0/")' -Z binary-dep-depinfo -L native=/usr/lib` (exit status: 254)
command did not execute successfully: "/home/semarie/repos/ports/pobj/rust-1.56.0/rustc-bootstrap-sparc64-1.55.0-20210907/bin/cargo" "build" "--target" "sparc64-unknown-openbsd" "-Zbinary-dep-depinfo" "-j" "1" "-v" "--release" "--frozen" "--features" "panic-unwind backtrace compiler-builtins-c" "--manifest-path" "/home/semarie/repos/ports/pobj/rust-1.56.0/rustc-1.56.0-src/library/test/Cargo.toml" "--message-format" "json-render-diagnostics"
expected success, got: exit status: 101
Traceback (most recent call last):
  File "/home/semarie/repos/ports/pobj/rust-1.56.0/rustc-1.56.0-src/x.py", line 27, in <module>
    bootstrap.main()
  File "/home/semarie/repos/ports/pobj/rust-1.56.0/rustc-1.56.0-src/src/bootstrap/bootstrap.py", line 1217, in main
    bootstrap(help_triggered)
  File "/home/semarie/repos/ports/pobj/rust-1.56.0/rustc-1.56.0-src/src/bootstrap/bootstrap.py", line 1203, in bootstrap
    run(args, env=env, verbose=build.verbose, is_bootstrap=True)
  File "/home/semarie/repos/ports/pobj/rust-1.56.0/rustc-1.56.0-src/src/bootstrap/bootstrap.py", line 153, in run
    raise RuntimeError(err)
RuntimeError: failed to run: /home/semarie/repos/ports/pobj/rust-1.56.0/build-sparc64/build/bootstrap/debug/bootstrap dist --jobs=1 library/std src/librustc cargo clippy rustfmt
*** Error 1 in . (Makefile:243 'do-build')
*** Error 2 in . (/home/semarie/repos/ports/infrastructure/mk/bsd.port.mk:2952 '/home/semarie/repos/ports/pobj/rust-1.56.0/build-sparc64/.build_done')
*** Error 2 in /home/semarie/ports/mystuff/lang/rust (/home/semarie/repos/ports/infrastructure/mk/bsd.port.mk:2602 'all': @lock=rust-1.56.0;...)

gdb backtrace:

(gdb) bt
#0  *_libc_abort () at /usr/src/lib/libc/stdlib/abort.c:57
#1  0x000000f72077127c in wrterror (d=0xf6d0ec95c0, msg=0xf720929518 "double free %p") at /usr/src/lib/libc/stdlib/malloc.c:307
#2  0x000000f7207748a4 in ofree (argpool=0xf7668ea6b0, p=0xf71c807970, clear=0, check=<optimized out>, argsz=0) at /usr/src/lib/libc/stdlib/malloc.c:1425
#3  0x000000f720775318 in free (ptr=0xf71c807970) at /usr/src/lib/libc/stdlib/malloc.c:1470
#4  0x000000f6e380530c in __rdl_dealloc () from /home/semarie/repos/ports/pobj/rust-1.56.0/build-sparc64/build/sparc64-unknown-openbsd/stage1/lib/libstd-2f7fa7da8a3eb261.so
#5  0x000000f6e384d7e0 in __rust_dealloc () from /home/semarie/repos/ports/pobj/rust-1.56.0/build-sparc64/build/sparc64-unknown-openbsd/stage1/lib/libstd-2f7fa7da8a3eb261.so
#6  0x000000f6e7c27168 in _$LT$rustc_mir..transform..abort_unwinding_calls..AbortUnwindingCalls$u20$as$u20$rustc_mir..transform..MirPass$GT$::run_pass::h053c381204964e57 ()
   from /home/semarie/repos/ports/pobj/rust-1.56.0/build-sparc64/build/sparc64-unknown-openbsd/stage1/lib/librustc_driver-5418242a65cf926c.so
#7  0x000000f6e7b73934 in rustc_mir::transform::run_passes::hc5a79e705cf4b7ff () from /home/semarie/repos/ports/pobj/rust-1.56.0/build-sparc64/build/sparc64-unknown-openbsd/stage1/lib/librustc_driver-5418242a65cf926c.so
#8  0x000000f6e7b7b008 in rustc_mir::transform::run_post_borrowck_cleanup_passes::h1f2ad3a24b17ef86 ()
   from /home/semarie/repos/ports/pobj/rust-1.56.0/build-sparc64/build/sparc64-unknown-openbsd/stage1/lib/librustc_driver-5418242a65cf926c.so
#9  0x000000f6e7b7a1c8 in rustc_mir::transform::mir_drops_elaborated_and_const_checked::h2e7a148809863d0a ()
   from /home/semarie/repos/ports/pobj/rust-1.56.0/build-sparc64/build/sparc64-unknown-openbsd/stage1/lib/librustc_driver-5418242a65cf926c.so
#10 0x000000f6e85098a8 in rustc_query_system::query::plumbing::get_query_impl::h31223dfb84119524 () from /home/semarie/repos/ports/pobj/rust-1.56.0/build-sparc64/build/sparc64-unknown-openbsd/stage1/lib/librustc_driver-5418242a65cf926c.so
#11 0x000000f6e8b94204 in _$LT$rustc_query_impl..Queries$u20$as$u20$rustc_middle..ty..query..QueryEngine$GT$::mir_drops_elaborated_and_const_checked::hf319f0f0f0dd3967 ()
   from /home/semarie/repos/ports/pobj/rust-1.56.0/build-sparc64/build/sparc64-unknown-openbsd/stage1/lib/librustc_driver-5418242a65cf926c.so
#12 0x000000f6e7b7bb34 in rustc_mir::transform::optimized_mir::h0a18ce025c9996e9 () from /home/semarie/repos/ports/pobj/rust-1.56.0/build-sparc64/build/sparc64-unknown-openbsd/stage1/lib/librustc_driver-5418242a65cf926c.so
#13 0x000000f6e85142f4 in rustc_query_system::query::plumbing::get_query_impl::h39907df79a9efdb6 () from /home/semarie/repos/ports/pobj/rust-1.56.0/build-sparc64/build/sparc64-unknown-openbsd/stage1/lib/librustc_driver-5418242a65cf926c.so
#14 0x000000f6e8b946bc in _$LT$rustc_query_impl..Queries$u20$as$u20$rustc_middle..ty..query..QueryEngine$GT$::optimized_mir::h5943a6dd3a5a7341 ()
   from /home/semarie/repos/ports/pobj/rust-1.56.0/build-sparc64/build/sparc64-unknown-openbsd/stage1/lib/librustc_driver-5418242a65cf926c.so
#15 0x000000f6e9de6820 in rustc_middle::ty::_$LT$impl$u20$rustc_middle..ty..context..TyCtxt$GT$::instance_mir::h36a0164fbb838479 ()
   from /home/semarie/repos/ports/pobj/rust-1.56.0/build-sparc64/build/sparc64-unknown-openbsd/stage1/lib/librustc_driver-5418242a65cf926c.so
#16 0x000000f6e7cc2f94 in rustc_mir::monomorphize::collector::collect_neighbours::hd7e072505b151b21 ()
   from /home/semarie/repos/ports/pobj/rust-1.56.0/build-sparc64/build/sparc64-unknown-openbsd/stage1/lib/librustc_driver-5418242a65cf926c.so
#17 0x000000f6e7cba1c8 in rustc_mir::monomorphize::collector::collect_items_rec::h5285a9621b2e0057 ()
   from /home/semarie/repos/ports/pobj/rust-1.56.0/build-sparc64/build/sparc64-unknown-openbsd/stage1/lib/librustc_driver-5418242a65cf926c.so
#18 0x000000f6e81484ac in rustc_session::utils::_$LT$impl$u20$rustc_session..session..Session$GT$::time::h6270d26c32cbf11a ()
   from /home/semarie/repos/ports/pobj/rust-1.56.0/build-sparc64/build/sparc64-unknown-openbsd/stage1/lib/librustc_driver-5418242a65cf926c.so
#19 0x000000f6e7cb8494 in rustc_mir::monomorphize::collector::collect_crate_mono_items::hfbe7d399465ca039 ()
   from /home/semarie/repos/ports/pobj/rust-1.56.0/build-sparc64/build/sparc64-unknown-openbsd/stage1/lib/librustc_driver-5418242a65cf926c.so
#20 0x000000f6e7cc478c in rustc_mir::monomorphize::partitioning::collect_and_partition_mono_items::h4ea486c19adc9420 ()
   from /home/semarie/repos/ports/pobj/rust-1.56.0/build-sparc64/build/sparc64-unknown-openbsd/stage1/lib/librustc_driver-5418242a65cf926c.so
#21 0x000000f6e85b711c in rustc_query_system::query::plumbing::get_query_impl::hef92cc8e0e612213 () from /home/semarie/repos/ports/pobj/rust-1.56.0/build-sparc64/build/sparc64-unknown-openbsd/stage1/lib/librustc_driver-5418242a65cf926c.so
#22 0x000000f6e8b9f490 in _$LT$rustc_query_impl..Queries$u20$as$u20$rustc_middle..ty..query..QueryEngine$GT$::collect_and_partition_mono_items::hac6f01e7aca93579 ()
   from /home/semarie/repos/ports/pobj/rust-1.56.0/build-sparc64/build/sparc64-unknown-openbsd/stage1/lib/librustc_driver-5418242a65cf926c.so
#23 0x000000f6e41b3be0 in rustc_codegen_ssa::base::codegen_crate::h3db3a6d60fd1c7d4 () from /home/semarie/repos/ports/pobj/rust-1.56.0/build-sparc64/build/sparc64-unknown-openbsd/stage1/lib/librustc_driver-5418242a65cf926c.so
#24 0x000000f6e41f5bd0 in _$LT$rustc_codegen_llvm..LlvmCodegenBackend$u20$as$u20$rustc_codegen_ssa..traits..backend..CodegenBackend$GT$::codegen_crate::h40fcbb02620c0c17 ()
   from /home/semarie/repos/ports/pobj/rust-1.56.0/build-sparc64/build/sparc64-unknown-openbsd/stage1/lib/librustc_driver-5418242a65cf926c.so
#25 0x000000f6e3f9cc00 in rustc_interface::queries::Queries::ongoing_codegen::h7dc2980385cffc42 () from /home/semarie/repos/ports/pobj/rust-1.56.0/build-sparc64/build/sparc64-unknown-openbsd/stage1/lib/librustc_driver-5418242a65cf926c.so
#26 0x000000f6e3e42560 in rustc_interface::queries::_$LT$impl$u20$rustc_interface..interface..Compiler$GT$::enter::h90128beff5c4cd10 ()
   from /home/semarie/repos/ports/pobj/rust-1.56.0/build-sparc64/build/sparc64-unknown-openbsd/stage1/lib/librustc_driver-5418242a65cf926c.so
#27 0x000000f6e3deb8e4 in rustc_span::with_source_map::hfaabe5aefc06fe09 () from /home/semarie/repos/ports/pobj/rust-1.56.0/build-sparc64/build/sparc64-unknown-openbsd/stage1/lib/librustc_driver-5418242a65cf926c.so
#28 0x000000f6e3e40128 in scoped_tls::ScopedKey$LT$T$GT$::set::h8d5d162635713055 () from /home/semarie/repos/ports/pobj/rust-1.56.0/build-sparc64/build/sparc64-unknown-openbsd/stage1/lib/librustc_driver-5418242a65cf926c.so
#29 0x000000f6e3ded9b8 in std::sys_common::backtrace::__rust_begin_short_backtrace::h2218f90c4db4ab67 ()
   from /home/semarie/repos/ports/pobj/rust-1.56.0/build-sparc64/build/sparc64-unknown-openbsd/stage1/lib/librustc_driver-5418242a65cf926c.so
#30 0x000000f6e3ddb1c8 in core::ops::function::FnOnce::call_once$u7b$$u7b$vtable.shim$u7d$$u7d$::hdc74afcb832c219f ()
   from /home/semarie/repos/ports/pobj/rust-1.56.0/build-sparc64/build/sparc64-unknown-openbsd/stage1/lib/librustc_driver-5418242a65cf926c.so
#31 0x000000f6e37ed5bc in std::sys::unix::thread::Thread::new::thread_start::h0daf8654cb819454 () from /home/semarie/repos/ports/pobj/rust-1.56.0/build-sparc64/build/sparc64-unknown-openbsd/stage1/lib/libstd-2f7fa7da8a3eb261.so
#32 0x000000f741a47490 in _rthread_start (v=0xf720080838) at /usr/src/lib/librthread/rthread.c:96
#33 0x000000f7207c58ac in __tfork_thread () at /usr/src/lib/libc/arch/sparc64/sys/tfork_thread.S:58
Backtrace stopped: previous frame identical to this frame (corrupt stack?)

Activity

added
O-openbsdOperating system: OpenBSD
O-SPARCTarget: SPARC processors
I-prioritizeIssue: Indicates that prioritization has been requested for this issue.
I-crashIssue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.
T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.
on Oct 19, 2021
semarie

semarie commented on Oct 20, 2021

@semarie
ContributorAuthor

for reference, I am building natively on sparc64, with openbsd packaging infrastructure using this port tree (it is Makefile which is fetching 1.56.0, applies some patches, start build, package, etc...). It includes few patches.

I tested 1.55.0 on the exact same OS version and it built fine.

I am currently testing 1.56.0 without a patch I backported from 1.57.0 which is changing few bits on backtrace. The gdb backtrace has mention of std::sys_common::backtrace::__rust_begin_short_backtrace, so it might be good candidate for this breakage.

semarie

semarie commented on Oct 20, 2021

@semarie
ContributorAuthor

my build without gimli patch still fail. so it isn't that.

apiraino

apiraino commented on Oct 21, 2021

@apiraino
Contributor

Assigning priority as discussed in the Zulip thread of the Prioritization Working Group.

@rustbot label -I-prioritize +P-medium

added and removed
I-prioritizeIssue: Indicates that prioritization has been requested for this issue.
on Oct 21, 2021
semarie

semarie commented on Oct 25, 2021

@semarie
ContributorAuthor

I bisected the problem and it seems that it is started to appear with d488de8 (#87587). I am looking if I could go futher.

semarie

semarie commented on Oct 31, 2021

@semarie
ContributorAuthor

I made some progress.

Disabling C-unwind by removing the AbortUnwindingCalls pass (see #86155) helps to not trigger the double-free.

Regarding unwinding, on OpenBSD, all architectures doesn't do it the same way: specially, sparc64 is the sole to use libgcc instead of libunwind.

@alexcrichton do you have some possible pointers to help me to properly resolv the issue ? For now, I intent to add debug! calls inside AbortUnwindingCalls pass to help to localize the double-free.

semarie

semarie commented on Oct 31, 2021

@semarie
ContributorAuthor

@alexcrichton as a workaround (for a local patch for sparc64 on OpenBSD), does not calling AbortUnwindingCalls might lead to big problems ?

semarie

semarie commented on Oct 31, 2021

@semarie
ContributorAuthor

it seems it is a code generation problem: adding println!("test") after abort_unwinding_calls.rs#L98 (between cleanups_to_remove.push(id) and continue) is enough to make the double free to gone.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.I-crashIssue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.O-SPARCTarget: SPARC processorsO-openbsdOperating system: OpenBSDP-mediumMedium priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-stablePerformance or correctness regression from one stable version to another.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @apiraino@semarie@JohnTitor@camelid@rustbot

        Issue actions

          rustc 1.56.0 : double free on OpenBSD sparc64 · Issue #90064 · rust-lang/rust