diff options
| author | Kiryl Shutsemau (Meta) <kas@kernel.org> | 2026-02-17 10:49:57 +0000 |
|---|---|---|
| committer | Ard Biesheuvel <ardb@kernel.org> | 2026-02-18 11:26:20 +0100 |
| commit | 948a013a54c47d5eba06e644b99d4927a8bc62f8 (patch) | |
| tree | dc71b583cf70b1cd67d314843d36e1d36f2dc999 /tools/debugging | |
| parent | 0862438c90487e79822d5647f854977d50381505 (diff) | |
efi: Align unaccepted memory range to page boundary
The accept_memory() and range_contains_unaccepted_memory() functions
employ a "guard page" logic to prevent crashes with load_unaligned_zeropad().
This logic extends the range to be accepted (or checked) by one unit_size
if the end of the range is aligned to a unit_size boundary.
However, if the caller passes a range that is not page-aligned, the
'end' of the range might not be numerically aligned to unit_size, even
if it covers the last page of a unit. This causes the "if (!(end % unit_size))"
check to fail, skipping the necessary extension and leaving the next
unit unaccepted, which can lead to a kernel panic when accessed by
load_unaligned_zeropad().
Align the start address down and the size up to the nearest page
boundary before performing the unit_size alignment check. This ensures
that the guard unit is correctly added when the range effectively ends
on a unit boundary.
Signed-off-by: Kiryl Shutsemau (Meta) <kas@kernel.org>
Reviewed-by: Tom Lendacky <thomas.lendacky@amd.com>
Acked-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Diffstat (limited to 'tools/debugging')
0 files changed, 0 insertions, 0 deletions
