public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH 0/3] Implement stack guard feature
@ 2017-10-31 14:24 Jian J Wang
  2017-10-31 14:24 ` [PATCH 1/3] MdeModulePkg/metafile: Add PCD PcdCpuStackGuard Jian J Wang
                   ` (2 more replies)
  0 siblings, 3 replies; 28+ messages in thread
From: Jian J Wang @ 2017-10-31 14:24 UTC (permalink / raw)
  To: edk2-devel

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



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

end of thread, other threads:[~2017-11-06  3:44 UTC | newest]

Thread overview: 28+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-31 14:24 [PATCH 0/3] Implement stack guard feature Jian J Wang
2017-10-31 14:24 ` [PATCH 1/3] MdeModulePkg/metafile: Add PCD PcdCpuStackGuard Jian J Wang
2017-10-31 14:24 ` [PATCH 2/3] MdeModulePkg/DxeIpl: Enable paging for stack guard Jian J Wang
2017-10-31 14:24 ` [PATCH 3/3] UefiCpuPkg/CpuExceptionHandlerLib: Add stack switch support Jian J Wang
2017-11-01  1:56   ` Yao, Jiewen
2017-11-01  2:33     ` 答复: " Fan Jeff
2017-11-01  2:48       ` Wang, Jian J
2017-11-01  2:59         ` 答复: " Fan Jeff
2017-11-01  3:08           ` Wang, Jian J
2017-11-01  3:12             ` Wang, Jian J
2017-11-01  3:45               ` 答复: " Fan Jeff
2017-11-01  3:12             ` Fan Jeff
2017-11-01 15:42       ` Kinney, Michael D
2017-11-03  1:24         ` Yao, Jiewen
2017-11-03  2:10           ` Wang, Jian J
2017-11-03  2:27             ` Yao, Jiewen
2017-11-03  2:30               ` Wang, Jian J
2017-11-03  8:21           ` 答复: " Fan Jeff
2017-11-03  8:58             ` Fan Jeff
2017-11-06  0:30               ` Wang, Jian J
2017-11-06  1:54                 ` Yao, Jiewen
2017-11-06  2:27                   ` Wang, Jian J
2017-11-06  3:47                     ` Yao, Jiewen
2017-11-06  3:10                   ` 答复: " Fan Jeff
2017-11-06  2:00                 ` Fan Jeff
2017-11-01  2:36     ` Wang, Jian J
2017-11-01  2:37   ` 答复: " Fan Jeff
2017-11-01  2:45     ` Wang, Jian J

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