[edk2] [PATCH 0/3] Implement stack guard feature

Jian J Wang posted 3 patches 7 years, 1 month ago
Failed in applying to current master (apply log)
There is a newer version of this series
MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf            |   1 +
MdeModulePkg/Core/DxeIplPeim/Ia32/DxeLoadFunc.c    |  35 +-
MdeModulePkg/Core/DxeIplPeim/X64/DxeLoadFunc.c     |   1 +
MdeModulePkg/Core/DxeIplPeim/X64/VirtualMemory.c   |  51 ++-
MdeModulePkg/MdeModulePkg.dec                      |   7 +
MdeModulePkg/MdeModulePkg.uni                      |   7 +
.../CpuExceptionHandlerLib/CpuExceptionCommon.h    |  22 ++
.../DxeCpuExceptionHandlerLib.inf                  |   5 +
.../Library/CpuExceptionHandlerLib/DxeException.c  |  19 +
.../Ia32/ArchExceptionHandler.c                    | 135 +++++++
.../Ia32/ArchInterruptDefs.h                       | 136 +++++++
.../Ia32/ExceptionTssEntryAsm.nasm                 | 398 +++++++++++++++++++++
.../PeiCpuExceptionHandlerLib.inf                  |   1 +
.../SecPeiCpuExceptionHandlerLib.inf               |   3 +
.../SmmCpuExceptionHandlerLib.inf                  |   1 +
.../X64/ArchExceptionHandler.c                     | 108 ++++++
.../CpuExceptionHandlerLib/X64/ArchInterruptDefs.h |  40 +++
.../X64/ExceptionHandlerAsm.S                      |  12 +
.../X64/ExceptionHandlerAsm.asm                    |  12 +
.../X64/ExceptionHandlerAsm.nasm                   |  12 +
20 files changed, 989 insertions(+), 17 deletions(-)
create mode 100644 UefiCpuPkg/Library/CpuExceptionHandlerLib/Ia32/ExceptionTssEntryAsm.nasm
[edk2] [PATCH 0/3] Implement stack guard feature
Posted by Jian J Wang 7 years, 1 month ago
Stack guard feature makes use of paging mechanism to monitor if there's a
stack overflow occurred during boot. A new PCD PcdCpuStackGuard is added to
enable/disable this feature.

If this feature is enabled, DxeIpl will setup page tables and set page where
the stack bottom is at to be NON-PRESENT. If stack overflow occurs, Page
Fault exception will be triggered.

In order to make sure exception handler works normally even when the stack
is corrupted, stack switching is implemented for exception library.

Due to the mechanism behind Stack Guard, this feature is only avaiable for
UEFI drivers. That also means it doesn't support NT32 emulated platform.

Validation works include:
  a. OVMF emulated platform: boot to shell (IA32/X64)
  b. Intel real platform: boot to shell (IA32/X64)

Jian J Wang (3):
  MdeModulePkg/metafile: Add PCD PcdCpuStackGuard
  MdeModulePkg/DxeIpl: Enable paging for stack guard
  UefiCpuPkg/CpuExceptionHandlerLib: Add stack switch support

 MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf            |   1 +
 MdeModulePkg/Core/DxeIplPeim/Ia32/DxeLoadFunc.c    |  35 +-
 MdeModulePkg/Core/DxeIplPeim/X64/DxeLoadFunc.c     |   1 +
 MdeModulePkg/Core/DxeIplPeim/X64/VirtualMemory.c   |  51 ++-
 MdeModulePkg/MdeModulePkg.dec                      |   7 +
 MdeModulePkg/MdeModulePkg.uni                      |   7 +
 .../CpuExceptionHandlerLib/CpuExceptionCommon.h    |  22 ++
 .../DxeCpuExceptionHandlerLib.inf                  |   5 +
 .../Library/CpuExceptionHandlerLib/DxeException.c  |  19 +
 .../Ia32/ArchExceptionHandler.c                    | 135 +++++++
 .../Ia32/ArchInterruptDefs.h                       | 136 +++++++
 .../Ia32/ExceptionTssEntryAsm.nasm                 | 398 +++++++++++++++++++++
 .../PeiCpuExceptionHandlerLib.inf                  |   1 +
 .../SecPeiCpuExceptionHandlerLib.inf               |   3 +
 .../SmmCpuExceptionHandlerLib.inf                  |   1 +
 .../X64/ArchExceptionHandler.c                     | 108 ++++++
 .../CpuExceptionHandlerLib/X64/ArchInterruptDefs.h |  40 +++
 .../X64/ExceptionHandlerAsm.S                      |  12 +
 .../X64/ExceptionHandlerAsm.asm                    |  12 +
 .../X64/ExceptionHandlerAsm.nasm                   |  12 +
 20 files changed, 989 insertions(+), 17 deletions(-)
 create mode 100644 UefiCpuPkg/Library/CpuExceptionHandlerLib/Ia32/ExceptionTssEntryAsm.nasm

-- 
2.14.1.windows.1

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