[PATCHv2 0/2] efi: Fix alignenment issues in unaccepted memory code

Kiryl Shutsemau (Meta) posted 2 patches 1 month, 2 weeks ago
drivers/firmware/efi/efi.c               |  8 ++++----
drivers/firmware/efi/unaccepted_memory.c | 10 ++++++++--
2 files changed, 12 insertions(+), 6 deletions(-)
[PATCHv2 0/2] efi: Fix alignenment issues in unaccepted memory code
Posted by Kiryl Shutsemau (Meta) 1 month, 2 weeks ago
This series addresses two issues related to unaligned physical addresses
and sizes when handling EFI unaccepted memory. These issues were
identified as potential sources of kernel panics in Intel TDX
environments due to incomplete memory reservation or missing "guard page"
extensions.

The first patch fixes the reservation of the unaccepted memory table
itself in efi_config_parse_tables(). It ensures the entire page range
covering the table is reserved even if the table doesn't start on a
page boundary.

The second patch ensures that memory acceptance requests in
accept_memory() and range_contains_unaccepted_memory() are page-aligned
before performing the unit_size alignment check. This prevents skipping
the necessary "guard page" extension for unaligned ranges, which is
required to avoid crashes with load_unaligned_zeropad().

v2:
 - Fix 'end' calculation in the second patch (Tom)

Kiryl Shutsemau (Meta) (2):
  efi: Fix reservation of unaccepted memory table
  efi: Align unaccepted memory range to page boundary

 drivers/firmware/efi/efi.c               |  8 ++++----
 drivers/firmware/efi/unaccepted_memory.c | 10 ++++++++--
 2 files changed, 12 insertions(+), 6 deletions(-)

-- 
2.51.2
Re: [PATCHv2 0/2] efi: Fix alignenment issues in unaccepted memory code
Posted by Ard Biesheuvel 1 month, 2 weeks ago

On Tue, 17 Feb 2026, at 11:49, Kiryl Shutsemau (Meta) wrote:
> This series addresses two issues related to unaligned physical addresses
> and sizes when handling EFI unaccepted memory. These issues were
> identified as potential sources of kernel panics in Intel TDX
> environments due to incomplete memory reservation or missing "guard page"
> extensions.
>
> The first patch fixes the reservation of the unaccepted memory table
> itself in efi_config_parse_tables(). It ensures the entire page range
> covering the table is reserved even if the table doesn't start on a
> page boundary.
>
> The second patch ensures that memory acceptance requests in
> accept_memory() and range_contains_unaccepted_memory() are page-aligned
> before performing the unit_size alignment check. This prevents skipping
> the necessary "guard page" extension for unaligned ranges, which is
> required to avoid crashes with load_unaligned_zeropad().
>
> v2:
>  - Fix 'end' calculation in the second patch (Tom)
>
> Kiryl Shutsemau (Meta) (2):
>   efi: Fix reservation of unaccepted memory table
>   efi: Align unaccepted memory range to page boundary
>
>  drivers/firmware/efi/efi.c               |  8 ++++----
>  drivers/firmware/efi/unaccepted_memory.c | 10 ++++++++--
>  2 files changed, 12 insertions(+), 6 deletions(-)
>

This looks fine to me. If other folks are happy too, I'll queue it up and get it to Linus by the end of the week.
Re: [PATCHv2 0/2] efi: Fix alignenment issues in unaccepted memory code
Posted by Mike Rapoport 1 month, 2 weeks ago
On Tue, Feb 17, 2026 at 10:49:55AM +0000, Kiryl Shutsemau (Meta) wrote:
> This series addresses two issues related to unaligned physical addresses
> and sizes when handling EFI unaccepted memory. These issues were
> identified as potential sources of kernel panics in Intel TDX
> environments due to incomplete memory reservation or missing "guard page"
> extensions.
> 
> The first patch fixes the reservation of the unaccepted memory table
> itself in efi_config_parse_tables(). It ensures the entire page range
> covering the table is reserved even if the table doesn't start on a
> page boundary.
> 
> The second patch ensures that memory acceptance requests in
> accept_memory() and range_contains_unaccepted_memory() are page-aligned
> before performing the unit_size alignment check. This prevents skipping
> the necessary "guard page" extension for unaligned ranges, which is
> required to avoid crashes with load_unaligned_zeropad().
> 
> v2:
>  - Fix 'end' calculation in the second patch (Tom)
> 
> Kiryl Shutsemau (Meta) (2):
>   efi: Fix reservation of unaccepted memory table
>   efi: Align unaccepted memory range to page boundary

