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

CFI compilation of libcore on arm32 fails to encode array length #122851

Closed
maurer opened this issue Mar 21, 2024 · 2 comments · Fixed by #122855
Closed

CFI compilation of libcore on arm32 fails to encode array length #122851

maurer opened this issue Mar 21, 2024 · 2 comments · Fixed by #122855
Labels
A-sanitizers Area: Sanitizers for correctness and code quality 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.

Comments

@maurer
Copy link
Contributor

maurer commented Mar 21, 2024

This is with rustc-1.76 built as a dev branch, so it's possible this is already fixed in nightly.

Buildbot Version: androidbuild_buildbot_20240306.00_RC00
Machine: prod-2004-4925
trusty/vendor/google/aosp/scripts/build.py --build-root `pwd`/out --archive /buildbot/dist_dirs/aosp-trusty-master-linux-generic_arm32/P71943188 --buildid P71943188 --jobs 80 generic-arm32
make/module.mk:351: warning: overriding recipe for target '/buildbot/src/android/master/out/build-generic-arm32/kernellib/libcompiler_builtins.rlib'
make/module.mk:351: warning: ignoring old recipe for target '/buildbot/src/android/master/out/build-generic-arm32/kernellib/libcompiler_builtins.rlib'
make/module.mk:351: warning: overriding recipe for target '/buildbot/src/android/master/out/build-generic-arm32/kernellib/libcore.rlib'
make/module.mk:351: warning: ignoring old recipe for target '/buildbot/src/android/master/out/build-generic-arm32/kernellib/libcore.rlib'
make/library.mk:301: warning: overriding recipe for target '/buildbot/src/android/master/out/build-generic-arm32/sdk/sysroot//usr/include/c++/v1/./__cxxabi_config.h'
make/library.mk:301: warning: ignoring old recipe for target '/buildbot/src/android/master/out/build-generic-arm32/sdk/sysroot//usr/include/c++/v1/./__cxxabi_config.h'
make/library.mk:248: trusty/user/app/storage is a userspace library module but has deprecated MODULE_DEPS: trusty/user/app/storage/test/block_host_test trusty/user/app/storage/test/storage_host_test .
Failed to run rustfmt: cannot find binary path (non-fatal, continuing)
thread 'rustc' panicked at compiler/rustc_symbol_mangling/src/typeid/typeid_itanium_cxx_abi.rs:530:41:
failed to convert length to u64
stack backtrace:
   0:     0x7f1b777a54ca - <std[ec5684ef7c50a2a5]::sys_common::backtrace::_print::DisplayBacktrace as core[8c2debda200eca11]::fmt::Display>::fmt
   1:     0x7f1b777fff6f - core[8c2debda200eca11]::fmt::write
   2:     0x7f1b77798d93 - <std[ec5684ef7c50a2a5]::sys::unix::stdio::Stderr as std[ec5684ef7c50a2a5]::io::Write>::write_fmt
   3:     0x7f1b777a52a0 - std[ec5684ef7c50a2a5]::sys_common::backtrace::print
   4:     0x7f1b777a816a - std[ec5684ef7c50a2a5]::panicking::default_hook::{closure#1}
   5:     0x7f1b777a7e8d - std[ec5684ef7c50a2a5]::panicking::default_hook
   6:     0x7f1b79609f84 - std[ec5684ef7c50a2a5]::panicking::update_hook::<alloc[8d7d43742b28871a]::boxed::Box<rustc_driver_impl[b2f5e955e22cd905]::install_ice_hook::{closure#0}>>::{closure#0}
   7:     0x7f1b777a8913 - std[ec5684ef7c50a2a5]::panicking::rust_panic_with_hook
   8:     0x7f1b777a8619 - std[ec5684ef7c50a2a5]::panicking::begin_panic_handler::{closure#0}
   9:     0x7f1b777a59f6 - std[ec5684ef7c50a2a5]::sys_common::backtrace::__rust_end_short_backtrace::<std[ec5684ef7c50a2a5]::panicking::begin_panic_handler::{closure#0}, !>
  10:     0x7f1b777a8374 - rust_begin_unwind
  11:     0x7f1b777fc4a9 - core[8c2debda200eca11]::panicking::panic_fmt
  12:     0x7f1b7aeee276 - rustc_symbol_mangling[5c77f3f54abf648b]::typeid::typeid_itanium_cxx_abi::encode_ty
  13:     0x7f1b7aef3c45 - rustc_symbol_mangling[5c77f3f54abf648b]::typeid::typeid_itanium_cxx_abi::typeid_for_fnabi
  14:     0x7f1b7aef1471 - rustc_symbol_mangling[5c77f3f54abf648b]::typeid::typeid_itanium_cxx_abi::typeid_for_instance
  15:     0x7f1b7932b825 - <rustc_codegen_llvm[94e810ad66e13edc]::context::CodegenCx>::declare_fn
  16:     0x7f1b79344416 - <rustc_codegen_llvm[94e810ad66e13edc]::context::CodegenCx as rustc_codegen_ssa[50a0ac7ae2ebdae7]::traits::declare::PreDefineMethods>::predefine_fn
  17:     0x7f1b792f666a - rustc_codegen_llvm[94e810ad66e13edc]::base::compile_codegen_unit::module_codegen
  18:     0x7f1b7934b3b4 - <rustc_codegen_llvm[94e810ad66e13edc]::LlvmCodegenBackend as rustc_codegen_ssa[50a0ac7ae2ebdae7]::traits::backend::ExtraBackendMethods>::compile_codegen_unit
  19:     0x7f1b79240533 - rustc_codegen_ssa[50a0ac7ae2ebdae7]::base::codegen_crate::<rustc_codegen_llvm[94e810ad66e13edc]::LlvmCodegenBackend>
  20:     0x7f1b79356921 - <rustc_codegen_llvm[94e810ad66e13edc]::LlvmCodegenBackend as rustc_codegen_ssa[50a0ac7ae2ebdae7]::traits::backend::CodegenBackend>::codegen_crate
  21:     0x7f1b79eb4018 - rustc_interface[c0948e53bd2b6698]::passes::start_codegen
  22:     0x7f1b79ebe351 - <rustc_interface[c0948e53bd2b6698]::queries::Queries>::codegen_and_build_linker
  23:     0x7f1b79607a02 - rustc_interface[c0948e53bd2b6698]::interface::run_compiler::<core[8c2debda200eca11]::result::Result<(), rustc_span[f25a89bb3938aa99]::ErrorGuaranteed>, rustc_driver_impl[b2f5e955e22cd905]::run_compiler::{closure#0}>::{closure#0}
  24:     0x7f1b795fc4b1 - std[ec5684ef7c50a2a5]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[c0948e53bd2b6698]::util::run_in_thread_with_globals<rustc_interface[c0948e53bd2b6698]::util::run_in_thread_pool_with_globals<rustc_interface[c0948e53bd2b6698]::interface::run_compiler<core[8c2debda200eca11]::result::Result<(), rustc_span[f25a89bb3938aa99]::ErrorGuaranteed>, rustc_driver_impl[b2f5e955e22cd905]::run_compiler::{closure#0}>::{closure#0}, core[8c2debda200eca11]::result::Result<(), rustc_span[f25a89bb3938aa99]::ErrorGuaranteed>>::{closure#0}, core[8c2debda200eca11]::result::Result<(), rustc_span[f25a89bb3938aa99]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[8c2debda200eca11]::result::Result<(), rustc_span[f25a89bb3938aa99]::ErrorGuaranteed>>
  25:     0x7f1b7960f11e - <<std[ec5684ef7c50a2a5]::thread::Builder>::spawn_unchecked_<rustc_interface[c0948e53bd2b6698]::util::run_in_thread_with_globals<rustc_interface[c0948e53bd2b6698]::util::run_in_thread_pool_with_globals<rustc_interface[c0948e53bd2b6698]::interface::run_compiler<core[8c2debda200eca11]::result::Result<(), rustc_span[f25a89bb3938aa99]::ErrorGuaranteed>, rustc_driver_impl[b2f5e955e22cd905]::run_compiler::{closure#0}>::{closure#0}, core[8c2debda200eca11]::result::Result<(), rustc_span[f25a89bb3938aa99]::ErrorGuaranteed>>::{closure#0}, core[8c2debda200eca11]::result::Result<(), rustc_span[f25a89bb3938aa99]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[8c2debda200eca11]::result::Result<(), rustc_span[f25a89bb3938aa99]::ErrorGuaranteed>>::{closure#1} as core[8c2debda200eca11]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  26:     0x7f1b777b2c59 - <std[ec5684ef7c50a2a5]::sys::unix::thread::Thread>::new::thread_start
  27:     0x7f1b6fcf0184 - start_thread
                               at /build/eglibc-xkFqqE/eglibc-2.19/nptl/pthread_create.c:312
  28:     0x7f1b7742803d - __clone
                               at /build/eglibc-xkFqqE/eglibc-2.19/misc/../sysdeps/unix/sysv/linux/x86_64/clone.S:111

error: the compiler unexpectedly panicked. this is a bug.

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 attach the file at `/buildbot/src/android/master/rustc-ice-2024-03-21T03_47_08-213.txt` to your bug report

note: compiler flags: -C codegen-units=1 -C debuginfo=2 -C opt-level=3 -C relocation-model=pic -C overflow-checks=on -C symbol-mangling-version=v0 -C panic=abort -Z link-native-libraries=no -Z panic_abort_tests -C linker-plugin-lto -Z split-lto-unit -Z force-unstable-if-unmarked -Z sanitizer=cfi -Z sanitizer-cfi-normalize-integers --crate-type rlib --crate-type rlib

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

query stack during panic:
end of query stack
make/rust-toplevel.mk:32: /buildbot/src/android/master/out/build-generic-arm32/kernellib/crate-dependency-ordering: No such file or directory
make[2]: *** [make/module.mk:353: /buildbot/src/android/master/out/build-generic-arm32/kernellib/libcore.rlib] Error 101
make[1]: *** [/buildbot/src/android/master/external/lk/engine.mk:29: make-make] Error 2
make: *** [/buildbot/src/android/master/external/lk/makefile:34: _top] Error 2

I locally computed the command it was running, and it's:
/usr/local/google/home/mmaurer/android/trusty/prebuilts/rust/linux-x86/1.76.0/bin/rustc -C codegen-units=1 -C debuginfo=2 -C opt-level=3 -C relocation-model=pic -C overflow-checks=on -C symbol-mangling-version=v0 -C panic=abort -Z link-native-libraries=no -Z panic_abort_tests --deny warnings -L dependency=/usr/local/google/home/mmaurer/android/trusty/build-root/build-generic-arm32/host_lib -L dependency=/usr/local/google/home/mmaurer/android/trusty/build-root/build-generic-arm32/kernellib -C linker-plugin-lto -Zsplit-lto-unit --target=/usr/local/google/home/mmaurer/android/trusty/external/lk/arch/arm/armv7-unknown-trusty-kernel.json -Z force-unstable-if-unmarked -Zsanitizer=cfi -Zsanitizer-cfi-normalize-integers --crate-name=core -C metadata=core --edition 2021 --emit link --crate-type=rlib --crate-type=rlib /usr/local/google/home/mmaurer/android/trusty/prebuilts/rust/linux-x86/1.76.0/bin/../src/stdlibs/library/core/src/lib.rs --emit "dep-info=/usr/local/google/home/mmaurer/android/trusty/build-root/build-generic-arm32/kernellib/libcore.rlib.d" -o /usr/local/google/home/mmaurer/android/trusty/build-root/build-generic-arm32/kernellib/libcore.rlib

Since the input file is core/src/lib.rs, this shouldn't technically require more information than what I've gathered, but I'll try to minimize this soon if nobody else immediately knows the answer.

@maurer maurer 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 Mar 21, 2024
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Mar 21, 2024
@maurer
Copy link
Contributor Author

maurer commented Mar 21, 2024

Attached the ICE txt in case someone gets to it before I do.
rustc-ice-2024-03-21T23_02_40-2944649.txt

@compiler-errors
Copy link
Member

We shouldn't be unwrapping the array size as a u64, but actually respect the usize size of machine.

@compiler-errors compiler-errors added A-sanitizers Area: Sanitizers for correctness and code quality and removed needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Mar 21, 2024
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Mar 22, 2024
…inism, r=compiler-errors

Fix Itanium mangling usizes

Arrays, surprisingly, are not sized to u64 on all platforms.

Fixes rust-lang#122851.

r? `@compiler-errors`

cc `@maurer`
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Mar 22, 2024
…inism, r=compiler-errors

Fix Itanium mangling usizes

Arrays, surprisingly, are not sized to u64 on all platforms.

Fixes rust-lang#122851.

r? ``@compiler-errors``

cc ``@maurer``
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Mar 22, 2024
…inism, r=compiler-errors

Fix Itanium mangling usizes

Arrays, surprisingly, are not sized to u64 on all platforms.

Fixes rust-lang#122851.

r? ```@compiler-errors```

cc ```@maurer```
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Mar 22, 2024
Rollup merge of rust-lang#122855 - workingjubilee:mangle-64-bit-chauvinism, r=compiler-errors

Fix Itanium mangling usizes

Arrays, surprisingly, are not sized to u64 on all platforms.

Fixes rust-lang#122851.

r? ```@compiler-errors```

cc ```@maurer```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-sanitizers Area: Sanitizers for correctness and code quality 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.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants