Setting memory attributes in handle_image() does not comply with UEFI specification

Open
#614 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
38/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Stale
Tech stack
c

Research direction

Start at handle_image() and trace the AllocatePages() buffer whose memory attributes are set. Check the UEFI ARM64 requirement for 64KiB regions, then adjust the buffer alignment and used-memory rounding so it cannot contain the listed memory types; done means the resulting pages use compliant identical attributes.

Written by the indexing model from the issue text.

Description

The UEFI specification requires for the ARM 64bit architecture that if a 64 KiB page contains either of

  • EfiRuntimeServicesCode
  • EfiRuntimeServicesData
  • EfiReserved
  • EfiACPIMemoryNVS

then all 4KiB pages in the 64KiB page must use identical attributes.

We must ensure that the buffer allocated with AllocatePages() in handle_image() for which we set memory attributes does not contain any of the above memory types. The easiest way to fulfill the requirement is appropriate alignment and rounding of the used memory.

Best regards

Heinrich

Dominant language
C
Stars
1.1k
Forks
348
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from rhboot/shim

All issues in rhboot/shim

Similar issues

More C issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.