]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commit
efi/libstub/random: Increase random alloc granularity
authorArd Biesheuvel <ardb@kernel.org>
Mon, 13 Apr 2020 14:06:56 +0000 (16:06 +0200)
committerArd Biesheuvel <ardb@kernel.org>
Thu, 23 Apr 2020 18:15:06 +0000 (20:15 +0200)
commitc37c9162a2fae026dc8570ad7c5ade0422b0a267
treedad943f57d61d611fe26b8d4b197f876c2f22d70
parente1df73e2d18b3b7d66f2ec38d81d9566b3a7fb21
efi/libstub/random: Increase random alloc granularity

The implementation of efi_random_alloc() arbitrarily truncates the
provided random seed to 16 bits, which limits the granularity of the
randomly chosen allocation offset in memory. This is currently only
an issue if the size of physical memory exceeds 128 GB, but going
forward, we will reduce the allocation alignment to 64 KB, and this
means we need to increase the granularity to ensure that the random
memory allocations are distributed evenly.

We will need to switch to 64-bit arithmetic for the multiplication,
but this does not result in 64-bit integer intrinsic calls on ARM or
on i386.

Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
drivers/firmware/efi/libstub/randomalloc.c