public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [Patch] MdeModulePkg/DxeCapsuleLibFmp: Verify nested capsule with FMP
@ 2018-02-07 18:49 Kinney, Michael D
  2018-02-08  0:17 ` Yao, Jiewen
  0 siblings, 1 reply; 4+ messages in thread
From: Kinney, Michael D @ 2018-02-07 18:49 UTC (permalink / raw)
  To: edk2-devel; +Cc: Jiewen Yao, Star Zeng, Eric Dong, Michael D Kinney

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

Update IsNestedFmpCapsule() to verify the CapsuleGuid in
the CapsuleHeader against the installed Firmware Management
Protocol instances.  The current logic that uses the ESRT
Table does not work because capsules are processed before
the ESRT Table is published at the Ready To Boot event.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
---
 .../Library/DxeCapsuleLibFmp/DxeCapsuleLib.c       | 27 ++++++++++++----------
 .../Library/DxeCapsuleLibFmp/DxeCapsuleLib.inf     |  3 +--
 2 files changed, 16 insertions(+), 14 deletions(-)

diff --git a/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.c b/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.c
index 2f397789b5..87e1deec03 100644
--- a/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.c
+++ b/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.c
@@ -10,7 +10,7 @@
   ValidateFmpCapsule(), DisplayCapsuleImage(), ConvertBmpToGopBlt() will
   receive untrusted input and do basic validation.
 
-  Copyright (c) 2016 - 2017, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2016 - 2018, 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
@@ -1446,7 +1446,6 @@ IsNestedFmpCapsule (
   )
 {
   EFI_STATUS                 Status;
-  EFI_SYSTEM_RESOURCE_TABLE  *Esrt;
   EFI_SYSTEM_RESOURCE_ENTRY  *EsrtEntry;
   UINTN                      Index;
   BOOLEAN                    EsrtGuidFound;
@@ -1454,6 +1453,8 @@ IsNestedFmpCapsule (
   UINTN                      NestedCapsuleSize;
   ESRT_MANAGEMENT_PROTOCOL   *EsrtProtocol;
   EFI_SYSTEM_RESOURCE_ENTRY  Entry;
+  EFI_HANDLE                 *HandleBuffer;
+  UINTN                      NumberOfHandles;
 
   EsrtGuidFound = FALSE;
   if (mIsVirtualAddrConverted) {
@@ -1479,19 +1480,21 @@ IsNestedFmpCapsule (
     }
 
     //
-    // Check ESRT configuration table
+    // Check Firmware Management Protocols
     //
     if (!EsrtGuidFound) {
-      Status = EfiGetSystemConfigurationTable(&gEfiSystemResourceTableGuid, (VOID **)&Esrt);
+      HandleBuffer = NULL;
+      Status = GetFmpHandleBufferByType (
+                 &CapsuleHeader->CapsuleGuid,
+                 0,
+                 &NumberOfHandles,
+                 &HandleBuffer
+                 );
       if (!EFI_ERROR(Status)) {
-        ASSERT (Esrt != NULL);
-        EsrtEntry = (VOID *)(Esrt + 1);
-        for (Index = 0; Index < Esrt->FwResourceCount; Index++, EsrtEntry++) {
-          if (CompareGuid(&EsrtEntry->FwClass, &CapsuleHeader->CapsuleGuid)) {
-            EsrtGuidFound = TRUE;
-            break;
-          }
-        }
+        EsrtGuidFound = TRUE;
+      }
+      if (HandleBuffer != NULL) {
+        FreePool (HandleBuffer);
       }
     }
   }
diff --git a/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.inf b/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.inf
index a7c36993c4..90edc52ee0 100644
--- a/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.inf
+++ b/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.inf
@@ -3,7 +3,7 @@
 #
 #  Capsule library instance for DXE_DRIVER module types.
 #
-#  Copyright (c) 2016 - 2017, Intel Corporation. All rights reserved.<BR>
+#  Copyright (c) 2016 - 2018, 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
@@ -72,7 +72,6 @@
 [Guids]
   gEfiFmpCapsuleGuid                      ## SOMETIMES_CONSUMES ## GUID
   gWindowsUxCapsuleGuid                   ## SOMETIMES_CONSUMES ## GUID
-  gEfiSystemResourceTableGuid             ## SOMETIMES_CONSUMES ## GUID
   ## SOMETIMES_CONSUMES ## Variable:L"CapsuleMax"
   ## SOMETIMES_PRODUCES ## Variable:L"CapsuleMax"
   gEfiCapsuleReportGuid
-- 
2.14.2.windows.3



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

* Re: [Patch] MdeModulePkg/DxeCapsuleLibFmp: Verify nested capsule with FMP
  2018-02-07 18:49 [Patch] MdeModulePkg/DxeCapsuleLibFmp: Verify nested capsule with FMP Kinney, Michael D
@ 2018-02-08  0:17 ` Yao, Jiewen
  2018-02-08  5:32   ` Zeng, Star
  0 siblings, 1 reply; 4+ messages in thread
From: Yao, Jiewen @ 2018-02-08  0:17 UTC (permalink / raw)
  To: Kinney, Michael D, edk2-devel@lists.01.org; +Cc: Zeng, Star, Dong, Eric

Reviewed-by: Jiewen.yao@intel.com

> -----Original Message-----
> From: Kinney, Michael D
> Sent: Thursday, February 8, 2018 2:50 AM
> To: edk2-devel@lists.01.org
> Cc: Yao, Jiewen <jiewen.yao@intel.com>; Zeng, Star <star.zeng@intel.com>;
> Dong, Eric <eric.dong@intel.com>; Kinney, Michael D
> <michael.d.kinney@intel.com>
> Subject: [Patch] MdeModulePkg/DxeCapsuleLibFmp: Verify nested capsule with
> FMP
> 
> https://bugzilla.tianocore.org/show_bug.cgi?id=873
> 
> Update IsNestedFmpCapsule() to verify the CapsuleGuid in
> the CapsuleHeader against the installed Firmware Management
> Protocol instances.  The current logic that uses the ESRT
> Table does not work because capsules are processed before
> the ESRT Table is published at the Ready To Boot event.
> 
> Cc: Jiewen Yao <jiewen.yao@intel.com>
> Cc: Star Zeng <star.zeng@intel.com>
> Cc: Eric Dong <eric.dong@intel.com>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
> ---
>  .../Library/DxeCapsuleLibFmp/DxeCapsuleLib.c       | 27
> ++++++++++++----------
>  .../Library/DxeCapsuleLibFmp/DxeCapsuleLib.inf     |  3 +--
>  2 files changed, 16 insertions(+), 14 deletions(-)
> 
> diff --git a/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.c
> b/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.c
> index 2f397789b5..87e1deec03 100644
> --- a/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.c
> +++ b/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.c
> @@ -10,7 +10,7 @@
>    ValidateFmpCapsule(), DisplayCapsuleImage(), ConvertBmpToGopBlt() will
>    receive untrusted input and do basic validation.
> 
> -  Copyright (c) 2016 - 2017, Intel Corporation. All rights reserved.<BR>
> +  Copyright (c) 2016 - 2018, 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
> @@ -1446,7 +1446,6 @@ IsNestedFmpCapsule (
>    )
>  {
>    EFI_STATUS                 Status;
> -  EFI_SYSTEM_RESOURCE_TABLE  *Esrt;
>    EFI_SYSTEM_RESOURCE_ENTRY  *EsrtEntry;
>    UINTN                      Index;
>    BOOLEAN                    EsrtGuidFound;
> @@ -1454,6 +1453,8 @@ IsNestedFmpCapsule (
>    UINTN                      NestedCapsuleSize;
>    ESRT_MANAGEMENT_PROTOCOL   *EsrtProtocol;
>    EFI_SYSTEM_RESOURCE_ENTRY  Entry;
> +  EFI_HANDLE                 *HandleBuffer;
> +  UINTN                      NumberOfHandles;
> 
>    EsrtGuidFound = FALSE;
>    if (mIsVirtualAddrConverted) {
> @@ -1479,19 +1480,21 @@ IsNestedFmpCapsule (
>      }
> 
>      //
> -    // Check ESRT configuration table
> +    // Check Firmware Management Protocols
>      //
>      if (!EsrtGuidFound) {
> -      Status = EfiGetSystemConfigurationTable(&gEfiSystemResourceTableGuid,
> (VOID **)&Esrt);
> +      HandleBuffer = NULL;
> +      Status = GetFmpHandleBufferByType (
> +                 &CapsuleHeader->CapsuleGuid,
> +                 0,
> +                 &NumberOfHandles,
> +                 &HandleBuffer
> +                 );
>        if (!EFI_ERROR(Status)) {
> -        ASSERT (Esrt != NULL);
> -        EsrtEntry = (VOID *)(Esrt + 1);
> -        for (Index = 0; Index < Esrt->FwResourceCount; Index++, EsrtEntry++)
> {
> -          if (CompareGuid(&EsrtEntry->FwClass,
> &CapsuleHeader->CapsuleGuid)) {
> -            EsrtGuidFound = TRUE;
> -            break;
> -          }
> -        }
> +        EsrtGuidFound = TRUE;
> +      }
> +      if (HandleBuffer != NULL) {
> +        FreePool (HandleBuffer);
>        }
>      }
>    }
> diff --git a/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.inf
> b/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.inf
> index a7c36993c4..90edc52ee0 100644
> --- a/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.inf
> +++ b/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.inf
> @@ -3,7 +3,7 @@
>  #
>  #  Capsule library instance for DXE_DRIVER module types.
>  #
> -#  Copyright (c) 2016 - 2017, Intel Corporation. All rights reserved.<BR>
> +#  Copyright (c) 2016 - 2018, 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
> @@ -72,7 +72,6 @@
>  [Guids]
>    gEfiFmpCapsuleGuid                      ## SOMETIMES_CONSUMES
> ## GUID
>    gWindowsUxCapsuleGuid                   ## SOMETIMES_CONSUMES
> ## GUID
> -  gEfiSystemResourceTableGuid             ## SOMETIMES_CONSUMES ##
> GUID
>    ## SOMETIMES_CONSUMES ## Variable:L"CapsuleMax"
>    ## SOMETIMES_PRODUCES ## Variable:L"CapsuleMax"
>    gEfiCapsuleReportGuid
> --
> 2.14.2.windows.3



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

* Re: [Patch] MdeModulePkg/DxeCapsuleLibFmp: Verify nested capsule with FMP
  2018-02-08  0:17 ` Yao, Jiewen
@ 2018-02-08  5:32   ` Zeng, Star
  2018-02-11  0:18     ` Bret Barkelew
  0 siblings, 1 reply; 4+ messages in thread
From: Zeng, Star @ 2018-02-08  5:32 UTC (permalink / raw)
  To: Yao, Jiewen, Kinney, Michael D, edk2-devel@lists.01.org
  Cc: Dong, Eric, Zeng, Star

Reviewed-by: Star Zeng <star.zeng@intel.com>

Thanks,
Star
-----Original Message-----
From: Yao, Jiewen 
Sent: Thursday, February 8, 2018 8:18 AM
To: Kinney, Michael D <michael.d.kinney@intel.com>; edk2-devel@lists.01.org
Cc: Zeng, Star <star.zeng@intel.com>; Dong, Eric <eric.dong@intel.com>
Subject: RE: [Patch] MdeModulePkg/DxeCapsuleLibFmp: Verify nested capsule with FMP

Reviewed-by: Jiewen.yao@intel.com

> -----Original Message-----
> From: Kinney, Michael D
> Sent: Thursday, February 8, 2018 2:50 AM
> To: edk2-devel@lists.01.org
> Cc: Yao, Jiewen <jiewen.yao@intel.com>; Zeng, Star 
> <star.zeng@intel.com>; Dong, Eric <eric.dong@intel.com>; Kinney, 
> Michael D <michael.d.kinney@intel.com>
> Subject: [Patch] MdeModulePkg/DxeCapsuleLibFmp: Verify nested capsule 
> with FMP
> 
> https://bugzilla.tianocore.org/show_bug.cgi?id=873
> 
> Update IsNestedFmpCapsule() to verify the CapsuleGuid in the 
> CapsuleHeader against the installed Firmware Management Protocol 
> instances.  The current logic that uses the ESRT Table does not work 
> because capsules are processed before the ESRT Table is published at 
> the Ready To Boot event.
> 
> Cc: Jiewen Yao <jiewen.yao@intel.com>
> Cc: Star Zeng <star.zeng@intel.com>
> Cc: Eric Dong <eric.dong@intel.com>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
> ---
>  .../Library/DxeCapsuleLibFmp/DxeCapsuleLib.c       | 27
> ++++++++++++----------
>  .../Library/DxeCapsuleLibFmp/DxeCapsuleLib.inf     |  3 +--
>  2 files changed, 16 insertions(+), 14 deletions(-)
> 
> diff --git a/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.c
> b/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.c
> index 2f397789b5..87e1deec03 100644
> --- a/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.c
> +++ b/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.c
> @@ -10,7 +10,7 @@
>    ValidateFmpCapsule(), DisplayCapsuleImage(), ConvertBmpToGopBlt() will
>    receive untrusted input and do basic validation.
> 
> -  Copyright (c) 2016 - 2017, Intel Corporation. All rights 
> reserved.<BR>
> +  Copyright (c) 2016 - 2018, 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 @@ -1446,7 +1446,6 @@ IsNestedFmpCapsule (
>    )
>  {
>    EFI_STATUS                 Status;
> -  EFI_SYSTEM_RESOURCE_TABLE  *Esrt;
>    EFI_SYSTEM_RESOURCE_ENTRY  *EsrtEntry;
>    UINTN                      Index;
>    BOOLEAN                    EsrtGuidFound;
> @@ -1454,6 +1453,8 @@ IsNestedFmpCapsule (
>    UINTN                      NestedCapsuleSize;
>    ESRT_MANAGEMENT_PROTOCOL   *EsrtProtocol;
>    EFI_SYSTEM_RESOURCE_ENTRY  Entry;
> +  EFI_HANDLE                 *HandleBuffer;
> +  UINTN                      NumberOfHandles;
> 
>    EsrtGuidFound = FALSE;
>    if (mIsVirtualAddrConverted) {
> @@ -1479,19 +1480,21 @@ IsNestedFmpCapsule (
>      }
> 
>      //
> -    // Check ESRT configuration table
> +    // Check Firmware Management Protocols
>      //
>      if (!EsrtGuidFound) {
> -      Status = EfiGetSystemConfigurationTable(&gEfiSystemResourceTableGuid,
> (VOID **)&Esrt);
> +      HandleBuffer = NULL;
> +      Status = GetFmpHandleBufferByType (
> +                 &CapsuleHeader->CapsuleGuid,
> +                 0,
> +                 &NumberOfHandles,
> +                 &HandleBuffer
> +                 );
>        if (!EFI_ERROR(Status)) {
> -        ASSERT (Esrt != NULL);
> -        EsrtEntry = (VOID *)(Esrt + 1);
> -        for (Index = 0; Index < Esrt->FwResourceCount; Index++, EsrtEntry++)
> {
> -          if (CompareGuid(&EsrtEntry->FwClass,
> &CapsuleHeader->CapsuleGuid)) {
> -            EsrtGuidFound = TRUE;
> -            break;
> -          }
> -        }
> +        EsrtGuidFound = TRUE;
> +      }
> +      if (HandleBuffer != NULL) {
> +        FreePool (HandleBuffer);
>        }
>      }
>    }
> diff --git a/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.inf
> b/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.inf
> index a7c36993c4..90edc52ee0 100644
> --- a/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.inf
> +++ b/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.inf
> @@ -3,7 +3,7 @@
>  #
>  #  Capsule library instance for DXE_DRIVER module types.
>  #
> -#  Copyright (c) 2016 - 2017, Intel Corporation. All rights 
> reserved.<BR>
> +#  Copyright (c) 2016 - 2018, 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 @@ -72,7 +72,6 @@  [Guids]
>    gEfiFmpCapsuleGuid                      ## SOMETIMES_CONSUMES
> ## GUID
>    gWindowsUxCapsuleGuid                   ## SOMETIMES_CONSUMES
> ## GUID
> -  gEfiSystemResourceTableGuid             ## SOMETIMES_CONSUMES ##
> GUID
>    ## SOMETIMES_CONSUMES ## Variable:L"CapsuleMax"
>    ## SOMETIMES_PRODUCES ## Variable:L"CapsuleMax"
>    gEfiCapsuleReportGuid
> --
> 2.14.2.windows.3



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

* Re: [Patch] MdeModulePkg/DxeCapsuleLibFmp: Verify nested capsule with FMP
  2018-02-08  5:32   ` Zeng, Star
@ 2018-02-11  0:18     ` Bret Barkelew
  0 siblings, 0 replies; 4+ messages in thread
From: Bret Barkelew @ 2018-02-11  0:18 UTC (permalink / raw)
  To: Zeng, Star, Yao, Jiewen, Kinney, Michael D,
	edk2-devel@lists.01.org
  Cc: Dong, Eric, Zeng, Star

Approved.
Reviewed-By: Bret Barkelew Bret.Barkelew@microsoft.com

- Bret

From: Zeng, Star<mailto:star.zeng@intel.com>
Sent: Wednesday, February 7, 2018 9:32 PM
To: Yao, Jiewen<mailto:jiewen.yao@intel.com>; Kinney, Michael D<mailto:michael.d.kinney@intel.com>; edk2-devel@lists.01.org<mailto:edk2-devel@lists.01.org>
Cc: Dong, Eric<mailto:eric.dong@intel.com>; Zeng, Star<mailto:star.zeng@intel.com>
Subject: Re: [edk2] [Patch] MdeModulePkg/DxeCapsuleLibFmp: Verify nested capsule with FMP

Reviewed-by: Star Zeng <star.zeng@intel.com>

Thanks,
Star
-----Original Message-----
From: Yao, Jiewen
Sent: Thursday, February 8, 2018 8:18 AM
To: Kinney, Michael D <michael.d.kinney@intel.com>; edk2-devel@lists.01.org
Cc: Zeng, Star <star.zeng@intel.com>; Dong, Eric <eric.dong@intel.com>
Subject: RE: [Patch] MdeModulePkg/DxeCapsuleLibFmp: Verify nested capsule with FMP

Reviewed-by: Jiewen.yao@intel.com

> -----Original Message-----
> From: Kinney, Michael D
> Sent: Thursday, February 8, 2018 2:50 AM
> To: edk2-devel@lists.01.org
> Cc: Yao, Jiewen <jiewen.yao@intel.com>; Zeng, Star
> <star.zeng@intel.com>; Dong, Eric <eric.dong@intel.com>; Kinney,
> Michael D <michael.d.kinney@intel.com>
> Subject: [Patch] MdeModulePkg/DxeCapsuleLibFmp: Verify nested capsule
> with FMP
>
> https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fbugzilla.tianocore.org%2Fshow_bug.cgi%3Fid%3D873&data=04%7C01%7CBret.Barkelew%40microsoft.com%7C9749c74b4d5b469499c208d56eb55fa0%7Cee3303d7fb734b0c8589bcd847f1c277%7C1%7C1%7C636536647662871396%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwifQ%3D%3D%7C-1&sdata=G%2FH4%2BZYbZgDfCKZHW%2FoQ5DzcMS1q0zL%2FYp26NhnEz7o%3D&reserved=0
>
> Update IsNestedFmpCapsule() to verify the CapsuleGuid in the
> CapsuleHeader against the installed Firmware Management Protocol
> instances.  The current logic that uses the ESRT Table does not work
> because capsules are processed before the ESRT Table is published at
> the Ready To Boot event.
>
> Cc: Jiewen Yao <jiewen.yao@intel.com>
> Cc: Star Zeng <star.zeng@intel.com>
> Cc: Eric Dong <eric.dong@intel.com>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
> ---
>  .../Library/DxeCapsuleLibFmp/DxeCapsuleLib.c       | 27
> ++++++++++++----------
>  .../Library/DxeCapsuleLibFmp/DxeCapsuleLib.inf     |  3 +--
>  2 files changed, 16 insertions(+), 14 deletions(-)
>
> diff --git a/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.c
> b/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.c
> index 2f397789b5..87e1deec03 100644
> --- a/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.c
> +++ b/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.c
> @@ -10,7 +10,7 @@
>    ValidateFmpCapsule(), DisplayCapsuleImage(), ConvertBmpToGopBlt() will
>    receive untrusted input and do basic validation.
>
> -  Copyright (c) 2016 - 2017, Intel Corporation. All rights
> reserved.<BR>
> +  Copyright (c) 2016 - 2018, 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 @@ -1446,7 +1446,6 @@ IsNestedFmpCapsule (
>    )
>  {
>    EFI_STATUS                 Status;
> -  EFI_SYSTEM_RESOURCE_TABLE  *Esrt;
>    EFI_SYSTEM_RESOURCE_ENTRY  *EsrtEntry;
>    UINTN                      Index;
>    BOOLEAN                    EsrtGuidFound;
> @@ -1454,6 +1453,8 @@ IsNestedFmpCapsule (
>    UINTN                      NestedCapsuleSize;
>    ESRT_MANAGEMENT_PROTOCOL   *EsrtProtocol;
>    EFI_SYSTEM_RESOURCE_ENTRY  Entry;
> +  EFI_HANDLE                 *HandleBuffer;
> +  UINTN                      NumberOfHandles;
>
>    EsrtGuidFound = FALSE;
>    if (mIsVirtualAddrConverted) {
> @@ -1479,19 +1480,21 @@ IsNestedFmpCapsule (
>      }
>
>      //
> -    // Check ESRT configuration table
> +    // Check Firmware Management Protocols
>      //
>      if (!EsrtGuidFound) {
> -      Status = EfiGetSystemConfigurationTable(&gEfiSystemResourceTableGuid,
> (VOID **)&Esrt);
> +      HandleBuffer = NULL;
> +      Status = GetFmpHandleBufferByType (
> +                 &CapsuleHeader->CapsuleGuid,
> +                 0,
> +                 &NumberOfHandles,
> +                 &HandleBuffer
> +                 );
>        if (!EFI_ERROR(Status)) {
> -        ASSERT (Esrt != NULL);
> -        EsrtEntry = (VOID *)(Esrt + 1);
> -        for (Index = 0; Index < Esrt->FwResourceCount; Index++, EsrtEntry++)
> {
> -          if (CompareGuid(&EsrtEntry->FwClass,
> &CapsuleHeader->CapsuleGuid)) {
> -            EsrtGuidFound = TRUE;
> -            break;
> -          }
> -        }
> +        EsrtGuidFound = TRUE;
> +      }
> +      if (HandleBuffer != NULL) {
> +        FreePool (HandleBuffer);
>        }
>      }
>    }
> diff --git a/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.inf
> b/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.inf
> index a7c36993c4..90edc52ee0 100644
> --- a/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.inf
> +++ b/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.inf
> @@ -3,7 +3,7 @@
>  #
>  #  Capsule library instance for DXE_DRIVER module types.
>  #
> -#  Copyright (c) 2016 - 2017, Intel Corporation. All rights
> reserved.<BR>
> +#  Copyright (c) 2016 - 2018, 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 @@ -72,7 +72,6 @@  [Guids]
>    gEfiFmpCapsuleGuid                      ## SOMETIMES_CONSUMES
> ## GUID
>    gWindowsUxCapsuleGuid                   ## SOMETIMES_CONSUMES
> ## GUID
> -  gEfiSystemResourceTableGuid             ## SOMETIMES_CONSUMES ##
> GUID
>    ## SOMETIMES_CONSUMES ## Variable:L"CapsuleMax"
>    ## SOMETIMES_PRODUCES ## Variable:L"CapsuleMax"
>    gEfiCapsuleReportGuid
> --
> 2.14.2.windows.3

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.01.org%2Fmailman%2Flistinfo%2Fedk2-devel&data=04%7C01%7CBret.Barkelew%40microsoft.com%7C9749c74b4d5b469499c208d56eb55fa0%7Cee3303d7fb734b0c8589bcd847f1c277%7C1%7C1%7C636536647662871396%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwifQ%3D%3D%7C-1&sdata=%2BqMy3769Z%2FTYuSrFJDBvAsr5vCSahoUAFlVJ1cyQVqo%3D&reserved=0



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

end of thread, other threads:[~2018-02-11  0:12 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-02-07 18:49 [Patch] MdeModulePkg/DxeCapsuleLibFmp: Verify nested capsule with FMP Kinney, Michael D
2018-02-08  0:17 ` Yao, Jiewen
2018-02-08  5:32   ` Zeng, Star
2018-02-11  0:18     ` Bret Barkelew

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