Skip to content

hii: account for efivarfs attributes when reading varstores - #13

Open
dishendradeshmukh1986 wants to merge 1 commit into
linuxboot:mainfrom
dishendradeshmukh1986:fix/efivarfs-varstore-read-size
Open

hii: account for efivarfs attributes when reading varstores#13
dishendradeshmukh1986 wants to merge 1 commit into
linuxboot:mainfrom
dishendradeshmukh1986:fix/efivarfs-varstore-read-size

Conversation

@dishendradeshmukh1986

Copy link
Copy Markdown

Summary

  • include the 4-byte efivarfs attributes field when reading a VarStore
  • preserve the complete HII-declared variable payload
  • add a regression test for extracting data after the attributes field

Root cause

efivarfs exposes each variable as a 4-byte attributes field followed by
the variable payload. VariableStore::read_bytes() allocated only the
HII-declared payload size, while extract_efi_data() skipped the first
four bytes. This left the final four payload bytes unavailable and caused
ExtractEFIDataError: failed to fill whole buffer for fields near the end
of a VarStore.

Testing

  • cargo test --lib (10 passed)

efivarfs prepends a 4-byte attributes field to each variable
payload. VariableStore::read_bytes() allocated only the HII-declared
payload size while extract_efi_data() skipped the attributes field,
leaving the final four payload bytes unavailable.

Read the attributes field together with the complete VarStore
payload.

Signed-off-by: Dishendra Deshmukh <dishendra.deshmukh@arm.com>
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.

1 participant