Skip to content

Commit

Permalink
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]>
  • Loading branch information
krystian-hebel committed Oct 1, 2024
1 parent 3b25f11 commit 97938d0
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,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
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
);
Expand Down

0 comments on commit 97938d0

Please sign in to comment.