]> git.proxmox.com Git - mirror_edk2.git/commitdiff
MdeModulePkg Variable: Add missing warning annotation.
authorStar Zeng <star.zeng@intel.com>
Wed, 19 Nov 2014 01:08:23 +0000 (01:08 +0000)
committerlzeng14 <lzeng14@Edk2>
Wed, 19 Nov 2014 01:08:23 +0000 (01:08 +0000)
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16401 6f19259b-4bc3-4df7-8a09-765794883524

MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c
MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf
MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.uni
MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmmRuntimeDxe.c
MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmmRuntimeDxe.inf
MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmmRuntimeDxe.uni

index c66bdbf9fd9095da386706470e8f1d38b40296da..b545a05530b5e0ee780b181bda3909612526c874 100644 (file)
@@ -3,6 +3,17 @@
   The common variable operation routines shared by DXE_RUNTIME variable \r
   module and DXE_SMM variable module.\r
   \r
+  Caution: This module requires additional review when modified.\r
+  This driver will have external input - variable data. They may be input in SMM mode.\r
+  This external input must be validated carefully to avoid security issue like\r
+  buffer overflow, integer overflow.\r
+\r
+  VariableServiceGetNextVariableName () and VariableServiceQueryVariableInfo() are external API.\r
+  They need check input parameter.\r
+\r
+  VariableServiceGetVariable() and VariableServiceSetVariable() are external API\r
+  to receive datasize and data buffer. The size should be checked carefully.\r
+\r
 Copyright (c) 2006 - 2014, 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
@@ -2276,6 +2287,10 @@ VariableLockRequestToLock (
 \r
   This code finds variable in storage blocks (Volatile or Non-Volatile).\r
 \r
+  Caution: This function may receive untrusted input.\r
+  This function may be invoked in SMM mode, and datasize is external input.\r
+  This function will do basic validation, before parse the data.\r
+\r
   @param VariableName               Name of Variable to be found.\r
   @param VendorGuid                 Variable vendor GUID.\r
   @param Attributes                 Attribute value of the variable found.\r
@@ -2353,6 +2368,9 @@ Done:
 \r
   This code Finds the Next available variable.\r
 \r
+  Caution: This function may receive untrusted input.\r
+  This function may be invoked in SMM mode. This function will do basic validation, before parse the data.\r
+\r
   @param VariableNameSize           Size of the variable name.\r
   @param VariableName               Pointer to variable name.\r
   @param VendorGuid                 Variable Vendor Guid.\r
@@ -2515,6 +2533,10 @@ Done:
 \r
   This code sets variable in storage blocks (Volatile or Non-Volatile).\r
 \r
+  Caution: This function may receive untrusted input.\r
+  This function may be invoked in SMM mode, and datasize and data are external input.\r
+  This function will do basic validation, before parse the data.\r
+\r
   @param VariableName                     Name of Variable to be found.\r
   @param VendorGuid                       Variable vendor GUID.\r
   @param Attributes                       Attribute value of the variable found\r
@@ -2686,6 +2708,9 @@ Done:
 \r
   This code returns information about the EFI variables.\r
 \r
+  Caution: This function may receive untrusted input.\r
+  This function may be invoked in SMM mode. This function will do basic validation, before parse the data.\r
+\r
   @param Attributes                     Attributes bitmask to specify the type of variables\r
                                         on which to return information.\r
   @param MaximumVariableStorageSize     Pointer to the maximum size of the storage space available\r
@@ -2839,6 +2864,9 @@ VariableServiceQueryVariableInfoInternal (
 \r
   This code returns information about the EFI variables.\r
 \r
+  Caution: This function may receive untrusted input.\r
+  This function may be invoked in SMM mode. This function will do basic validation, before parse the data.\r
+\r
   @param Attributes                     Attributes bitmask to specify the type of variables\r
                                         on which to return information.\r
   @param MaximumVariableStorageSize     Pointer to the maximum size of the storage space available\r
@@ -2910,7 +2938,10 @@ VariableServiceQueryVariableInfo (
 \r
 /**\r
   This function reclaims variable storage if free size is below the threshold.\r
-  \r
+\r
+  Caution: This function may be invoked at SMM mode.\r
+  Care must be taken to make sure not security issue.\r
+\r
 **/\r
 VOID\r
 ReclaimForOS(\r
index 2585203120cea3baef68d17d82333ef5a30c73df..f8ee4684e2fde7b64ca8ad5bcb1235ac1e38ffe2 100644 (file)
@@ -3,6 +3,11 @@
 #\r
 # It provides four EFI_RUNTIME_SERVICES: SetVariable, GetVariable, GetNextVariableName and QueryVariableInfo.\r
 #\r
+#  Caution: This module requires additional review when modified.\r
+#  This driver will have external input - variable data.\r
+#  This external input must be validated carefully to avoid security issues such as\r
+#  buffer overflow or integer overflow.\r
+#\r
 # Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>\r
 #\r
 #  This program and the accompanying materials\r
index b91e18a339083e590330f9aecb3ac1e35c7f6d12..ee8acd0ad15e03ec5b02d459b7e2b24fda6f14c1 100644 (file)
Binary files a/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.uni and b/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.uni differ
index 7ca3326a887b0a323e60d33f2c5dda8fce51a9a3..14e421cb793f6e9b19dad8b70d829ce4db4a3f24 100644 (file)
@@ -4,6 +4,16 @@
   and volatile storage space and install variable architecture protocol\r
   based on SMM variable module.\r
 \r
+  Caution: This module requires additional review when modified.\r
+  This driver will have external input - variable data.\r
+  This external input must be validated carefully to avoid security issue like\r
+  buffer overflow, integer overflow.\r
+\r
+  RuntimeServiceGetVariable() and RuntimeServiceSetVariable() are external API\r
+  to receive data buffer. The size should be checked carefully.\r
+\r
+  InitCommunicateBuffer() is really function to check the variable data size.\r
+\r
 Copyright (c) 2010 - 2014, 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
@@ -97,6 +107,9 @@ ReleaseLockOnlyAtBootTime (
   The communicate size is: SMM_COMMUNICATE_HEADER_SIZE + SMM_VARIABLE_COMMUNICATE_HEADER_SIZE +\r
   DataSize.\r
 \r
+  Caution: This function may receive untrusted input.\r
+  The data size external input, so this function will validate it carefully to avoid buffer overflow.\r
+\r
   @param[out]      DataPtr          Points to the data in the communicate buffer.\r
   @param[in]       DataSize         The data size to send to SMM.\r
   @param[in]       Function         The function number to initialize the communicate header.\r
@@ -234,6 +247,9 @@ Done:
 /**\r
   This code finds variable in storage blocks (Volatile or Non-Volatile).\r
 \r
+  Caution: This function may receive untrusted input.\r
+  The data size is external input, so this function will validate it carefully to avoid buffer overflow.\r
+\r
   @param[in]      VariableName       Name of Variable to be found.\r
   @param[in]      VendorGuid         Variable vendor GUID.\r
   @param[out]     Attributes         Attribute value of the variable found.\r
@@ -453,6 +469,9 @@ Done:
 /**\r
   This code sets variable in storage blocks (Volatile or Non-Volatile).\r
 \r
+  Caution: This function may receive untrusted input.\r
+  The data size and data are external input, so this function will validate it carefully to avoid buffer overflow.\r
+\r
   @param[in] VariableName                 Name of Variable to be found.\r
   @param[in] VendorGuid                   Variable vendor GUID.\r
   @param[in] Attributes                   Attribute value of the variable found\r
index 644c4fce67ddbdca77c2d0602ef37a14835bd981..4bd470662f09ca8c7075ca544dfce8bbca8cee0e 100644 (file)
@@ -5,6 +5,11 @@
 #  four EFI_RUNTIME_SERVICES: SetVariable, GetVariable, GetNextVariableName and QueryVariableInfo\r
 #  and works with SMM variable module together.\r
 #\r
+#  Caution: This module requires additional review when modified.\r
+#  This driver will have external input - variable data.\r
+#  This external input must be validated carefully to avoid security issues such as\r
+#  buffer overflow or integer overflow.\r
+#\r
 # Copyright (c) 2010 - 2014, Intel Corporation. All rights reserved.<BR>\r
 #\r
 #  This program and the accompanying materials\r
index 5b5dcd8ab35d9b73cb9f3ae9c2b9f00d61ae6d0f..39cf83edec2b63cdcf3a24a9edf918e38b429d65 100644 (file)
Binary files a/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmmRuntimeDxe.uni and b/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmmRuntimeDxe.uni differ