-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Fix undefined-behavior on MacOSX structs in stdbuilds #972
Conversation
(rust_highfive has picked a reviewer for you, use r? to override) |
@alexcrichton this would require updating the stable Rust version used in CI. Is there a policy about that? |
What would it require updating to? |
I think |
@alexcrichton we would need to update from 1.0.0 to 1.13.0 meaning newer libc versions wouldn't compile with older compilers anymore. This is pretty much a backwards incompatible change, might need to change libc from 0.2 to 0.3 :/ |
An alternative could be tuning repr(packed) syntax to something that is compatible with 1.0, maybe instead of |
@alexcrichton I can also put these two structs into two different files, and conditionally include one or the other depending on the |
Nah Rust 1.13.0 is ancient at this point (aka pre-stable-Serde) so I doubt anything before that is still in use. If you'd like to raise the minimum version in CI to 1.13.0 I think we'll be good to go! |
@alexcrichton done ! |
@bors: r+ |
📌 Commit 77837a0 has been approved by |
Fix undefined-behavior on MacOSX structs in stdbuilds Some MacOSX structs have an incorrect layout that results in undefined behavior. This is because on `x86_64` the MacOSX kernel headers define these using `#pragma pack 4`. This PR fixes their layout using `repr(packed(4))` . Since it is only available on nightly, it is only enabled for stdbuilds .
☀️ Test successful - status-appveyor, status-travis |
Some MacOSX structs have an incorrect layout that results in undefined behavior. This is because on
x86_64
the MacOSX kernel headers define these using#pragma pack 4
.This PR fixes their layout using
repr(packed(4))
. Since it is only available on nightly, it is only enabled for stdbuilds .