-
Notifications
You must be signed in to change notification settings - Fork 36
Fix signatures of most EFI functions to be unsafe #90
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
base: main
Are you sure you want to change the base?
Conversation
|
Thanks for the PR! A few comments:
I am generally not opposed to this. Major users are Patina (@makubacki @joschock) and rust::std (@Ayush1325), maybe they want to chime in? |
|
Btw., did you auto-generate this? If yes, can you append the script? This is usually easier to review and audit, then the raw diff. |
|
I first really hit upon this issue when using Admittedly, that issue only applies to callbacks; and one could argue that because "it is known" both that the UEFI platform will uphold the safety preconditions and that the callback is not called elsewhere, the implementor can author the function without it having an Moreover, whilst I agree that accessing the UEFI function-pointers does require some original use of I'm not too sure that I understand your second point (that "you cannot implement a safe version of such a function")? An As regards auto-generation: no, I'm afraid I just used a vim macro as I manually reviewed each occurrence of
|
|
@dvdhrm, thank you for reaching out to us. While this will result in a lot of code churn, we've discussed this within the Patina project and we're in favor of this change. We believe this better makes use of unsafe to help consistently structure the codebase alongside safe wrappers and other code. |
|
@dvdhrm Thanks for reaching out. I am in favor of the change as well. |
Surely it's only safe to call the vast majority of EFI functions if the caller upholds certain requirements: for example, most EFI functions have one or more parameters of pointer type—and it's surely UB if those pointers aren't valid?