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

32bit debug builds panic (misaligned pointer dereference:) #1001

Closed
Trolldemorted opened this issue Jul 2, 2023 · 9 comments
Closed

32bit debug builds panic (misaligned pointer dereference:) #1001

Trolldemorted opened this issue Jul 2, 2023 · 9 comments

Comments

@Trolldemorted
Copy link

Trolldemorted commented Jul 2, 2023

Describe the bug

  • sysinfo 0.29.3
  • W10 (64bit) Pro 21H2 (Build 19044.3086)

To Reproduce

fn main() {
    let s = System::new_all();
}

cargo run --target i686-pc-windows-msvc

Callstack

thread 'main' panicked at 'misaligned pointer dereference: address must be a multiple of 0x8 but is 0x2ed2844', C:\Users\Benni\.cargo\registry\src\index.crates.io-6f17d22bba15001f\sysinfo-0.29.3\src\network_helper_win.rs:43:28
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
thread 'main' panicked at 'panic in a function that cannot unwind', library\core\src\panicking.rs:126:5
stack backtrace:
   0:   0x7fef4a - core::fmt::write
                       at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library\core\src\fmt\mod.rs:1254
   1:   0x7eb1e1 - std::io::Write::write_fmt<std::sys::windows::stdio::Stderr>
                       at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library\std\src\io\mod.rs:1698
   2:   0x7ee6d5 - std::sys_common::backtrace::_print
                       at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library\std\src\sys_common\backtrace.rs:47
   3:   0x7ee6d5 - std::sys_common::backtrace::print
                       at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library\std\src\sys_common\backtrace.rs:34
   4:   0x7f0497 - std::panicking::default_hook::closure$1
                       at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library\std\src\panicking.rs:269
   5:   0x7f00f4 - std::panicking::default_hook
                       at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library\std\src\panicking.rs:288
   6:   0x7f0c22 - std::panicking::rust_panic_with_hook
                       at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library\std\src\panicking.rs:691
   7:   0x7f098d - std::panicking::begin_panic_handler::closure$0
                       at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library\std\src\panicking.rs:580
   8:   0x7ef205 - std::sys_common::backtrace::__rust_end_short_backtrace<std::panicking::begin_panic_handler::closure_env$0,never$>
                       at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library\std\src\sys_common\backtrace.rs:150
   9:   0x7f06b4 - std::panicking::begin_panic_handler
                       at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library\std\src\panicking.rs:578
  10:   0x80473c - core::panicking::panic_nounwind_fmt
                       at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library\core\src\panicking.rs:96
  11:   0x8047f7 - core::panicking::panic_nounwind
                       at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library\core\src\panicking.rs:126
  12:   0x80492c - core::panicking::panic_cannot_unwind
                       at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library\core\src\panicking.rs:188
  13:   0x75b0fd - sysinfo::network::refresh_networks_addresses
                       at C:\Users\Benni\.cargo\registry\src\index.crates.io-6f17d22bba15001f\sysinfo-0.29.3\src\network.rs:11
  14:   0x75b0fd - sysinfo::network::refresh_networks_addresses
                       at C:\Users\Benni\.cargo\registry\src\index.crates.io-6f17d22bba15001f\sysinfo-0.29.3\src\network.rs:11
  15:   0x77fbb1 - sysinfo::windows::network::impl$1::refresh_networks_list
                       at C:\Users\Benni\.cargo\registry\src\index.crates.io-6f17d22bba15001f\sysinfo-0.29.3\src\windows\network.rs:153
  16:   0x742735 - sysinfo::traits::SystemExt::refresh_networks_list<sysinfo::windows::system::System>
                       at C:\Users\Benni\.cargo\registry\src\index.crates.io-6f17d22bba15001f\sysinfo-0.29.3\src\traits.rs:968
  17:   0x742b15 - sysinfo::windows::system::impl$3::new_with_specifics
                       at C:\Users\Benni\.cargo\registry\src\index.crates.io-6f17d22bba15001f\sysinfo-0.29.3\src\windows\system.rs:113
  18:   0x73120f - sysinfo::traits::SystemExt::new_all<sysinfo::windows::system::System>
                       at C:\Users\Benni\.cargo\registry\src\index.crates.io-6f17d22bba15001f\sysinfo-0.29.3\src\traits.rs:643
thread caused non-unwinding panic. aborting.
@GuillaumeGomez
Copy link
Owner

Just to be sure I'm not missing something: you build a 64 bits executable and run it on a 32 bits target?

@Trolldemorted
Copy link
Author

sorry, I put the wrong command into this issue - I am building a 32bit executable (i686-pc-windows-msvc) and running it on a 64bit machine. So --target x86_64-pc-windows-msvc works but --target i686-pc-windows-msvc does not, I have amended my post.

@GuillaumeGomez
Copy link
Owner

I'm sorry but I can't work on a fix here since I don't have the tools to check that. If you want it to be fixed, you'll need to fix it yourself. A patch is very welcome of course.

@Trolldemorted
Copy link
Author

Unfortunately I don't even know where the error message is from - is this a rustc "feature"?

@GuillaumeGomez
Copy link
Owner

The error is emitted by the compiler because apparently, a pointer address is apparently is invalid, meaning it cannot be dereferenced. That's what I understood from what you pasted.

@Trolldemorted
Copy link
Author

Well something complains about the alignment of the address, but why would it demand that the pointer is 8 byte aligned? Especially on x86, which should be rather forgiving when it comes to alignment.

@Trolldemorted
Copy link
Author

I think we are hitting rust-lang/rust#112480

@GuillaumeGomez
Copy link
Owner

Should be fixed by rust-lang/rust#112684. Closing then since it's not a sysinfo bug.

@Trolldemorted
Copy link
Author

Fingers crossed for rustc 1.71 then, I guess

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants