summaryrefslogtreecommitdiff
path: root/MdeModulePkg/Library/PiDxeS3BootScriptLib/InternalBootScriptLib.h
diff options
context:
space:
mode:
authorAnsen Huang <ansen.huang@microsoft.com>2025-11-04 02:02:05 +0300
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2026-08-27 16:22:19 +0300
commitf24679c855400cb306f543bf353f102b9120ba7a (patch)
treee4d47889582204161849798bf16cdaa492a1473b /MdeModulePkg/Library/PiDxeS3BootScriptLib/InternalBootScriptLib.h
parent48c268e7f4ae5bc7a0a716bfbfd4c20e45f59b25 (diff)
downloadedk2-f24679c855400cb306f543bf353f102b9120ba7a.tar.xz
MdeModulePkg: Skip deleted vars in PeiVariable index table searches
The Variable PEIM's index table optimization search path incorrectly returns deleted variables instead of valid variables when duplicate variables exist with different states. This occurs when: - One variable has deleted state (VAR_IN_DELETED_TRANSITION & VAR_ADDED, value 0x3C) - One variable has valid state (VAR_ADDED, value 0x3F) - Both variables have the same name and GUID The function should prioritize and return the valid variable, but the index table search was returning the first match regardless of state validity. In the FindVariableEx() index table traversal, the function was not properly validating variable states before returning a match. When CompareWithValidVariable() found a matching variable name and GUID, it would return immediately without checking if the variable state was valid (0x3F) or deleted (0x3C). This issue only affects the index table optimization search path and does not impact the linear traversal search path. The Variable PEIM has two main search mechanisms: 1. Linear traversal search - Walks through the entire variable store checking each header sequentially. This path has correct state validation logic and is unaffected by this issue. 2. Index table optimization search - Uses a gEfiVariableIndexTableGuid HOB to quickly jump to variable locations. This optimization is only active when the platform produces this HOB. This is the path affected by the issue. This commit adds explicit state validation in FindVariableEx() to skip variables with deleted state (0x3C). Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
Diffstat (limited to 'MdeModulePkg/Library/PiDxeS3BootScriptLib/InternalBootScriptLib.h')
0 files changed, 0 insertions, 0 deletions