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

uefi: Improve support for null protocol interfaces #861

Merged
merged 2 commits into from Jun 19, 2023

Conversation

nicholasbishop
Copy link
Contributor

Modify ScopedProtocol to check if the interface pointer is null. If it is, then Deref and DerefMut will now panic. They are also now marked #[track_caller] so that the panic location points to the caller.

Also added get and get_mut methods to get potentially-null interface data without panicking.


This is a minimal fix for the issue described in #859. I'm not sure if it's the best long-term fix, but I'm wary of doing anything too invasive until we have better Miri coverage of protocols.

Checklist

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

@nicholasbishop nicholasbishop force-pushed the bishop-fix-dp-null-2 branch 2 times, most recently from bef210b to d8145f4 Compare June 17, 2023 19:32
uefi/src/table/boot.rs Outdated Show resolved Hide resolved
Copy link
Contributor

@phip1611 phip1611 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is the best solution at the moment. Please have a look at my open remarks before merging

nicholasbishop and others added 2 commits June 19, 2023 10:56
Modify `ScopedProtocol` to check if the interface pointer is null. If it is,
then `Deref` and `DerefMut` will now panic. They are also now marked
`#[track_caller]` so that the panic location points to the caller.

Also added `get` and `get_mut` methods to get potentially-null interface data
without panicking.
@nicholasbishop nicholasbishop merged commit 2988b71 into rust-osdev:main Jun 19, 2023
12 checks passed
@nicholasbishop nicholasbishop deleted the bishop-fix-dp-null-2 branch June 19, 2023 15:02
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