-
Notifications
You must be signed in to change notification settings - Fork 281
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
Uninstalling earlier shim protocol does not actually do anything, fails silently #221
Comments
This basically means commit c8ca1c5 by @cyphermox never did anything, but this is confusing :/ |
I have an idea for how to make this a lot better, but it requires a couple of other features first: SHIM_VOLATILE_KEYS_PROTOCOL:
SHIM_IMAGE_PROTOCOL:
the handle on the LoadedImage object
|
While analyzing https://bugs.launchpad.net/bugs/1865515 I found out that the earlier shim protocol uninstalling actually does nothing.
In
src/shim.c
insideinstall_shim_protocols()
we attempt to uninstall the old shim by callinguninstall_shim_protocols()
. This does nothing, and hence loading two shims and then a kernel fails.What happens is that when we enter
uninstall_shim_protocols()
we haveshim_lock_handle == NULL
, which is an invalid argument (and henceUninstallProtocolInterface()
fails with invalid argument error). It'sNULL
because we have not yet installed our new shim protocol, or made any attempt to get the old handle.Furthermore, the protocol interface we try to remove in there is
shim_lock_interface
, but that is our new interface - the old one we located was only stored in a local variable inshim_lock
.How can we fix this?
One solution I found involves asking the old shim to uninstall itself, by extending its protocol (or realistically, adding a new one, for ABI reasons I suppose). The old shim knows its handle and interface, and hence
uninstall_shim_protocols
there just works.Another attempt could be made by locating the old shim's handle with
LibLocateHandle()
orLocateHandle()
orLocateHandleBuffer()
similar to how we locate the protocol usingLibLocateProtocol()
, and then uninstall that.We should also add error checking to the uninstall code, so we actually see errors there as well.
The text was updated successfully, but these errors were encountered: