public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Jian J Wang <jian.j.wang@intel.com>
To: edk2-devel@lists.01.org
Subject: [PATCH 0/2] fix DXE memory free issue in SMM mode
Date: Mon, 11 Jun 2018 15:08:31 +0800	[thread overview]
Message-ID: <20180611070833.5440-1-jian.j.wang@intel.com> (raw)

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.c            |   2 +-
 UefiCpuPkg/CpuDxe/CpuDxe.inf          |   1 +
 UefiCpuPkg/CpuDxe/CpuPageTable.c      | 108 +++++++++++++++++++++++-----------
 4 files changed, 75 insertions(+), 46 deletions(-)

-- 
2.16.2.windows.1



             reply	other threads:[~2018-06-11  7:08 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-11  7:08 Jian J Wang [this message]
2018-06-11  7:08 ` [PATCH 1/2] UefiCpuPkg/CpuDxe: allow accessing (DXE) page table in SMM mode Jian J Wang
2018-06-11 12:17   ` Laszlo Ersek
2018-06-12  3:35     ` Zeng, Star
2018-06-12  3:36       ` Zeng, Star
2018-06-12  7:17         ` Laszlo Ersek
2018-06-12  4:32     ` Wang, Jian J
2018-06-12  8:04       ` Laszlo Ersek
2018-06-12  8:44         ` Wang, Jian J
2018-06-12 13:15           ` Laszlo Ersek
2018-06-11  7:08 ` [PATCH 2/2] MdeModulePkg/Core: remove SMM check for Heap Guard feature detection Jian J Wang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180611070833.5440-1-jian.j.wang@intel.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox