Commit Graph
4 Commits
Author SHA1 Message Date
Gerald Elder-Vass 5d492ce33d efi: Protect against unnecessary image unloading
Commit 59a1d6d3ea introduced Shim's LoadImage protocol and unloads the
image after loading it (for verification purposes) regardless of the
returned status. The protocol API implies this is the correct behaviour
but we should add a check to protect against the unlikely case this
frees any memory in use.

Signed-off-by: Gerald Elder-Vass <gerald.elder-vass@cloud.com>
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
Release-Acked-By: Oleksii Kurochko <oleksii.kurochko@gmail.com>
2025-10-14 18:31:43 +01:00
Gerald Elder-Vass 38a5e0d031 efi: Limit Shim's Verify success to EFI_SUCCESS
Commit 59a1d6d3ea replaced the Verify status check with
!EFI_ERROR(...), this changed the behaviour to consider any warnings
(EFI_WARN_) to be considered a successful verification.

This commit reverts that behaviour change.

Fixes: 59a1d6d3ea ("efi: Support using Shim's LoadImage protocol")
Reported-by: Jan Beulich <jbeulich@suse.com>
Signed-off-by: Gerald Elder-Vass <gerald.elder-vass@cloud.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
2025-09-25 16:02:14 +02:00
Gerald Elder-Vass 85d7fe2e14 efi: Fix line length in init_secure_boot_mode
Commit cb41b4ce14 introduced init_secure_boot_mode but one line was
not wrapped appropriately.

Signed-off-by: Gerald Elder-Vass <gerald.elder-vass@cloud.com>
Reviewed-by: Alejandro Vallejo <alejandro.garciavallejo@amd.com>
Acked-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
2025-09-25 16:01:36 +02:00
Gerald Elder-Vass 59a1d6d3ea efi: Support using Shim's LoadImage protocol
The existing Verify functionality of the Shim lock protocol is
deprecated and will be removed, the alternative it to use the LoadImage
interface to perform the verification.

When the loading is successful we won't be using the newly loaded image
(as of yet) so we must then immediately unload the image to clean up.

If the LoadImage protocol isn't available then fall back to the Shim
Lock (Verify) interface.

Log when the kernel is not verified and fail if this occurs
when secure boot mode is enabled.

Signed-off-by: Gerald Elder-Vass <gerald.elder-vass@cloud.com>
Acked-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
2025-09-05 23:45:38 +01:00