rust-lang / rust

Empowering everyone to build reliable and efficient software.
https://www.rust-lang.org
Other
98.26k stars 12.71k forks source link

Compiler crashed when running clippy on LibAFL #124075

Closed mkravchik closed 6 months ago

mkravchik commented 6 months ago

Summary

I got the latest code of LibAFL, updated rust (rustup update) and ran the scripts/clippy.sh

Version

rustc 1.77.2 (25ef9e3d8 2024-04-09)
binary: rustc
commit-hash: 25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04
commit-date: 2024-04-09
host: x86_64-unknown-linux-gnu
release: 1.77.2
LLVM version: 17.0.6

Error output

Checking serial_test v2.0.0
error: internal compiler error: compiler/rustc_infer/src/infer/mod.rs:956:17: opaque types got hidden types registered from within subtype predicate: libafl::events::SimpleEventManager<libafl::monitors::SimpleMonitor<Alias(Opaque, AliasTy { args: [], def_id: DefId(0:2544 ~ afl_libfuzzer_runtime[8285]::fuzz::create_monitor_closure::{opaque#0}) })>, libafl::state::StdState<libafl::inputs::BytesInput, corpus::LibfuzzerCorpus, libafl_bolts::rands::RomuDuoJrRand, corpus::ArtifactCorpus>> vs libafl::events::SimpleEventManager<libafl::monitors::SimpleMonitor<Alias(Opaque, AliasTy { args: [], def_id: DefId(0:2544 ~ afl_libfuzzer_runtime[8285]::fuzz::create_monitor_closure::{opaque#0}) })>, libafl::state::StdState<libafl::inputs::BytesInput, corpus::LibfuzzerCorpus, libafl_bolts::rands::RomuDuoJrRand, corpus::ArtifactCorpus>> --> src/lib.rs:228:34 150 / macro_rules! fuzz_with { 151 ($options:ident, $harness:ident, $operation:expr, $and_then:expr, $edge_maker:expr) => {{ 152 use libafl_bolts::{ 153 current_nanos, ... 228 let generalization = IfStage::new( , , , Ok(grimoire.into()), tuple_list!(generalization)); ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ... 521 / fuzz_with!($options, $harness, $operation, $and_then, { 522 let edges = unsafe { extra_counters() }; 523 let edges_observer = 524 HitcountsMapObserver::new(StdMapObserver::from_mut_slice("edges", edges.into_iter().next().unwrap())); 525 edges_observer 526 }) __- in this macro invocation (#2) ... 537 }}; 538 }
___in this expansion of fuzz_with! (#1)
in this expansion of fuzz_with! (#2)

::: src/fuzz.rs:228:9 | 228 | / fuzz_with!(options, harness, do_fuzz, |fuzz_single| { 229 | | let mgr = SimpleEventManager::new(SimpleMonitor::new(create_monitor_closure())); 230 | | crate::start_fuzzing_single(fuzz_single, None, mgr) 231 | | }) | |__- in this macro invocation (#1)

thread 'rustc' panicked at compiler/rustc_infer/src/infer/mod.rs:956:17: Box stack backtrace: 0: 0x7f6d0c04fcd5 - std::backtrace_rs::backtrace::libunwind::trace::h39aa7bbcf61112e7 at /rustc/1cec373f65eb76e8e4b4d1847213cf3ec6c292b6/library/std/src/../../backtrace/src/backtrace/libunwind.rs:105:5 1: 0x7f6d0c04fcd5 - std::backtrace_rs::backtrace::trace_unsynchronized::h8cbdf27e1140b5c7 at /rustc/1cec373f65eb76e8e4b4d1847213cf3ec6c292b6/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5 2: 0x7f6d0c04fcd5 - std::sys_common::backtrace::_print_fmt::hf30f89c5893a63c3 at /rustc/1cec373f65eb76e8e4b4d1847213cf3ec6c292b6/library/std/src/sys_common/backtrace.rs:68:5 3: 0x7f6d0c04fcd5 - ::fmt::h8ae58e1a025dc15e at /rustc/1cec373f65eb76e8e4b4d1847213cf3ec6c292b6/library/std/src/sys_common/backtrace.rs:44:22 4: 0x7f6d0c09ef9b - core::fmt::rt::Argument::fmt::h79663960ec3ead41 at /rustc/1cec373f65eb76e8e4b4d1847213cf3ec6c292b6/library/core/src/fmt/rt.rs:165:63 5: 0x7f6d0c09ef9b - core::fmt::write::hea0bc3323f37fb37 at /rustc/1cec373f65eb76e8e4b4d1847213cf3ec6c292b6/library/core/src/fmt/mod.rs:1157:21 6: 0x7f6d0c04485f - std::io::Write::write_fmt::h0aebada01ce9c9e1 at /rustc/1cec373f65eb76e8e4b4d1847213cf3ec6c292b6/library/std/src/io/mod.rs:1832:15 7: 0x7f6d0c04faae - std::sys_common::backtrace::_print::hb8b452cedd5245b9 at /rustc/1cec373f65eb76e8e4b4d1847213cf3ec6c292b6/library/std/src/sys_common/backtrace.rs:47:5 8: 0x7f6d0c04faae - std::sys_common::backtrace::print::h45e09369dba6d79a at /rustc/1cec373f65eb76e8e4b4d1847213cf3ec6c292b6/library/std/src/sys_common/backtrace.rs:34:9 9: 0x7f6d0c052429 - std::panicking::default_hook::{{closure}}::h17bec0ff62b1df32 10: 0x7f6d0c05216d - std::panicking::default_hook::hc8938c3997234b0d at /rustc/1cec373f65eb76e8e4b4d1847213cf3ec6c292b6/library/std/src/panicking.rs:291:9 11: 0x7f6d0f1303dc - std[531770c5e2e8d301]::panicking::update_hook::<alloc[d882034972180c03]::boxed::Box<rustc_driver_impl[427e5c398467f86b]::install_ice_hook::{closure#0}>>::{closure#0} 12: 0x7f6d0c052b2c - <alloc::boxed::Box<F,A> as core::ops::function::Fn>::call::h6d2f4133a0440d99 at /rustc/1cec373f65eb76e8e4b4d1847213cf3ec6c292b6/library/alloc/src/boxed.rs:2032:9 13: 0x7f6d0c052b2c - std::panicking::rust_panic_with_hook::h7c86743fcac7c36d at /rustc/1cec373f65eb76e8e4b4d1847213cf3ec6c292b6/library/std/src/panicking.rs:792:13 14: 0x7f6d0f15ff54 - std[531770c5e2e8d301]::panicking::begin_panic::<rustc_errors[1b3eec32e47ffd2f]::ExplicitBug>::{closure#0} 15: 0x7f6d0f15cbd6 - std[531770c5e2e8d301]::sys_common::backtrace::rust_end_short_backtrace::<std[531770c5e2e8d301]::panicking::begin_panic<rustc_errors[1b3eec32e47ffd2f]::ExplicitBug>::{closure#0}, !> 16: 0x7f6d0f15c8b6 - std[531770c5e2e8d301]::panicking::begin_panic::<rustc_errors[1b3eec32e47ffd2f]::ExplicitBug> 17: 0x7f6d0f168f81 - <rustc_errors[1b3eec32e47ffd2f]::diagnostic::BugAbort as rustc_errors[1b3eec32e47ffd2f]::diagnostic::EmissionGuarantee>::emit_producing_guarantee 18: 0x7f6d0f3a85b8 - <rustc_errors[1b3eec32e47ffd2f]::DiagCtxt>::span_bug::<rustc_span[53b55791d064607f]::span_encoding::Span, alloc[d882034972180c03]::string::String> 19: 0x7f6d0f3df5fd - rustc_middle[d8712503438341b1]::util::bug::opt_span_bug_fmt::<rustc_span[53b55791d064607f]::span_encoding::Span>::{closure#0} 20: 0x7f6d0f3df92a - rustc_middle[d8712503438341b1]::ty::context::tls::with_opt::<rustc_middle[d8712503438341b1]::util::bug::opt_span_bug_fmt<rustc_span[53b55791d064607f]::span_encoding::Span>::{closure#0}, !>::{closure#0} 21: 0x7f6d0f3c499b - rustc_middle[d8712503438341b1]::ty::context::tls::with_context_opt::<rustc_middle[d8712503438341b1]::ty::context::tls::with_opt<rustc_middle[d8712503438341b1]::util::bug::opt_span_bug_fmt<rustc_span[53b55791d064607f]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !> 22: 0x7f6d0f3c36b7 - rustc_middle[d8712503438341b1]::util::bug::span_bug_fmt::<rustc_span[53b55791d064607f]::span_encoding::Span> 23: 0x7f6d0d0cace1 - <rustc_trait_selection[27d743aeac5b0616]::traits::fulfill::FulfillProcessor as rustc_data_structures[f4bfcbb9d91a10eb]::obligation_forest::ObligationProcessor>::process_obligation 24: 0x7f6d104d0823 - <rustc_data_structures[f4bfcbb9d91a10eb]::obligation_forest::ObligationForest<rustc_trait_selection[27d743aeac5b0616]::traits::fulfill::PendingPredicateObligation>>::process_obligations::<rustc_trait_selection[27d743aeac5b0616]::traits::fulfill::FulfillProcessor> 25: 0x7f6d111968f7 - <rustc_hir_typeck[77e1cc157524533d]::fn_ctxt::FnCtxt>::check_argument_types 26: 0x7f6d10525e09 - <rustc_hir_typeck[77e1cc157524533d]::fn_ctxt::FnCtxt>::check_call 27: 0x7f6d10e3621d - <rustc_hir_typeck[77e1cc157524533d]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args 28: 0x7f6d10e307a6 - <rustc_hir_typeck[77e1cc157524533d]::fn_ctxt::FnCtxt>::check_block_with_expected 29: 0x7f6d10e36701 - <rustc_hir_typeck[77e1cc157524533d]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args 30: 0x7f6d10e307a6 - <rustc_hir_typeck[77e1cc157524533d]::fn_ctxt::FnCtxt>::check_block_with_expected 31: 0x7f6d10e36701 - <rustc_hir_typeck[77e1cc157524533d]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args 32: 0x7f6d10e37d8e - <rustc_hir_typeck[77e1cc157524533d]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args 33: 0x7f6d10e307a6 - <rustc_hir_typeck[77e1cc157524533d]::fn_ctxt::FnCtxt>::check_block_with_expected 34: 0x7f6d10e36701 - <rustc_hir_typeck[77e1cc157524533d]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args 35: 0x7f6d10e307a6 - <rustc_hir_typeck[77e1cc157524533d]::fn_ctxt::FnCtxt>::check_block_with_expected 36: 0x7f6d10e36701 - <rustc_hir_typeck[77e1cc157524533d]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args 37: 0x7f6d10e391e2 - <rustc_hir_typeck[77e1cc157524533d]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args 38: 0x7f6d10e391e2 - <rustc_hir_typeck[77e1cc157524533d]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args 39: 0x7f6d10e307a6 - <rustc_hir_typeck[77e1cc157524533d]::fn_ctxt::FnCtxt>::check_block_with_expected 40: 0x7f6d10e36701 - <rustc_hir_typeck[77e1cc157524533d]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args 41: 0x7f6d10717821 - rustc_hir_typeck[77e1cc157524533d]::check::check_fn 42: 0x7f6d1070dd49 - rustc_hir_typeck[77e1cc157524533d]::typeck 43: 0x7f6d1070d709 - rustc_query_impl[ffef2ea0cc82d0dd]::plumbing::rust_begin_short_backtrace::<rustc_query_impl[ffef2ea0cc82d0dd]::query_impl::typeck::dynamic_query::{closure#2}::{closure#0}, rustc_middle[d8712503438341b1]::query::erase::Erased<[u8; 8usize]>> 44: 0x7f6d106fd01a - rustc_query_system[219200ddf699f4fc]::query::plumbing::try_execute_query::<rustc_query_impl[ffef2ea0cc82d0dd]::DynamicConfig<rustc_query_system[219200ddf699f4fc]::query::caches::VecCache<rustc_span[53b55791d064607f]::def_id::LocalDefId, rustc_middle[d8712503438341b1]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[ffef2ea0cc82d0dd]::plumbing::QueryCtxt, true> 45: 0x7f6d10a3e0c9 - rustc_query_impl[ffef2ea0cc82d0dd]::query_impl::typeck::get_query_incr::rust_end_short_backtrace 46: 0x7f6d106f8218 - <rustc_middle[d8712503438341b1]::hir::map::Map>::par_body_owners::<rustc_hir_analysis[6a1b22ded269dcc8]::check_crate::{closure#4}>::{closure#0} 47: 0x7f6d106f6f01 - rustc_hir_analysis[6a1b22ded269dcc8]::check_crate 48: 0x7f6d10d88b7a - rustc_interface[336e9a5fb47021d9]::passes::analysis 49: 0x7f6d10d886d5 - rustc_query_impl[ffef2ea0cc82d0dd]::plumbing::rust_begin_short_backtrace::<rustc_query_impl[ffef2ea0cc82d0dd]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[d8712503438341b1]::query::erase::Erased<[u8; 1usize]>> 50: 0x7f6d112d9b4a - rustc_query_system[219200ddf699f4fc]::query::plumbing::try_execute_query::<rustc_query_impl[ffef2ea0cc82d0dd]::DynamicConfig<rustc_query_system[219200ddf699f4fc]::query::caches::SingleCache<rustc_middle[d8712503438341b1]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[ffef2ea0cc82d0dd]::plumbing::QueryCtxt, true> 51: 0x7f6d112d975c - rustc_query_impl[ffef2ea0cc82d0dd]::query_impl::analysis::get_query_incr::rust_end_short_backtrace 52: 0x7f6d11180fd9 - rustc_interface[336e9a5fb47021d9]::interface::run_compiler::<core[2a3c68b720306447]::result::Result<(), rustc_span[53b55791d064607f]::ErrorGuaranteed>, rustc_driver_impl[427e5c398467f86b]::run_compiler::{closure#0}>::{closure#1} 53: 0x7f6d1106e327 - std[531770c5e2e8d301]::sys_common::backtrace::rust_begin_short_backtrace::<rustc_interface[336e9a5fb47021d9]::util::run_in_thread_with_globals<rustc_interface[336e9a5fb47021d9]::util::run_in_thread_pool_with_globals<rustc_interface[336e9a5fb47021d9]::interface::run_compiler<core[2a3c68b720306447]::result::Result<(), rustc_span[53b55791d064607f]::ErrorGuaranteed>, rustc_driver_impl[427e5c398467f86b]::run_compiler::{closure#0}>::{closure#1}, core[2a3c68b720306447]::result::Result<(), rustc_span[53b55791d064607f]::ErrorGuaranteed>>::{closure#0}, core[2a3c68b720306447]::result::Result<(), rustc_span[53b55791d064607f]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[2a3c68b720306447]::result::Result<(), rustc_span[53b55791d064607f]::ErrorGuaranteed>> 54: 0x7f6d1106e0ea - <<std[531770c5e2e8d301]::thread::Builder>::spawnunchecked<rustc_interface[336e9a5fb47021d9]::util::run_in_thread_with_globals<rustc_interface[336e9a5fb47021d9]::util::run_in_thread_pool_with_globals<rustc_interface[336e9a5fb47021d9]::interface::run_compiler<core[2a3c68b720306447]::result::Result<(), rustc_span[53b55791d064607f]::ErrorGuaranteed>, rustc_driver_impl[427e5c398467f86b]::run_compiler::{closure#0}>::{closure#1}, core[2a3c68b720306447]::result::Result<(), rustc_span[53b55791d064607f]::ErrorGuaranteed>>::{closure#0}, core[2a3c68b720306447]::result::Result<(), rustc_span[53b55791d064607f]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[2a3c68b720306447]::result::Result<(), rustc_span[53b55791d064607f]::ErrorGuaranteed>>::{closure#2} as core[2a3c68b720306447]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0} 55: 0x7f6d0c05ca1b - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce>::call_once::hc8d25b9018534ef3 at /rustc/1cec373f65eb76e8e4b4d1847213cf3ec6c292b6/library/alloc/src/boxed.rs:2018:9 56: 0x7f6d0c05ca1b - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce>::call_once::h9f7c65c9881af958 at /rustc/1cec373f65eb76e8e4b4d1847213cf3ec6c292b6/library/alloc/src/boxed.rs:2018:9 57: 0x7f6d0c05ca1b - std::sys::pal::unix::thread::Thread::new::thread_start::ha61a9957d3d99efc at /rustc/1cec373f65eb76e8e4b4d1847213cf3ec6c292b6/library/std/src/sys/pal/unix/thread.rs:108:17 58: 0x7f6d0bf45609 - start_thread at /build/glibc-wuryBv/glibc-2.31/nptl/pthread_create.c:477:8 59: 0x7f6d0bd19353 - clone at /build/glibc-wuryBv/glibc-2.31/misc/../sysdeps/unix/sysv/linux/x86_64/clone.S:95 60: 0x0 -

note: we would appreciate a bug report: https://github.com/rust-lang/rust-clippy/issues/new?template=ice.yml

note: please make sure that you have updated to the latest nightly

note: please attach the file at <REDACTED>rustc-ice-2024-04-17T13_33_02-1893447.txt to your bug report

note: compiler flags: -C embed-bitcode=no -C debuginfo=2 -C incremental=[REDACTED]

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

query stack during panic:

0 [typeck] type-checking fuzz::fuzz

rust-lang/rust-clippy#1 [analysis] running analysis passes on this crate end of query stack note: Clippy version: clippy 0.1.79 (1cec373 2024-04-16)

error: could not compile libafl_libfuzzer_runtime (lib test) rustc-ice-2024-04-17T13_33_02-1893447.txt

y21 commented 6 months ago

Moved to the rust repo because this doesn't look like a clippy ICE: this also reproduces simply with cargo check in the libafl_libfuzzer/libafl_libfuzzer_runtime crate.

addisoncrump commented 6 months ago

Yup, I ICE'd out on CI just now. Whoops.

addisoncrump commented 6 months ago

More context: https://github.com/AFLplusplus/LibAFL/actions/runs/8722806578/job/23929680630?pr=2061

matthiaskrgr commented 6 months ago

probably related to https://github.com/rust-lang/rust/issues/124054

lqd commented 6 months ago

The rustc 1.77.2 (25ef9e3d8 2024-04-09) version in the OP should not trigger this ICE, which is on nightly since yesterday only, but yeah it's most likely a duplicate of https://github.com/rust-lang/rust/issues/124054 and will be fixed by #124066