Patch "[Variant 1/Spectre-v1] arm64: Make USER_DS an inclusive limit" has been added to the 4.15-stable tree
Subsystems (2)
This is a note to let you know that I've just added the patch titled
[Variant 1/Spectre-v1] arm64: Make USER_DS an inclusive limit
to the 4.15-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
arm64-make-user_ds-an-inclusive-limit.patch
and it can be found in the queue-4.15 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.
Quoted 1 line
From foo@baz Tue Feb 13 17:25:10 CET 2018
From: Robin Murphy <[email protected]>
Date: Mon, 5 Feb 2018 15:34:18 +0000
Subject: [Variant 1/Spectre-v1] arm64: Make USER_DS an inclusive limit
From: Robin Murphy <[email protected]>
Commit 51369e398d0d upstream.
Currently, USER_DS represents an exclusive limit while KERNEL_DS is inclusive. In order to do some clever trickery for speculation-safe masking, we need them both to behave equivalently - there aren't enough bits to make KERNEL_DS exclusive, so we have precisely one option. This also happens to correct a longstanding false negative for a range ending on the very top byte of kernel memory.
Mark Rutland points out that we've actually got the semantics of addresses vs. segments muddled up in most of the places we need to amend, so shuffle the {USER,KERNEL}_DS definitions around such that we can correct those properly instead of just pasting "-1"s everywhere.
--- arch/arm64/include/asm/processor.h | 3 ++ arch/arm64/include/asm/uaccess.h | 45 +++++++++++++++++++++---------------- arch/arm64/kernel/entry.S | 4 +-- arch/arm64/mm/fault.c | 4 +-- 4 files changed, 33 insertions(+), 23 deletions(-)
arch/arm64/include/asm/processor.h +3 -0
@@ -21,6 +21,9 @@#define TASK_SIZE_64 (UL(1) << VA_BITS) +#define KERNEL_DS UL(-1) +#define USER_DS (TASK_SIZE_64 - 1) +#ifndef __ASSEMBLY__/*
arch/arm64/include/asm/uaccess.h +26 -19
65 lines not on this page · raw message
arch/arm64/kernel/entry.S +2 -2
@@ -167,10 +167,10 @@ alternative_else_nop_endif .else add x21, sp, #S_FRAME_SIZE get_thread_info tsk - /* Save the task's original addr_limit and set USER_DS (TASK_SIZE_64) */ + /* Save the task's original addr_limit and set USER_DS */ ldr x20, [tsk, #TSK_TI_ADDR_LIMIT] str x20, [sp, #S_ORIG_ADDR_LIMIT] - mov x20, #TASK_SIZE_64 + mov x20, #USER_DS str x20, [tsk, #TSK_TI_ADDR_LIMIT] /* No need to reset PSTATE.UAO, hardware's already set it to 0 for us */ .endif /* \el == 0 */
arch/arm64/mm/fault.c +2 -2
@@ -240,7 +240,7 @@ static inline bool is_permission_fault(uif (fsc_type == ESR_ELx_FSC_PERM)return true; -if (addr <USER_DS &&system_uses_ttbr0_pan ()) +if (addr <TASK_SIZE &&system_uses_ttbr0_pan ())return fsc_type == ESR_ELx_FSC_FAULT && (regs->pstate &PSR_PAN_BIT );
@@ -414,7 +414,7 @@ static int __kprobes do_page_fault(unsig mm_flags |=FAULT_FLAG_WRITE ; } -if (addr <USER_DS &&is_permission_fault (esr, regs, addr)) { +if (addr <TASK_SIZE &&is_permission_fault (esr, regs, addr)) {/* regs->orig_addr_limit may be 0 if we entered from EL0 */ if (regs->orig_addr_limit ==KERNEL_DS )die ("Accessing user space memory with fs=KERNEL_DS" , regs, esr);
Patches currently in stable-queue which might be from [email protected] are
queue-4.15/arm64-make-user_ds-an-inclusive-limit.patch queue-4.15/arm64-uaccess-don-t-bother-eliding-access_ok-checks-in-__-get-put-_user.patch queue-4.15/arm-arm64-smccc-make-function-identifiers-an-unsigned-quantity.patch queue-4.15/firmware-psci-expose-psci-conduit.patch queue-4.15/firmware-psci-expose-smccc-version-through-psci_ops.patch queue-4.15/arm64-use-pointer-masking-to-limit-uaccess-speculation.patch queue-4.15/arm-arm64-smccc-implement-smccc-v1.1-inline-primitive.patch queue-4.15/arm64-implement-array_index_mask_nospec.patch