public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH V2 0/3] HobLib: Check FV alignment when building FV HOB
@ 2016-11-16  2:17 Star Zeng
  2016-11-16  2:17 ` [PATCH V2 1/3] MdePkg " Star Zeng
                   ` (5 more replies)
  0 siblings, 6 replies; 8+ messages in thread
From: Star Zeng @ 2016-11-16  2:17 UTC (permalink / raw)
  To: edk2-devel
  Cc: Star Zeng, Jiewen Yao, Liming Gao, Michael D Kinney, Jeff Fan,
	Laszlo Ersek, Ard Biesheuvel

If the FvImage buffer is not at its required alignment, then ASSERT().
Also update the function header description of BuildFv(2)Hob()
correspondingly.

Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=205

V2:
If the FvImage buffer is not at its required alignment, then ASSERT().

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Jeff Fan <jeff.fan@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>

Star Zeng (3):
  MdePkg HobLib: Check FV alignment when building FV HOB
  IntelFrameworkPkg PeiHobLib: Check FV alignment when building FV HOB
  ArmVirtPkg DxeHobLib: Update func header description of
    BuildFv(2)Hob()

 ArmVirtPkg/Library/ArmVirtDxeHobLib/HobLib.c       |  4 +-
 .../Library/PeiHobLibFramework/HobLib.c            | 70 +++++++++++++++++++++-
 MdePkg/Include/Library/HobLib.h                    |  4 +-
 MdePkg/Library/DxeCoreHobLib/HobLib.c              |  4 +-
 MdePkg/Library/DxeHobLib/HobLib.c                  |  4 +-
 MdePkg/Library/PeiHobLib/HobLib.c                  | 70 +++++++++++++++++++++-
 6 files changed, 150 insertions(+), 6 deletions(-)

-- 
2.7.0.windows.1



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

* [PATCH V2 1/3] MdePkg HobLib: Check FV alignment when building FV HOB
  2016-11-16  2:17 [PATCH V2 0/3] HobLib: Check FV alignment when building FV HOB Star Zeng
@ 2016-11-16  2:17 ` Star Zeng
  2016-11-16  2:17 ` [PATCH V2 2/3] IntelFrameworkPkg PeiHobLib: " Star Zeng
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: Star Zeng @ 2016-11-16  2:17 UTC (permalink / raw)
  To: edk2-devel; +Cc: Star Zeng, Jiewen Yao, Liming Gao, Michael D Kinney

If the FvImage buffer is not at its required alignment, then ASSERT().
Also update the function header description of BuildFv(2)Hob()
correspondingly.

Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=205

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Star Zeng <star.zeng@intel.com>
---
 MdePkg/Include/Library/HobLib.h       |  4 +-
 MdePkg/Library/DxeCoreHobLib/HobLib.c |  4 +-
 MdePkg/Library/DxeHobLib/HobLib.c     |  4 +-
 MdePkg/Library/PeiHobLib/HobLib.c     | 70 ++++++++++++++++++++++++++++++++++-
 4 files changed, 78 insertions(+), 4 deletions(-)

diff --git a/MdePkg/Include/Library/HobLib.h b/MdePkg/Include/Library/HobLib.h
index c6b15961714d..fc48703826c5 100644
--- a/MdePkg/Include/Library/HobLib.h
+++ b/MdePkg/Include/Library/HobLib.h
@@ -8,7 +8,7 @@
   allows the PEI phase to pass information to the DXE phase. HOBs are position
   independent and can be relocated easily to different memory memory locations.
 
-Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>
 This program and the accompanying materials
 are licensed and made available under the terms and conditions of the BSD License
 which accompanies this distribution.  The full text of the license may be found at
@@ -304,6 +304,7 @@ BuildGuidDataHob (
   for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.
 
   If there is no additional space for HOB creation, then ASSERT().
+  If the FvImage buffer is not at its required alignment, then ASSERT().
 
   @param  BaseAddress   The base address of the Firmware Volume.
   @param  Length        The size of the Firmware Volume in bytes.
@@ -324,6 +325,7 @@ BuildFvHob (
   for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.
 
   If there is no additional space for HOB creation, then ASSERT().
+  If the FvImage buffer is not at its required alignment, then ASSERT().
 
   @param  BaseAddress   The base address of the Firmware Volume.
   @param  Length        The size of the Firmware Volume in bytes.
diff --git a/MdePkg/Library/DxeCoreHobLib/HobLib.c b/MdePkg/Library/DxeCoreHobLib/HobLib.c
index ad6696627936..2e5fb1c6ee55 100644
--- a/MdePkg/Library/DxeCoreHobLib/HobLib.c
+++ b/MdePkg/Library/DxeCoreHobLib/HobLib.c
@@ -1,7 +1,7 @@
 /** @file
   HOB Library implementation for DxeCore driver.
 
-Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>
 This program and the accompanying materials
 are licensed and made available under the terms and conditions of the BSD License
 which accompanies this distribution.  The full text of the license may be found at
@@ -385,6 +385,7 @@ BuildGuidDataHob (
   for DXE phase, it will ASSERT() because PEI HOB is read-only for DXE phase.
   
   If there is no additional space for HOB creation, then ASSERT().
+  If the FvImage buffer is not at its required alignment, then ASSERT().
 
   @param  BaseAddress   The base address of the Firmware Volume.
   @param  Length        The size of the Firmware Volume in bytes.
@@ -411,6 +412,7 @@ BuildFvHob (
   for DXE phase, it will ASSERT() because PEI HOB is read-only for DXE phase.
   
   If there is no additional space for HOB creation, then ASSERT().
+  If the FvImage buffer is not at its required alignment, then ASSERT().
 
   @param  BaseAddress   The base address of the Firmware Volume.
   @param  Length        The size of the Firmware Volume in bytes.
diff --git a/MdePkg/Library/DxeHobLib/HobLib.c b/MdePkg/Library/DxeHobLib/HobLib.c
index f0861ffcb4e6..c6c04e6a5924 100644
--- a/MdePkg/Library/DxeHobLib/HobLib.c
+++ b/MdePkg/Library/DxeHobLib/HobLib.c
@@ -1,7 +1,7 @@
 /** @file
   HOB Library implemenation for Dxe Phase.
 
-Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>
 This program and the accompanying materials
 are licensed and made available under the terms and conditions of the BSD License
 which accompanies this distribution.  The full text of the license may be found at
@@ -418,6 +418,7 @@ BuildGuidDataHob (
   for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.
   
   If there is no additional space for HOB creation, then ASSERT().
+  If the FvImage buffer is not at its required alignment, then ASSERT().
 
   @param  BaseAddress   The base address of the Firmware Volume.
   @param  Length        The size of the Firmware Volume in bytes.
@@ -444,6 +445,7 @@ BuildFvHob (
   for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.
   
   If there is no additional space for HOB creation, then ASSERT().
+  If the FvImage buffer is not at its required alignment, then ASSERT().
 
   @param  BaseAddress   The base address of the Firmware Volume.
   @param  Length        The size of the Firmware Volume in bytes.
diff --git a/MdePkg/Library/PeiHobLib/HobLib.c b/MdePkg/Library/PeiHobLib/HobLib.c
index f3ce93afc63e..a1522dd9f5ff 100644
--- a/MdePkg/Library/PeiHobLib/HobLib.c
+++ b/MdePkg/Library/PeiHobLib/HobLib.c
@@ -1,7 +1,7 @@
 /** @file
   Provide Hob Library functions for Pei phase.
 
-Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2007 - 2016, Intel Corporation. All rights reserved.<BR>
 This program and the accompanying materials
 are licensed and made available under the terms and conditions of the BSD License
 which accompanies this distribution.  The full text of the license may be found at
@@ -474,6 +474,62 @@ BuildGuidDataHob (
 }
 
 /**
+  Check FV alignment.
+
+  @param  BaseAddress   The base address of the Firmware Volume.
+  @param  Length        The size of the Firmware Volume in bytes.
+
+  @retval TRUE          FvImage buffer is at its required alignment.
+  @retval FALSE         FvImage buffer is not at its required alignment.
+
+**/
+BOOLEAN
+InternalCheckFvAlignment (
+  IN EFI_PHYSICAL_ADDRESS       BaseAddress,
+  IN UINT64                     Length
+  )
+{
+  EFI_FIRMWARE_VOLUME_HEADER    *FwVolHeader;
+  UINT32                        FvAlignment;
+
+  FvAlignment = 0;
+  FwVolHeader = (EFI_FIRMWARE_VOLUME_HEADER *) (UINTN) BaseAddress;
+
+  //
+  // If EFI_FVB2_WEAK_ALIGNMENT is set in the volume header then the first byte of the volume
+  // can be aligned on any power-of-two boundary. A weakly aligned volume can not be moved from
+  // its initial linked location and maintain its alignment.
+  //
+  if ((FwVolHeader->Attributes & EFI_FVB2_WEAK_ALIGNMENT) != EFI_FVB2_WEAK_ALIGNMENT) {
+    //
+    // Get FvHeader alignment
+    //
+    FvAlignment = 1 << ((FwVolHeader->Attributes & EFI_FVB2_ALIGNMENT) >> 16);
+    //
+    // FvAlignment must be greater than or equal to 8 bytes of the minimum FFS alignment value.
+    //
+    if (FvAlignment < 8) {
+      FvAlignment = 8;
+    }
+    if ((UINTN)BaseAddress % FvAlignment != 0) {
+      //
+      // FvImage buffer is not at its required alignment.
+      //
+      DEBUG ((
+        DEBUG_ERROR,
+        "Unaligned FvImage found at 0x%lx:0x%lx, the required alignment is 0x%x\n",
+        BaseAddress,
+        Length,
+        FvAlignment
+        ));
+      return FALSE;
+    }
+  }
+
+  return TRUE;
+}
+
+/**
   Builds a Firmware Volume HOB.
 
   This function builds a Firmware Volume HOB.
@@ -481,6 +537,7 @@ BuildGuidDataHob (
   for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.
   
   If there is no additional space for HOB creation, then ASSERT().
+  If the FvImage buffer is not at its required alignment, then ASSERT().
 
   @param  BaseAddress   The base address of the Firmware Volume.
   @param  Length        The size of the Firmware Volume in bytes.
@@ -495,6 +552,11 @@ BuildFvHob (
 {
   EFI_HOB_FIRMWARE_VOLUME  *Hob;
 
+  if (!InternalCheckFvAlignment (BaseAddress, Length)) {
+    ASSERT (FALSE);
+    return;
+  }
+
   Hob = InternalPeiCreateHob (EFI_HOB_TYPE_FV, (UINT16) sizeof (EFI_HOB_FIRMWARE_VOLUME));
   if (Hob == NULL) {
     return;
@@ -512,6 +574,7 @@ BuildFvHob (
   for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.
   
   If there is no additional space for HOB creation, then ASSERT().
+  If the FvImage buffer is not at its required alignment, then ASSERT().
 
   @param  BaseAddress   The base address of the Firmware Volume.
   @param  Length        The size of the Firmware Volume in bytes.
@@ -530,6 +593,11 @@ BuildFv2Hob (
 {
   EFI_HOB_FIRMWARE_VOLUME2  *Hob;
 
+  if (!InternalCheckFvAlignment (BaseAddress, Length)) {
+    ASSERT (FALSE);
+    return;
+  }
+
   Hob = InternalPeiCreateHob (EFI_HOB_TYPE_FV2, (UINT16) sizeof (EFI_HOB_FIRMWARE_VOLUME2));
   if (Hob == NULL) {
     return;
-- 
2.7.0.windows.1



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

* [PATCH V2 2/3] IntelFrameworkPkg PeiHobLib: Check FV alignment when building FV HOB
  2016-11-16  2:17 [PATCH V2 0/3] HobLib: Check FV alignment when building FV HOB Star Zeng
  2016-11-16  2:17 ` [PATCH V2 1/3] MdePkg " Star Zeng
@ 2016-11-16  2:17 ` Star Zeng
  2016-11-16  2:17 ` [PATCH V2 3/3] ArmVirtPkg DxeHobLib: Update func header description of BuildFv(2)Hob() Star Zeng
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: Star Zeng @ 2016-11-16  2:17 UTC (permalink / raw)
  To: edk2-devel; +Cc: Star Zeng, Jiewen Yao, Liming Gao, Michael D Kinney, Jeff Fan

If the FvImage buffer is not at its required alignment, then ASSERT().
Also update the function header description of BuildFv(2)Hob()
correspondingly.

Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=205

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Jeff Fan <jeff.fan@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Star Zeng <star.zeng@intel.com>
---
 .../Library/PeiHobLibFramework/HobLib.c            | 70 +++++++++++++++++++++-
 1 file changed, 69 insertions(+), 1 deletion(-)

diff --git a/IntelFrameworkPkg/Library/PeiHobLibFramework/HobLib.c b/IntelFrameworkPkg/Library/PeiHobLibFramework/HobLib.c
index b41536e2a15a..223e56a9db12 100644
--- a/IntelFrameworkPkg/Library/PeiHobLibFramework/HobLib.c
+++ b/IntelFrameworkPkg/Library/PeiHobLibFramework/HobLib.c
@@ -5,7 +5,7 @@
  This library instance uses EFI_HOB_TYPE_CV defined in Intel framework HOB specification v0.9
  to implement HobLib BuildCvHob() API. 
 
-Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2007 - 2016, Intel Corporation. All rights reserved.<BR>
 This program and the accompanying materials
 are licensed and made available under the terms and conditions of the BSD License
 which accompanies this distribution.  The full text of the license may be found at
@@ -476,6 +476,62 @@ BuildGuidDataHob (
 }
 
 /**
+  Check FV alignment.
+
+  @param  BaseAddress   The base address of the Firmware Volume.
+  @param  Length        The size of the Firmware Volume in bytes.
+
+  @retval TRUE          FvImage buffer is at its required alignment.
+  @retval FALSE         FvImage buffer is not at its required alignment.
+
+**/
+BOOLEAN
+InternalCheckFvAlignment (
+  IN EFI_PHYSICAL_ADDRESS       BaseAddress,
+  IN UINT64                     Length
+  )
+{
+  EFI_FIRMWARE_VOLUME_HEADER    *FwVolHeader;
+  UINT32                        FvAlignment;
+
+  FvAlignment = 0;
+  FwVolHeader = (EFI_FIRMWARE_VOLUME_HEADER *) (UINTN) BaseAddress;
+
+  //
+  // If EFI_FVB2_WEAK_ALIGNMENT is set in the volume header then the first byte of the volume
+  // can be aligned on any power-of-two boundary. A weakly aligned volume can not be moved from
+  // its initial linked location and maintain its alignment.
+  //
+  if ((FwVolHeader->Attributes & EFI_FVB2_WEAK_ALIGNMENT) != EFI_FVB2_WEAK_ALIGNMENT) {
+    //
+    // Get FvHeader alignment
+    //
+    FvAlignment = 1 << ((FwVolHeader->Attributes & EFI_FVB2_ALIGNMENT) >> 16);
+    //
+    // FvAlignment must be greater than or equal to 8 bytes of the minimum FFS alignment value.
+    //
+    if (FvAlignment < 8) {
+      FvAlignment = 8;
+    }
+    if ((UINTN)BaseAddress % FvAlignment != 0) {
+      //
+      // FvImage buffer is not at its required alignment.
+      //
+      DEBUG ((
+        DEBUG_ERROR,
+        "Unaligned FvImage found at 0x%lx:0x%lx, the required alignment is 0x%x\n",
+        BaseAddress,
+        Length,
+        FvAlignment
+        ));
+      return FALSE;
+    }
+  }
+
+  return TRUE;
+}
+
+/**
   Builds a Firmware Volume HOB.
 
   This function builds a Firmware Volume HOB.
@@ -483,6 +539,7 @@ BuildGuidDataHob (
   for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.
   
   If there is no additional space for HOB creation, then ASSERT().
+  If the FvImage buffer is not at its required alignment, then ASSERT().
 
   @param  BaseAddress   The base address of the Firmware Volume.
   @param  Length        The size of the Firmware Volume in bytes.
@@ -497,6 +554,11 @@ BuildFvHob (
 {
   EFI_HOB_FIRMWARE_VOLUME  *Hob;
 
+  if (!InternalCheckFvAlignment (BaseAddress, Length)) {
+    ASSERT (FALSE);
+    return;
+  }
+
   Hob = InternalPeiCreateHob (EFI_HOB_TYPE_FV, (UINT16) sizeof (EFI_HOB_FIRMWARE_VOLUME));
   if (Hob == NULL) {
     return;
@@ -514,6 +576,7 @@ BuildFvHob (
   for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.
   
   If there is no additional space for HOB creation, then ASSERT().
+  If the FvImage buffer is not at its required alignment, then ASSERT().
 
   @param  BaseAddress   The base address of the Firmware Volume.
   @param  Length        The size of the Firmware Volume in bytes.
@@ -532,6 +595,11 @@ BuildFv2Hob (
 {
   EFI_HOB_FIRMWARE_VOLUME2  *Hob;
 
+  if (!InternalCheckFvAlignment (BaseAddress, Length)) {
+    ASSERT (FALSE);
+    return;
+  }
+
   Hob = InternalPeiCreateHob (EFI_HOB_TYPE_FV2, (UINT16) sizeof (EFI_HOB_FIRMWARE_VOLUME2));
   if (Hob == NULL) {
     return;
-- 
2.7.0.windows.1



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

* [PATCH V2 3/3] ArmVirtPkg DxeHobLib: Update func header description of BuildFv(2)Hob()
  2016-11-16  2:17 [PATCH V2 0/3] HobLib: Check FV alignment when building FV HOB Star Zeng
  2016-11-16  2:17 ` [PATCH V2 1/3] MdePkg " Star Zeng
  2016-11-16  2:17 ` [PATCH V2 2/3] IntelFrameworkPkg PeiHobLib: " Star Zeng
@ 2016-11-16  2:17 ` Star Zeng
  2016-11-16 11:26   ` Ard Biesheuvel
  2016-11-16  3:51 ` [PATCH V2 0/3] HobLib: Check FV alignment when building FV HOB Yao, Jiewen
                   ` (2 subsequent siblings)
  5 siblings, 1 reply; 8+ messages in thread
From: Star Zeng @ 2016-11-16  2:17 UTC (permalink / raw)
  To: edk2-devel
  Cc: Star Zeng, Jiewen Yao, Liming Gao, Michael D Kinney, Laszlo Ersek,
	Ard Biesheuvel

Update the function header description of BuildFv(2)Hob() to match
with HobLib.h in MdePkg.

Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=205

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Star Zeng <star.zeng@intel.com>
---
 ArmVirtPkg/Library/ArmVirtDxeHobLib/HobLib.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/ArmVirtPkg/Library/ArmVirtDxeHobLib/HobLib.c b/ArmVirtPkg/Library/ArmVirtDxeHobLib/HobLib.c
index 81196b207d1e..9e617b8e6991 100644
--- a/ArmVirtPkg/Library/ArmVirtDxeHobLib/HobLib.c
+++ b/ArmVirtPkg/Library/ArmVirtDxeHobLib/HobLib.c
@@ -1,7 +1,7 @@
 /** @file
   HOB Library implemenation for Dxe Phase with DebugLib dependency removed
 
-Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>
 Copyright (c) 2014, Linaro Ltd. All rights reserved.<BR>
 This program and the accompanying materials
 are licensed and made available under the terms and conditions of the BSD License
@@ -395,6 +395,7 @@ BuildGuidDataHob (
   for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.
 
   If there is no additional space for HOB creation, then ASSERT().
+  If the FvImage buffer is not at its required alignment, then ASSERT().
 
   @param  BaseAddress   The base address of the Firmware Volume.
   @param  Length        The size of the Firmware Volume in bytes.
@@ -421,6 +422,7 @@ BuildFvHob (
   for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.
 
   If there is no additional space for HOB creation, then ASSERT().
+  If the FvImage buffer is not at its required alignment, then ASSERT().
 
   @param  BaseAddress   The base address of the Firmware Volume.
   @param  Length        The size of the Firmware Volume in bytes.
-- 
2.7.0.windows.1



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

* Re: [PATCH V2 0/3] HobLib: Check FV alignment when building FV HOB
  2016-11-16  2:17 [PATCH V2 0/3] HobLib: Check FV alignment when building FV HOB Star Zeng
                   ` (2 preceding siblings ...)
  2016-11-16  2:17 ` [PATCH V2 3/3] ArmVirtPkg DxeHobLib: Update func header description of BuildFv(2)Hob() Star Zeng
@ 2016-11-16  3:51 ` Yao, Jiewen
  2016-11-16  4:53 ` Gao, Liming
  2016-11-16 17:04 ` Laszlo Ersek
  5 siblings, 0 replies; 8+ messages in thread
From: Yao, Jiewen @ 2016-11-16  3:51 UTC (permalink / raw)
  To: Zeng, Star, edk2-devel@lists.01.org
  Cc: Gao, Liming, Kinney, Michael D, Fan, Jeff, Laszlo Ersek,
	Ard Biesheuvel

Reviewed-by: jiewen.yao@intel.com

> -----Original Message-----
> From: Zeng, Star
> Sent: Wednesday, November 16, 2016 10:18 AM
> To: edk2-devel@lists.01.org
> Cc: Zeng, Star <star.zeng@intel.com>; Yao, Jiewen <jiewen.yao@intel.com>;
> Gao, Liming <liming.gao@intel.com>; Kinney, Michael D
> <michael.d.kinney@intel.com>; Fan, Jeff <jeff.fan@intel.com>; Laszlo Ersek
> <lersek@redhat.com>; Ard Biesheuvel <ard.biesheuvel@linaro.org>
> Subject: [PATCH V2 0/3] HobLib: Check FV alignment when building FV HOB
> 
> If the FvImage buffer is not at its required alignment, then ASSERT().
> Also update the function header description of BuildFv(2)Hob()
> correspondingly.
> 
> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=205
> 
> V2:
> If the FvImage buffer is not at its required alignment, then ASSERT().
> 
> Cc: Jiewen Yao <jiewen.yao@intel.com>
> Cc: Liming Gao <liming.gao@intel.com>
> Cc: Michael D Kinney <michael.d.kinney@intel.com>
> Cc: Jeff Fan <jeff.fan@intel.com>
> Cc: Laszlo Ersek <lersek@redhat.com>
> Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> 
> Star Zeng (3):
>   MdePkg HobLib: Check FV alignment when building FV HOB
>   IntelFrameworkPkg PeiHobLib: Check FV alignment when building FV HOB
>   ArmVirtPkg DxeHobLib: Update func header description of
>     BuildFv(2)Hob()
> 
>  ArmVirtPkg/Library/ArmVirtDxeHobLib/HobLib.c       |  4 +-
>  .../Library/PeiHobLibFramework/HobLib.c            | 70
> +++++++++++++++++++++-
>  MdePkg/Include/Library/HobLib.h                    |  4 +-
>  MdePkg/Library/DxeCoreHobLib/HobLib.c              |  4 +-
>  MdePkg/Library/DxeHobLib/HobLib.c                  |  4 +-
>  MdePkg/Library/PeiHobLib/HobLib.c                  | 70
> +++++++++++++++++++++-
>  6 files changed, 150 insertions(+), 6 deletions(-)
> 
> --
> 2.7.0.windows.1



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

* Re: [PATCH V2 0/3] HobLib: Check FV alignment when building FV HOB
  2016-11-16  2:17 [PATCH V2 0/3] HobLib: Check FV alignment when building FV HOB Star Zeng
                   ` (3 preceding siblings ...)
  2016-11-16  3:51 ` [PATCH V2 0/3] HobLib: Check FV alignment when building FV HOB Yao, Jiewen
@ 2016-11-16  4:53 ` Gao, Liming
  2016-11-16 17:04 ` Laszlo Ersek
  5 siblings, 0 replies; 8+ messages in thread
From: Gao, Liming @ 2016-11-16  4:53 UTC (permalink / raw)
  To: Zeng, Star, edk2-devel@lists.01.org
  Cc: Yao, Jiewen, Kinney, Michael D, Fan, Jeff, Laszlo Ersek,
	Ard Biesheuvel

Reviewed-by: Liming Gao <liming.gao@intel.com>

> -----Original Message-----
> From: Zeng, Star
> Sent: Wednesday, November 16, 2016 10:18 AM
> To: edk2-devel@lists.01.org
> Cc: Zeng, Star <star.zeng@intel.com>; Yao, Jiewen <jiewen.yao@intel.com>;
> Gao, Liming <liming.gao@intel.com>; Kinney, Michael D
> <michael.d.kinney@intel.com>; Fan, Jeff <jeff.fan@intel.com>; Laszlo Ersek
> <lersek@redhat.com>; Ard Biesheuvel <ard.biesheuvel@linaro.org>
> Subject: [PATCH V2 0/3] HobLib: Check FV alignment when building FV HOB
> 
> If the FvImage buffer is not at its required alignment, then ASSERT().
> Also update the function header description of BuildFv(2)Hob()
> correspondingly.
> 
> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=205
> 
> V2:
> If the FvImage buffer is not at its required alignment, then ASSERT().
> 
> Cc: Jiewen Yao <jiewen.yao@intel.com>
> Cc: Liming Gao <liming.gao@intel.com>
> Cc: Michael D Kinney <michael.d.kinney@intel.com>
> Cc: Jeff Fan <jeff.fan@intel.com>
> Cc: Laszlo Ersek <lersek@redhat.com>
> Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> 
> Star Zeng (3):
>   MdePkg HobLib: Check FV alignment when building FV HOB
>   IntelFrameworkPkg PeiHobLib: Check FV alignment when building FV HOB
>   ArmVirtPkg DxeHobLib: Update func header description of
>     BuildFv(2)Hob()
> 
>  ArmVirtPkg/Library/ArmVirtDxeHobLib/HobLib.c       |  4 +-
>  .../Library/PeiHobLibFramework/HobLib.c            | 70
> +++++++++++++++++++++-
>  MdePkg/Include/Library/HobLib.h                    |  4 +-
>  MdePkg/Library/DxeCoreHobLib/HobLib.c              |  4 +-
>  MdePkg/Library/DxeHobLib/HobLib.c                  |  4 +-
>  MdePkg/Library/PeiHobLib/HobLib.c                  | 70
> +++++++++++++++++++++-
>  6 files changed, 150 insertions(+), 6 deletions(-)
> 
> --
> 2.7.0.windows.1



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

* Re: [PATCH V2 3/3] ArmVirtPkg DxeHobLib: Update func header description of BuildFv(2)Hob()
  2016-11-16  2:17 ` [PATCH V2 3/3] ArmVirtPkg DxeHobLib: Update func header description of BuildFv(2)Hob() Star Zeng
@ 2016-11-16 11:26   ` Ard Biesheuvel
  0 siblings, 0 replies; 8+ messages in thread
From: Ard Biesheuvel @ 2016-11-16 11:26 UTC (permalink / raw)
  To: Star Zeng
  Cc: edk2-devel-01, Jiewen Yao, Liming Gao, Michael D Kinney,
	Laszlo Ersek

On 16 November 2016 at 02:17, Star Zeng <star.zeng@intel.com> wrote:
> Update the function header description of BuildFv(2)Hob() to match
> with HobLib.h in MdePkg.
>
> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=205
>
> Cc: Jiewen Yao <jiewen.yao@intel.com>
> Cc: Liming Gao <liming.gao@intel.com>
> Cc: Michael D Kinney <michael.d.kinney@intel.com>
> Cc: Laszlo Ersek <lersek@redhat.com>
> Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Star Zeng <star.zeng@intel.com>

Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>

> ---
>  ArmVirtPkg/Library/ArmVirtDxeHobLib/HobLib.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/ArmVirtPkg/Library/ArmVirtDxeHobLib/HobLib.c b/ArmVirtPkg/Library/ArmVirtDxeHobLib/HobLib.c
> index 81196b207d1e..9e617b8e6991 100644
> --- a/ArmVirtPkg/Library/ArmVirtDxeHobLib/HobLib.c
> +++ b/ArmVirtPkg/Library/ArmVirtDxeHobLib/HobLib.c
> @@ -1,7 +1,7 @@
>  /** @file
>    HOB Library implemenation for Dxe Phase with DebugLib dependency removed
>
> -Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
> +Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>
>  Copyright (c) 2014, Linaro Ltd. All rights reserved.<BR>
>  This program and the accompanying materials
>  are licensed and made available under the terms and conditions of the BSD License
> @@ -395,6 +395,7 @@ BuildGuidDataHob (
>    for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.
>
>    If there is no additional space for HOB creation, then ASSERT().
> +  If the FvImage buffer is not at its required alignment, then ASSERT().
>
>    @param  BaseAddress   The base address of the Firmware Volume.
>    @param  Length        The size of the Firmware Volume in bytes.
> @@ -421,6 +422,7 @@ BuildFvHob (
>    for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.
>
>    If there is no additional space for HOB creation, then ASSERT().
> +  If the FvImage buffer is not at its required alignment, then ASSERT().
>
>    @param  BaseAddress   The base address of the Firmware Volume.
>    @param  Length        The size of the Firmware Volume in bytes.
> --
> 2.7.0.windows.1
>


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

* Re: [PATCH V2 0/3] HobLib: Check FV alignment when building FV HOB
  2016-11-16  2:17 [PATCH V2 0/3] HobLib: Check FV alignment when building FV HOB Star Zeng
                   ` (4 preceding siblings ...)
  2016-11-16  4:53 ` Gao, Liming
@ 2016-11-16 17:04 ` Laszlo Ersek
  5 siblings, 0 replies; 8+ messages in thread
From: Laszlo Ersek @ 2016-11-16 17:04 UTC (permalink / raw)
  To: Star Zeng, edk2-devel
  Cc: Ard Biesheuvel, Liming Gao, Jiewen Yao, Michael D Kinney,
	Jeff Fan

On 11/16/16 03:17, Star Zeng wrote:
> If the FvImage buffer is not at its required alignment, then ASSERT().
> Also update the function header description of BuildFv(2)Hob()
> correspondingly.
> 
> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=205
> 
> V2:
> If the FvImage buffer is not at its required alignment, then ASSERT().
> 
> Cc: Jiewen Yao <jiewen.yao@intel.com>
> Cc: Liming Gao <liming.gao@intel.com>
> Cc: Michael D Kinney <michael.d.kinney@intel.com>
> Cc: Jeff Fan <jeff.fan@intel.com>
> Cc: Laszlo Ersek <lersek@redhat.com>
> Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> 
> Star Zeng (3):
>   MdePkg HobLib: Check FV alignment when building FV HOB
>   IntelFrameworkPkg PeiHobLib: Check FV alignment when building FV HOB
>   ArmVirtPkg DxeHobLib: Update func header description of
>     BuildFv(2)Hob()
> 
>  ArmVirtPkg/Library/ArmVirtDxeHobLib/HobLib.c       |  4 +-
>  .../Library/PeiHobLibFramework/HobLib.c            | 70 +++++++++++++++++++++-
>  MdePkg/Include/Library/HobLib.h                    |  4 +-
>  MdePkg/Library/DxeCoreHobLib/HobLib.c              |  4 +-
>  MdePkg/Library/DxeHobLib/HobLib.c                  |  4 +-
>  MdePkg/Library/PeiHobLib/HobLib.c                  | 70 +++++++++++++++++++++-
>  6 files changed, 150 insertions(+), 6 deletions(-)
> 

patches #1 and #3:

Regression-tested-by: Laszlo Ersek <lersek@redhat.com>

Thanks
Laszlo


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

end of thread, other threads:[~2016-11-16 17:04 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-11-16  2:17 [PATCH V2 0/3] HobLib: Check FV alignment when building FV HOB Star Zeng
2016-11-16  2:17 ` [PATCH V2 1/3] MdePkg " Star Zeng
2016-11-16  2:17 ` [PATCH V2 2/3] IntelFrameworkPkg PeiHobLib: " Star Zeng
2016-11-16  2:17 ` [PATCH V2 3/3] ArmVirtPkg DxeHobLib: Update func header description of BuildFv(2)Hob() Star Zeng
2016-11-16 11:26   ` Ard Biesheuvel
2016-11-16  3:51 ` [PATCH V2 0/3] HobLib: Check FV alignment when building FV HOB Yao, Jiewen
2016-11-16  4:53 ` Gao, Liming
2016-11-16 17:04 ` Laszlo Ersek

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