mirror of
https://github.com/acidanthera/audk.git
synced 2025-04-08 17:05:09 +02:00
In the MdeModulePkg/VarCheckPolicyLib, the Primary Buffer (CommBuffer) check function has been updated to match the buffer validation behavior. For SMM, the SMM Handlers is to validate the buffer outside MMRAM. For MM, the MM Handlers do not need to validate the buffer if it is the CommBuffer passed from MmCore through the MmiHandler() parameter. Return TRUE directly in this case. Existing code is incorrect for the MM check. This will be fixed in the following patch. There is no function impact. Signed-off-by: Jiaxin Wu <jiaxin.wu@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Ray Ni <ray.ni@intel.com> Cc: Star Zeng <star.zeng@intel.com> Cc: Hongbin1 Zhang <hongbin1.zhang@intel.com> Cc: Wei6 Xu <wei6.xu@intel.com> Cc: Dun Tan <dun.tan@intel.com> Cc: Yuanhao Xie <yuanhao.xie@intel.com>
52 lines
1.4 KiB
C
52 lines
1.4 KiB
C
/** @file -- VarCheckPolicyLibTraditional.c
|
|
This is an instance of a VarCheck lib constructor for traditional SMM.
|
|
|
|
Copyright (c) 2024, Intel Corporation. All rights reserved.<BR>
|
|
Copyright (c) Microsoft Corporation. All rights reserved.
|
|
SPDX-License-Identifier: BSD-2-Clause-Patent
|
|
|
|
**/
|
|
|
|
#include <Library/SmmMemLib.h>
|
|
|
|
#include "VarCheckPolicyLib.h"
|
|
|
|
/**
|
|
Traditional constructor function of VarCheckPolicyLib to invoke common
|
|
constructor routine.
|
|
|
|
@param[in] ImageHandle The firmware allocated handle for the EFI image.
|
|
@param[in] SystemTable A pointer to the EFI System Table.
|
|
|
|
@retval EFI_SUCCESS The constructor executed correctly.
|
|
|
|
**/
|
|
EFI_STATUS
|
|
EFIAPI
|
|
VarCheckPolicyLibTraditionalConstructor (
|
|
IN EFI_HANDLE ImageHandle,
|
|
IN EFI_SYSTEM_TABLE *SystemTable
|
|
)
|
|
{
|
|
return VarCheckPolicyLibCommonConstructor ();
|
|
}
|
|
|
|
/**
|
|
This function is wrapper function to validate the Primary Buffer (CommBuffer).
|
|
|
|
@param Buffer The buffer start address to be checked.
|
|
@param Length The buffer length to be checked.
|
|
|
|
@retval TRUE This buffer is valid per processor architecture and not overlap with SMRAM.
|
|
@retval FALSE This buffer is not valid per processor architecture or overlap with SMRAM.
|
|
**/
|
|
BOOLEAN
|
|
EFIAPI
|
|
VarCheckPolicyIsPrimaryBufferValid (
|
|
IN EFI_PHYSICAL_ADDRESS Buffer,
|
|
IN UINT64 Length
|
|
)
|
|
{
|
|
return SmmIsBufferOutsideSmmValid (Buffer, Length);
|
|
}
|