public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH V1 1/1] OvmfPkg/PlatformInitLib: Add check to NvVarStoreFV HeaderLength
@ 2022-11-27  7:00 Min Xu
  2022-12-01  6:26 ` Yao, Jiewen
       [not found] ` <172C97603AF93BB4.27320@groups.io>
  0 siblings, 2 replies; 3+ messages in thread
From: Min Xu @ 2022-11-27  7:00 UTC (permalink / raw)
  To: devel
  Cc: Min M Xu, Erdem Aktas, James Bottomley, Jiewen Yao, Gerd Hoffmann,
	Tom Lendacky

From: Min M Xu <min.m.xu@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@QemuFlashFvbServicesRuntimeDxe/FwBlockServices.c
there a is similar check to the FwVolHeader->HeaderLength.

Cc: Erdem Aktas <erdemaktas@google.com>
Cc: James Bottomley <jejb@linux.ibm.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Tom Lendacky <thomas.lendacky@amd.com>
Signed-off-by: Min Xu <min.m.xu@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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH V1 1/1] OvmfPkg/PlatformInitLib: Add check to NvVarStoreFV HeaderLength
  2022-11-27  7:00 [PATCH V1 1/1] OvmfPkg/PlatformInitLib: Add check to NvVarStoreFV HeaderLength Min Xu
@ 2022-12-01  6:26 ` Yao, Jiewen
       [not found] ` <172C97603AF93BB4.27320@groups.io>
  1 sibling, 0 replies; 3+ messages in thread
From: Yao, Jiewen @ 2022-12-01  6:26 UTC (permalink / raw)
  To: Xu, Min M, devel@edk2.groups.io
  Cc: Aktas, Erdem, James Bottomley, Gerd Hoffmann, Tom Lendacky

Reviewed-by: Jiewen Yao <Jiewen.yao@intel.com>

> -----Original Message-----
> From: Xu, Min M <min.m.xu@intel.com>
> Sent: Sunday, November 27, 2022 3:00 PM
> To: devel@edk2.groups.io
> Cc: Xu, Min M <min.m.xu@intel.com>; Aktas, Erdem
> <erdemaktas@google.com>; James Bottomley <jejb@linux.ibm.com>; Yao,
> Jiewen <jiewen.yao@intel.com>; Gerd Hoffmann <kraxel@redhat.com>;
> Tom Lendacky <thomas.lendacky@amd.com>
> Subject: [PATCH V1 1/1] OvmfPkg/PlatformInitLib: Add check to
> NvVarStoreFV HeaderLength
> 
> From: Min M Xu <min.m.xu@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@QemuFlashFvbServicesRuntimeDxe/FwBlockServices.c
> there a is similar check to the FwVolHeader->HeaderLength.
> 
> Cc: Erdem Aktas <erdemaktas@google.com>
> Cc: James Bottomley <jejb@linux.ibm.com>
> Cc: Jiewen Yao <jiewen.yao@intel.com>
> Cc: Gerd Hoffmann <kraxel@redhat.com>
> Cc: Tom Lendacky <thomas.lendacky@amd.com>
> Signed-off-by: Min Xu <min.m.xu@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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [edk2-devel] [PATCH V1 1/1] OvmfPkg/PlatformInitLib: Add check to NvVarStoreFV HeaderLength
       [not found] ` <172C97603AF93BB4.27320@groups.io>
@ 2022-12-02  1:34   ` Yao, Jiewen
  0 siblings, 0 replies; 3+ messages in thread
From: Yao, Jiewen @ 2022-12-02  1:34 UTC (permalink / raw)
  To: devel@edk2.groups.io, Yao, Jiewen, Xu, Min M
  Cc: Aktas, Erdem, James Bottomley, Gerd Hoffmann, Tom Lendacky

Merged https://github.com/tianocore/edk2/pull/3694

> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Yao,
> Jiewen
> Sent: Thursday, December 1, 2022 2:27 PM
> To: Xu, Min M <min.m.xu@intel.com>; devel@edk2.groups.io
> Cc: Aktas, Erdem <erdemaktas@google.com>; James Bottomley
> <jejb@linux.ibm.com>; Gerd Hoffmann <kraxel@redhat.com>; Tom
> Lendacky <thomas.lendacky@amd.com>
> Subject: Re: [edk2-devel] [PATCH V1 1/1] OvmfPkg/PlatformInitLib: Add
> check to NvVarStoreFV HeaderLength
> 
> Reviewed-by: Jiewen Yao <Jiewen.yao@intel.com>
> 
> > -----Original Message-----
> > From: Xu, Min M <min.m.xu@intel.com>
> > Sent: Sunday, November 27, 2022 3:00 PM
> > To: devel@edk2.groups.io
> > Cc: Xu, Min M <min.m.xu@intel.com>; Aktas, Erdem
> > <erdemaktas@google.com>; James Bottomley <jejb@linux.ibm.com>;
> Yao,
> > Jiewen <jiewen.yao@intel.com>; Gerd Hoffmann <kraxel@redhat.com>;
> > Tom Lendacky <thomas.lendacky@amd.com>
> > Subject: [PATCH V1 1/1] OvmfPkg/PlatformInitLib: Add check to
> > NvVarStoreFV HeaderLength
> >
> > From: Min M Xu <min.m.xu@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@QemuFlashFvbServicesRuntimeDxe/FwBlockServices.c
> > there a is similar check to the FwVolHeader->HeaderLength.
> >
> > Cc: Erdem Aktas <erdemaktas@google.com>
> > Cc: James Bottomley <jejb@linux.ibm.com>
> > Cc: Jiewen Yao <jiewen.yao@intel.com>
> > Cc: Gerd Hoffmann <kraxel@redhat.com>
> > Cc: Tom Lendacky <thomas.lendacky@amd.com>
> > Signed-off-by: Min Xu <min.m.xu@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
> 
> 
> 
> 
> 


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-12-02  1:34 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-27  7:00 [PATCH V1 1/1] OvmfPkg/PlatformInitLib: Add check to NvVarStoreFV HeaderLength Min Xu
2022-12-01  6:26 ` Yao, Jiewen
     [not found] ` <172C97603AF93BB4.27320@groups.io>
2022-12-02  1:34   ` [edk2-devel] " Yao, Jiewen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox