diff options
author | James Morse <james.morse@arm.com> | 2016-06-20 19:28:01 +0200 |
---|---|---|
committer | Will Deacon <will.deacon@arm.com> | 2016-07-07 16:55:37 +0200 |
commit | e19a6ee2460bdd0d0055a6029383422773f9999a (patch) | |
tree | f8e7898101568c82617d7afd66e712b9f0538a0e /arch/arm64/mm | |
parent | Linux 4.7-rc5 (diff) | |
download | linux-e19a6ee2460bdd0d0055a6029383422773f9999a.tar.xz linux-e19a6ee2460bdd0d0055a6029383422773f9999a.zip |
arm64: kernel: Save and restore UAO and addr_limit on exception entry
If we take an exception while at EL1, the exception handler inherits
the original context's addr_limit and PSTATE.UAO values. To be consistent
always reset addr_limit and PSTATE.UAO on (re-)entry to EL1. This
prevents accidental re-use of the original context's addr_limit.
Based on a similar patch for arm from Russell King.
Cc: <stable@vger.kernel.org> # 4.6-
Acked-by: Will Deacon <will.deacon@arm.com>
Reviewed-by: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: James Morse <james.morse@arm.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
Diffstat (limited to 'arch/arm64/mm')
-rw-r--r-- | arch/arm64/mm/fault.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/arch/arm64/mm/fault.c b/arch/arm64/mm/fault.c index 013e2cbe7924..b1166d1e5955 100644 --- a/arch/arm64/mm/fault.c +++ b/arch/arm64/mm/fault.c @@ -280,7 +280,8 @@ static int __kprobes do_page_fault(unsigned long addr, unsigned int esr, } if (permission_fault(esr) && (addr < USER_DS)) { - if (get_fs() == KERNEL_DS) + /* 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); if (!search_exception_tables(regs->pc)) |