Module Name: src Committed By: mlelstv Date: Sat Jul 13 17:03:01 UTC 2019
Modified Files: src/sys/arch/amd64/amd64: trap.c Log Message: Use common code for SMEP/SMAP panic to print more information and allow debugging. To generate a diff of this commit: cvs rdiff -u -r1.120 -r1.121 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.120 src/sys/arch/amd64/amd64/trap.c:1.121 --- src/sys/arch/amd64/amd64/trap.c:1.120 Wed May 15 13:49:10 2019 +++ src/sys/arch/amd64/amd64/trap.c Sat Jul 13 17:03:01 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: trap.c,v 1.120 2019/05/15 13:49:10 christos Exp $ */ +/* $NetBSD: trap.c,v 1.121 2019/07/13 17:03:01 mlelstv 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.120 2019/05/15 13:49:10 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.121 2019/07/13 17:03:01 mlelstv Exp $"); #include "opt_ddb.h" #include "opt_kgdb.h" @@ -481,13 +481,9 @@ trap(struct trapframe *frame) if (frame->tf_err & PGEX_X) { /* SMEP might have brought us here */ if (cr2 < VM_MAXUSER_ADDRESS) { - if (cr2 == 0) - panic("prevented jump to null" - " instruction pointer (SMEP)"); - else - panic("prevented execution of" - " user address %p (SMEP)", - (void *)cr2); + printf("prevented execution of %p (SMEP)\n", + (void *)cr2); + goto we_re_toast; } } @@ -495,8 +491,9 @@ trap(struct trapframe *frame) cr2 < VM_MAXUSER_ADDRESS) { /* SMAP might have brought us here */ if (onfault_handler(pcb, frame) == NULL) { - panic("prevented access to %p (SMAP)", + printf("prevented access to %p (SMAP)\n", (void *)cr2); + goto we_re_toast; } }