diff options
author | eric_tian <eric_tian@6f19259b-4bc3-4df7-8a09-765794883524> | 2009-03-19 08:50:41 +0000 |
---|---|---|
committer | eric_tian <eric_tian@6f19259b-4bc3-4df7-8a09-765794883524> | 2009-03-19 08:50:41 +0000 |
commit | fba0ee1f4cfd80ae2ac2ae5b82a01a17c72dfef5 (patch) | |
tree | e2103b23a0e7f15ea4abf32b34898f27fe867223 | |
parent | f7796c71c52d686034fffa3a7480cbdbb69ae531 (diff) | |
download | edk2-platforms-fba0ee1f4cfd80ae2ac2ae5b82a01a17c72dfef5.tar.xz |
Fix tracker 202216:linux runtime test issue.
[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.
Note that, Variable Pei driver has not such issue as the flash area is accessed in pre-os environment.All page table entries are filled. The access to next memory block will not cause such issue.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@7910 6f19259b-4bc3-4df7-8a09-765794883524
-rw-r--r-- | MdeModulePkg/Universal/Variable/EmuRuntimeDxe/EmuVariable.c | 2 | ||||
-rw-r--r-- | MdeModulePkg/Universal/Variable/Pei/Variable.c | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/MdeModulePkg/Universal/Variable/EmuRuntimeDxe/EmuVariable.c b/MdeModulePkg/Universal/Variable/EmuRuntimeDxe/EmuVariable.c index 1714ebab71..ef9d35de9f 100644 --- a/MdeModulePkg/Universal/Variable/EmuRuntimeDxe/EmuVariable.c +++ b/MdeModulePkg/Universal/Variable/EmuRuntimeDxe/EmuVariable.c @@ -310,7 +310,7 @@ FindVariable ( PtrTrack->StartPtr = (VARIABLE_HEADER *) (VariableStoreHeader[Index] + 1);
PtrTrack->EndPtr = GetEndPointer (VariableStoreHeader[Index]);
- while ((Variable[Index] != NULL) && (Variable[Index] <= GetEndPointer (VariableStoreHeader[Index]))) {
+ while ((Variable[Index] < GetEndPointer (VariableStoreHeader[Index])) && (Variable[Index] != NULL)) {
if (Variable[Index]->StartId == VARIABLE_DATA && Variable[Index]->State == VAR_ADDED) {
if (!(EfiAtRuntime () && ((Variable[Index]->Attributes & EFI_VARIABLE_RUNTIME_ACCESS) == 0))) {
if (VariableName[0] == 0) {
diff --git a/MdeModulePkg/Universal/Variable/Pei/Variable.c b/MdeModulePkg/Universal/Variable/Pei/Variable.c index 7f4b4f68d7..39998f5f67 100644 --- a/MdeModulePkg/Universal/Variable/Pei/Variable.c +++ b/MdeModulePkg/Universal/Variable/Pei/Variable.c @@ -442,7 +442,7 @@ FindVariable ( PtrTrack->StartPtr = IndexTable->StartPtr;
PtrTrack->EndPtr = IndexTable->EndPtr;
- while (IsValidVariableHeader (Variable) && (Variable <= IndexTable->EndPtr)) {
+ while ((Variable < IndexTable->EndPtr) && IsValidVariableHeader (Variable)) {
if (Variable->State == VAR_ADDED) {
//
// Record Variable in VariableIndex HOB
|