-
Notifications
You must be signed in to change notification settings - Fork 105
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
Defend against padding instability #1648
Comments
jswrenn
added
the
blocking-next-release
This issue should be resolved before we release on crates.io
label
Sep 13, 2024
joshlf
added a commit
that referenced
this issue
Sep 15, 2024
Document that writes to padding bytes are not preserved when an object is moved or copied. Makes progress on #1648
joshlf
added a commit
that referenced
this issue
Sep 15, 2024
Document that writes to padding bytes are not preserved when an object is moved or copied. Makes progress on #1648
joshlf
added a commit
that referenced
this issue
Sep 15, 2024
Document that writes to padding bytes are not preserved when an object is moved or copied. Makes progress on #1648
union PaddingStable<T> {
a: core::mem::ManuallyDrop<T>,
b: [u8; core::mem::size_of::<u8>()]
} The last |
Yeah, that's a typo. Unfortunately, using |
joshlf
added a commit
that referenced
this issue
Sep 16, 2024
Document that writes to padding bytes are not preserved when an object is moved or copied. Makes progress on #1648
joshlf
added
blocking-next-release-publicization
and removed
blocking-next-release
This issue should be resolved before we release on crates.io
labels
Sep 16, 2024
github-merge-queue bot
pushed a commit
that referenced
this issue
Sep 16, 2024
Document that writes to padding bytes are not preserved when an object is moved or copied. Makes progress on #1648
If we need to add a utility type, we can do that when the need arises. For now, I'll consider this closed by #1660. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In light of rust-lang/rust#129778, we should do more to defend against misconceptions about the durability of padding bytes across moves. For example,
FromZeros::new_zeroed
returns its value by-move, and so padding bytes withinSelf
may not be0
.We can do some combination of the following. First, we can aggressively sign-post this risk. As a rule, one shouldn't depend on the value of padding bytes.
Second, we can wrap zeroed types in a type that ensures padding remains preserved; e.g.:
The text was updated successfully, but these errors were encountered: