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

ICE when compile the anyhow with CFI on nightly #129169

Closed
ChoKyuWon opened this issue Aug 16, 2024 · 0 comments · Fixed by #129179
Closed

ICE when compile the anyhow with CFI on nightly #129169

ChoKyuWon opened this issue Aug 16, 2024 · 0 comments · Fixed by #129179
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

@ChoKyuWon
Copy link
Contributor

Code

I clone the master branch of anyhow and build with following command:

RUSTFLAGS="-Zsanitizer=cfi -Clto -Ccodegen-units=1 -Cembed-bitcode=yes" cargo build

Meta

rustc --version --verbose:

rustc 1.82.0-nightly (2c93fabd9 2024-08-15)
binary: rustc
commit-hash: 2c93fabd98d2c183bcb3afed1f7d51b2517ac5ed
commit-date: 2024-08-15
host: x86_64-unknown-linux-gnu
release: 1.82.0-nightly
LLVM version: 19.1.0

Error output

error: internal compiler error: compiler/rustc_sanitizers/src/cfi/typeid/itanium_cxx_abi/encode.rs:311:13: encode_region: unexpected `'static`

thread 'rustc' panicked at compiler/rustc_sanitizers/src/cfi/typeid/itanium_cxx_abi/encode.rs:311:13:
Box<dyn Any>
Backtrace

stack backtrace:
   0:     0x7fb9eddc6eed - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::hb1ec11483faf59ec
   1:     0x7fb9ee605117 - core::fmt::write::h84a6b6ae510da190
   2:     0x7fb9ef598911 - std::io::Write::write_fmt::h8404ebdc78861201
   3:     0x7fb9eddc95cb - std::panicking::default_hook::{{closure}}::h518a263c25cb1111
   4:     0x7fb9eddc923e - std::panicking::default_hook::h2752a9c81c12d6b4
   5:     0x7fb9ecf5d8b9 - std[8ad521eebc951483]::panicking::update_hook::<alloc[bed25e850ed3cccd]::boxed::Box<rustc_driver_impl[20da052418ddae16]::install_ice_hook::{closure#0}>>::{closure#0}
   6:     0x7fb9eddc9ee7 - std::panicking::rust_panic_with_hook::he354a699a0d60be5
   7:     0x7fb9ecf97bc1 - std[8ad521eebc951483]::panicking::begin_panic::<rustc_errors[3691a4d368011984]::ExplicitBug>::{closure#0}
   8:     0x7fb9ecf8ac06 - std[8ad521eebc951483]::sys::backtrace::__rust_end_short_backtrace::<std[8ad521eebc951483]::panicking::begin_panic<rustc_errors[3691a4d368011984]::ExplicitBug>::{closure#0}, !>
   9:     0x7fb9ecf85fe6 - std[8ad521eebc951483]::panicking::begin_panic::<rustc_errors[3691a4d368011984]::ExplicitBug>
  10:     0x7fb9ecfa0ba1 - <rustc_errors[3691a4d368011984]::diagnostic::BugAbort as rustc_errors[3691a4d368011984]::diagnostic::EmissionGuarantee>::emit_producing_guarantee
  11:     0x7fb9ed5620a4 - rustc_middle[a0379b534d6c66f1]::util::bug::opt_span_bug_fmt::<rustc_span[39ebff29ad47627f]::span_encoding::Span>::{closure#0}
  12:     0x7fb9ed54838a - rustc_middle[a0379b534d6c66f1]::ty::context::tls::with_opt::<rustc_middle[a0379b534d6c66f1]::util::bug::opt_span_bug_fmt<rustc_span[39ebff29ad47627f]::span_encoding::Span>::{closure#0}, !>::{closure#0}
  13:     0x7fb9ed54821b - rustc_middle[a0379b534d6c66f1]::ty::context::tls::with_context_opt::<rustc_middle[a0379b534d6c66f1]::ty::context::tls::with_opt<rustc_middle[a0379b534d6c66f1]::util::bug::opt_span_bug_fmt<rustc_span[39ebff29ad47627f]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
  14:     0x7fb9eb0b5030 - rustc_middle[a0379b534d6c66f1]::util::bug::bug_fmt
  15:     0x7fb9eda04b63 - rustc_sanitizers[63b8049478e37d69]::cfi::typeid::itanium_cxx_abi::encode::encode_region
  16:     0x7fb9eda0860e - rustc_sanitizers[63b8049478e37d69]::cfi::typeid::itanium_cxx_abi::encode::encode_ty
  17:     0x7fb9eda03f54 - rustc_sanitizers[63b8049478e37d69]::cfi::typeid::itanium_cxx_abi::encode::encode_args
  18:     0x7fb9eda075b9 - rustc_sanitizers[63b8049478e37d69]::cfi::typeid::itanium_cxx_abi::encode::encode_ty
  19:     0x7fb9eda03f54 - rustc_sanitizers[63b8049478e37d69]::cfi::typeid::itanium_cxx_abi::encode::encode_args
  20:     0x7fb9eda075b9 - rustc_sanitizers[63b8049478e37d69]::cfi::typeid::itanium_cxx_abi::encode::encode_ty
  21:     0x7fb9eda07eae - rustc_sanitizers[63b8049478e37d69]::cfi::typeid::itanium_cxx_abi::encode::encode_ty
  22:     0x7fb9eda0af47 - rustc_sanitizers[63b8049478e37d69]::cfi::typeid::itanium_cxx_abi::typeid_for_fnabi
  23:     0x7fb9eda0ce6e - rustc_sanitizers[63b8049478e37d69]::cfi::typeid::itanium_cxx_abi::typeid_for_instance
  24:     0x7fb9eb54d365 - <rustc_codegen_llvm[fcbb06d9709bdc07]::context::CodegenCx as rustc_codegen_ssa[d64ec570170a35ec]::traits::declare::PreDefineMethods>::predefine_fn
  25:     0x7fb9ef4bfa80 - rustc_codegen_llvm[fcbb06d9709bdc07]::base::compile_codegen_unit::module_codegen
  26:     0x7fb9ef53704d - <rustc_codegen_llvm[fcbb06d9709bdc07]::LlvmCodegenBackend as rustc_codegen_ssa[d64ec570170a35ec]::traits::backend::ExtraBackendMethods>::compile_codegen_unit
  27:     0x7fb9ef5336a2 - <rustc_codegen_llvm[fcbb06d9709bdc07]::LlvmCodegenBackend as rustc_codegen_ssa[d64ec570170a35ec]::traits::backend::CodegenBackend>::codegen_crate
  28:     0x7fb9ef613c98 - <rustc_interface[6f723ce00558beb9]::queries::Linker>::codegen_and_build_linker
  29:     0x7fb9ef3ea217 - rustc_interface[6f723ce00558beb9]::interface::run_compiler::<core[9e9ee4be3f424a60]::result::Result<(), rustc_span[39ebff29ad47627f]::ErrorGuaranteed>, rustc_driver_impl[20da052418ddae16]::run_compiler::{closure#0}>::{closure#1}
  30:     0x7fb9ef305f90 - std[8ad521eebc951483]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[6f723ce00558beb9]::util::run_in_thread_with_globals<rustc_interface[6f723ce00558beb9]::util::run_in_thread_pool_with_globals<rustc_interface[6f723ce00558beb9]::interface::run_compiler<core[9e9ee4be3f424a60]::result::Result<(), rustc_span[39ebff29ad47627f]::ErrorGuaranteed>, rustc_driver_impl[20da052418ddae16]::run_compiler::{closure#0}>::{closure#1}, core[9e9ee4be3f424a60]::result::Result<(), rustc_span[39ebff29ad47627f]::ErrorGuaranteed>>::{closure#0}, core[9e9ee4be3f424a60]::result::Result<(), rustc_span[39ebff29ad47627f]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[9e9ee4be3f424a60]::result::Result<(), rustc_span[39ebff29ad47627f]::ErrorGuaranteed>>
  31:     0x7fb9ef3065fa - <<std[8ad521eebc951483]::thread::Builder>::spawn_unchecked_<rustc_interface[6f723ce00558beb9]::util::run_in_thread_with_globals<rustc_interface[6f723ce00558beb9]::util::run_in_thread_pool_with_globals<rustc_interface[6f723ce00558beb9]::interface::run_compiler<core[9e9ee4be3f424a60]::result::Result<(), rustc_span[39ebff29ad47627f]::ErrorGuaranteed>, rustc_driver_impl[20da052418ddae16]::run_compiler::{closure#0}>::{closure#1}, core[9e9ee4be3f424a60]::result::Result<(), rustc_span[39ebff29ad47627f]::ErrorGuaranteed>>::{closure#0}, core[9e9ee4be3f424a60]::result::Result<(), rustc_span[39ebff29ad47627f]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[9e9ee4be3f424a60]::result::Result<(), rustc_span[39ebff29ad47627f]::ErrorGuaranteed>>::{closure#1} as core[9e9ee4be3f424a60]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  32:     0x7fb9ef30696b - std::sys::pal::unix::thread::Thread::new::thread_start::hc5f45ff6e8a2ee2e
  33:     0x7fb9e986bac3 - start_thread
                               at ./nptl/pthread_create.c:442:8
  34:     0x7fb9e98fd850 - __GI___clone3
                               at ./misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:81
  35:                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: please make sure that you have updated to the latest nightly

note: compiler flags: --crate-type lib -C embed-bitcode=no -C debuginfo=2 -C incremental=[REDACTED] -Z sanitizer=cfi -C lto -C codegen-units=1 -C embed-bitcode=yes

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
end of query stack

@ChoKyuWon ChoKyuWon 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 Aug 16, 2024
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Aug 16, 2024
@saethlin saethlin added the PG-exploit-mitigations Project group: Exploit mitigations label Aug 17, 2024
@compiler-errors compiler-errors self-assigned this Aug 17, 2024
@saethlin saethlin removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Aug 17, 2024
@bors bors closed this as completed in 7da4b2d Aug 21, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Aug 21, 2024
Rollup merge of rust-lang#129179 - compiler-errors:cfi-erase-transparent, r=davidtwco

CFI: Erase regions when projecting ADT to its transparent non-1zst field

The output from `FieldDef::ty` (or `TyCtxt::type_of`) may have free regions (well, `'static`) -- erase it.

Fixes rust-lang#129169
Fixes rust-lang#123685
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

Successfully merging a pull request may close this issue.

4 participants