Skip to content
/ edk2 Public

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
DasharoModulePkg/DasharoVariablesLib: add runtime attribute to FUM
Browse files Browse the repository at this point in the history
This is required for initializing capsule update process from Linux's
capsule_loader.

It also fixes the possibility for putting the device in infinite FUM
loop by creating the variable with runtime access. SetVariable() in
WarnIfFirmwareUpdateMode() used to remove the variable failed because
of mismatched attributes.

According to UEFI specification,

> If a preexisting variable is rewritten with no access attributes
> specified, the variable will be deleted.

This is exactly what is needed. The other way to delete a variable is
to specify matching attributes and set the size of a variable as 0.

Signed-off-by: Krystian Hebel <[email protected]>
krystian-hebel authored and SergiiDmytruk committed Oct 3, 2024

Verified

This commit was signed with the committer’s verified signature. The key has expired.
1 parent 033c03e commit 88a61f5
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -513,7 +513,7 @@ DasharoEnableFUM (
Status = gRT->SetVariable (
DASHARO_VAR_FIRMWARE_UPDATE_MODE,
&gDasharoSystemFeaturesGuid,
EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_NON_VOLATILE,
EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,
sizeof (Enable),
&Enable
);
Original file line number Diff line number Diff line change
@@ -1134,7 +1134,7 @@ WarnIfFirmwareUpdateMode (
Status = gRT->SetVariable (
DASHARO_VAR_FIRMWARE_UPDATE_MODE,
&gDasharoSystemFeaturesGuid,
EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_NON_VOLATILE,
0,
0,
NULL
);

0 comments on commit 88a61f5

Please sign in to comment.