audk/MdeModulePkg
Zhiguang Liu 74f6ce6734 MdeModulePkg/SMM: Support to unregister SMI handler in SMI handlers
This patch fix a use-after-free issue where unregistering an
SMI handler could lead to the deletion of the SMI_HANDLER while it is
still in use by SmiManage(). The fix involves modifying
SmiHandlerUnRegister() to detect whether it is being called from
within the SmiManage() stack. If so, the removal of the SMI_HANDLER
is deferred until SmiManage() has finished executing.
Additionally, due to the possibility of recursive SmiManage() calls,
the unregistration and subsequent removal of the SMI_HANDLER are
ensured to occur only after the outermost SmiManage() invocation has
completed.

Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Jiaxin Wu <jiaxin.wu@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>

Signed-off-by: Zhiguang Liu <zhiguang.liu@intel.com>
2024-04-16 04:41:27 +00:00
..
Application MdeModulePkg/CapsuleApp: Add EFIAPI to CompareFileNameInAlphabet() 2023-05-06 17:48:49 +00:00
Bus MdeModulePkg: Update the comments of ReadKeyStroke and ReadKeyStrokeEx 2024-04-03 10:25:06 +08:00
Core MdeModulePkg/SMM: Support to unregister SMI handler in SMI handlers 2024-04-16 04:41:27 +00:00
Include MdeModulePkg/Core/Dxe: Set MemoryTypeInfo bin range from HOB 2024-01-30 18:30:02 +00:00
Library MdeModulePkg: ImagePropertiesRecordLib: Consolidate Usage 2024-03-29 23:56:16 +00:00
Logo MdeModulePkg/Logo: Add LoongArch64 architecture. 2022-10-14 02:16:33 +00:00
Test MdeModulePkg: Update DumpImageRecord() in ImagePropertiesRecordLib 2023-11-27 18:55:18 +00:00
Universal MdeModulePkg/AcpiTableDxe: Prefer xDSDT over DSDT when installing tables 2024-04-11 16:04:45 +08:00
MdeModulePkg.ci.yaml MdeModulePkg: Remove ArmPkg Dependency 2024-03-14 16:29:22 +00:00
MdeModulePkg.dec MdeModulePkg/AcpiTableDxe: PCD switch to avoid using ACPI reclaim memory 2024-04-09 07:03:08 +00:00
MdeModulePkg.dsc MdeModulePkg: Remove ArmPkg Dependency 2024-03-14 16:29:22 +00:00
MdeModulePkg.uni MdeModulePkg/AcpiTableDxe: PCD switch to avoid using ACPI reclaim memory 2024-04-09 07:03:08 +00:00
MdeModulePkgExtra.uni MdeModulePkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:08 -07:00