Skip to content

Fix potential UB in file info - #408

Merged
GabrielMajeri merged 1 commit into
rust-osdev:mainfrom
nicholasbishop:bishop-better-info-ptr
Apr 23, 2022
Merged

GabrielMajeri merged 1 commit into
rust-osdev:mainfrom
nicholasbishop:bishop-better-info-ptr

Conversation

@nicholasbishop

Copy link
Copy Markdown
Member

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
Copy Markdown
Member 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.

2 participants