[edk2-devel] [PATCH V1 1/1] OvmfPkg/PlatformInitLib: Add check to NvVarStoreFV HeaderLength
Yao, Jiewen
jiewen.yao at intel.com
Thu Dec 1 06:26:35 UTC 2022
Reviewed-by: Jiewen Yao <Jiewen.yao at intel.com>
> -----Original Message-----
> From: Xu, Min M <min.m.xu at intel.com>
> Sent: Sunday, November 27, 2022 3:00 PM
> To: devel at edk2.groups.io
> Cc: Xu, Min M <min.m.xu at intel.com>; Aktas, Erdem
> <erdemaktas at google.com>; James Bottomley <jejb at linux.ibm.com>; Yao,
> Jiewen <jiewen.yao at intel.com>; Gerd Hoffmann <kraxel at redhat.com>;
> Tom Lendacky <thomas.lendacky at amd.com>
> Subject: [PATCH V1 1/1] OvmfPkg/PlatformInitLib: Add check to
> NvVarStoreFV HeaderLength
>
> From: Min M Xu <min.m.xu at intel.com>
>
> There should be a check that the FV HeaderLength cannot be an odd
> number. Otherwise in the following CalculateSum16 there would be an
> ASSERT.
>
> In ValidateFvHeader at QemuFlashFvbServicesRuntimeDxe/FwBlockServices.c
> there a is similar check to the FwVolHeader->HeaderLength.
>
> Cc: Erdem Aktas <erdemaktas at google.com>
> Cc: James Bottomley <jejb at linux.ibm.com>
> Cc: Jiewen Yao <jiewen.yao at intel.com>
> Cc: Gerd Hoffmann <kraxel at redhat.com>
> Cc: Tom Lendacky <thomas.lendacky at amd.com>
> Signed-off-by: Min Xu <min.m.xu at intel.com>
> ---
> OvmfPkg/Library/PlatformInitLib/Platform.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/OvmfPkg/Library/PlatformInitLib/Platform.c
> b/OvmfPkg/Library/PlatformInitLib/Platform.c
> index 2582689ffe35..77f22de046f2 100644
> --- a/OvmfPkg/Library/PlatformInitLib/Platform.c
> +++ b/OvmfPkg/Library/PlatformInitLib/Platform.c
> @@ -653,6 +653,7 @@ PlatformValidateNvVarStore (
> (!CompareGuid (&FvHdrGUID, &NvVarStoreFvHeader->FileSystemGuid))
> ||
> (NvVarStoreFvHeader->Signature != EFI_FVH_SIGNATURE) ||
> (NvVarStoreFvHeader->Attributes != 0x4feff) ||
> + ((NvVarStoreFvHeader->HeaderLength & 0x01) != 0) ||
> (NvVarStoreFvHeader->Revision != EFI_FVH_REVISION) ||
> (NvVarStoreFvHeader->FvLength != NvVarStoreSize)
> )
> --
> 2.29.2.windows.2
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#96815): https://edk2.groups.io/g/devel/message/96815
Mute This Topic: https://groups.io/mt/95285469/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-
More information about the edk2-devel-archive
mailing list