Acked-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
 
>  drivers/firmware/efi/efi.c               |  8 ++++----
>  drivers/firmware/efi/unaccepted_memory.c | 10 ++++++++--
>  2 files changed, 12 insertions(+), 6 deletions(-)
> 
> -- 
> 2.51.2
> 

-- 
Sincerely yours,
Mike.
Re: [PATCHv2 0/2] efi: Fix alignenment issues in unaccepted memory code
Posted by Tom Lendacky 1 month, 2 weeks ago
On 2/17/26 04:49, Kiryl Shutsemau (Meta) wrote:
> This series addresses two issues related to unaligned physical addresses
> and sizes when handling EFI unaccepted memory. These issues were
> identified as potential sources of kernel panics in Intel TDX
> environments due to incomplete memory reservation or missing "guard page"
> extensions.
> 
> The first patch fixes the reservation of the unaccepted memory table
> itself in efi_config_parse_tables(). It ensures the entire page range
> covering the table is reserved even if the table doesn't start on a
> page boundary.
> 
> The second patch ensures that memory acceptance requests in
> accept_memory() and range_contains_unaccepted_memory() are page-aligned
> before performing the unit_size alignment check. This prevents skipping
> the necessary "guard page" extension for unaligned ranges, which is
> required to avoid crashes with load_unaligned_zeropad().
> 
> v2:
>  - Fix 'end' calculation in the second patch (Tom)
> 
> Kiryl Shutsemau (Meta) (2):
>   efi: Fix reservation of unaccepted memory table
>   efi: Align unaccepted memory range to page boundary
> 
>  drivers/firmware/efi/efi.c               |  8 ++++----
>  drivers/firmware/efi/unaccepted_memory.c | 10 ++++++++--
>  2 files changed, 12 insertions(+), 6 deletions(-)

Reviewed-by: Tom Lendacky <thomas.lendacky@amd.com>

>
Re: [PATCHv2 0/2] efi: Fix alignenment issues in unaccepted memory code
Posted by Ard Biesheuvel 1 month, 1 week ago

On Tue, 17 Feb 2026, at 14:56, Tom Lendacky wrote:
> On 2/17/26 04:49, Kiryl Shutsemau (Meta) wrote:
>> This series addresses two issues related to unaligned physical addresses
>> and sizes when handling EFI unaccepted memory. These issues were
>> identified as potential sources of kernel panics in Intel TDX
>> environments due to incomplete memory reservation or missing "guard page"
>> extensions.
>> 
>> The first patch fixes the reservation of the unaccepted memory table
>> itself in efi_config_parse_tables(). It ensures the entire page range
>> covering the table is reserved even if the table doesn't start on a
>> page boundary.
>> 
>> The second patch ensures that memory acceptance requests in
>> accept_memory() and range_contains_unaccepted_memory() are page-aligned
>> before performing the unit_size alignment check. This prevents skipping
>> the necessary "guard page" extension for unaligned ranges, which is
>> required to avoid crashes with load_unaligned_zeropad().
>> 
>> v2:
>>  - Fix 'end' calculation in the second patch (Tom)
>> 
>> Kiryl Shutsemau (Meta) (2):
>>   efi: Fix reservation of unaccepted memory table
>>   efi: Align unaccepted memory range to page boundary
>> 
>>  drivers/firmware/efi/efi.c               |  8 ++++----
>>  drivers/firmware/efi/unaccepted_memory.c | 10 ++++++++--
>>  2 files changed, 12 insertions(+), 6 deletions(-)
>
> Reviewed-by: Tom Lendacky <thomas.lendacky@amd.com>
>

Thanks - I've queued this up now.