Blame SOURCES/0207-grub-core-loader-arm64-linux.c-do-not-validate-kerne.patch

fd0330
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
fd0330
From: Dimitri John Ledkov <dimitri.ledkov@canonical.com>
fd0330
Date: Fri, 4 Mar 2022 11:29:31 +0100
fd0330
Subject: [PATCH] grub-core/loader/arm64/linux.c: do not validate kernel twice
fd0330
fd0330
Call to grub_file_open(, GRUB_FILE_TYPE_LINUX_KERNEL) already passes
fd0330
the kernel file through shim-lock verifier when secureboot is on. Thus
fd0330
there is no need to validate the kernel image again. And when doing so
fd0330
again, duplicate PCR measurement is performed, breaking measurements
fd0330
compatibility with 2.04+linuxefi.
fd0330
fd0330
This patch must not be ported to older editions of grub code bases
fd0330
that do not have verifiers framework, or it is not builtin, or
fd0330
shim-lock-verifier is an optional module.
fd0330
fd0330
Signed-off-by: Dimitri John Ledkov <dimitri.ledkov@canonical.com>
fd0330
---
fd0330
 grub-core/loader/arm64/linux.c | 13 -------------
fd0330
 1 file changed, 13 deletions(-)
fd0330
fd0330
diff --git a/grub-core/loader/arm64/linux.c b/grub-core/loader/arm64/linux.c
fd0330
index f18d90bd74..d2af47c2c0 100644
fd0330
--- a/grub-core/loader/arm64/linux.c
fd0330
+++ b/grub-core/loader/arm64/linux.c
fd0330
@@ -34,7 +34,6 @@
fd0330
 #include <grub/i18n.h>
fd0330
 #include <grub/lib/cmdline.h>
fd0330
 #include <grub/verify.h>
fd0330
-#include <grub/efi/sb.h>
fd0330
 
fd0330
 GRUB_MOD_LICENSE ("GPLv3+");
fd0330
 
fd0330
@@ -341,7 +340,6 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
fd0330
   grub_off_t filelen;
fd0330
   grub_uint32_t align;
fd0330
   void *kernel = NULL;
fd0330
-  int rc;
fd0330
 
fd0330
   grub_dl_ref (my_mod);
fd0330
 
fd0330
@@ -370,17 +368,6 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
fd0330
       goto fail;
fd0330
     }
fd0330
 
fd0330
-  if (grub_efi_get_secureboot () == GRUB_EFI_SECUREBOOT_MODE_ENABLED)
fd0330
-    {
fd0330
-      rc = grub_linuxefi_secure_validate (kernel, filelen);
fd0330
-      if (rc <= 0)
fd0330
-	{
fd0330
-	  grub_error (GRUB_ERR_INVALID_COMMAND,
fd0330
-		      N_("%s has invalid signature"), argv[0]);
fd0330
-	  goto fail;
fd0330
-	}
fd0330
-    }
fd0330
-
fd0330
   if (grub_arch_efi_linux_check_image (kernel) != GRUB_ERR_NONE)
fd0330
     goto fail;
fd0330
   if (parse_pe_header (kernel, &kernel_size, &handover_offset, &align) != GRUB_ERR_NONE)