Skip to content

Commit 84a0425

Browse files
authored
Merge pull request #305 from bcressey/tidy-pcr-9
kernel-6.1, -6.12: disable PCR 9 measurement
2 parents 18b5e94 + 310060a commit 84a0425

File tree

4 files changed

+70
-0
lines changed

4 files changed

+70
-0
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
From fa0eefb655d457b24bdaffab3e7beb968faae223 Mon Sep 17 00:00:00 2001
2+
From: Ben Cressey <[email protected]>
3+
Date: Tue, 4 Nov 2025 16:42:55 +0000
4+
Subject: [PATCH] efi/libstub: don't measure kernel command line into PCR 9
5+
6+
The kernel command line can be extended via bootconfig, which may add
7+
additional parameters but depends on initrd parsing that happens at a
8+
later point in the boot.
9+
10+
Disable the boot-time measurement so that the verified userspace can
11+
perform a complete measurement later.
12+
13+
Signed-off-by: Ben Cressey <[email protected]>
14+
---
15+
drivers/firmware/efi/libstub/efi-stub-helper.c | 2 ++
16+
1 file changed, 2 insertions(+)
17+
18+
diff --git a/drivers/firmware/efi/libstub/efi-stub-helper.c b/drivers/firmware/efi/libstub/efi-stub-helper.c
19+
index 587ba946ba9d..e932673f5209 100644
20+
--- a/drivers/firmware/efi/libstub/efi-stub-helper.c
21+
+++ b/drivers/firmware/efi/libstub/efi-stub-helper.c
22+
@@ -431,9 +431,11 @@ char *efi_convert_cmdline(efi_loaded_image_t *image, int *cmd_line_len)
23+
efi_status_t status;
24+
u32 options_chars;
25+
26+
+#if 0
27+
if (options_size > 0)
28+
efi_measure_tagged_event((unsigned long)options, options_size,
29+
EFISTUB_EVT_LOAD_OPTIONS);
30+
+#endif
31+
32+
efi_apply_loadoptions_quirk((const void **)&options, &options_size);
33+
options_chars = options_size / sizeof(efi_char16_t);

packages/kernel-6.1/kernel-6.1.spec

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ Patch1004: 1004-af_unix-increase-default-max_dgram_qlen-to-512.patch
5757
Patch1005: 1005-Revert-Revert-drm-fb_helper-improve-CONFIG_FB-depend.patch
5858
# Backport patch to ensure NUL-terminated task->comm buffer
5959
Patch1006: 1006-strscpy-write-destination-buffer-only-once.patch
60+
# Disable incomplete measurement into PCR 9 on aarch64.
61+
Patch1007: 1007-efi-libstub-don-t-measure-kernel-command-line-into-P.patch
6062

6163
BuildRequires: bc
6264
BuildRequires: elfutils-devel
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
From 7582a3b837ddffaddf2a4121285464b8655fe4f0 Mon Sep 17 00:00:00 2001
2+
From: Ben Cressey <[email protected]>
3+
Date: Tue, 4 Nov 2025 16:42:55 +0000
4+
Subject: [PATCH] efi/libstub: don't measure kernel command line into PCR 9
5+
6+
The kernel command line can be extended via bootconfig, which may add
7+
additional parameters but depends on initrd parsing that happens at a
8+
later point in the boot.
9+
10+
Disable the boot-time measurement so that the verified userspace can
11+
perform a complete measurement later.
12+
13+
Signed-off-by: Ben Cressey <[email protected]>
14+
---
15+
drivers/firmware/efi/libstub/efi-stub-helper.c | 2 ++
16+
1 file changed, 2 insertions(+)
17+
18+
diff --git a/drivers/firmware/efi/libstub/efi-stub-helper.c b/drivers/firmware/efi/libstub/efi-stub-helper.c
19+
index 1ad414da9920..f8363a5d31f7 100644
20+
--- a/drivers/firmware/efi/libstub/efi-stub-helper.c
21+
+++ b/drivers/firmware/efi/libstub/efi-stub-helper.c
22+
@@ -338,9 +338,11 @@ char *efi_convert_cmdline(efi_loaded_image_t *image, int *cmd_line_len)
23+
efi_status_t status;
24+
u32 options_chars;
25+
26+
+#if 0
27+
if (options_size > 0)
28+
efi_measure_tagged_event((unsigned long)options, options_size,
29+
EFISTUB_EVT_LOAD_OPTIONS);
30+
+#endif
31+
32+
efi_apply_loadoptions_quirk((const void **)&options, &options_size);
33+
options_chars = options_size / sizeof(efi_char16_t);

packages/kernel-6.12/kernel-6.12.spec

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ Patch1005: 1005-Lustre-cast-unsigned-long-to-pointer.patch
6060
Patch1006: 1006-Select-prerequisites-for-gpu-drivers.patch
6161
# Backport patch to ensure NUL-terminated task->comm buffer
6262
Patch1007: 1007-strscpy-write-destination-buffer-only-once.patch
63+
# Disable incomplete measurement into PCR 9 on aarch64.
64+
Patch1008: 1008-efi-libstub-don-t-measure-kernel-command-line-into-P.patch
6365

6466
BuildRequires: bc
6567
BuildRequires: elfutils-devel

0 commit comments

Comments
 (0)