common/efi: bail if dom0 fails the shim verification step
PATCH 1/2 common/efi: bail if dom0 fails the shim verification step
From: Tamas K Lengyel <[email protected]>
If the shim protocol is located it is expected that the dom0 kernel image will also pass the shim verification.
--- xen/common/efi/boot.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
xen/common/efi/boot.c +7 -3
@@ -1226,9 +1226,13 @@ efi_start(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable) efi_bs->FreePool (name.w);if ( !EFI_ERROR (efi_bs->LocateProtocol (&shim_lock_guid,NULL , - (void **)&shim_lock)) && - (status = shim_lock->Verify (kernel.ptr, kernel.size)) !=EFI_SUCCESS ) -PrintErrMesg (L"Dom0 kernel image could not be verified" , status); + (void **)&shim_lock))) + { +if ( shim_lock->Verify (kernel.ptr, kernel.size) !=EFI_SUCCESS ) +blexit (L"Dom0 kernel image could not be verified by the shim." ); + +PrintStr (L"Dom0 kernel image was verified by the shim.\r\n" ); + } name.s =get_value (&cfg, section.s,"ramdisk" );if ( name.s )
Signature · 7 lines
2.11.0 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
PATCH 2/2 common/efi: give people some time to read messages when debugging
From: Tamas K Lengyel <[email protected]>
The EFI messages flash by so fast that it is impossible to catch them without a serial debugger attached. Sometimes though we don't have that available so having some time to read the messages off the screen is valuable.
--- xen/common/efi/boot.c | 9 +++++++++ 1 file changed, 9 insertions(+)
xen/common/efi/boot.c +9 -0
@@ -321,6 +321,11 @@ static void __init noreturn blexit(const CHAR16 *str)PrintStr ((CHAR16 *)str);PrintStr (newline); +#ifndef NDEBUG +if ( efi_bs ) + efi_bs->Stall (5000000 ); +#endif +if ( !efi_bs )efi_arch_halt ();
@@ -1300,6 +1305,10 @@ efi_start(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable)if ( gop )efi_set_gop_mode (gop, gop_mode); +#ifndef NDEBUG + efi_bs->Stall (5000000 ); +#endif +efi_exit_boot (ImageHandle, SystemTable);efi_arch_post_exit_boot ();
Signature · 7 lines
2.11.0 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Jan Beulich
NAKRe: [PATCH 2/2] common/efi: give people some time to read messages when debugging
Quoted 8 lines
Quoted 1 line
Quoted 1 line · On 20.09.17 at 22:57, <[email protected]> wrote:
From: Tamas K Lengyel <[email protected]>
The EFI messages flash by so fast that it is impossible to catch them without a serial debugger attached. Sometimes though we don't have that available so having some time to read the messages off the screen is valuable.
Signed-off-by Tamas K Lengyel <[email protected]>
NAK: I don't want any unnecessary stalls, including on debug builds. If you want such stalls for yourself, patch then in as needed.
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Quoted 7 lines
Quoted 1 line
Quoted 1 line · On 20.09.17 at 22:57, <[email protected]> wrote:
xen/common/efi/boot.c +0
-0@@ -1226,9 +1226,13 @@ efi_start(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable) efi_bs->FreePool (name.w); if ( !EFI_ERROR(efi_bs->LocateProtocol(&shim_lock_guid, NULL,
xen/common/efi/boot.c efi_start(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable) · line 1235
Quoted 10 lines
xen/common/efi/boot.c +7
-3- (void **)&shim_lock)) && - (status = shim_lock->Verify(kernel.ptr, kernel.size)) != EFI_SUCCESS ) -PrintErrMesg (L"Dom0 kernel image could not be verified" , status); + (void **)&shim_lock))) + { +if ( shim_lock->Verify (kernel.ptr, kernel.size) !=EFI_SUCCESS ) +blexit (L"Dom0 kernel image could not be verified by the shim." ); + +PrintStr (L"Dom0 kernel image was verified by the shim.\r\n" ); + }
So what is the actual behavioral change you're trying to accomplish? PrintErrMesg() already calls blexit(), and I hope sure the purpose of the change is neither to open code anything, nor to drop the printing of the error code. And I don't see any value in the success case message - it'll be visible for a very brief moment at best anyway.
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Quoted 6 lines · Jan Beulich
Quoted 6 lines
Quoted 1 line
Quoted 1 line · On 20.09.17 at 22:57, <[email protected]> wrote:
xen/common/efi/boot.c +0
-0@@ -1226,9 +1226,13 @@ efi_start(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable) efi_bs->FreePool (name.w);
Quoted 14 lines
xen/common/efi/boot.c efi_start(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable) · line 1235
Quoted 11 lines
xen/common/efi/boot.c +7
-3if ( !EFI_ERROR (efi_bs->LocateProtocol (&shim_lock_guid,NULL , - (void **)&shim_lock)) && - (status = shim_lock->Verify (kernel.ptr, kernel.size)) !=EFI_SUCCESS ) -PrintErrMesg (L"Dom0 kernel image could not be verified" , status); + (void **)&shim_lock))) + { +if ( shim_lock->Verify (kernel.ptr, kernel.size) !=EFI_SUCCESS ) +blexit (L"Dom0 kernel image could not be verified by the shim." ); + +PrintStr (L"Dom0 kernel image was verified by the shim.\r\n" ); + }So what is the actual behavioral change you're trying to accomplish?
PrintErrMesg()already callsblexit(),
Indeed, I've somehow missed that. Sorry for the noise.
Tamas
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel