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

Bug: invalid alignment of Win32::System::Diagnostics::Debug::MINIDUMP_CALLBACK_INPUT #1744

Closed
EddieIvan01 opened this issue May 7, 2022 · 3 comments
Labels
bug Something isn't working

Comments

@EddieIvan01
Copy link

Which crate is this about?

windows-sys

Crate version

0.36.0

Summary

The MINIDUMP_CALLBACK_INPUT should be repr(4), now it is only repr(C)

unsafe extern "system" fn minidump_callback(
    callbackparam: *mut ::core::ffi::c_void,
    callbackinput: *const MINIDUMP_CALLBACK_INPUT,
    callbackoutput: *mut MINIDUMP_CALLBACK_OUTPUT,
) -> i32 {
    println!("{:?}", &*(callbackinput as *const [u8; 16]));
    let callbackinput = &*callbackinput;

    println!(
        "PID {}   HANDLE {}   TYP {}",
        callbackinput.ProcessId, callbackinput.ProcessHandle, callbackinput.CallbackType,
    );
}

Output:

[0, 0, 0, 0, 208, 0, 0, 0, 0, 0, 0, 0, 16, 0, 0, 0]
PID 0   HANDLE 68719476736   TYP 5832792
[0, 0, 0, 0, 208, 0, 0, 0, 0, 0, 0, 0, 17, 0, 0, 0]
PID 0   HANDLE 73014444032   TYP 5832792
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 11, 0, 0, 0]
PID 0   HANDLE 47244640256   TYP 0
[228, 4, 0, 0, 208, 0, 0, 0, 0, 0, 0, 0, 15, 0, 0, 0]
PID 1252   HANDLE 64424509440   TYP 0
[228, 4, 0, 0, 208, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0]
PID 1252   HANDLE 25769803776   TYP 277
[228, 4, 0, 0, 208, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0]
PID 1252   HANDLE 12884901888   TYP 15788
[228, 4, 0, 0, 208, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0]
PID 1252   HANDLE 17179869184   TYP 1856110592
[228, 4, 0, 0, 208, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0]
PID 1252   HANDLE 17179869184   TYP 3292594176

It's clear enough

Toolchain version/configuration

unimportant

Reproducible example

No response

Crate manifest

No response

Expected behavior

No response

Actual behavior

No response

Additional comments

No response

@EddieIvan01 EddieIvan01 added the bug Something isn't working label May 7, 2022
@tim-weis
Copy link
Contributor

tim-weis commented May 7, 2022

Looks like an issue with the metadata. Tested with version "23.0.2-preview" the metadata doesn't contain any attributes to encode the lowered packing requirements. minidumpapiset.h is wrapped inside #include <pshpack4.h>/#include <poppack.h> that doesn't find its way into the metadata.

@rylev
Copy link
Contributor

rylev commented May 9, 2022

Looks like this is being tracked in @tim-weis's issue on the metadata repo, so I think this can be closed here since we should handle this correctly when the metadata is fixed. Let me know if there's a reason to keep this open.

@rylev rylev closed this as completed May 9, 2022
@tim-weis
Copy link
Contributor

tim-weis commented May 9, 2022

@rylev While it's true that the issue needs to be addressed on the metadata side of things, and there's nothing actionable here, the issue itself still has repercussions on this repo. Namely, it crosses Kenny's plans voiced over here:

In the short term, I'll probably exclude windows-sys from the regular 3-week release cadence that we've been on to allow the current version (0.36) to establish itself. Notably, windows-sys 0.36 has now been adopted by both tokio and parking_lot.

I don't believe this warrants re-opening this issues. Though, either way, I'm leaving a few more notes here:

  • As currently published, both 0.36.0 and 0.36.1 of the windows and windows-sys crates contain incorrect structure definitions
  • This issue probably only affects clients targeting 64-bit versions of Windows; 32-bit targets aren't affected
  • At this point it is unknown, how many structure definitions are affected (extrapolating this comment it appears to only affect structures that have their structure packing set to 4 across all architectures)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants