rust-lang / rust-lang/rustc_codegen_cranelift
Valgrind `segmentation fault` when trying to run binary
Open
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 2.1k
- Forks
- 157
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 3
Description
git clone https://github.com/qarmin/czkawka.git
cd czkawka
git checkout 922502515776437a9add23fdb2c524ec7ab42b6c
cd krokiet
CARGO_PROFILE_DEV_CODEGEN_BACKEND=cranelift cargo +nightly build -Zcodegen-backend # I used precompiled binaries
valgrind ../target/debug/krokiet
valgrind 3.21.0 - from snap
System:
Host: rafal-komputer
Kernel: 6.5.0-10-generic arch: x86_64
bits: 64 Desktop: GNOME v: 45.0
Distro: Ubuntu 23.10 (Mantic Minotaur)
CPU:
Info: quad core model: Intel Core i7-4770
bits: 64 type: MT MCP cache: L2: 1024 KiB
Speed (MHz): avg: 3764
when using valgrind with default cargo version I not have any problem, but here with cranefild I have this crash
valgrind ../target/debug/krokiet
==250441== Memcheck, a memory error detector
==250441== Copyright (C) 2002-2022, and GNU GPL'd, by Julian Seward et al.
==250441== Using Valgrind-3.21.0 and LibVEX; rerun with -h for copyright info
==250441== Command: ../target/debug/krokiet
==250441==
==250441== Invalid write of size 4
==250441== at 0x21D4D44: tz::parse::tz_file::parse_tz_file (tz_file.rs:211)
==250441== by 0x21ADE42: tz::timezone::TimeZone::from_posix_tz (mod.rs:554)
==250441== by 0x21AC4C1: tz::timezone::TimeZone::local (mod.rs:523)
==250441== by 0x215EFA9: handsome_logger::config::ConfigBuilder::get_local_time_offset (config.rs:336)
==250441== by 0x215F2A7: <handsome_logger::config::Config as core::default::Default>::default (config.rs:364)
==250441== by 0x215E989: handsome_logger::config::ConfigBuilder::new (config.rs:141)
==250441== by 0x215F256: <handsome_logger::config::ConfigBuilder as core::default::Default>::default (config.rs:358)
==250441== by 0x16F9CCF: czkawka_core::common::setup_logger (common.rs:56)
==250441== by 0x1225EC1: krokiet::main (main.rs:41)
==250441== by 0xB2D768: core::ops::function::FnOnce::call_once (function.rs:250)
==250441== by 0xC62E88: std::sys_common::backtrace::__rust_begin_short_backtrace (backtrace.rs:154)
==250441== by 0xFD7FD2: std::rt::lang_start::{{closure}} (rt.rs:167)
==250441== Address 0x1ffeffc260 is on thread 1's stack
==250441== 4096 bytes below stack pointer
==250441==
==250441== Invalid write of size 4
==250441== at 0x21D4D4B: tz::parse::tz_file::parse_tz_file (tz_file.rs:211)
==250441== by 0x21ADE42: tz::timezone::TimeZone::from_posix_tz (mod.rs:554)
==250441== by 0x21AC4C1: tz::timezone::TimeZone::local (mod.rs:523)
==250441== by 0x215EFA9: handsome_logger::config::ConfigBuilder::get_local_time_offset (config.rs:336)
==250441== by 0x215F2A7: <handsome_logger::config::Config as core::default::Default>::default (config.rs:364)
==250441== by 0x215E989: handsome_logger::config::ConfigBuilder::new (config.rs:141)
==250441== by 0x215F256: <handsome_logger::config::ConfigBuilder as core::default::Default>::default (config.rs:358)
==250441== by 0x16F9CCF: czkawka_core::common::setup_logger (common.rs:56)
==250441== by 0x1225EC1: krokiet::main (main.rs:41)
==250441== by 0xB2D768: core::ops::function::FnOnce::call_once (function.rs:250)
==250441== by 0xC62E88: std::sys_common::backtrace::__rust_begin_short_backtrace (backtrace.rs:154)
==250441== by 0xFD7FD2: std::rt::lang_start::{{closure}} (rt.rs:167)
==250441== Address 0x1ffeffb260 is on thread 1's stack
==250441== 8192 bytes below stack pointer
==250441==
==250441== Invalid write of size 4
==250441== at 0x21D2A94: tz::parse::tz_file::DataBlock::parse (tz_file.rs:150)
==250441== by 0x21D5702: tz::parse::tz_file::parse_tz_file (tz_file.rs:234)
==250441== by 0x21ADE42: tz::timezone::TimeZone::from_posix_tz (mod.rs:554)
==250441== by 0x21AC4C1: tz::timezone::TimeZone::local (mod.rs:523)
==250441== by 0x215EFA9: handsome_logger::config::ConfigBuilder::get_local_time_offset (config.rs:336)
==250441== by 0x215F2A7: <handsome_logger::config::Config as core::default::Default>::default (config.rs:364)
==250441== by 0x215E989: handsome_logger::config::ConfigBuilder::new (config.rs:141)
==250441== by 0x215F256: <handsome_logger::config::ConfigBuilder as core::default::Default>::default (config.rs:358)
==250441== by 0x16F9CCF: czkawka_core::common::setup_logger (common.rs:56)
==250441== by 0x1225EC1: krokiet::main (main.rs:41)
==250441== by 0xB2D768: core::ops::function::FnOnce::call_once (function.rs:250)
==250441== by 0xC62E88: std::sys_common::backtrace::__rust_begin_short_backtrace (backtrace.rs:154)
==250441== Address 0x1ffeffb040 is on thread 1's stack
==250441== 4096 bytes below stack pointer
==250441==
==250441== Invalid write of size 4
==250441== at 0x21D2A9B: tz::parse::tz_file::DataBlock::parse (tz_file.rs:150)
==250441== by 0x21D5702: tz::parse::tz_file::parse_tz_file (tz_file.rs:234)
==250441== by 0x21ADE42: tz::timezone::TimeZone::from_posix_tz (mod.rs:554)
==250441== by 0x21AC4C1: tz::timezone::TimeZone::local (mod.rs:523)
==250441== by 0x215EFA9: handsome_logger::config::ConfigBuilder::get_local_time_offset (config.rs:336)
==250441== by 0x215F2A7: <handsome_logger::config::Config as core::default::Default>::default (config.rs:364)
==250441== by 0x215E989: handsome_logger::config::ConfigBuilder::new (config.rs:141)
==250441== by 0x215F256: <handsome_logger::config::ConfigBuilder as core::default::Default>::default (config.rs:358)
==250441== by 0x16F9CCF: czkawka_core::common::setup_logger (common.rs:56)
==250441== by 0x1225EC1: krokiet::main (main.rs:41)
==250441== by 0xB2D768: core::ops::function::FnOnce::call_once (function.rs:250)
==250441== by 0xC62E88: std::sys_common::backtrace::__rust_begin_short_backtrace (backtrace.rs:154)
==250441== Address 0x1ffeffa040 is not stack'd, malloc'd or (recently) free'd
==250441==
==250441==
==250441== Process terminating with default action of signal 11 (SIGSEGV)
==250441== Access not within mapped region at address 0x1FFEFFA040
==250441== at 0x21D2A9B: tz::parse::tz_file::DataBlock::parse (tz_file.rs:150)
==250441== by 0x21D5702: tz::parse::tz_file::parse_tz_file (tz_file.rs:234)
==250441== by 0x21ADE42: tz::timezone::TimeZone::from_posix_tz (mod.rs:554)
==250441== by 0x21AC4C1: tz::timezone::TimeZone::local (mod.rs:523)
==250441== by 0x215EFA9: handsome_logger::config::ConfigBuilder::get_local_time_offset (config.rs:336)
==250441== by 0x215F2A7: <handsome_logger::config::Config as core::default::Default>::default (config.rs:364)
==250441== by 0x215E989: handsome_logger::config::ConfigBuilder::new (config.rs:141)
==250441== by 0x215F256: <handsome_logger::config::ConfigBuilder as core::default::Default>::default (config.rs:358)
==250441== by 0x16F9CCF: czkawka_core::common::setup_logger (common.rs:56)
==250441== by 0x1225EC1: krokiet::main (main.rs:41)
==250441== by 0xB2D768: core::ops::function::FnOnce::call_once (function.rs:250)
==250441== by 0xC62E88: std::sys_common::backtrace::__rust_begin_short_backtrace (backtrace.rs:154)
==250441== If you believe this happened as a result of a stack
==250441== overflow in your program's main thread (unlikely but
==250441== possible), you can try to increase the size of the
==250441== main thread stack using the --main-stacksize= flag.
==250441== The main thread stack size used in this run was 8388608.
==250441==
==250441== HEAP SUMMARY:
==250441== in use at exit: 18,514 bytes in 43 blocks
==250441== total heap usage: 54 allocs, 11 frees, 20,670 bytes allocated
==250441==
==250441== LEAK SUMMARY:
==250441== definitely lost: 0 bytes in 0 blocks
==250441== indirectly lost: 0 bytes in 0 blocks
==250441== possibly lost: 0 bytes in 0 blocks
==250441== still reachable: 18,514 bytes in 43 blocks
==250441== suppressed: 0 bytes in 0 blocks
==250441== Rerun with --leak-check=full to see details of leaked memory
==250441==
==250441== For lists of detected and suppressed errors, rerun with: -s
==250441== ERROR SUMMARY: 5 errors from 4 contexts (suppressed: 0 from 0)
Segmentation fault (core dumped)
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the reported checkout and compare the default Cargo build with the Cranelift build under Valgrind. Start at krokiet/main.rs and czkawka_core/common.rs, then follow the reported calls into tz_file.rs and the timezone parser. Done means determining why the Cranelift binary reaches the invalid writes and confirming the crash no longer occurs.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100