]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
efi/libstub: Avoid physical address 0x0 when doing random allocation
authorArd Biesheuvel <ardb@kernel.org>
Fri, 14 Mar 2025 11:03:33 +0000 (12:03 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 28 Mar 2025 20:59:01 +0000 (21:59 +0100)
commitccb4aef2e77efe8271f5c13590194ec7f89611cb
treec87874bdd707a64be66255427be57bcf6f24bd5d
parent1091f78287e0b1d47b38cc78fbb90ca669ec9ed2
efi/libstub: Avoid physical address 0x0 when doing random allocation

commit cb16dfed0093217a68c0faa9394fa5823927e04c upstream.

Ben reports spurious EFI zboot failures on a system where physical RAM
starts at 0x0. When doing random memory allocation from the EFI stub on
such a platform, a random seed of 0x0 (which means no entropy source is
available) will result in the allocation to be placed at address 0x0 if
sufficient space is available.

When this allocation is subsequently passed on to the decompression
code, the 0x0 address is mistaken for NULL and the code complains and
gives up.

So avoid address 0x0 when doing random allocation, and set the minimum
address to the minimum alignment.

Cc: <stable@vger.kernel.org>
Reported-by: Ben Schneider <ben@bens.haus>
Tested-by: Ben Schneider <ben@bens.haus>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/firmware/efi/libstub/randomalloc.c