Repository navigation
feat(uefi): read TianoCore EDK2 NVRAM variable stores - #14701
Conversation
Add read-only parsing of gEfiVariableGuid / gEfiAuthenticatedVariableGuid VARIABLE_STORE_HEADER regions to inspect_uefi_nvram via additive edk2_stores, preserving the AMI NVAR stores contract and reporting added vs superseded variable states.
Codex Review Summary: ❌ FailedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
[Medium impact] The PR appears safe to merge; no blocking findings remain. SummaryAdds read-only EDK2 / OVMF variable-store inventory under
Diagram%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Read local image] --> B[Create shared record budget]
B --> C[Scan AMI NVAR chains]
C --> D[Scan EDK2 variable stores]
D --> E[Combine coverage and limitations]
E --> F[Return stores and edk2_stores]
Reviews (5) · Last reviewed commit: "fix(uefi): distinguish unchecked EDK2 st..." · Reviewed by Greptile |
Occupy store ranges and charge decoded names before retention, keep truncated and damaged-name facts, examine unread tails, and compose empty-format diagnostics from scanner facts with a provider-level test.
…locks Walk store GUID candidates in ascending offset order, claim only verified spans so damaged oversized headers cannot hide later stores, and checkpoint erased suffixes per 64 KiB block.
A gEfiVariableGuid or gEfiAuthenticatedVariableGuid match whose header lacks the formatted marker was skipped silently, so an image holding only such a header reported that no EDK2 store exists. It is now reported as a rejected signature, and the absence statement is qualified. A formatted store that is not HEALTHY is walked with EDK2's verdict as a caveat: EDK2 treats it as invalid, while UEFITool still parses it. A store at an unaligned image offset states the HEADER_ALIGN assumption. An in-use EDK2 fault-tolerant-write queue is noted, because REA does not replay FTW writes or rebuild a store from the spare area. AMI NVAR and EDK2 scans now share one structural record budget, as the limit documents. GUID signature encoding moves to UefiGuid beside its decoder, header field offsets are named after VariableFormat.h, the limitation-line cap is a named limit, and the store walk is split from header admission with unreachable branches removed.
Carry an explicit completed-search absence fact from the EDK2 scanner. Partial or budget-stopped searches report that presence is unknown instead of claiming no store exists.
|
Thanks for this. I reviewed the whole PR against EDK2's own headers and UEFITool, and pushed two commits on top of your branch: a merge of The layout you implemented matches EDK2: both variable header forms, the store header, the Defects fixed
Brittleness cleanup
Left as is: Validation
Sources
|
Summary
Fixes #13229.
inspect_uefi_nvrampreviously returnedstores: []with only an AMI NVAR limitation for TianoCore EDK2 / OVMF*_VARS.fdimages. It now also reportsVARIABLE_STORE_HEADERregions under additiveedk2_storeswhile leaving the AMIstorescontract unchanged.Problem and expected behavior
EDK2 / OVMF / ArmVirtQemu NVRAM flash images use
gEfiVariableGuidorgEfiAuthenticatedVariableGuidstore headers. Analysts need static BootOrder / SecureBoot style inventory with active (VAR_ADDED/0x3f) versus superseded states without executing firmware. Expected: read-only EDK2 store cartography alongside the existing AMI path.Change and scope
scanEdk2VariableStoresfor public UEFI PI / EDK2VariableFormat.hlayouts (authenticated and non-auth headers, 4-byte alignment, Format0x5a/ State0xfe).edk2_stores(issue Option B) so AMIstoresremain byte-compatible.statefrom the observed State byte (added,in-deleted-transition0x3e,deletedincluding0x3d= ADDED&DELETED,header-only,unknown); reportstate_raw, 32-bit EFIattributes,vendor_guid, and bounded data digests without interpreting bytes.Contribution scope: ordinary extension of the existing read-only UEFI NVRAM inspector. Maintainer scope decision: not applicable (no target execution, injection, mutation, or protection recovery).
Contract and boundary impact
inspect_uefi_nvram/UefiAnalysisProvider+UefiEdk2Nvramproduce EDK2 store facts; AMI mapping unchanged. Consumers that only readstoreskeep prior AMI behavior; callers that need EDK2 readedk2_stores.edk2_storesoninspect_uefi_nvramoutput; inputmax_storesapplies per format; description updated.edk2_storesoptional for Evidence saved before this field; producers always emit it.docs/public/product-catalog.json), package, or installation impact: catalog regenerates in CI from contracts; no package metadata change.Expected effects (check known effects; use documentation-only on its own).
Unchecked items do not establish absence; leave uncertainties visible.
Evidence and regression coverage
src/uefi/UefiNvram.test.ts— synthetic authenticated BootOrder (0x3ddeleted +0x3fadded), non-authgEfiVariableGuid+in-deleted-transition(0x3e),max_storespartial coverage; existing AMI tests unchanged.stores: []with the AMI empty limitation.edk2_storesarrays withstate/state_raw/vendor_guid/ data ranges.Boundary regressions: parser inventory for a new firmware region format (module tests). Lifecycle regressions: not applicable (no owned child processes).
For evidence-bearing changes:
Validation performed
npm run test:focused -- src/uefi/UefiNvram.test.ts— 16 passednpm run verify:architecture-guards— passednpm run check:fast(pre-push) — typecheck + lint + architecture guards passedgit fetch upstream main; AMI scan of synthetic EDK2 fixture stillstores: []; no open PR for [Feature] Support TianoCore EDK2 variable stores (gEfiVariableGuid / gEfiAuthenticatedVariableGuid) in inspect_uefi_nvram #13229Compatibility, safety, and release
edk2_stores; AMIstoresunchanged.Author readiness
Human owner: @BeqaKs
Author checklist (completed by the PR author before requesting review)
type(scope): outcome.REA_runtime setting with a default, floor, and maximum, unless a fixed ceiling has a stated reason. See Adding a runtime setting.