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

Fix potential UB in file info #408

Merged

Conversation

nicholasbishop
Copy link
Contributor

When running the file info tests under Miri with
-Zmiri-tag-raw-pointers enabled, new_impl triggered a Stacked
Borrows error. This occurred because after a mutable info pointer to the
raw u8 buffer was created, we went back and created another mutable
pointer within the u8 buffer to copy the name string into.

Fix by creating the name destination pointer from the info pointer
rather than the u8 buffer pointer.

When running the file info tests under Miri with
`-Zmiri-tag-raw-pointers` enabled, `new_impl` triggered a Stacked
Borrows error. This occurred because after a mutable info pointer to the
raw `u8` buffer was created, we went back and created another mutable
pointer within the `u8` buffer to copy the name string into.

Fix by creating the name destination pointer from the info pointer
rather than the `u8` buffer pointer.
@nicholasbishop
Copy link
Contributor Author

(I'd like to enable -Zmiri-tag-raw-pointers as part of the CI eventually, but there are some issues with DevicePath I need to work through first.)

@GabrielMajeri GabrielMajeri merged commit 200c9fa into rust-osdev:main Apr 23, 2022
@nicholasbishop nicholasbishop deleted the bishop-better-info-ptr branch April 24, 2022 17:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants