audk/MdeModulePkg
James Bottomley 872f953262 MdeModulePkg/VariablePolicyLib: Fix runtime panic in ValidateSetVariable()
The current variable policy is allocated by AllocatePool(), which is
boot time only.  This means that if you do any variable setting in the
runtime, the policy has been freed.  Ordinarily this isn't detected
because freed memory is still there, but when you boot the Linux
kernel, it's been remapped so the actual memory no longer exists in
the memory map causing a page fault.

Fix this by making it AllocateRuntimePool().  For SMM drivers, the
platform DSC is responsible for resolving the MemoryAllocationLib
class to the SmmMemoryAllocationLib instance. In the
SmmMemoryAllocationLib instance, AllocatePool() and
AllocateRuntimePool() are implemented identically. Therefore this
change is a no-op when the RegisterVariablePolicy() function is built
into an SMM driver. The fix affects runtime DXE drivers only.

Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3092
Signed-off-by: James Bottomley <jejb@linux.ibm.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Tested-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
2020-11-27 01:19:34 +00:00
..
Application MdeModulePkg/CapsuleApp: Fix spelling mistake 2020-08-07 18:53:01 +00:00
Bus MdeModulePkg/AtaAtapiPassThru: Trace ATA packets 2020-11-11 02:27:59 +00:00
Core MdeModulePkg/Core/Dxe: limit FwVol encapsulation section recursion 2020-11-21 01:40:53 +00:00
Include MdeModulePkg: Define the VarCheckPolicyLib and SMM interface 2020-11-17 01:03:43 +00:00
Library MdeModulePkg/VariablePolicyLib: Fix runtime panic in ValidateSetVariable() 2020-11-27 01:19:34 +00:00
Logo MdeModulePkg/Logo:Add RISCV64 architecture 2020-05-07 03:17:15 +00:00
Test MdeModulePkg: Add DxeResetSystemLib unit test 2020-02-07 19:18:53 +00:00
Universal MdeModulePkg: Drop VarLock from RuntimeDxe variable driver 2020-11-17 01:03:43 +00:00
MdeModulePkg.ci.yaml MdeModulePkg: Define the VariablePolicyLib 2020-11-17 01:03:43 +00:00
MdeModulePkg.dec MdeModulePkg/Core/Dxe: limit FwVol encapsulation section recursion 2020-11-21 01:40:53 +00:00
MdeModulePkg.dsc MdeModulePkg: Define the VarCheckPolicyLib and SMM interface 2020-11-17 01:03:43 +00:00
MdeModulePkg.uni MdeModulePkg/Core/Dxe: limit FwVol encapsulation section recursion 2020-11-21 01:40:53 +00:00
MdeModulePkgExtra.uni MdeModulePkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:08 -07:00