[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Bug#820129: grub2: Disallow booting unsigned kernels when Secure Boot is enabled

[ Note cc to the d-efi list. SB is finally in progress after last
  week's sprint! ]

Very belated, it's time we discussed this.

On Tue, Apr 05, 2016 at 11:17:24AM -0700, Linn Crosetto wrote:
>Package: grub2
>Version: 2.02~beta2-36
>Severity: wishlist
>Tags: patch
>Hash: SHA1
>The current code in 2.02~beta2-36 will silently fall back to calling
>ExitBootServices() and booting an unsigned kernel if signature verification
>As a part of support for UEFI Secure Boot in Debian (820036) change the boot
>to fail if signature verification fails.
>I have attached a trivial patch for this change. Thanks!
>Version: GnuPG v1

>>From 52de74c85ef6a9aca426d9de8f188fe92241aff6 Mon Sep 17 00:00:00 2001
>From: Linn Crosetto <linn@hpe.com>
>Date: Tue, 5 Apr 2016 11:49:05 -0600
>Subject: [PATCH] Disallow unsigned kernels if UEFI Secure Boot is enabled
>If UEFI Secure Boot is enabled and kernel signature verification fails, do not
>boot the kernel. Before this change, if kernel signature verification failed
>then GRUB would fall back to calling ExitBootServices() and continuing the
>Patch-Name: linuxefi_disable_sb_fallback.patch
>Signed-off-by: Linn Crosetto <linn@hpe.com>
> grub-core/loader/i386/linux.c | 8 +++-----
> 1 file changed, 3 insertions(+), 5 deletions(-)
>diff --git a/grub-core/loader/i386/linux.c b/grub-core/loader/i386/linux.c
>index 2380642..e2e26dd 100644
>--- a/grub-core/loader/i386/linux.c
>+++ b/grub-core/loader/i386/linux.c
>@@ -696,10 +696,8 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
>   using_linuxefi = 0;
>   if (grub_efi_secure_boot ())
>     {
>-      /* Try linuxefi first, which will require a successful signature check
>-	 and then hand over to the kernel without calling ExitBootServices.
>-	 If that fails, however, fall back to calling ExitBootServices
>-	 ourselves and then booting an unsigned kernel.  */
>+      /* linuxefi requires a successful signature check and then hand over
>+	 to the kernel without calling ExitBootServices. */
>       grub_dl_t mod;
>       grub_command_t linuxefi_cmd;
>@@ -721,7 +719,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
> 		  return GRUB_ERR_NONE;
> 		}
> 	      grub_dprintf ("linux", "linuxefi failed (%d)\n", grub_errno);
>-	      grub_errno = GRUB_ERR_NONE;
>+	      goto fail;
> 	    }
> 	}
>     }

This looks like one way of doing this. Philipp Hahn is suggesting that
we just don't include the "linux" module in our signed grub
build. That's simpler, but potentially causes problems elsewhere,
e.g. "it gets a bit nasty to try and dynamically switch between linux
and linuxefi in live-build". So, let's discuss - we need to agree our
policy and decide the best mechanism here. Go...!

Steve McIntyre, Cambridge, UK.                                steve@einval.com
< liw> everything I know about UK hotels I learned from "Fawlty Towers"

Reply to: