[edk2] [PATCH] MdeModulePkg/PiSmmCore: Fix an assert issue in pool free

Jian J Wang posted 1 patch 6 years, 5 months ago
Failed in applying to current master (apply log)
MdeModulePkg/Core/PiSmmCore/Pool.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[edk2] [PATCH] MdeModulePkg/PiSmmCore: Fix an assert issue in pool free
Posted by Jian J Wang 6 years, 5 months ago
This issue is caused by assigning incorrect value to PoolHdr.Size
if the requested size is more than MAX_POOL_SIZE, because the SMM
core will actually allocate page memory instead of pool memory in
this situation.

Cc: Star Zeng <star.zeng@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Wu Hao <hao.a.wu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jian J Wang <jian.j.wang@intel.com>
---
 MdeModulePkg/Core/PiSmmCore/Pool.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/MdeModulePkg/Core/PiSmmCore/Pool.c b/MdeModulePkg/Core/PiSmmCore/Pool.c
index e77caa8853..e98ce01b0f 100644
--- a/MdeModulePkg/Core/PiSmmCore/Pool.c
+++ b/MdeModulePkg/Core/PiSmmCore/Pool.c
@@ -287,7 +287,7 @@ SmmInternalAllocatePool (
 
     PoolHdr = (POOL_HEADER*)(UINTN)Address;
     PoolHdr->Signature = POOL_HEAD_SIGNATURE;
-    PoolHdr->Size = Size;
+    PoolHdr->Size = EFI_PAGES_TO_SIZE (NoPages);
     PoolHdr->Available = FALSE;
     PoolHdr->Type = PoolType;
 
-- 
2.14.1.windows.1

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [PATCH] MdeModulePkg/PiSmmCore: Fix an assert issue in pool free
Posted by Zeng, Star 6 years, 5 months ago
Reviewed-by: Star Zeng <star.zeng@intel.com>

By the way, could you add comments in the commit log to say which commit is causing this issue?

Thanks,
Star
-----Original Message-----
From: Wang, Jian J 
Sent: Monday, November 20, 2017 10:42 AM
To: edk2-devel@lists.01.org
Cc: Zeng, Star <star.zeng@intel.com>; Dong, Eric <eric.dong@intel.com>; Wu, Hao A <hao.a.wu@intel.com>
Subject: [PATCH] MdeModulePkg/PiSmmCore: Fix an assert issue in pool free

This issue is caused by assigning incorrect value to PoolHdr.Size if the requested size is more than MAX_POOL_SIZE, because the SMM core will actually allocate page memory instead of pool memory in this situation.

Cc: Star Zeng <star.zeng@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Wu Hao <hao.a.wu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jian J Wang <jian.j.wang@intel.com>
---
 MdeModulePkg/Core/PiSmmCore/Pool.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/MdeModulePkg/Core/PiSmmCore/Pool.c b/MdeModulePkg/Core/PiSmmCore/Pool.c
index e77caa8853..e98ce01b0f 100644
--- a/MdeModulePkg/Core/PiSmmCore/Pool.c
+++ b/MdeModulePkg/Core/PiSmmCore/Pool.c
@@ -287,7 +287,7 @@ SmmInternalAllocatePool (
 
     PoolHdr = (POOL_HEADER*)(UINTN)Address;
     PoolHdr->Signature = POOL_HEAD_SIGNATURE;
-    PoolHdr->Size = Size;
+    PoolHdr->Size = EFI_PAGES_TO_SIZE (NoPages);
     PoolHdr->Available = FALSE;
     PoolHdr->Type = PoolType;
 
--
2.14.1.windows.1

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [PATCH] MdeModulePkg/PiSmmCore: Fix an assert issue in pool free
Posted by Wu, Hao A 6 years, 5 months ago
Tested-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Hao Wu <hao.a.wu@intel.com>


Best Regards,
Hao Wu


> -----Original Message-----
> From: Zeng, Star
> Sent: Monday, November 20, 2017 10:54 AM
> To: Wang, Jian J; edk2-devel@lists.01.org
> Cc: Dong, Eric; Wu, Hao A; Zeng, Star
> Subject: RE: [PATCH] MdeModulePkg/PiSmmCore: Fix an assert issue in pool
> free
> 
> Reviewed-by: Star Zeng <star.zeng@intel.com>
> 
> By the way, could you add comments in the commit log to say which commit is
> causing this issue?
> 
> Thanks,
> Star
> -----Original Message-----
> From: Wang, Jian J
> Sent: Monday, November 20, 2017 10:42 AM
> To: edk2-devel@lists.01.org
> Cc: Zeng, Star <star.zeng@intel.com>; Dong, Eric <eric.dong@intel.com>; Wu,
> Hao A <hao.a.wu@intel.com>
> Subject: [PATCH] MdeModulePkg/PiSmmCore: Fix an assert issue in pool free
> 
> This issue is caused by assigning incorrect value to PoolHdr.Size if the requested
> size is more than MAX_POOL_SIZE, because the SMM core will actually
> allocate page memory instead of pool memory in this situation.
> 
> Cc: Star Zeng <star.zeng@intel.com>
> Cc: Eric Dong <eric.dong@intel.com>
> Cc: Wu Hao <hao.a.wu@intel.com>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Jian J Wang <jian.j.wang@intel.com>
> ---
>  MdeModulePkg/Core/PiSmmCore/Pool.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/MdeModulePkg/Core/PiSmmCore/Pool.c
> b/MdeModulePkg/Core/PiSmmCore/Pool.c
> index e77caa8853..e98ce01b0f 100644
> --- a/MdeModulePkg/Core/PiSmmCore/Pool.c
> +++ b/MdeModulePkg/Core/PiSmmCore/Pool.c
> @@ -287,7 +287,7 @@ SmmInternalAllocatePool (
> 
>      PoolHdr = (POOL_HEADER*)(UINTN)Address;
>      PoolHdr->Signature = POOL_HEAD_SIGNATURE;
> -    PoolHdr->Size = Size;
> +    PoolHdr->Size = EFI_PAGES_TO_SIZE (NoPages);
>      PoolHdr->Available = FALSE;
>      PoolHdr->Type = PoolType;
> 
> --
> 2.14.1.windows.1

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [PATCH] MdeModulePkg/PiSmmCore: Fix an assert issue in pool free
Posted by Wang, Jian J 6 years, 5 months ago
Sure. Thanks for reminding.

> -----Original Message-----
> From: Zeng, Star
> Sent: Monday, November 20, 2017 10:54 AM
> To: Wang, Jian J <jian.j.wang@intel.com>; edk2-devel@lists.01.org
> Cc: Dong, Eric <eric.dong@intel.com>; Wu, Hao A <hao.a.wu@intel.com>; Zeng,
> Star <star.zeng@intel.com>
> Subject: RE: [PATCH] MdeModulePkg/PiSmmCore: Fix an assert issue in pool free
> 
> Reviewed-by: Star Zeng <star.zeng@intel.com>
> 
> By the way, could you add comments in the commit log to say which commit is
> causing this issue?
> 
> Thanks,
> Star
> -----Original Message-----
> From: Wang, Jian J
> Sent: Monday, November 20, 2017 10:42 AM
> To: edk2-devel@lists.01.org
> Cc: Zeng, Star <star.zeng@intel.com>; Dong, Eric <eric.dong@intel.com>; Wu,
> Hao A <hao.a.wu@intel.com>
> Subject: [PATCH] MdeModulePkg/PiSmmCore: Fix an assert issue in pool free
> 
> This issue is caused by assigning incorrect value to PoolHdr.Size if the requested
> size is more than MAX_POOL_SIZE, because the SMM core will actually allocate
> page memory instead of pool memory in this situation.
> 
> Cc: Star Zeng <star.zeng@intel.com>
> Cc: Eric Dong <eric.dong@intel.com>
> Cc: Wu Hao <hao.a.wu@intel.com>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Jian J Wang <jian.j.wang@intel.com>
> ---
>  MdeModulePkg/Core/PiSmmCore/Pool.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/MdeModulePkg/Core/PiSmmCore/Pool.c
> b/MdeModulePkg/Core/PiSmmCore/Pool.c
> index e77caa8853..e98ce01b0f 100644
> --- a/MdeModulePkg/Core/PiSmmCore/Pool.c
> +++ b/MdeModulePkg/Core/PiSmmCore/Pool.c
> @@ -287,7 +287,7 @@ SmmInternalAllocatePool (
> 
>      PoolHdr = (POOL_HEADER*)(UINTN)Address;
>      PoolHdr->Signature = POOL_HEAD_SIGNATURE;
> -    PoolHdr->Size = Size;
> +    PoolHdr->Size = EFI_PAGES_TO_SIZE (NoPages);
>      PoolHdr->Available = FALSE;
>      PoolHdr->Type = PoolType;
> 
> --
> 2.14.1.windows.1

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel