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: cfi with async: transform_ty: unexpected GeneratorWitness(Binder.. #111184

Closed
matthiaskrgr opened this issue May 4, 2023 · 1 comment · Fixed by #111914
Closed

ICE: cfi with async: transform_ty: unexpected GeneratorWitness(Binder.. #111184

matthiaskrgr opened this issue May 4, 2023 · 1 comment · Fixed by #111914
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

@matthiaskrgr
Copy link
Member

matthiaskrgr commented May 4, 2023

Code

rustc treereduce.out --edition=2021 -Zsanitizer=cfi -Zsanitizer-cfi-normalize-integers -Clto

use std::future::Future;

async fn data_moved_async() {}

fn run_fut<T>(fut: impl Future<Output = T>) -> T {
    loop {}
}

fn main() {
    run_fut(data_moved_async());
}

Meta

rustc --version --verbose:

rustc 1.71.0-nightly (6f8c0557e 2023-05-04)
binary: rustc
commit-hash: 6f8c0557e0b73c73a8a7163a15f4a5a3feca7d5c
commit-date: 2023-05-04
host: x86_64-unknown-linux-gnu
release: 1.71.0-nightly
LLVM version: 16.0.2

Error output

<output>
Backtrace

error: internal compiler error: compiler/rustc_symbol_mangling/src/typeid/typeid_itanium_cxx_abi.rs:881:13: transform_ty: unexpected `GeneratorWitness(Binder([], []))`

thread 'rustc' panicked at 'Box<dyn Any>', /rustc/6f8c0557e0b73c73a8a7163a15f4a5a3feca7d5c/compiler/rustc_errors/src/lib.rs:1643:9
stack backtrace:
   0:     0x7f9d9d369441 - std::backtrace_rs::backtrace::libunwind::trace::ha1124e3c4b659eb5
                               at /rustc/6f8c0557e0b73c73a8a7163a15f4a5a3feca7d5c/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7f9d9d369441 - std::backtrace_rs::backtrace::trace_unsynchronized::h3a8d622ec81b6cb5
                               at /rustc/6f8c0557e0b73c73a8a7163a15f4a5a3feca7d5c/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f9d9d369441 - std::sys_common::backtrace::_print_fmt::h2128e938c7086b6e
                               at /rustc/6f8c0557e0b73c73a8a7163a15f4a5a3feca7d5c/library/std/src/sys_common/backtrace.rs:65:5
   3:     0x7f9d9d369441 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hc50c3543d0b1b52f
                               at /rustc/6f8c0557e0b73c73a8a7163a15f4a5a3feca7d5c/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7f9d9d3ca0df - core::fmt::rt::Argument::fmt::h84c36e9580f5b71f
                               at /rustc/6f8c0557e0b73c73a8a7163a15f4a5a3feca7d5c/library/core/src/fmt/rt.rs:138:9
   5:     0x7f9d9d3ca0df - core::fmt::write::h326e01f7a9aa5dd9
                               at /rustc/6f8c0557e0b73c73a8a7163a15f4a5a3feca7d5c/library/core/src/fmt/mod.rs:1094:21
   6:     0x7f9d9d35c4f1 - std::io::Write::write_fmt::h71f0f6281149b8c8
                               at /rustc/6f8c0557e0b73c73a8a7163a15f4a5a3feca7d5c/library/std/src/io/mod.rs:1712:15
   7:     0x7f9d9d369255 - std::sys_common::backtrace::_print::h6b9c2111a065fb89
                               at /rustc/6f8c0557e0b73c73a8a7163a15f4a5a3feca7d5c/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x7f9d9d369255 - std::sys_common::backtrace::print::hf8d0af7625f66057
                               at /rustc/6f8c0557e0b73c73a8a7163a15f4a5a3feca7d5c/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x7f9d9d36bee7 - std::panicking::default_hook::{{closure}}::h630fe7740556559d
  10:     0x7f9d9d36bcd4 - std::panicking::default_hook::h337047625b381696
                               at /rustc/6f8c0557e0b73c73a8a7163a15f4a5a3feca7d5c/library/std/src/panicking.rs:288:9
  11:     0x7f9da0571715 - rustc_driver_impl[f38315262de66e12]::DEFAULT_HOOK::{closure#0}::{closure#0}
  12:     0x7f9d9d36c607 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h1ac669e77ecf459f
                               at /rustc/6f8c0557e0b73c73a8a7163a15f4a5a3feca7d5c/library/alloc/src/boxed.rs:1999:9
  13:     0x7f9d9d36c607 - std::panicking::rust_panic_with_hook::h22ef26cea64ec65c
                               at /rustc/6f8c0557e0b73c73a8a7163a15f4a5a3feca7d5c/library/std/src/panicking.rs:695:13
  14:     0x7f9da0a39901 - std[2e06b57a958d7603]::panicking::begin_panic::<rustc_errors[5778b576bff5e43e]::ExplicitBug>::{closure#0}
  15:     0x7f9da0a392a6 - std[2e06b57a958d7603]::sys_common::backtrace::__rust_end_short_backtrace::<std[2e06b57a958d7603]::panicking::begin_panic<rustc_errors[5778b576bff5e43e]::ExplicitBug>::{closure#0}, !>
  16:     0x7f9da0a5fca6 - std[2e06b57a958d7603]::panicking::begin_panic::<rustc_errors[5778b576bff5e43e]::ExplicitBug>
  17:     0x7f9da0a5d114 - <rustc_errors[5778b576bff5e43e]::HandlerInner>::bug::<alloc[3df6c3833cdafa3e]::string::String>
  18:     0x7f9da0a5ce46 - <rustc_errors[5778b576bff5e43e]::Handler>::bug::<alloc[3df6c3833cdafa3e]::string::String>
  19:     0x7f9da0ae52cc - rustc_middle[9b03ef73197c8750]::util::bug::opt_span_bug_fmt::<rustc_span[e5d9edf586a8e474]::span_encoding::Span>::{closure#0}
  20:     0x7f9da0ae4afa - rustc_middle[9b03ef73197c8750]::ty::context::tls::with_opt::<rustc_middle[9b03ef73197c8750]::util::bug::opt_span_bug_fmt<rustc_span[e5d9edf586a8e474]::span_encoding::Span>::{closure#0}, !>::{closure#0}
  21:     0x7f9da0ae4aca - rustc_middle[9b03ef73197c8750]::ty::context::tls::with_context_opt::<rustc_middle[9b03ef73197c8750]::ty::context::tls::with_opt<rustc_middle[9b03ef73197c8750]::util::bug::opt_span_bug_fmt<rustc_span[e5d9edf586a8e474]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
  22:     0x7f9d9ec50ccd - rustc_middle[9b03ef73197c8750]::util::bug::bug_fmt
  23:     0x7f9da0fc9752 - rustc_symbol_mangling[1bf499ff7f75842a]::typeid::typeid_itanium_cxx_abi::transform_ty
  24:     0x7f9da0fc5613 - <&mut rustc_symbol_mangling[1bf499ff7f75842a]::typeid::typeid_itanium_cxx_abi::transform_substs::{closure#0} as core[351080cb3919538e]::ops::function::FnOnce<(rustc_middle[9b03ef73197c8750]::ty::subst::GenericArg,)>>::call_once
  25:     0x7f9da0fd4beb - <smallvec[163c2c57480b45e5]::SmallVec<[rustc_middle[9b03ef73197c8750]::ty::subst::GenericArg; 8usize]> as core[351080cb3919538e]::iter::traits::collect::Extend<<[rustc_middle[9b03ef73197c8750]::ty::subst::GenericArg; 8usize] as smallvec[163c2c57480b45e5]::Array>::Item>>::extend::<core[351080cb3919538e]::iter::adapters::map::Map<core[351080cb3919538e]::iter::adapters::copied::Copied<core[351080cb3919538e]::slice::iter::Iter<rustc_middle[9b03ef73197c8750]::ty::subst::GenericArg>>, rustc_symbol_mangling[1bf499ff7f75842a]::typeid::typeid_itanium_cxx_abi::transform_substs::{closure#0}>>
  26:     0x7f9da0fcf19e - <rustc_middle[9b03ef73197c8750]::ty::subst::GenericArg as rustc_type_ir[2476610ddda7a73]::CollectAndApply<rustc_middle[9b03ef73197c8750]::ty::subst::GenericArg, &rustc_middle[9b03ef73197c8750]::ty::list::List<rustc_middle[9b03ef73197c8750]::ty::subst::GenericArg>>>::collect_and_apply::<core[351080cb3919538e]::iter::adapters::map::Map<core[351080cb3919538e]::iter::adapters::copied::Copied<core[351080cb3919538e]::slice::iter::Iter<rustc_middle[9b03ef73197c8750]::ty::subst::GenericArg>>, rustc_symbol_mangling[1bf499ff7f75842a]::typeid::typeid_itanium_cxx_abi::transform_substs::{closure#0}>, <rustc_middle[9b03ef73197c8750]::ty::context::TyCtxt>::mk_substs_from_iter<core[351080cb3919538e]::iter::adapters::map::Map<core[351080cb3919538e]::iter::adapters::copied::Copied<core[351080cb3919538e]::slice::iter::Iter<rustc_middle[9b03ef73197c8750]::ty::subst::GenericArg>>, rustc_symbol_mangling[1bf499ff7f75842a]::typeid::typeid_itanium_cxx_abi::transform_substs::{closure#0}>, rustc_middle[9b03ef73197c8750]::ty::subst::GenericArg>::{closure#0}>
  27:     0x7f9da0fc91c5 - rustc_symbol_mangling[1bf499ff7f75842a]::typeid::typeid_itanium_cxx_abi::transform_ty
  28:     0x7f9da0fc9db1 - rustc_symbol_mangling[1bf499ff7f75842a]::typeid::typeid_itanium_cxx_abi::typeid_for_fnabi
  29:     0x7f9d9eb7059f - <rustc_codegen_llvm[d78081c433bf4e31]::context::CodegenCx as rustc_codegen_ssa[7c934ba332e0ab85]::traits::declare::PreDefineMethods>::predefine_fn
  30:     0x7f9d9fa1a0dd - rustc_codegen_llvm[d78081c433bf4e31]::base::compile_codegen_unit::module_codegen
  31:     0x7f9d9fa18fb0 - rustc_codegen_llvm[d78081c433bf4e31]::base::compile_codegen_unit
  32:     0x7f9d9fc5c416 - rustc_codegen_ssa[7c934ba332e0ab85]::base::codegen_crate::<rustc_codegen_llvm[d78081c433bf4e31]::LlvmCodegenBackend>
  33:     0x7f9d9fc5bce2 - <rustc_codegen_llvm[d78081c433bf4e31]::LlvmCodegenBackend as rustc_codegen_ssa[7c934ba332e0ab85]::traits::backend::CodegenBackend>::codegen_crate
  34:     0x7f9d9f7ff8e0 - rustc_interface[32f66f6c15b482f4]::passes::start_codegen
  35:     0x7f9d9f7facc7 - <rustc_middle[9b03ef73197c8750]::ty::context::GlobalCtxt>::enter::<<rustc_interface[32f66f6c15b482f4]::queries::Queries>::ongoing_codegen::{closure#0}::{closure#0}, core[351080cb3919538e]::result::Result<alloc[3df6c3833cdafa3e]::boxed::Box<dyn core[351080cb3919538e]::any::Any>, rustc_span[e5d9edf586a8e474]::ErrorGuaranteed>>
  36:     0x7f9d9f7fa2a8 - <rustc_interface[32f66f6c15b482f4]::queries::Queries>::ongoing_codegen
  37:     0x7f9d9f7f99e3 - <rustc_interface[32f66f6c15b482f4]::interface::Compiler>::enter::<rustc_driver_impl[f38315262de66e12]::run_compiler::{closure#1}::{closure#2}, core[351080cb3919538e]::result::Result<core[351080cb3919538e]::option::Option<rustc_interface[32f66f6c15b482f4]::queries::Linker>, rustc_span[e5d9edf586a8e474]::ErrorGuaranteed>>
  38:     0x7f9d9f7f714f - std[2e06b57a958d7603]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[32f66f6c15b482f4]::util::run_in_thread_pool_with_globals<rustc_interface[32f66f6c15b482f4]::interface::run_compiler<core[351080cb3919538e]::result::Result<(), rustc_span[e5d9edf586a8e474]::ErrorGuaranteed>, rustc_driver_impl[f38315262de66e12]::run_compiler::{closure#1}>::{closure#0}, core[351080cb3919538e]::result::Result<(), rustc_span[e5d9edf586a8e474]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[351080cb3919538e]::result::Result<(), rustc_span[e5d9edf586a8e474]::ErrorGuaranteed>>
  39:     0x7f9d9fe58a1e - <<std[2e06b57a958d7603]::thread::Builder>::spawn_unchecked_<rustc_interface[32f66f6c15b482f4]::util::run_in_thread_pool_with_globals<rustc_interface[32f66f6c15b482f4]::interface::run_compiler<core[351080cb3919538e]::result::Result<(), rustc_span[e5d9edf586a8e474]::ErrorGuaranteed>, rustc_driver_impl[f38315262de66e12]::run_compiler::{closure#1}>::{closure#0}, core[351080cb3919538e]::result::Result<(), rustc_span[e5d9edf586a8e474]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[351080cb3919538e]::result::Result<(), rustc_span[e5d9edf586a8e474]::ErrorGuaranteed>>::{closure#1} as core[351080cb3919538e]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  40:     0x7f9d9d376ad5 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::he4e640066a72afb4
                               at /rustc/6f8c0557e0b73c73a8a7163a15f4a5a3feca7d5c/library/alloc/src/boxed.rs:1985:9
  41:     0x7f9d9d376ad5 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h6a43b4ec147b3dd9
                               at /rustc/6f8c0557e0b73c73a8a7163a15f4a5a3feca7d5c/library/alloc/src/boxed.rs:1985:9
  42:     0x7f9d9d376ad5 - std::sys::unix::thread::Thread::new::thread_start::h8c269a865bc351fb
                               at /rustc/6f8c0557e0b73c73a8a7163a15f4a5a3feca7d5c/library/std/src/sys/unix/thread.rs:108:17
  43:     0x7f9d9d112bb5 - <unknown>
  44:     0x7f9d9d194d90 - <unknown>
  45:                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.71.0-nightly (6f8c0557e 2023-05-04) running on x86_64-unknown-linux-gnu

note: compiler flags: -Z sanitizer=cfi -Z sanitizer-cfi-normalize-integers -C lto

query stack during panic:
end of query stack
error: aborting due to previous error; 1 warning emitted

@matthiaskrgr matthiaskrgr added 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. C-bug Category: This is a bug. labels May 4, 2023
@matthiaskrgr matthiaskrgr added the PG-exploit-mitigations Project group: Exploit mitigations label May 13, 2023
@rcvalle
Copy link
Member

rcvalle commented May 23, 2023

@rustbot claim

compiler-errors added a commit to compiler-errors/rust that referenced this issue Jun 2, 2023
…piler-errors

CFI: Fix cfi with async: transform_ty: unexpected GeneratorWitness(Bi…

Fixes rust-lang#111184 by encoding ty::Generator parent substs only.
@bors bors closed this as completed in 76ff5ec Jun 2, 2023
RalfJung pushed a commit to RalfJung/miri that referenced this issue Jun 11, 2023
CFI: Fix cfi with async: transform_ty: unexpected GeneratorWitness(Bi…

Fixes rust-lang/rust#111184 by encoding ty::Generator parent substs only.
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.

2 participants