Skip to content

uefi: Fix lifetimes in device_path TryFrom<&[u8]> impls #1282

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

Merged
merged 1 commit into from
Aug 2, 2024

Conversation

nicholasbishop
Copy link
Member

The missing lifetime means that the &[u8] buffer could be freed while the &DevicePath still exists, which is UB.

Bug: #1281

Checklist

  • Sensible git history (for example, squash "typo" or "fix" commits). See the Rewriting History guide for help.
  • Update the changelog (if necessary)

The missing lifetime means that the &[u8] buffer could be freed while the
&DevicePath still exists, which is UB.
@phip1611
Copy link
Member

phip1611 commented Aug 1, 2024

Shouldn't miri catch this? Ah, I guess there are no unit tests for this functionality?

@nicholasbishop
Copy link
Member Author

nicholasbishop commented Aug 1, 2024

There are some tests. But since miri is a runtime checker, not a static analyzer, it would only catch it if you modified the test to drop the source buffer early. (And we don't want to modify the tests to do that, because then the code wouldn't compile with the fix.)

@phip1611 phip1611 added this pull request to the merge queue Aug 2, 2024
Merged via the queue into rust-osdev:main with commit a457110 Aug 2, 2024
13 checks passed
@nicholasbishop nicholasbishop deleted the bishop-fix-dp-lifetimes branch August 2, 2024 15:15
nicholasbishop added a commit to nicholasbishop/uefi-rs that referenced this pull request Aug 2, 2024
This release contains a cherry-pick of
rust-osdev#1282.
@nicholasbishop nicholasbishop mentioned this pull request Aug 2, 2024
2 tasks
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