[edk2] [PATCH v4 0/6] Add NULL pointer detection feature

Jian J Wang posted 6 patches 6 years, 6 months ago
Failed in applying to current master (apply log)
.../Csm/BiosThunk/KeyboardDxe/BiosKeyboard.c       | 101 ++++++++++++++
.../Csm/BiosThunk/KeyboardDxe/BiosKeyboard.h       |   2 +
.../Csm/BiosThunk/KeyboardDxe/KeyboardDxe.inf      |   2 +
.../Csm/LegacyBiosDxe/LegacyBda.c                  |   4 +
.../Csm/LegacyBiosDxe/LegacyBios.c                 | 152 +++++++++++++++++++++
.../Csm/LegacyBiosDxe/LegacyBiosDxe.inf            |   2 +
.../Csm/LegacyBiosDxe/LegacyBiosInterface.h        |  18 +++
.../Csm/LegacyBiosDxe/LegacyBootSupport.c          |  23 +++-
.../Csm/LegacyBiosDxe/LegacyPci.c                  |  17 ++-
IntelFrameworkModulePkg/Csm/LegacyBiosDxe/Thunk.c  |  27 +++-
MdeModulePkg/Core/Dxe/DxeMain.inf                  |   1 +
MdeModulePkg/Core/Dxe/Mem/Page.c                   |   4 +-
MdeModulePkg/Core/Dxe/Misc/MemoryProtection.c      |  65 +++++++++
MdeModulePkg/Core/DxeIplPeim/DxeIpl.h              |  25 ++++
MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf            |   1 +
MdeModulePkg/Core/DxeIplPeim/DxeLoad.c             |   1 +
MdeModulePkg/Core/DxeIplPeim/Ia32/DxeLoadFunc.c    |  17 ++-
MdeModulePkg/Core/DxeIplPeim/X64/DxeLoadFunc.c     |   4 +
MdeModulePkg/Core/DxeIplPeim/X64/VirtualMemory.c   |  93 ++++++++++++-
MdeModulePkg/MdeModulePkg.dec                      |  13 ++
MdeModulePkg/MdeModulePkg.uni                      |  13 ++
OvmfPkg/QemuVideoDxe/QemuVideoDxe.inf              |   1 +
OvmfPkg/QemuVideoDxe/VbeShim.c                     |  14 ++
UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/PageTbl.c           |  12 ++
UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c              |  25 +++-
UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.inf       |   1 +
UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c            |  12 ++
27 files changed, 628 insertions(+), 22 deletions(-)
[edk2] [PATCH v4 0/6] Add NULL pointer detection feature
Posted by Jian J Wang 6 years, 6 months ago
The mechanism behind is to trigger a page fault exception at address 0.
This can be made by disabling page 0 (0-4095) during page table setup.
So this feature can only be available on platform with paging enabled.

Once this feature is enabled, any code, like CSM, which has to access
memory in page 0 needs to enable this page temporarily in advance and
disable it afterwards.

PcdNullPointerDetectionPropertyMask is used to control and elaborate
the use cases. For example, BIT7 of this PCD must be set for Windows 7
boot on Qemu if BIT0 set; or boot will fail.

Suggested-by: Ayellet Wolman <ayellet.wolman@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jian J Wang <jian.j.wang@intel.com>

Jian J Wang (5):
  MdeModulePkg/DxeIpl: Implement NULL pointer detection
  MdeModulePkg/Core/Dxe: Add EndOfDxe workaround for NULL pointer
    detection
  UefiCpuPkg/PiSmmCpuDxeSmm: Implement NULL pointer detection for SMM
    code
  IntelFrameworkModulePkg/Csm: Add code to bypass NULL pointer detection
  OvmfPkg/QemuVideoDxe: Bypass NULL pointer detection during VBE SHIM
    installing

Wang, Jian J (1):
  MdeModulePkg/MdeModulePkg.dec,.uni: Add NULL pointer detection PCD

 .../Csm/BiosThunk/KeyboardDxe/BiosKeyboard.c       | 101 ++++++++++++++
 .../Csm/BiosThunk/KeyboardDxe/BiosKeyboard.h       |   2 +
 .../Csm/BiosThunk/KeyboardDxe/KeyboardDxe.inf      |   2 +
 .../Csm/LegacyBiosDxe/LegacyBda.c                  |   4 +
 .../Csm/LegacyBiosDxe/LegacyBios.c                 | 152 +++++++++++++++++++++
 .../Csm/LegacyBiosDxe/LegacyBiosDxe.inf            |   2 +
 .../Csm/LegacyBiosDxe/LegacyBiosInterface.h        |  18 +++
 .../Csm/LegacyBiosDxe/LegacyBootSupport.c          |  23 +++-
 .../Csm/LegacyBiosDxe/LegacyPci.c                  |  17 ++-
 IntelFrameworkModulePkg/Csm/LegacyBiosDxe/Thunk.c  |  27 +++-
 MdeModulePkg/Core/Dxe/DxeMain.inf                  |   1 +
 MdeModulePkg/Core/Dxe/Mem/Page.c                   |   4 +-
 MdeModulePkg/Core/Dxe/Misc/MemoryProtection.c      |  65 +++++++++
 MdeModulePkg/Core/DxeIplPeim/DxeIpl.h              |  25 ++++
 MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf            |   1 +
 MdeModulePkg/Core/DxeIplPeim/DxeLoad.c             |   1 +
 MdeModulePkg/Core/DxeIplPeim/Ia32/DxeLoadFunc.c    |  17 ++-
 MdeModulePkg/Core/DxeIplPeim/X64/DxeLoadFunc.c     |   4 +
 MdeModulePkg/Core/DxeIplPeim/X64/VirtualMemory.c   |  93 ++++++++++++-
 MdeModulePkg/MdeModulePkg.dec                      |  13 ++
 MdeModulePkg/MdeModulePkg.uni                      |  13 ++
 OvmfPkg/QemuVideoDxe/QemuVideoDxe.inf              |   1 +
 OvmfPkg/QemuVideoDxe/VbeShim.c                     |  14 ++
 UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/PageTbl.c           |  12 ++
 UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c              |  25 +++-
 UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.inf       |   1 +
 UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c            |  12 ++
 27 files changed, 628 insertions(+), 22 deletions(-)

-- 
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 v4 0/6] Add NULL pointer detection feature
Posted by Wang, Jian J 6 years, 6 months ago
Hi,

Any more comments for this version of patch? If no, I'll check in it today. Thanks.

Jian

> -----Original Message-----
> From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Jian J
> Wang
> Sent: Monday, October 09, 2017 10:17 PM
> To: edk2-devel@lists.01.org
> Subject: [edk2] [PATCH v4 0/6] Add NULL pointer detection feature
> 
> The mechanism behind is to trigger a page fault exception at address 0.
> This can be made by disabling page 0 (0-4095) during page table setup.
> So this feature can only be available on platform with paging enabled.
> 
> Once this feature is enabled, any code, like CSM, which has to access
> memory in page 0 needs to enable this page temporarily in advance and
> disable it afterwards.
> 
> PcdNullPointerDetectionPropertyMask is used to control and elaborate
> the use cases. For example, BIT7 of this PCD must be set for Windows 7
> boot on Qemu if BIT0 set; or boot will fail.
> 
> Suggested-by: Ayellet Wolman <ayellet.wolman@intel.com>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Jian J Wang <jian.j.wang@intel.com>
> 
> Jian J Wang (5):
>   MdeModulePkg/DxeIpl: Implement NULL pointer detection
>   MdeModulePkg/Core/Dxe: Add EndOfDxe workaround for NULL pointer
>     detection
>   UefiCpuPkg/PiSmmCpuDxeSmm: Implement NULL pointer detection for SMM
>     code
>   IntelFrameworkModulePkg/Csm: Add code to bypass NULL pointer detection
>   OvmfPkg/QemuVideoDxe: Bypass NULL pointer detection during VBE SHIM
>     installing
> 
> Wang, Jian J (1):
>   MdeModulePkg/MdeModulePkg.dec,.uni: Add NULL pointer detection PCD
> 
>  .../Csm/BiosThunk/KeyboardDxe/BiosKeyboard.c       | 101 ++++++++++++++
>  .../Csm/BiosThunk/KeyboardDxe/BiosKeyboard.h       |   2 +
>  .../Csm/BiosThunk/KeyboardDxe/KeyboardDxe.inf      |   2 +
>  .../Csm/LegacyBiosDxe/LegacyBda.c                  |   4 +
>  .../Csm/LegacyBiosDxe/LegacyBios.c                 | 152 +++++++++++++++++++++
>  .../Csm/LegacyBiosDxe/LegacyBiosDxe.inf            |   2 +
>  .../Csm/LegacyBiosDxe/LegacyBiosInterface.h        |  18 +++
>  .../Csm/LegacyBiosDxe/LegacyBootSupport.c          |  23 +++-
>  .../Csm/LegacyBiosDxe/LegacyPci.c                  |  17 ++-
>  IntelFrameworkModulePkg/Csm/LegacyBiosDxe/Thunk.c  |  27 +++-
>  MdeModulePkg/Core/Dxe/DxeMain.inf                  |   1 +
>  MdeModulePkg/Core/Dxe/Mem/Page.c                   |   4 +-
>  MdeModulePkg/Core/Dxe/Misc/MemoryProtection.c      |  65 +++++++++
>  MdeModulePkg/Core/DxeIplPeim/DxeIpl.h              |  25 ++++
>  MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf            |   1 +
>  MdeModulePkg/Core/DxeIplPeim/DxeLoad.c             |   1 +
>  MdeModulePkg/Core/DxeIplPeim/Ia32/DxeLoadFunc.c    |  17 ++-
>  MdeModulePkg/Core/DxeIplPeim/X64/DxeLoadFunc.c     |   4 +
>  MdeModulePkg/Core/DxeIplPeim/X64/VirtualMemory.c   |  93 ++++++++++++-
>  MdeModulePkg/MdeModulePkg.dec                      |  13 ++
>  MdeModulePkg/MdeModulePkg.uni                      |  13 ++
>  OvmfPkg/QemuVideoDxe/QemuVideoDxe.inf              |   1 +
>  OvmfPkg/QemuVideoDxe/VbeShim.c                     |  14 ++
>  UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/PageTbl.c           |  12 ++
>  UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c              |  25 +++-
>  UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.inf       |   1 +
>  UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c            |  12 ++
>  27 files changed, 628 insertions(+), 22 deletions(-)
> 
> --
> 2.14.1.windows.1
> 
> _______________________________________________
> 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