Blame SOURCES/0286-kern-efi-sb-Enforce-verification-of-font-files.patch

fd0330
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
fd0330
From: Zhang Boyang <zhangboyang.id@gmail.com>
fd0330
Date: Sun, 14 Aug 2022 15:51:54 +0800
fd0330
Subject: [PATCH] kern/efi/sb: Enforce verification of font files
fd0330
fd0330
As a mitigation and hardening measure enforce verification of font
fd0330
files. Then only trusted font files can be load. This will reduce the
fd0330
attack surface at cost of losing the ability of end-users to customize
fd0330
fonts if e.g. UEFI Secure Boot is enabled. Vendors can always customize
fd0330
fonts because they have ability to pack fonts into their GRUB bundles.
fd0330
fd0330
This goal is achieved by:
fd0330
fd0330
  * Removing GRUB_FILE_TYPE_FONT from shim lock verifier's
fd0330
    skip-verification list.
fd0330
fd0330
  * Adding GRUB_FILE_TYPE_FONT to lockdown verifier's defer-auth list,
fd0330
    so font files must be verified by a verifier before they can be loaded.
fd0330
fd0330
Suggested-by: Daniel Kiper <daniel.kiper@oracle.com>
fd0330
Signed-off-by: Zhang Boyang <zhangboyang.id@gmail.com>
fd0330
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
fd0330
(cherry picked from commit 630deb8c0d8b02b670ced4b7030414bcf17aa080)
fd0330
---
fd0330
 grub-core/kern/efi/sb.c   | 1 -
fd0330
 grub-core/kern/lockdown.c | 1 +
fd0330
 2 files changed, 1 insertion(+), 1 deletion(-)
fd0330
fd0330
diff --git a/grub-core/kern/efi/sb.c b/grub-core/kern/efi/sb.c
fd0330
index 89c4bb3fd1..db42c2539f 100644
fd0330
--- a/grub-core/kern/efi/sb.c
fd0330
+++ b/grub-core/kern/efi/sb.c
fd0330
@@ -145,7 +145,6 @@ shim_lock_verifier_init (grub_file_t io __attribute__ ((unused)),
fd0330
     case GRUB_FILE_TYPE_PRINT_BLOCKLIST:
fd0330
     case GRUB_FILE_TYPE_TESTLOAD:
fd0330
     case GRUB_FILE_TYPE_GET_SIZE:
fd0330
-    case GRUB_FILE_TYPE_FONT:
fd0330
     case GRUB_FILE_TYPE_ZFS_ENCRYPTION_KEY:
fd0330
     case GRUB_FILE_TYPE_CAT:
fd0330
     case GRUB_FILE_TYPE_HEXCAT:
fd0330
diff --git a/grub-core/kern/lockdown.c b/grub-core/kern/lockdown.c
fd0330
index 0bc70fd42d..af6d493cd3 100644
fd0330
--- a/grub-core/kern/lockdown.c
fd0330
+++ b/grub-core/kern/lockdown.c
fd0330
@@ -51,6 +51,7 @@ lockdown_verifier_init (grub_file_t io __attribute__ ((unused)),
fd0330
     case GRUB_FILE_TYPE_EFI_CHAINLOADED_IMAGE:
fd0330
     case GRUB_FILE_TYPE_ACPI_TABLE:
fd0330
     case GRUB_FILE_TYPE_DEVICE_TREE_IMAGE:
fd0330
+    case GRUB_FILE_TYPE_FONT:
fd0330
       *flags = GRUB_VERIFY_FLAGS_DEFER_AUTH;
fd0330
 
fd0330
       /* Fall through. */