diff options
author | Patrick Wildt <patrick@cvs.openbsd.org> | 2016-10-22 17:48:42 +0000 |
---|---|---|
committer | Patrick Wildt <patrick@cvs.openbsd.org> | 2016-10-22 17:48:42 +0000 |
commit | ed7072c40aa37f180c86c20062d0cc6c8dd2d2e7 (patch) | |
tree | 9eb714f259038d5e03025a49676ed8b493629e5c /sys/arch | |
parent | bdf52bb9dfcc3ccee177baef57030534355267f8 (diff) |
If an Access Flag fault happens while we were running the kernel and
it happened on a kernel page, we need to consult the kernel pmap
instead of the current proc's pmap. Fixes panic when using tmpfs.
ok kettenis@
Diffstat (limited to 'sys/arch')
-rw-r--r-- | sys/arch/arm/arm/fault.c | 5 | ||||
-rw-r--r-- | sys/arch/arm/arm/pmap7.c | 5 | ||||
-rw-r--r-- | sys/arch/arm/include/frame.h | 5 |
3 files changed, 9 insertions, 6 deletions
diff --git a/sys/arch/arm/arm/fault.c b/sys/arch/arm/arm/fault.c index a9322acf938..788469b6ffa 100644 --- a/sys/arch/arm/arm/fault.c +++ b/sys/arch/arm/arm/fault.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fault.c,v 1.24 2016/10/08 05:49:08 guenther Exp $ */ +/* $OpenBSD: fault.c,v 1.25 2016/10/22 17:48:41 patrick Exp $ */ /* $NetBSD: fault.c,v 1.46 2004/01/21 15:39:21 skrll Exp $ */ /* @@ -188,9 +188,6 @@ static const struct data_abort data_aborts[] = { #endif }; -/* Determine if a fault came from user mode */ -#define TRAP_USERMODE(tf) ((tf->tf_spsr & PSR_MODE) == PSR_USR32_MODE) - /* Determine if 'ftyp' is a permission fault */ #define IS_PERMISSION_FAULT(ftyp) \ (((1 << (ftyp)) & \ diff --git a/sys/arch/arm/arm/pmap7.c b/sys/arch/arm/arm/pmap7.c index b7e0b6fa7f2..f99ee582e00 100644 --- a/sys/arch/arm/arm/pmap7.c +++ b/sys/arch/arm/arm/pmap7.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap7.c,v 1.54 2016/10/19 08:28:19 guenther Exp $ */ +/* $OpenBSD: pmap7.c,v 1.55 2016/10/22 17:48:41 patrick Exp $ */ /* $NetBSD: pmap.c,v 1.147 2004/01/18 13:03:50 scw Exp $ */ /* @@ -1697,6 +1697,9 @@ dab_access(trapframe_t *tf, u_int fsr, u_int far, struct proc *p) paddr_t pa; u_int l1idx; + if (!TRAP_USERMODE(tf) && far >= VM_MIN_KERNEL_ADDRESS) + pm = pmap_kernel(); + l1idx = L1_IDX(va); /* diff --git a/sys/arch/arm/include/frame.h b/sys/arch/arm/include/frame.h index 8aaaec07712..dd68dcc5d99 100644 --- a/sys/arch/arm/include/frame.h +++ b/sys/arch/arm/include/frame.h @@ -1,4 +1,4 @@ -/* $OpenBSD: frame.h,v 1.10 2016/04/25 08:00:43 patrick Exp $ */ +/* $OpenBSD: frame.h,v 1.11 2016/10/22 17:48:41 patrick Exp $ */ /* $NetBSD: frame.h,v 1.9 2003/12/01 08:48:33 scw Exp $ */ /* @@ -83,6 +83,9 @@ typedef struct trapframe { #define tf_r14 tf_usr_lr #define tf_r15 tf_pc +/* Determine if a fault came from user mode */ +#define TRAP_USERMODE(tf) ((tf->tf_spsr & PSR_MODE) == PSR_USR32_MODE) + /* * Signal frame. Pushed onto user stack before calling sigcode. */ |