summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinux Build Service Account <lnxbuild@localhost>2017-01-30 07:04:53 -0800
committerGerrit - the friendly Code Review server <code-review@localhost>2017-01-30 07:04:52 -0800
commitfbf5f7c2db68a10a681929fded48615629751af8 (patch)
treea4d31bbbe52cc31a77eaba7c597d371568c64172
parentf6e3e8bba44447d27fe7a53f16890d57293fec6f (diff)
parent76e9e5bbd9122e10e028585c6fac95a5e09cf9e6 (diff)
Merge "arm64: kernel: Save and restore UAO and addr_limit on exception entry"
-rw-r--r--arch/arm64/kernel/entry.S3
-rw-r--r--arch/arm64/mm/fault.c3
2 files changed, 5 insertions, 1 deletions
diff --git a/arch/arm64/kernel/entry.S b/arch/arm64/kernel/entry.S
index 9bcc0ad84917..cab1821db191 100644
--- a/arch/arm64/kernel/entry.S
+++ b/arch/arm64/kernel/entry.S
@@ -104,6 +104,7 @@
str x20, [sp, #S_ORIG_ADDR_LIMIT]
mov x20, #TASK_SIZE_64
str x20, [tsk, #TI_ADDR_LIMIT]
+ ALTERNATIVE(nop, SET_PSTATE_UAO(0), ARM64_HAS_UAO, CONFIG_ARM64_UAO)
.endif /* \el == 0 */
mrs x22, elr_el1
mrs x23, spsr_el1
@@ -139,6 +140,8 @@
/* Restore the task's original addr_limit. */
ldr x20, [sp, #S_ORIG_ADDR_LIMIT]
str x20, [tsk, #TI_ADDR_LIMIT]
+
+ /* No need to restore UAO, it will be restored from SPSR_EL1 */
.endif
ldp x21, x22, [sp, #S_PC] // load ELR, SPSR
diff --git a/arch/arm64/mm/fault.c b/arch/arm64/mm/fault.c
index 68cd3bb8eb89..eacaee18645b 100644
--- a/arch/arm64/mm/fault.c
+++ b/arch/arm64/mm/fault.c
@@ -291,7 +291,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))