]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Fix tracker 202216:linux runtime test issue.
authoreric_tian <eric_tian@6f19259b-4bc3-4df7-8a09-765794883524>
Mon, 16 Mar 2009 09:57:10 +0000 (09:57 +0000)
committereric_tian <eric_tian@6f19259b-4bc3-4df7-8a09-765794883524>
Mon, 16 Mar 2009 09:57:10 +0000 (09:57 +0000)
[Root Cause]
The root cause is that in FindVariable function, original code logic will traverse all variable stored in variable volatile/non-volatile area. If the non-variable area is full and Linux sets a new variable, the caller of GetNextVariablePtr will get the address of next memory block, but this block doesn't be reserved as RUNTIME attribute. Therefore its corresponding page translation table doesn't exist and causes linux kernel panic.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@7890 6f19259b-4bc3-4df7-8a09-765794883524

MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c

index 98da3b8b792a1b8bebc2e45975cd9098ca572aaa..7a69a223c4cf129b3db1a0940908410412208232 100644 (file)
@@ -930,7 +930,7 @@ FindVariable (
   InDeletedVariable     = NULL;\r
   InDeletedStorageIndex = 0;\r
   for (Index = 0; Index < 2; Index++) {\r
-    while (IsValidVariableHeader (Variable[Index]) && (Variable[Index] <= GetEndPointer (VariableStoreHeader[Index]))) {\r
+    while ((Variable[Index] < GetEndPointer (VariableStoreHeader[Index])) && IsValidVariableHeader (Variable[Index])) {\r
       if (Variable[Index]->State == VAR_ADDED || \r
           Variable[Index]->State == (VAR_IN_DELETED_TRANSITION & VAR_ADDED)\r
          ) {\r
@@ -2090,10 +2090,10 @@ FvbNotificationEvent (
     Status = VariableCommonInitialize (Fvb);\r
     ASSERT_EFI_ERROR (Status);\r
   \r
-    SystemTable->RuntimeServices->GetVariable            = RuntimeServiceGetVariable;\r
+    SystemTable->RuntimeServices->GetVariable         = RuntimeServiceGetVariable;\r
     SystemTable->RuntimeServices->GetNextVariableName = RuntimeServiceGetNextVariableName;\r
-    SystemTable->RuntimeServices->SetVariable            = RuntimeServiceSetVariable;\r
-    SystemTable->RuntimeServices->QueryVariableInfo      = RuntimeServiceQueryVariableInfo;\r
+    SystemTable->RuntimeServices->SetVariable         = RuntimeServiceSetVariable;\r
+    SystemTable->RuntimeServices->QueryVariableInfo   = RuntimeServiceQueryVariableInfo;\r
   \r
     //\r
     // Now install the Variable Runtime Architectural Protocol on a new handle\r