kernel-ark/drivers/firmware/efi/libstub
Ard Biesheuvel 018edcfac4 efi/libstub: Make efi_random_alloc() allocate below 4 GB on 32-bit
The UEFI stub executes in the context of the firmware, which identity
maps the available system RAM, which implies that only memory below
4 GB can be used for allocations on 32-bit architectures, even on [L]PAE
capable hardware.

So ignore any reported memory above 4 GB in efi_random_alloc(). This
also fixes a reported build problem on ARM under -Os, where the 64-bit
logical shift relies on a software routine that the ARM decompressor does
not provide.

A second [minor] issue is also fixed, where the '+ 1' is moved out of
the shift, where it belongs: the reason for its presence is that a
memory region where start == end should count as a single slot, given
that 'end' takes the desired size and alignment of the allocation into
account.

To clarify the code in this regard, rename start/end to 'first_slot' and
'last_slot', respectively, and introduce 'region_end' to describe the
last usable address of the current region.

Reported-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Matt Fleming <matt@codeblueprint.co.uk>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-efi@vger.kernel.org
Link: http://lkml.kernel.org/r/1480010543-25709-2-git-send-email-ard.biesheuvel@linaro.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
2016-11-25 07:15:23 +01:00
..
arm32-stub.c efi/arm/libstub: Make screen_info accessible to the UEFI stub 2016-04-28 11:33:59 +02:00
arm64-stub.c arm64: kaslr: increase randomization granularity 2016-04-28 19:44:15 +01:00
arm-stub.c efi/arm*/libstub: Invoke EFI_RNG_PROTOCOL to seed the UEFI RNG table 2016-11-13 08:23:15 +01:00
efi-stub-helper.c efi/libstub: Add random.c to ARM build 2016-11-13 08:23:15 +01:00
efistub.h efi/arm*/libstub: Invoke EFI_RNG_PROTOCOL to seed the UEFI RNG table 2016-11-13 08:23:15 +01:00
fdt.c efi/libstub: Use efi_exit_boot_services() in FDT 2016-09-05 12:32:36 +01:00
gop.c efi/libstub: Move Graphics Output Protocol handling to generic code 2016-04-28 11:33:57 +02:00
Makefile efi/libstub: Add random.c to ARM build 2016-11-13 08:23:15 +01:00
random.c efi/libstub: Make efi_random_alloc() allocate below 4 GB on 32-bit 2016-11-25 07:15:23 +01:00
string.c arm64/efi: isolate EFI stub from the kernel proper 2015-10-12 16:20:12 +01:00