mirror of
https://github.com/systemd/systemd.git
synced 2025-02-28 05:57:33 +03:00
efi: set EFIVAR to stop Shim from uninstalling its protocol
We'll use it from the stub to validate files. Requires Shim 5.18. By default, Shim uninstalls its protocol when calling StartImage(), so when loading systemd-boot via shim and then loading an UKI, the UKI's sd-stub will no longer be able to use the shim verification protocol by default.
This commit is contained in:
parent
e715d82de6
commit
e1f1b5fc62
@ -2641,6 +2641,10 @@ static EFI_STATUS run(EFI_HANDLE image) {
|
|||||||
|
|
||||||
init_usec = time_usec();
|
init_usec = time_usec();
|
||||||
|
|
||||||
|
/* Ask Shim to leave its protocol around, so that the stub can use it to validate PEs.
|
||||||
|
* By default, Shim uninstalls its protocol when calling StartImage(). */
|
||||||
|
shim_retain_protocol();
|
||||||
|
|
||||||
err = BS->OpenProtocol(
|
err = BS->OpenProtocol(
|
||||||
image,
|
image,
|
||||||
MAKE_GUID_PTR(EFI_LOADED_IMAGE_PROTOCOL),
|
MAKE_GUID_PTR(EFI_LOADED_IMAGE_PROTOCOL),
|
||||||
|
@ -97,3 +97,12 @@ EFI_STATUS shim_load_image(EFI_HANDLE parent, const EFI_DEVICE_PATH *device_path
|
|||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void shim_retain_protocol(void) {
|
||||||
|
uint8_t value = 1;
|
||||||
|
|
||||||
|
/* Ask Shim to avoid uninstalling its security protocol, so that we can use it from sd-stub to
|
||||||
|
* validate PE addons. By default, Shim uninstalls its protocol when calling StartImage().
|
||||||
|
* Requires Shim 15.8. */
|
||||||
|
(void) efivar_set_raw(MAKE_GUID_PTR(SHIM_LOCK), u"ShimRetainProtocol", &value, sizeof(value), 0);
|
||||||
|
}
|
||||||
|
@ -13,3 +13,4 @@
|
|||||||
|
|
||||||
bool shim_loaded(void);
|
bool shim_loaded(void);
|
||||||
EFI_STATUS shim_load_image(EFI_HANDLE parent, const EFI_DEVICE_PATH *device_path, EFI_HANDLE *ret_image);
|
EFI_STATUS shim_load_image(EFI_HANDLE parent, const EFI_DEVICE_PATH *device_path, EFI_HANDLE *ret_image);
|
||||||
|
void shim_retain_protocol(void);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user