Skip to content

Commit

Permalink
fix: add sd-stub assertion patch
Browse files Browse the repository at this point in the history
Add assetion patch from upstream.

ref: systemd/systemd#26428

Signed-off-by: Noel Georgi <[email protected]>
  • Loading branch information
frezbo committed May 18, 2023
1 parent d2dde48 commit c6a41b6
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 0 deletions.
27 changes: 27 additions & 0 deletions sd-boot/patches/26445.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
From 54b306449ab3b6917f6f3534241e8b39fe9e98f1 Mon Sep 17 00:00:00 2001
From: Jan Janssen <[email protected]>
Date: Thu, 16 Feb 2023 15:24:44 +0100
Subject: [PATCH] boot: Fix assertion failure

The TPM code expects a description unless the PCR index indicates that
no measurements have to take place. The assert was preempting this
check from happening.

Fixes: #26428
---
src/boot/efi/measure.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/boot/efi/measure.c b/src/boot/efi/measure.c
index a8bbc62eaae0..949e26350c78 100644
--- a/src/boot/efi/measure.c
+++ b/src/boot/efi/measure.c
@@ -146,7 +146,7 @@ EFI_STATUS tpm_log_event(uint32_t pcrindex, EFI_PHYSICAL_ADDRESS buffer, size_t
EFI_TCG2 *tpm2;
EFI_STATUS err;

- assert(description);
+ assert(description || pcrindex == UINT32_MAX);

/* If EFI_SUCCESS is returned, will initialize ret_measured to true if we actually measured
* something, or false if measurement was turned off. */
1 change: 1 addition & 0 deletions sd-boot/pkg.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ steps:
pip3 install jinja2 ninja
patch -p1 < /pkg/patches/musl.patch
patch -p1 < /pkg/patches/26445.patch
meson setup build \
--buildtype=release \
Expand Down
27 changes: 27 additions & 0 deletions sd-stub/patches/26445.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
From 54b306449ab3b6917f6f3534241e8b39fe9e98f1 Mon Sep 17 00:00:00 2001
From: Jan Janssen <[email protected]>
Date: Thu, 16 Feb 2023 15:24:44 +0100
Subject: [PATCH] boot: Fix assertion failure

The TPM code expects a description unless the PCR index indicates that
no measurements have to take place. The assert was preempting this
check from happening.

Fixes: #26428
---
src/boot/efi/measure.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/boot/efi/measure.c b/src/boot/efi/measure.c
index a8bbc62eaae0..949e26350c78 100644
--- a/src/boot/efi/measure.c
+++ b/src/boot/efi/measure.c
@@ -146,7 +146,7 @@ EFI_STATUS tpm_log_event(uint32_t pcrindex, EFI_PHYSICAL_ADDRESS buffer, size_t
EFI_TCG2 *tpm2;
EFI_STATUS err;

- assert(description);
+ assert(description || pcrindex == UINT32_MAX);

/* If EFI_SUCCESS is returned, will initialize ret_measured to true if we actually measured
* something, or false if measurement was turned off. */
1 change: 1 addition & 0 deletions sd-stub/pkg.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ steps:
pip3 install jinja2 ninja
patch -p1 < /pkg/patches/musl.patch
patch -p1 < /pkg/patches/26445.patch
meson setup build \
--buildtype=release \
Expand Down

0 comments on commit c6a41b6

Please sign in to comment.