summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2018-04-09 22:21:06 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2018-04-09 22:21:06 +0000
commit1d3edd2a1956b9dc82d9c6d923f647192aa396a6 (patch)
tree328394a47f1177096e2d50ab3dea9ace6eae35c7
parent00415188bd212b34608bddaf0ceb90ea82fc72d1 (diff)
Set trapframe pointer early on in do_el0_sync. This allows the use of
PROC_STACK() in the upcoming stack pointer checking diff and probably fixes bugs where ptrace(2) and core dumps would report the wrong register state. ok deraadt@
-rw-r--r--sys/arch/arm64/arm64/syscall.c4
-rw-r--r--sys/arch/arm64/arm64/trap.c4
2 files changed, 4 insertions, 4 deletions
diff --git a/sys/arch/arm64/arm64/syscall.c b/sys/arch/arm64/arm64/syscall.c
index 6e20b2b9968..9406a32c80f 100644
--- a/sys/arch/arm64/arm64/syscall.c
+++ b/sys/arch/arm64/arm64/syscall.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: syscall.c,v 1.2 2018/01/12 22:20:28 kettenis Exp $ */
+/* $OpenBSD: syscall.c,v 1.3 2018/04/09 22:21:05 kettenis Exp $ */
/*
* Copyright (c) 2015 Dale Rahn <drahn@dalerahn.com>
*
@@ -50,8 +50,6 @@ svc_handler(trapframe_t *frame)
if (__predict_true((frame->tf_spsr & I_bit) == 0))
enable_interrupts();
- p->p_addr->u_pcb.pcb_tf = frame;
-
code = frame->tf_x[8];
ap = &frame->tf_x[0];
diff --git a/sys/arch/arm64/arm64/trap.c b/sys/arch/arm64/arm64/trap.c
index c65d764dc3a..c655e5e6607 100644
--- a/sys/arch/arm64/arm64/trap.c
+++ b/sys/arch/arm64/arm64/trap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: trap.c,v 1.17 2018/04/09 22:17:11 kettenis Exp $ */
+/* $OpenBSD: trap.c,v 1.18 2018/04/09 22:21:05 kettenis Exp $ */
/*-
* Copyright (c) 2014 Andrew Turner
* All rights reserved.
@@ -39,6 +39,7 @@ __FBSDID("$FreeBSD: head/sys/arm64/arm64/trap.c 281654 2015-04-17 12:58:09Z andr
#include <sys/ptrace.h>
#include <sys/syscall.h>
#include <sys/signalvar.h>
+#include <sys/user.h>
#ifdef KDB
#include <sys/kdb.h>
@@ -231,6 +232,7 @@ do_el0_sync(struct trapframe *frame)
enable_interrupts();
+ p->p_addr->u_pcb.pcb_tf = frame;
refreshcreds(p);
switch(exception) {