--- /dev/null
+/** @file\r
+ Serialize operation on all load-from-memory instructions (DXE version).\r
+\r
+Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>\r
+This program and the accompanying materials\r
+are licensed and made available under the terms and conditions of the BSD License\r
+which accompanies this distribution. The full text of the license may be found at\r
+http://opensource.org/licenses/bsd-license.php\r
+\r
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+**/\r
+\r
+#include "Variable.h"\r
+\r
+/**\r
+ This service is consumed by the variable modules to perform a serializing\r
+ operation on all load-from-memory instructions that were issued prior to the\r
+ call of this function.\r
+\r
+**/\r
+VOID\r
+MemoryLoadFence (\r
+ VOID\r
+ )\r
+{\r
+ //\r
+ // Do nothing.\r
+ //\r
+}\r
--- /dev/null
+/** @file\r
+ Serialize operation on all load-from-memory instructions (SMM version).\r
+\r
+Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>\r
+This program and the accompanying materials\r
+are licensed and made available under the terms and conditions of the BSD License\r
+which accompanies this distribution. The full text of the license may be found at\r
+http://opensource.org/licenses/bsd-license.php\r
+\r
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+**/\r
+\r
+#include <Library/BaseLib.h>\r
+#include "Variable.h"\r
+\r
+/**\r
+ This service is consumed by the variable modules to perform a serializing\r
+ operation on all load-from-memory instructions that were issued prior to the\r
+ call of this function.\r
+\r
+**/\r
+VOID\r
+MemoryLoadFence (\r
+ VOID\r
+ )\r
+{\r
+ AsmLfence ();\r
+}\r
vs. non-privileged driver code.\r
\r
Copyright (c) 2017, Red Hat, Inc.<BR>\r
- Copyright (c) 2010 - 2017, Intel Corporation. All rights reserved.<BR>\r
+ Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR>\r
\r
This program and the accompanying materials are licensed and made available\r
under the terms and conditions of the BSD License which accompanies this\r
IN VOID *Data\r
);\r
\r
+/**\r
+ This service is consumed by the variable modules to perform a serializing\r
+ operation on all load-from-memory instructions that were issued prior to the\r
+ call of this function.\r
+\r
+**/\r
+VOID\r
+MemoryLoadFence (\r
+ VOID\r
+ );\r
+\r
#endif\r
((EFI_VARIABLE_AUTHENTICATION_2 *) Data)->AuthInfo.Hdr.dwLength < OFFSET_OF (WIN_CERTIFICATE_UEFI_GUID, CertData)) {\r
return EFI_SECURITY_VIOLATION;\r
}\r
+ //\r
+ // The MemoryLoadFence() call here is to ensure the above sanity check\r
+ // for the EFI_VARIABLE_AUTHENTICATION_2 descriptor has been completed\r
+ // before the execution of subsequent codes.\r
+ //\r
+ MemoryLoadFence ();\r
PayloadSize = DataSize - AUTHINFO2_SIZE (Data);\r
} else {\r
PayloadSize = DataSize;\r
TcgMorLockDxe.c\r
VarCheck.c\r
VariableExLib.c\r
+ LoadFenceDxe.c\r
\r
[Packages]\r
MdePkg/MdePkg.dec\r
goto EXIT;\r
}\r
\r
+ //\r
+ // The MemoryLoadFence() call here is to ensure the previous range/content\r
+ // checks for the CommBuffer have been completed before the subsequent\r
+ // consumption of the CommBuffer content.\r
+ //\r
+ MemoryLoadFence ();\r
if (SmmVariableHeader->NameSize < sizeof (CHAR16) || SmmVariableHeader->Name[SmmVariableHeader->NameSize/sizeof (CHAR16) - 1] != L'\0') {\r
//\r
// Make sure VariableName is A Null-terminated string.\r
goto EXIT;\r
}\r
\r
+ //\r
+ // The MemoryLoadFence() call here is to ensure the previous range/content\r
+ // checks for the CommBuffer have been completed before the subsequent\r
+ // consumption of the CommBuffer content.\r
+ //\r
+ MemoryLoadFence ();\r
if (SmmVariableHeader->NameSize < sizeof (CHAR16) || SmmVariableHeader->Name[SmmVariableHeader->NameSize/sizeof (CHAR16) - 1] != L'\0') {\r
//\r
// Make sure VariableName is A Null-terminated string.\r
goto EXIT;\r
}\r
\r
+ //\r
+ // The MemoryLoadFence() call here is to ensure the previous range/content\r
+ // checks for the CommBuffer have been completed before the subsequent\r
+ // consumption of the CommBuffer content.\r
+ //\r
+ MemoryLoadFence ();\r
if (CommVariableProperty->NameSize < sizeof (CHAR16) || CommVariableProperty->Name[CommVariableProperty->NameSize/sizeof (CHAR16) - 1] != L'\0') {\r
//\r
// Make sure VariableName is A Null-terminated string.\r
PrivilegePolymorphic.h\r
VariableExLib.c\r
TcgMorLockSmm.c\r
+ LoadFenceSmm.c\r
\r
[Packages]\r
MdePkg/MdePkg.dec\r