Module Name: src
Committed By: maxv
Date: Sun Sep 3 09:01:03 UTC 2017
Modified Files:
src/sys/arch/amd64/amd64: trap.c
Log Message:
Treat page faults from iretq/etc as fatal, otherwise we could hide kernel
stack bugs. Note that it would be good to call check_swapgs from trap0e,
but a few things need to be fixed before that.
To generate a diff of this commit:
cvs rdiff -u -r1.97 -r1.98 src/sys/arch/amd64/amd64/trap.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/arch/amd64/amd64/trap.c
diff -u src/sys/arch/amd64/amd64/trap.c:1.97 src/sys/arch/amd64/amd64/trap.c:1.98
--- src/sys/arch/amd64/amd64/trap.c:1.97 Sun Sep 3 08:52:18 2017
+++ src/sys/arch/amd64/amd64/trap.c Sun Sep 3 09:01:03 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: trap.c,v 1.97 2017/09/03 08:52:18 maxv Exp $ */
+/* $NetBSD: trap.c,v 1.98 2017/09/03 09:01:03 maxv Exp $ */
/*
* Copyright (c) 1998, 2000, 2017 The NetBSD Foundation, Inc.
@@ -64,7 +64,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.97 2017/09/03 08:52:18 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.98 2017/09/03 09:01:03 maxv Exp $");
#include "opt_ddb.h"
#include "opt_kgdb.h"
@@ -401,6 +401,7 @@ trap(struct trapframe *frame)
case T_TSSFLT:
if (p == NULL)
goto we_re_toast;
+
/* Check for copyin/copyout fault. */
onfault = onfault_handler(pcb, frame);
if (onfault != NULL) {
@@ -412,7 +413,6 @@ copyfault:
return;
}
-kernelfault:
trap_user_kernelmode(frame, type, l, p);
goto we_re_toast;
@@ -662,7 +662,7 @@ faultcommon:
goto copyfault;
printf("uvm_fault(%p, 0x%lx, %d) -> %x\n",
map, va, ftype, error);
- goto kernelfault;
+ goto we_re_toast;
}
KSI_INIT_TRAP(&ksi);