8ee92f5194
- Implement NV index mode for TPM 2.0 key protector 0001-protectors-Implement-NV-index.patch - Fall back to passphrase mode when the key protector fails to unlock the disk 0002-cryptodisk-Fallback-to-passphrase.patch - Wipe out the cached key cleanly 0003-cryptodisk-wipe-out-the-cached-keys-from-protectors.patch - Make diskfiler to look up cryptodisk devices first 0004-diskfilter-look-up-cryptodisk-devices-first.patch - Version bump to 2.12~rc1 * Added: - grub-2.12~rc1.tar.xz * Removed: - grub-2.06.tar.xz * Patch dropped merged by new version: - grub2-GRUB_CMDLINE_LINUX_RECOVERY-for-recovery-mode.patch - grub2-s390x-02-kexec-module-added-to-emu.patch - grub2-efi-chainloader-root.patch - grub2-Fix-incorrect-netmask-on-ppc64.patch - 0001-osdep-Introduce-include-grub-osdep-major.h-and-use-i.patch - 0002-osdep-linux-hostdisk-Use-stat-instead-of-udevadm-for.patch - 0002-net-read-bracketed-ipv6-addrs-and-port-numbers.patch - grub2-s390x-10-keep-network-at-kexec.patch - 0001-Fix-build-error-in-binutils-2.36.patch - 0001-emu-fix-executable-stack-marking.patch - 0046-squash-verifiers-Move-verifiers-API-to-kernel-image.patch - 0001-30_uefi-firmware-fix-printf-format-with-null-byte.patch - 0001-tpm-Pass-unknown-error-as-non-fatal-but-debug-print-.patch - 0001-Filter-out-POSIX-locale-for-translation.patch OBS-URL: https://build.opensuse.org/request/show/1105405 OBS-URL: https://build.opensuse.org/package/show/Base:System/grub2?expand=0&rev=458
102 lines
2.8 KiB
Diff
102 lines
2.8 KiB
Diff
From 806bb18c3493537530b6b0387143752478078f5b Mon Sep 17 00:00:00 2001
|
|
From: Daniel Axtens <dja@axtens.net>
|
|
Date: Mon, 28 Sep 2020 11:11:17 +1000
|
|
Subject: [PATCH 22/23] ieee1275: enter lockdown based on /ibm,secure-boot
|
|
|
|
If the 'ibm,secure-boot' property of the root node is 2 or greater,
|
|
enter lockdown.
|
|
|
|
Signed-off-by: Daniel Axtens <dja@axtens.net>
|
|
---
|
|
docs/grub.texi | 4 ++--
|
|
grub-core/Makefile.core.def | 1 +
|
|
grub-core/kern/ieee1275/init.c | 27 +++++++++++++++++++++++++++
|
|
include/grub/lockdown.h | 3 ++-
|
|
4 files changed, 32 insertions(+), 3 deletions(-)
|
|
|
|
--- a/docs/grub.texi
|
|
+++ b/docs/grub.texi
|
|
@@ -6740,8 +6740,8 @@
|
|
@section Lockdown when booting on a secure setup
|
|
|
|
The GRUB can be locked down when booted on a secure boot environment, for example
|
|
-if the UEFI secure boot is enabled. On a locked down configuration, the GRUB will
|
|
-be restricted and some operations/commands cannot be executed.
|
|
+if UEFI or Power secure boot is enabled. On a locked down configuration, the
|
|
+GRUB will be restricted and some operations/commands cannot be executed.
|
|
|
|
The @samp{lockdown} variable is set to @samp{y} when the GRUB is locked down.
|
|
Otherwise it does not exit.
|
|
--- a/grub-core/Makefile.core.def
|
|
+++ b/grub-core/Makefile.core.def
|
|
@@ -331,6 +331,7 @@
|
|
powerpc_ieee1275 = kern/powerpc/cache.S;
|
|
powerpc_ieee1275 = kern/powerpc/dl.c;
|
|
powerpc_ieee1275 = kern/powerpc/compiler-rt.S;
|
|
+ powerpc_ieee1275 = kern/lockdown.c;
|
|
|
|
sparc64_ieee1275 = kern/sparc64/cache.S;
|
|
sparc64_ieee1275 = kern/sparc64/dl.c;
|
|
--- a/grub-core/kern/ieee1275/init.c
|
|
+++ b/grub-core/kern/ieee1275/init.c
|
|
@@ -44,6 +44,7 @@
|
|
#ifdef __sparc__
|
|
#include <grub/machine/kernel.h>
|
|
#endif
|
|
+#include <grub/lockdown.h>
|
|
|
|
/* The maximum heap size we're going to claim at boot. Not used by sparc. */
|
|
#ifdef __i386__
|
|
@@ -708,6 +709,30 @@
|
|
}
|
|
}
|
|
|
|
+static void
|
|
+grub_get_ieee1275_secure_boot (void)
|
|
+{
|
|
+ grub_ieee1275_phandle_t root;
|
|
+ int rc;
|
|
+ grub_uint32_t is_sb;
|
|
+
|
|
+ grub_ieee1275_finddevice ("/", &root);
|
|
+
|
|
+ rc = grub_ieee1275_get_integer_property (root, "ibm,secure-boot", &is_sb,
|
|
+ sizeof (is_sb), 0);
|
|
+
|
|
+ /* ibm,secure-boot:
|
|
+ * 0 - disabled
|
|
+ * 1 - audit
|
|
+ * 2 - enforce
|
|
+ * 3 - enforce + OS-specific behaviour
|
|
+ *
|
|
+ * We only support enforce.
|
|
+ */
|
|
+ if (rc >= 0 && is_sb >= 2)
|
|
+ grub_lockdown ();
|
|
+}
|
|
+
|
|
grub_addr_t grub_modbase;
|
|
|
|
void
|
|
@@ -733,6 +758,8 @@
|
|
#else
|
|
grub_install_get_time_ms (grub_rtc_get_time_ms);
|
|
#endif
|
|
+
|
|
+ grub_get_ieee1275_secure_boot ();
|
|
}
|
|
|
|
void
|
|
--- a/include/grub/lockdown.h
|
|
+++ b/include/grub/lockdown.h
|
|
@@ -24,7 +24,8 @@
|
|
#define GRUB_LOCKDOWN_DISABLED 0
|
|
#define GRUB_LOCKDOWN_ENABLED 1
|
|
|
|
-#ifdef GRUB_MACHINE_EFI
|
|
+#if defined(GRUB_MACHINE_EFI) || \
|
|
+ (defined(__powerpc__) && defined(GRUB_MACHINE_IEEE1275))
|
|
extern void
|
|
EXPORT_FUNC (grub_lockdown) (void);
|
|
extern int
|