-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Zero the REPARSE_MOUNTPOINT_DATA_BUFFER
header
#107900
Conversation
r? @thomcc (rustbot has picked a reviewer for you, use r? to override) |
Hey! It looks like you've submitted a new PR for the library teams! If this PR contains changes to any Examples of
|
Makes sure the full header is correctly initialized, including reserve parameters.
55226c7
to
59b11e8
Compare
@@ -1393,6 +1393,8 @@ fn symlink_junction_inner(original: &Path, junction: &Path) -> io::Result<()> { | |||
let mut data = Align8([MaybeUninit::<u8>::uninit(); c::MAXIMUM_REPARSE_DATA_BUFFER_SIZE]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might MU::zeroed
be clearer here?
let mut data = Align8([MaybeUninit::<u8>::uninit(); c::MAXIMUM_REPARSE_DATA_BUFFER_SIZE]); | |
let mut data = Align8([MaybeUninit::<u8>::zeroed(); c::MAXIMUM_REPARSE_DATA_BUFFER_SIZE]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, that would zero the entire buffer tho. Which I assume we're trying to avoid because it's large. Otherwise [0_u8, c::MAXIMUM_REPARSE_DATA_BUFFER_SIZE]
would probably be ok because it's a plain old data struct.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It probably doesn't matter too much if it's only used in tests but good point.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's apparently 16KB for the buffer, so we'd be touching 4 pages on x86. That doesn't thrash all of a standard 32KB cache but it's still a lot when compared to simply zeroing a few shorts and longs.
otoh, "just tests".
Oof... @bors r+ |
Btw, as @clubby789 has said, the struct definition for I think I need to stop complaining about how bad this function is and actually do the rewrite already. I'll try some time this weekend. It would also be nice to add as a public API at some point. |
Rollup of 9 pull requests Successful merges: - rust-lang#105019 (Add parentheses properly for borrowing suggestion) - rust-lang#106001 (Stop at the first `NULL` argument when iterating `argv`) - rust-lang#107098 (Suggest function call on pattern type mismatch) - rust-lang#107490 (rustdoc: remove inconsistently-present sidebar tooltips) - rust-lang#107855 (Add a couple random projection tests for new solver) - rust-lang#107857 (Add ui test for implementation on projection) - rust-lang#107878 (Clarify `new_size` for realloc means bytes) - rust-lang#107888 (revert rust-lang#107074, add regression test) - rust-lang#107900 (Zero the `REPARSE_MOUNTPOINT_DATA_BUFFER` header) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Makes sure the full header is correctly initialized.
Fixes #107884