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

rustc crash with -Zsanitizer=cfi #113366

Closed
danakj opened this issue Jul 5, 2023 · 2 comments
Closed

rustc crash with -Zsanitizer=cfi #113366

danakj opened this issue Jul 5, 2023 · 2 comments
Assignees
Labels
C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ PG-exploit-mitigations Project group: Exploit mitigations T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@danakj
Copy link
Contributor

danakj commented Jul 5, 2023

Downstream bug: https://bugs.chromium.org/p/chromium/issues/detail?id=1442331

Compiler logs: https://logs.chromium.org/logs/chromium/buildbucket/cr-buildbucket/8776466488696196673/+/u/compile__with_patch_/stdout

Compiler output: [30927/97590] RUST local_rustc_sysroot/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd.rlib
 FAILED: local_rustc_sysroot/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd.rlib 
 "python3" "/b/s/w/ir/cache/builder/src/build/rust/rustc_wrapper.py" --rustc=../../third_party/rust-toolchain/bin/rustc --depfile=local_rustc_sysroot/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd.rlib.d -- -Clinker="../../third_party/llvm-build/Release+Asserts/bin/clang++" --crate-name std ../../third_party/rust-toolchain/lib/rustlib/src/rust/library/std/src/lib.rs --crate-type rlib --cfg=backtrace_in_libstd -Zforce-unstable-if-unmarked @gen/build/rust/std/rules/std/cargo_flags.rs --cfg=feature=\"addr2line\" --cfg=feature=\"backtrace\" --cfg=feature=\"gimli-symbolize\" --cfg=feature=\"miniz_oxide\" --cfg=feature=\"object\" --cfg=feature=\"panic_unwind\" --cfg=feature=\"profiler\" --cfg=feature=\"profiler_builtins\" --cfg=feature=\"std_detect_dlsym_getauxval\" --cfg=feature=\"std_detect_file_io\" --edition=2021 -Cforce-unwind-tables=no -Crelocation-model=pic -Zsplit-lto-unit -Clinker-plugin-lto=yes -Coverflow-checks=on -Cdefault-linker-libraries -Zdep-info-omit-d-target -Zmacro-backtrace -Zremap-cwd-prefix=. --color=always --target=x86_64-unknown-linux-gnu -Ccodegen-units=1 -Cpanic=abort -Zpanic_abort_tests --cfg cr_rustc_revision=\"[006a26c0b546abc0fbef59a773639582b641e500](https://crrev.com/006a26c0b546abc0fbef59a773639582b641e500)-1-llvmorg-17-init-12166-g7586aeab\" -Copt-level=3 -Zdwarf-version=4 -Cdebuginfo=1 -Clinker-plugin-lto=yes -Zsanitizer=cfi -Zsanitizer-cfi-normalize-integers -Zsanitizer=cfi -Zsanitizer-cfi-normalize-integers -Zsanitizer-cfi-normalize-integers --cap-lints=allow -Dunsafe_op_in_unsafe_fn --cfg feature=\"panic_immediate_abort\" --sysroot=local_rustc_sysroot -Ldependency=local_rustc_sysroot/lib/rustlib/x86_64-unknown-linux-gnu/lib -Clink-arg=../../third_party/llvm-build/Release+Asserts/lib/clang/17/lib/x86_64-unknown-linux-gnu/libclang_rt.builtins.a --extern addr2line=local_rustc_sysroot/lib/rustlib/x86_64-unknown-linux-gnu/lib/libaddr2line.rlib --extern compiler_builtins=local_rustc_sysroot/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcompiler_builtins.rlib --extern core=local_rustc_sysroot/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore.rlib --extern alloc=local_rustc_sysroot/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc.rlib --extern cfg_if=local_rustc_sysroot/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcfg_if.rlib --extern hashbrown=local_rustc_sysroot/lib/rustlib/x86_64-unknown-linux-gnu/lib/libhashbrown.rlib --extern libc=local_rustc_sysroot/lib/rustlib/x86_64-unknown-linux-gnu/lib/liblibc.rlib --extern miniz_oxide=local_rustc_sysroot/lib/rustlib/x86_64-unknown-linux-gnu/lib/libminiz_oxide.rlib --extern object=local_rustc_sysroot/lib/rustlib/x86_64-unknown-linux-gnu/lib/libobject.rlib --extern panic_abort=local_rustc_sysroot/lib/rustlib/x86_64-unknown-linux-gnu/lib/libpanic_abort.rlib --extern panic_unwind=local_rustc_sysroot/lib/rustlib/x86_64-unknown-linux-gnu/lib/libpanic_unwind.rlib --extern unwind=local_rustc_sysroot/lib/rustlib/x86_64-unknown-linux-gnu/lib/libunwind.rlib --extern rustc_demangle=local_rustc_sysroot/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_demangle.rlib --extern std_detect=local_rustc_sysroot/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd_detect.rlib --emit=dep-info=local_rustc_sysroot/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd.rlib.d,link -o local_rustc_sysroot/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd.rlib LDFLAGS RUSTENV OUT_DIR=/b/s/w/ir/cache/builder/src/out/Release/gen/build/rust/std/rules/std STD_ENV_ARCH=x86_64 CARGO_PKG_VERSION=0.0.0 CARGO_PKG_NAME=std CARGO_PKG_DESCRIPTION=The\ Rust\ Standard\ Library
 error: internal compiler error: compiler/rustc_symbol_mangling/src/typeid/typeid_itanium_cxx_abi.rs:133:9: encode_const: unexpected type `usize`
 thread 'rustc' panicked at 'Box<dyn Any>', /b/s/w/ir/cache/builder/src/third_party/rust_src/src/compiler/rustc_errors/src/lib.rs:1650:9
 stack backtrace:
    0:     0x7f3640edca8d - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h4e4cb9634d0fe93f
    1:     0x7f3640f44a4f - core::fmt::write::h4f28fd15af8bc95a
    2:     0x7f3640e942d7 - std::io::Write::write_fmt::hf7f81bd4debbb94f
    3:     0x7f3640edc844 - std::sys_common::backtrace::print::h95623834b1869033
    4:     0x7f3640ea7e23 - std::panicking::default_hook::{{closure}}::h6ae9488552a43cee
    5:     0x7f3640ea7b45 - std::panicking::default_hook::h5dc7587310edc152
    6:     0x7f363b7a780b - rustc_driver_impl[d030775120254cac]::install_ice_hook::{closure#0}
    7:     0x7f3640ea8667 - std::panicking::rust_panic_with_hook::h03e242a352a893c4
    8:     0x7f3640384453 - std[fa7c4af34776eeed]::panicking::begin_panic::<rustc_errors[8cd9c197ba6d8496]::ExplicitBug>::{closure#0}
    9:     0x7f3640383686 - std[fa7c4af34776eeed]::sys_common::backtrace::__rust_end_short_backtrace::<std[fa7c4af34776eeed]::panicking::begin_panic<rustc_errors[8cd9c197ba6d8496]::ExplicitBug>::{closure#0}, !>
   10:     0x7f3640517796 - std[fa7c4af34776eeed]::panicking::begin_panic::<rustc_errors[8cd9c197ba6d8496]::ExplicitBug>
   11:     0x7f364037b127 - <rustc_errors[8cd9c197ba6d8496]::HandlerInner>::bug::<alloc[b9c6ec4bf973ed5f]::string::String>
   12:     0x7f364037ad78 - <rustc_errors[8cd9c197ba6d8496]::Handler>::bug::<alloc[b9c6ec4bf973ed5f]::string::String>
   13:     0x7f3640477b67 - rustc_middle[9f6e00ffe02658f5]::util::bug::opt_span_bug_fmt::<rustc_span[b2ec9bb2e3736744]::span_encoding::Span>::{closure#0}
   14:     0x7f36404719fc - rustc_middle[9f6e00ffe02658f5]::ty::context::tls::with_opt::<rustc_middle[9f6e00ffe02658f5]::util::bug::opt_span_bug_fmt<rustc_span[b2ec9bb2e3736744]::span_encoding::Span>::{closure#0}, !>::{closure#0}
   15:     0x7f36404719ae - rustc_middle[9f6e00ffe02658f5]::ty::context::tls::with_context_opt::<rustc_middle[9f6e00ffe02658f5]::ty::context::tls::with_opt<rustc_middle[9f6e00ffe02658f5]::util::bug::opt_span_bug_fmt<rustc_span[b2ec9bb2e3736744]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
   16:     0x7f3640477a52 - rustc_middle[9f6e00ffe02658f5]::util::bug::bug_fmt
   17:     0x7f363f791ca8 - rustc_symbol_mangling[866550e6dc835112]::typeid::typeid_itanium_cxx_abi::encode_const
   18:     0x7f363f792ab9 - rustc_symbol_mangling[866550e6dc835112]::typeid::typeid_itanium_cxx_abi::encode_substs
   19:     0x7f363f79226e - rustc_symbol_mangling[866550e6dc835112]::typeid::typeid_itanium_cxx_abi::encode_predicates
   20:     0x7f363f794854 - rustc_symbol_mangling[866550e6dc835112]::typeid::typeid_itanium_cxx_abi::encode_ty
   21:     0x7f363f794648 - rustc_symbol_mangling[866550e6dc835112]::typeid::typeid_itanium_cxx_abi::encode_ty
   22:     0x7f363f79757d - rustc_symbol_mangling[866550e6dc835112]::typeid::typeid_itanium_cxx_abi::typeid_for_fnabi
   23:     0x7f363f796cbc - rustc_symbol_mangling[866550e6dc835112]::typeid::typeid_itanium_cxx_abi::typeid_for_instance
   24:     0x7f363f7b33a9 - rustc_symbol_mangling[866550e6dc835112]::typeid::typeid_for_instance
   25:     0x7f363b94c0fd - <rustc_codegen_llvm[b25f58fb75ffeeda]::context::CodegenCx>::declare_fn
   26:     0x7f363b94c989 - <rustc_codegen_llvm[b25f58fb75ffeeda]::context::CodegenCx as rustc_codegen_ssa[f7db0cdf107e9498]::traits::declare::PreDefineMethods>::predefine_fn
   27:     0x7f363ba3615c - rustc_codegen_llvm[b25f58fb75ffeeda]::base::compile_codegen_unit::module_codegen
   28:     0x7f363ba3560f - rustc_codegen_llvm[b25f58fb75ffeeda]::base::compile_codegen_unit
   29:     0x7f363b8fab67 - rustc_codegen_ssa[f7db0cdf107e9498]::base::codegen_crate::<rustc_codegen_llvm[b25f58fb75ffeeda]::LlvmCodegenBackend>
   30:     0x7f363b8f24cf - <rustc_codegen_llvm[b25f58fb75ffeeda]::LlvmCodegenBackend as rustc_codegen_ssa[f7db0cdf107e9498]::traits::backend::CodegenBackend>::codegen_crate
   31:     0x7f363b8087a3 - <rustc_session[348c63889d9395ba]::session::Session>::time::<alloc[b9c6ec4bf973ed5f]::boxed::Box<dyn core[71da62e9f5b127d7]::any::Any>, rustc_interface[e21568b8841192ba]::passes::start_codegen::{closure#0}>
   32:     0x7f363b7f046d - rustc_interface[e21568b8841192ba]::passes::start_codegen
   33:     0x7f363b827882 - <rustc_middle[9f6e00ffe02658f5]::ty::context::GlobalCtxt>::enter::<<rustc_interface[e21568b8841192ba]::queries::Queries>::ongoing_codegen::{closure#0}, core[71da62e9f5b127d7]::result::Result<alloc[b9c6ec4bf973ed5f]::boxed::Box<dyn core[71da62e9f5b127d7]::any::Any>, rustc_span[b2ec9bb2e3736744]::ErrorGuaranteed>>
   34:     0x7f363b8c7f76 - <rustc_interface[e21568b8841192ba]::queries::Queries>::ongoing_codegen
   35:     0x7f363b731c39 - <rustc_interface[e21568b8841192ba]::interface::Compiler>::enter::<rustc_driver_impl[d030775120254cac]::run_compiler::{closure#1}::{closure#2}, core[71da62e9f5b127d7]::result::Result<core[71da62e9f5b127d7]::option::Option<rustc_interface[e21568b8841192ba]::queries::Linker>, rustc_span[b2ec9bb2e3736744]::ErrorGuaranteed>>
   36:     0x7f363b72c6af - std[fa7c4af34776eeed]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[e21568b8841192ba]::util::run_in_thread_pool_with_globals<rustc_interface[e21568b8841192ba]::interface::run_compiler<core[71da62e9f5b127d7]::result::Result<(), rustc_span[b2ec9bb2e3736744]::ErrorGuaranteed>, rustc_driver_impl[d030775120254cac]::run_compiler::{closure#1}>::{closure#0}, core[71da62e9f5b127d7]::result::Result<(), rustc_span[b2ec9bb2e3736744]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[71da62e9f5b127d7]::result::Result<(), rustc_span[b2ec9bb2e3736744]::ErrorGuaranteed>>
   37:     0x7f363b74dde1 - <<std[fa7c4af34776eeed]::thread::Builder>::spawn_unchecked_<rustc_interface[e21568b8841192ba]::util::run_in_thread_pool_with_globals<rustc_interface[e21568b8841192ba]::interface::run_compiler<core[71da62e9f5b127d7]::result::Result<(), rustc_span[b2ec9bb2e3736744]::ErrorGuaranteed>, rustc_driver_impl[d030775120254cac]::run_compiler::{closure#1}>::{closure#0}, core[71da62e9f5b127d7]::result::Result<(), rustc_span[b2ec9bb2e3736744]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[71da62e9f5b127d7]::result::Result<(), rustc_span[b2ec9bb2e3736744]::ErrorGuaranteed>>::{closure#1} as core[71da62e9f5b127d7]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
   38:     0x7f3640e87c05 - std::sys::unix::thread::Thread::new::thread_start::h813d429a191688ac
   39:     0x7f3638894b43 - start_thread
                                at ./nptl/pthread_create.c:442:8
   40:     0x7f3638926a00 - clone3
                                at ./misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:81
   41:                0x0 - <unknown>
 note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md
 note: rustc 1.72.0-nightly (006a26c0b 2023-06-21) ([006a26c0b546abc0fbef59a773639582b641e500](https://crrev.com/006a26c0b546abc0fbef59a773639582b641e500)-1-llvmorg-17-init-12166-g7586aeab chromium) running on x86_64-unknown-linux-gnu
 note: compiler flags: -C linker=../../third_party/llvm-build/Release+Asserts/bin/clang++ --crate-type rlib -Z force-unstable-if-unmarked -C force-unwind-tables=no -C relocation-model=pic -Z split-lto-unit -C linker-plugin-lto=yes -C overflow-checks=on -C default-linker-libraries -Z dep-info-omit-d-target -Z macro-backtrace -Z remap-cwd-prefix=. -C codegen-units=1 -C panic=abort -Z panic_abort_tests -C opt-level=3 -Z dwarf-version=4 -C debuginfo=1 -C linker-plugin-lto=yes -Z sanitizer=cfi -Z sanitizer-cfi-normalize-integers -Z sanitizer=cfi -Z sanitizer-cfi-normalize-integers -Z sanitizer-cfi-normalize-integers -C link-arg=../../third_party/llvm-build/Release+Asserts/lib/clang/17/lib/x86_64-unknown-linux-gnu/libclang_rt.builtins.a
 query stack during panic:
 end of query stack
 error: aborting due to previous error

To reproduce:

  1. Checkout chromium source
  2. Apply https://chromium-review.googlesource.com/c/chromium/src/+/4666161 (through the DOWNLOAD link)
  3. Apply https://chromium-review.googlesource.com/c/chromium/src/+/4663924 (through the DOWNLOAD link)
  4. Build all_rust target.

#89653
cc: @rcvalle

@danakj danakj added C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jul 5, 2023
@rcvalle rcvalle added the PG-exploit-mitigations Project group: Exploit mitigations label Jul 5, 2023
@rcvalle
Copy link
Member

rcvalle commented Jul 5, 2023

This seems to be a duplicate of #100778.

@rcvalle rcvalle self-assigned this Jul 5, 2023
rcvalle added a commit to rcvalle/rust that referenced this issue Jul 17, 2023
Fixes rust-lang#100778 and rust-lang#113366, and complements rust-lang#106547 by adding support for
encoding const parameters.
bors added a commit to rust-lang-ci/rust that referenced this issue Jul 27, 2023
…ler-errors

CFI: Fix ICE: encode_const: unexpected type [usize

Fixes rust-lang#100778 and rust-lang#113366, and complements rust-lang#106547 by adding support for encoding const parameters.
@rcvalle
Copy link
Member

rcvalle commented Aug 9, 2023

This was fixed in #113708.

@rcvalle rcvalle closed this as completed Aug 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ PG-exploit-mitigations Project group: Exploit mitigations T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

2 participants