MdeModulePkg/EmuRuntimeDxe: skip console NVRAM variables
Tianocore currently reads/writes a lot of NVRAM variables that don't actually need to be saved. Occasionally some, specifically related to the graphical/serial consoles, can become corrupted, leading to a bricked device. To avoid this, temporarily restrict the reading/writing of variables to skip console related ones (starting with 'Con') until a better solution can be found. Test: build/boot google/eve, inject "bad" NVRAM data, observe device boots normally instead of hanging with no display detected. Signed-off-by: Matt DeVillier <matt.devillier@gmail.com>
This commit is contained in:
committed by
Tim Crawford
parent
e3e4f6ddd5
commit
e10ad1c874
@@ -1100,13 +1100,14 @@ UpdateVariable (
|
|||||||
Store:
|
Store:
|
||||||
// If the store is initialized
|
// If the store is initialized
|
||||||
// And we are storing or deleting a non volatile variable
|
// And we are storing or deleting a non volatile variable
|
||||||
|
// And variable name doesn't start with 'Con'
|
||||||
// Send the new data to SMMSTORE
|
// Send the new data to SMMSTORE
|
||||||
if (storeInitialized && (
|
if (storeInitialized && (
|
||||||
(Attributes & EFI_VARIABLE_NON_VOLATILE) != 0 || (
|
(Attributes & EFI_VARIABLE_NON_VOLATILE) != 0 || (
|
||||||
Delete &&
|
Delete &&
|
||||||
(Variable->CurrPtr->Attributes & EFI_VARIABLE_NON_VOLATILE) != 0
|
(Variable->CurrPtr->Attributes & EFI_VARIABLE_NON_VOLATILE) != 0
|
||||||
)
|
)) && (StrnCmp(L"Con", VariableName, StrLen(L"Con")))
|
||||||
)) {
|
) {
|
||||||
|
|
||||||
/* TODO: add hook for logging nv changes here */
|
/* TODO: add hook for logging nv changes here */
|
||||||
|
|
||||||
@@ -1978,6 +1979,8 @@ VariableCommonInitialize (
|
|||||||
EFI_GUID *guid = (EFI_GUID *)(buf + i + 8);
|
EFI_GUID *guid = (EFI_GUID *)(buf + i + 8);
|
||||||
VOID *data = (VOID *)(buf + i + 8 + keysz);
|
VOID *data = (VOID *)(buf + i + 8 + keysz);
|
||||||
|
|
||||||
|
// don't update console variables
|
||||||
|
if (StrnCmp(L"Con", varname, StrLen(L"Con"))) {
|
||||||
DEBUG ((DEBUG_WARN, "Fetching variable: %s\n", varname));
|
DEBUG ((DEBUG_WARN, "Fetching variable: %s\n", varname));
|
||||||
DEBUG ((DEBUG_WARN, "buf: %p, buf+i: %p, guid: %p, varname: %p, data: %p\n", buf, buf + i, guid, varname, data));
|
DEBUG ((DEBUG_WARN, "buf: %p, buf+i: %p, guid: %p, varname: %p, data: %p\n", buf, buf + i, guid, varname, data));
|
||||||
VARIABLE_POINTER_TRACK Variable;
|
VARIABLE_POINTER_TRACK Variable;
|
||||||
@@ -1993,8 +1996,10 @@ VariableCommonInitialize (
|
|||||||
EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
|
EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
|
||||||
&Variable
|
&Variable
|
||||||
);
|
);
|
||||||
|
} else {
|
||||||
|
DEBUG ((DEBUG_WARN, "Skipping console variable: %s\n", varname));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
DEBUG ((DEBUG_WARN, "Added variable: 0x%x, val size: %x\n", keysz, valsz));
|
|
||||||
// no UEFI variable since it's at most the GUID part, so skip
|
// no UEFI variable since it's at most the GUID part, so skip
|
||||||
i += 8 + keysz + valsz + 1;
|
i += 8 + keysz + valsz + 1;
|
||||||
i = (i + 3) & ~3;
|
i = (i + 3) & ~3;
|
||||||
|
Reference in New Issue
Block a user