mirror of
https://github.com/acidanthera/audk.git
synced 2025-07-23 13:44:33 +02:00
MdeModulePkg/VariableSmm: Add func for Primary Buffer valid check
Add a new function (VariableSmmIsPrimaryBufferValid) to check Primary Buffer valid or not. original function (VariableSmmIsBufferOutsideSmmValid) is used to check the buffer outside MMRAM. 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>
This commit is contained in:
parent
acfdb6771c
commit
8befdb1441
@ -7,7 +7,7 @@
|
|||||||
vs. non-privileged driver code.
|
vs. non-privileged driver code.
|
||||||
|
|
||||||
Copyright (c) 2017, Red Hat, Inc.<BR>
|
Copyright (c) 2017, Red Hat, Inc.<BR>
|
||||||
Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2010 - 2024, Intel Corporation. All rights reserved.<BR>
|
||||||
|
|
||||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||||
**/
|
**/
|
||||||
@ -122,6 +122,21 @@ MmVariableServiceInitialize (
|
|||||||
VOID
|
VOID
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
This function checks if the communication buffer is valid.
|
||||||
|
|
||||||
|
@param Buffer The buffer start address to be checked.
|
||||||
|
@param Length The buffer length to be checked.
|
||||||
|
|
||||||
|
@retval TRUE This buffer is valid.
|
||||||
|
@retval FALSE This buffer is not valid.
|
||||||
|
**/
|
||||||
|
BOOLEAN
|
||||||
|
VariableSmmIsPrimaryBufferValid (
|
||||||
|
IN EFI_PHYSICAL_ADDRESS Buffer,
|
||||||
|
IN UINT64 Length
|
||||||
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
This function checks if the buffer is valid per processor architecture and
|
This function checks if the buffer is valid per processor architecture and
|
||||||
does not overlap with SMRAM.
|
does not overlap with SMRAM.
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
VariableServiceSetVariable(), VariableServiceQueryVariableInfo(), ReclaimForOS(),
|
VariableServiceSetVariable(), VariableServiceQueryVariableInfo(), ReclaimForOS(),
|
||||||
SmmVariableGetStatistics() should also do validation based on its own knowledge.
|
SmmVariableGetStatistics() should also do validation based on its own knowledge.
|
||||||
|
|
||||||
Copyright (c) 2010 - 2019, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2010 - 2024, Intel Corporation. All rights reserved.<BR>
|
||||||
Copyright (c) 2018, Linaro, Ltd. All rights reserved.<BR>
|
Copyright (c) 2018, Linaro, Ltd. All rights reserved.<BR>
|
||||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||||
|
|
||||||
@ -497,8 +497,8 @@ SmmVariableHandler (
|
|||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!VariableSmmIsBufferOutsideSmmValid ((UINTN)CommBuffer, TempCommBufferSize)) {
|
if (!VariableSmmIsPrimaryBufferValid ((UINTN)CommBuffer, TempCommBufferSize)) {
|
||||||
DEBUG ((DEBUG_ERROR, "SmmVariableHandler: SMM communication buffer in SMRAM or overflow!\n"));
|
DEBUG ((DEBUG_ERROR, "SmmVariableHandler: SMM Primary Buffer (CommBuffer) is not valid!\n"));
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
Parts of the SMM/MM implementation that are specific to standalone MM
|
Parts of the SMM/MM implementation that are specific to standalone MM
|
||||||
|
|
||||||
Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved. <BR>
|
Copyright (c) 2011 - 2024, Intel Corporation. All rights reserved. <BR>
|
||||||
Copyright (c) 2018, Linaro, Ltd. All rights reserved. <BR>
|
Copyright (c) 2018, Linaro, Ltd. All rights reserved. <BR>
|
||||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||||
|
|
||||||
@ -10,6 +10,24 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
|||||||
|
|
||||||
#include "Variable.h"
|
#include "Variable.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
This function checks if the Primary Buffer (CommBuffer) is valid.
|
||||||
|
|
||||||
|
@param Buffer The buffer start address to be checked.
|
||||||
|
@param Length The buffer length to be checked.
|
||||||
|
|
||||||
|
@retval TRUE This buffer is valid.
|
||||||
|
@retval FALSE This buffer is not valid.
|
||||||
|
**/
|
||||||
|
BOOLEAN
|
||||||
|
VariableSmmIsPrimaryBufferValid (
|
||||||
|
IN EFI_PHYSICAL_ADDRESS Buffer,
|
||||||
|
IN UINT64 Length
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
This function checks if the buffer is valid per processor architecture and
|
This function checks if the buffer is valid per processor architecture and
|
||||||
does not overlap with SMRAM.
|
does not overlap with SMRAM.
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
Parts of the SMM/MM implementation that are specific to traditional MM
|
Parts of the SMM/MM implementation that are specific to traditional MM
|
||||||
|
|
||||||
Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved. <BR>
|
Copyright (c) 2011 - 2024, Intel Corporation. All rights reserved. <BR>
|
||||||
Copyright (c) 2018, Linaro, Ltd. All rights reserved. <BR>
|
Copyright (c) 2018, Linaro, Ltd. All rights reserved. <BR>
|
||||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||||
|
|
||||||
@ -12,6 +12,24 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
|||||||
#include <Library/SmmMemLib.h>
|
#include <Library/SmmMemLib.h>
|
||||||
#include "Variable.h"
|
#include "Variable.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
This function checks if the Primary Buffer (CommBuffer) is valid.
|
||||||
|
|
||||||
|
@param Buffer The buffer start address to be checked.
|
||||||
|
@param Length The buffer length to be checked.
|
||||||
|
|
||||||
|
@retval TRUE This buffer is valid.
|
||||||
|
@retval FALSE This buffer is not valid.
|
||||||
|
**/
|
||||||
|
BOOLEAN
|
||||||
|
VariableSmmIsPrimaryBufferValid (
|
||||||
|
IN EFI_PHYSICAL_ADDRESS Buffer,
|
||||||
|
IN UINT64 Length
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return SmmIsBufferOutsideSmmValid (Buffer, Length);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
This function checks if the buffer is valid per processor architecture and
|
This function checks if the buffer is valid per processor architecture and
|
||||||
does not overlap with SMRAM.
|
does not overlap with SMRAM.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user