linux_dsm_epyc7002/drivers/firmware/efi/libstub
Ard Biesheuvel 197decefdb efi/libstub/arm: Don't use TASK_SIZE when randomizing the RT space
As reported by James, Catalin and Mark, commit:

  e69176d68d ("ef/libstub/arm/arm64: Randomize the base of the UEFI rt services region")

... results in a crash in the firmware, regardless of whether KASLR
is in effect or not and whether the firmware implements EFI_RNG_PROTOCOL
or not.

Mark has identified the root cause to be the inappropriate use of
TASK_SIZE in the stub, which arm64 defines as:

  #define TASK_SIZE             (test_thread_flag(TIF_32BIT) ? \
                                TASK_SIZE_32 : TASK_SIZE_64)

and testing thread flags at this point results in the dereference of
pointers in uninitialized structures.

So instead, introduce a preprocessor symbol EFI_RT_VIRTUAL_LIMIT and
define it to TASK_SIZE_64 on arm64 and TASK_SIZE on ARM, both of which
are compile time constants. Also, change the 'headroom' variable to
static const to force an error if this might change in the future.

Tested-by: Mark Rutland <mark.rutland@arm.com>
Tested-by: James Morse <james.morse@arm.com>
Tested-by: Catalin Marinas <catalin.marinas@arm.com>
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-arm-kernel@lists.infradead.org
Cc: linux-efi@vger.kernel.org
Link: http://lkml.kernel.org/r/20170417093201.10181-2-ard.biesheuvel@linaro.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
2017-04-17 12:35:33 +02:00
..
arm32-stub.c efi/libstub/arm/arm64: Disable debug prints on 'quiet' cmdline arg 2017-04-05 12:27:28 +02:00
arm64-stub.c efi/libstub: Unify command line param parsing 2017-04-05 12:27:28 +02:00
arm-stub.c efi/libstub/arm: Don't use TASK_SIZE when randomizing the RT space 2017-04-17 12:35:33 +02:00
efi-stub-helper.c efi/libstub/arm/arm64: Disable debug prints on 'quiet' cmdline arg 2017-04-05 12:27:28 +02:00
efistub.h efi/libstub/arm/arm64: Disable debug prints on 'quiet' cmdline arg 2017-04-05 12:27:28 +02:00
fdt.c efi/arm-stub: Round up FDT allocation to mapping size 2017-04-05 12:27:24 +02:00
gop.c efi/libstub: Skip GOP with PIXEL_BLT_ONLY format 2017-04-05 09:20:18 +02:00
Makefile efi: Get and store the secure boot status 2017-02-07 10:42:10 +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
secureboot.c efi/libstub/arm/arm64: Disable debug prints on 'quiet' cmdline arg 2017-04-05 12:27:28 +02:00
string.c arm64/efi: isolate EFI stub from the kernel proper 2015-10-12 16:20:12 +01:00