public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH v2 0/2] fix DXE memory free issue in SMM mode
@ 2018-06-13  5:34 Jian J Wang
  2018-06-13  5:35 ` [PATCH v2 1/2] UefiCpuPkg/CpuDxe: allow accessing (DXE) page table " Jian J Wang
  2018-06-13  5:35 ` [PATCH v2 2/2] MdeModulePkg/Core: remove SMM check for Heap Guard feature detection Jian J Wang
  0 siblings, 2 replies; 9+ messages in thread
From: Jian J Wang @ 2018-06-13  5:34 UTC (permalink / raw)
  To: edk2-devel

> v2:
>   a. add more specific explanations in commit message
>   b. add more comments in code
>   c. remove redundant logic in code
>   d. fix logic hole in code
>   e. replace meanless constant macro with meaning ones
>   f. remove irrelated changes

This patch series try to fix an issue caused by trying to free memory
allocated in DXE but freed in SMM mode. This happens only if Heap
Guard feature is enabled, which needs to update page table. The root
cause is that DXE and SMM don't share the same paging configuration
but CpuDxe driver still tries to access page table through current
processor registers (CR3) in SMM mode, during memory free opration in
DXE core. This will cause DXE core got the incorrect paging attributes
of memory to be freed, and then fail the free operation.

The solution is let CpuDxe store the paging configuration in a global
variable and use it to access DXE page table if in SMM mode.

Jian J Wang (2):
  UefiCpuPkg/CpuDxe: allow accessing (DXE) page table in SMM mode
  MdeModulePkg/Core: remove SMM check for Heap Guard feature detection

 MdeModulePkg/Core/Dxe/Mem/HeapGuard.c |  10 ---
 UefiCpuPkg/CpuDxe/CpuDxe.inf          |   1 +
 UefiCpuPkg/CpuDxe/CpuPageTable.c      | 159 ++++++++++++++++++++++++++--------
 3 files changed, 123 insertions(+), 47 deletions(-)

-- 
2.16.2.windows.1



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

end of thread, other threads:[~2018-06-14  2:02 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-06-13  5:34 [PATCH v2 0/2] fix DXE memory free issue in SMM mode Jian J Wang
2018-06-13  5:35 ` [PATCH v2 1/2] UefiCpuPkg/CpuDxe: allow accessing (DXE) page table " Jian J Wang
2018-06-13 15:10   ` Laszlo Ersek
2018-06-14  0:46     ` Wang, Jian J
2018-06-14  2:01       ` Dong, Eric
2018-06-13 15:14   ` Andrew Fish
2018-06-13 19:54     ` Laszlo Ersek
2018-06-13  5:35 ` [PATCH v2 2/2] MdeModulePkg/Core: remove SMM check for Heap Guard feature detection Jian J Wang
2018-06-14  0:58   ` Zeng, Star

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