[edk2] [PATCH 0/2] Fix issues in Heap Guard

Jian J Wang posted 2 patches 6 years, 4 months ago
Failed in applying to current master (apply log)
MdeModulePkg/Core/Dxe/Mem/HeapGuard.c   | 93 ++++++++++++++++++++++++++-------
MdeModulePkg/Core/Dxe/Mem/HeapGuard.h   |  4 +-
MdeModulePkg/Core/Dxe/Mem/Page.c        | 15 +++---
MdeModulePkg/Core/Dxe/Mem/Pool.c        |  4 +-
MdeModulePkg/Core/PiSmmCore/HeapGuard.c | 91 ++++++++++++++++++++++++++------
MdeModulePkg/Core/PiSmmCore/HeapGuard.h |  4 +-
6 files changed, 164 insertions(+), 47 deletions(-)
[edk2] [PATCH 0/2] Fix issues in Heap Guard
Posted by Jian J Wang 6 years, 4 months ago
One issue is that macros defined in HeapGuard.h

    GUARD_HEAP_TYPE_PAGE
    GUARD_HEAP_TYPE_POOL

doesn't match the definition of PCD PcdHeapGuardPropertyMask in
MdeModulePkg.dec. This patch fixed it by exchanging the BIT0 and BIT1
of them.

Another is that method AdjustMemoryF() will return a bigger NumberOfPages than
the value passed in. This is caused by counting twice of a shared Guard page
which can be used for both head and tail Guard of the memory before it and
after it. This happens only when partially freeing just one page in the middle
of a bunch of allocated pages. The freed page should be turned into a new
Guard page.

Since the most part code of Heap Guard feature are almost the same,
PiSmmCore and DxeCore have both above issues. This patch series fix them all.

Jian J Wang (2):
  MdeModulePkg/DxeCore: Fix issues in Heap Guard
  MdeModulePkg/PiSmmCore: Fix issues in Heap Guard

 MdeModulePkg/Core/Dxe/Mem/HeapGuard.c   | 93 ++++++++++++++++++++++++++-------
 MdeModulePkg/Core/Dxe/Mem/HeapGuard.h   |  4 +-
 MdeModulePkg/Core/Dxe/Mem/Page.c        | 15 +++---
 MdeModulePkg/Core/Dxe/Mem/Pool.c        |  4 +-
 MdeModulePkg/Core/PiSmmCore/HeapGuard.c | 91 ++++++++++++++++++++++++++------
 MdeModulePkg/Core/PiSmmCore/HeapGuard.h |  4 +-
 6 files changed, 164 insertions(+), 47 deletions(-)

-- 
2.15.1.windows.2

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [PATCH 0/2] Fix issues in Heap Guard
Posted by Zeng, Star 6 years, 4 months ago
Reviewed-by: Star Zeng <star.zeng@intel.com>

Thanks,
Star
-----Original Message-----
From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Jian J Wang
Sent: Monday, December 11, 2017 9:55 AM
To: edk2-devel@lists.01.org
Subject: [edk2] [PATCH 0/2] Fix issues in Heap Guard

One issue is that macros defined in HeapGuard.h

    GUARD_HEAP_TYPE_PAGE
    GUARD_HEAP_TYPE_POOL

doesn't match the definition of PCD PcdHeapGuardPropertyMask in MdeModulePkg.dec. This patch fixed it by exchanging the BIT0 and BIT1 of them.

Another is that method AdjustMemoryF() will return a bigger NumberOfPages than the value passed in. This is caused by counting twice of a shared Guard page which can be used for both head and tail Guard of the memory before it and after it. This happens only when partially freeing just one page in the middle of a bunch of allocated pages. The freed page should be turned into a new Guard page.

Since the most part code of Heap Guard feature are almost the same, PiSmmCore and DxeCore have both above issues. This patch series fix them all.

Jian J Wang (2):
  MdeModulePkg/DxeCore: Fix issues in Heap Guard
  MdeModulePkg/PiSmmCore: Fix issues in Heap Guard

 MdeModulePkg/Core/Dxe/Mem/HeapGuard.c   | 93 ++++++++++++++++++++++++++-------
 MdeModulePkg/Core/Dxe/Mem/HeapGuard.h   |  4 +-
 MdeModulePkg/Core/Dxe/Mem/Page.c        | 15 +++---
 MdeModulePkg/Core/Dxe/Mem/Pool.c        |  4 +-
 MdeModulePkg/Core/PiSmmCore/HeapGuard.c | 91 ++++++++++++++++++++++++++------  MdeModulePkg/Core/PiSmmCore/HeapGuard.h |  4 +-
 6 files changed, 164 insertions(+), 47 deletions(-)

--
2.15.1.windows.2

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