grub-devel.gnu.org archive mirror
 help / color / mirror / Atom feed
From: Julian Andres Klode <julian.klode@canonical.com>
To: grub-devel@gnu.org
Cc: Julian Andres Klode <julian.klode@canonical.com>,
	Peter Jones <pjones@redhat.com>, Michael Chang <mchang@suse.com>
Subject: [PATCH v2] efi: Set shim_lock_enabled even if validation is disabled
Date: Tue, 21 Nov 2023 18:09:59 +0100	[thread overview]
Message-ID: <20231121170959.520297-1-julian.klode@canonical.com> (raw)

If validation has been disabled via MokSbState, secure boot on the
firmware is still enabled, and the kernel fails to boot.

This is a bit hacky, because shim_lock is not *fully* enabled, but
it triggers the right code paths.

Ultimately, all this will be resolved by shim gaining it's own image
loading and starting protocol, so this is more a temporary workaround.

Fixes: 6425c12cd (efi: Fallback to legacy mode if shim is loaded on x86 archs)

Cc: Peter Jones <pjones@redhat.com>
Cc: Michael Chang <mchang@suse.com>
Signed-off-by: Julian Andres Klode <julian.klode@canonical.com>
---
 grub-core/kern/efi/sb.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/grub-core/kern/efi/sb.c b/grub-core/kern/efi/sb.c
index 60550a6da..8d3e41360 100644
--- a/grub-core/kern/efi/sb.c
+++ b/grub-core/kern/efi/sb.c
@@ -95,6 +95,14 @@ grub_efi_get_secureboot (void)
   if (!(attr & GRUB_EFI_VARIABLE_RUNTIME_ACCESS) && *moksbstate == 1)
     {
       secureboot = GRUB_EFI_SECUREBOOT_MODE_DISABLED;
+      /*
+       * TODO: Replace this all with shim's LoadImage protocol, delegating policy to it.
+       *
+       * We need to set shim_lock_enabled here because we disabled secure boot
+       * validation *inside* shim but not in the firmware, so we set this variable
+       * here to trigger that code path, whereas the actual verifier is not enabled.
+       */
+      shim_lock_enabled = true;
       goto out;
     }
 
-- 
2.40.1


_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel

             reply	other threads:[~2023-11-21 17:10 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-21 17:09 Julian Andres Klode [this message]
2023-11-29 19:34 ` [PATCH v2] efi: Set shim_lock_enabled even if validation is disabled Daniel Kiper

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231121170959.520297-1-julian.klode@canonical.com \
    --to=julian.klode@canonical.com \
    --cc=grub-devel@gnu.org \
    --cc=mchang@suse.com \
    --cc=pjones@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).