Skip to content

firmware_uefi: test NVRAM quota enforcement - #5071

Open
Mike Ebersol (mebersol) wants to merge 1 commit into
microsoft:mainfrom
mebersol:user/mebersol/59884185-openhcl-nvram
Open

Mike Ebersol (mebersol) wants to merge 1 commit into
microsoft:mainfrom
mebersol:user/mebersol/59884185-openhcl-nvram

Conversation

@mebersol

Copy link
Copy Markdown
Collaborator

[Copilot]

Why

Protect OpenHCL's existing NVRAM capacity enforcement against regressions. Store exhaustion must return EFI_OUT_OF_RESOURCES, while oversized variables must return EFI_INVALID_PARAMETER, without changing existing contents.

What Changed

Add exact-capacity tests for rejected insert, replacement, and append operations, preservation of live and persisted state, space reclamation through shrink/delete, and reload.

Exercise the real HCL-compatible store through guest command descriptors during boot and runtime, checking guest-visible status write-back and preservation of existing variable attributes and data.

This is a test-only change; production enforcement already handles these cases correctly.

Validation

WSL Linux x64, Rust stable 1.99.1, packages firmware_uefi and hcl_compat_uefi_nvram_storage:

  • cargo check: passed.
  • cargo clippy --all-targets: completed with warnings in unchanged code.
  • cargo doc --no-deps: passed.
  • cargo nextest run --profile agent: 51 passed, none skipped.
  • Final cargo xtask fmt --fix: passed, including lints and flowey verification.

Focused coverage collection was attempted but failed during coverage-helper setup before executing tests. No coverage result is claimed. VM boot, Windows, and ARM64 were not tested.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues remain for the NVRAM capacity regression-test additions.

No open issues 🎉

What changed in this PR

Adds regression tests for OpenHCL’s NVRAM capacity enforcement at the storage and guest-command layers. Production behavior is unchanged.

Changes:

  • Test exact-capacity rejection without live or persisted state changes, plus space reclamation and reload.
  • Verify guest-visible quota and size-limit errors during boot and runtime, preserving existing attributes and data.
File Description
vm/​devices/​firmware/​hcl_compat_uefi_nvram_storage/​src/​lib.rs Adds storage quota, state-preservation, reclamation, and reload tests.
vm/​devices/​firmware/​firmware_uefi/​src/​service/​nvram/​mod.rs Generalizes the test helper and tests EFI status write-back using the HCL-compatible store.

Review effort: Balanced

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants