Re: [PATCH] efi/libstub: arm/arm64: don't use TASK_SIZE when randomising the RT space

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Ard, Mark

On 10/04/17 11:44, Mark Rutland wrote:
> On Mon, Apr 10, 2017 at 11:30:38AM +0100, Ard Biesheuvel wrote:
>> As reported by James, Catalin and Mark, commit e69176d68d26
>> ("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 changes in the future.
>>
>> Cc: James Morse <james.morse@xxxxxxx>
>> Cc: Mark Rutland <mark.rutland@xxxxxxx>
>> Cc: Catalin Marinas <catalin.marinas@xxxxxxx>
>> Cc: Matt Fleming <matt@xxxxxxxxxxxxxxxxxxx>
>> Cc: Ingo Molnar <mingo@xxxxxxxxxx>
>> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@xxxxxxxxxx>
> 
> With this patch applied atop of next-20170410, a defconfig arm64 kernel
> built with the Linaro 15.08 toolchain boots happily for me on Juno R1.

Likewise, this fixes the problem I was seeing on Seattle. If it's useful:
Tested-by: James Morse <james.morse@xxxxxxx>

Thanks for debugging that so quickly Mark!


James
--
To unsubscribe from this list: send the line "unsubscribe linux-efi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux