This repository was archived by the owner on Mar 28, 2024. It is now read-only.
forked from rhboot/shim-review
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0c025ea
commit 00ed2a2
Showing
7 changed files
with
634 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
From: Gary Lin <[email protected]> | ||
Date: Wed, 5 May 2021 11:25:07 +0800 | ||
Subject: mok: relax the maximum variable size check | ||
|
||
Some UEFI environment such as u-boot doesn't implement | ||
QueryVariableInfo(), so we couldn't rely on the function to estimate the | ||
available space for RT variables. All we can do is to call SetVariable() | ||
directly and check the return value of SetVariable(). | ||
|
||
Signed-off-by: Gary Lin <[email protected]> | ||
Origin: https://github.com/rhboot/shim/pull/369 | ||
Bug-Ubuntuhttps://bugs.launchpad.net/bugs/1934780 | ||
--- | ||
mok.c | 9 +++++++-- | ||
1 file changed, 7 insertions(+), 2 deletions(-) | ||
|
||
diff --git a/mok.c b/mok.c | ||
index a687a92..d3d0f25 100644 | ||
--- a/mok.c | ||
+++ b/mok.c | ||
@@ -362,13 +362,18 @@ mirror_mok_db(CHAR16 *name, CHAR8 *name8, EFI_GUID *guid, UINT32 attrs, | ||
SIZE_T max_var_sz; | ||
|
||
efi_status = get_max_var_sz(attrs, &max_var_sz); | ||
- if (EFI_ERROR(efi_status)) { | ||
+ if (EFI_ERROR(efi_status) && efi_status != EFI_UNSUPPORTED) { | ||
LogError(L"Could not get maximum variable size: %r", | ||
efi_status); | ||
return efi_status; | ||
} | ||
|
||
- if (FullDataSize <= max_var_sz) { | ||
+ /* Some UEFI environment such as u-boot doesn't implement | ||
+ * QueryVariableInfo() and we will only get EFI_UNSUPPORTED when | ||
+ * querying the available space. In this case, we just mirror | ||
+ * the variable directly. */ | ||
+ if (FullDataSize <= max_var_sz || efi_status == EFI_UNSUPPORTED) { | ||
+ efi_status = EFI_SUCCESS; | ||
if (only_first) | ||
efi_status = SetVariable(name, guid, attrs, | ||
FullDataSize, FullData); |
Oops, something went wrong.