svn commit: r327694 - in stable/11/sys: amd64/amd64 i386/i386

Konstantin Belousov kib at FreeBSD.org
Mon Jan 8 12:56:54 UTC 2018


Author: kib
Date: Mon Jan  8 12:56:53 2018
New Revision: 327694
URL: https://svnweb.freebsd.org/changeset/base/327694

Log:
  MFC r327472:
  Avoid re-check of usermode condition.

Modified:
  stable/11/sys/amd64/amd64/trap.c
  stable/11/sys/i386/i386/trap.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/amd64/amd64/trap.c
==============================================================================
--- stable/11/sys/amd64/amd64/trap.c	Mon Jan  8 11:45:56 2018	(r327693)
+++ stable/11/sys/amd64/amd64/trap.c	Mon Jan  8 12:56:53 2018	(r327694)
@@ -606,7 +606,6 @@ trap_pfault(struct trapframe *frame, int usermode)
 	td = curthread;
 	p = td->td_proc;
 	eva = frame->tf_addr;
-	rv = 0;
 
 	if (__predict_false((td->td_pflags & TDP_NOFAULTING) != 0)) {
 		/*
@@ -658,7 +657,7 @@ trap_pfault(struct trapframe *frame, int usermode)
 		 * Don't allow user-mode faults in kernel address space.
 		 */
 		if (usermode)
-			goto nogo;
+			return (SIGSEGV);
 
 		map = kernel_map;
 	} else {
@@ -713,7 +712,6 @@ trap_pfault(struct trapframe *frame, int usermode)
 #endif
 		return (0);
 	}
-nogo:
 	if (!usermode) {
 		if (td->td_intr_nesting_level == 0 &&
 		    curpcb->pcb_onfault != NULL) {

Modified: stable/11/sys/i386/i386/trap.c
==============================================================================
--- stable/11/sys/i386/i386/trap.c	Mon Jan  8 11:45:56 2018	(r327693)
+++ stable/11/sys/i386/i386/trap.c	Mon Jan  8 12:56:53 2018	(r327694)
@@ -742,7 +742,6 @@ trap_pfault(struct trapframe *frame, int usermode, vm_
 
 	td = curthread;
 	p = td->td_proc;
-	rv = 0;
 
 	if (__predict_false((td->td_pflags & TDP_NOFAULTING) != 0)) {
 		/*
@@ -803,7 +802,7 @@ trap_pfault(struct trapframe *frame, int usermode, vm_
 			return (-2);
 #endif
 		if (usermode)
-			goto nogo;
+			return (SIGSEGV);
 
 		map = kernel_map;
 	} else {
@@ -860,7 +859,6 @@ trap_pfault(struct trapframe *frame, int usermode, vm_
 #endif
 		return (0);
 	}
-nogo:
 	if (!usermode) {
 		if (td->td_intr_nesting_level == 0 &&
 		    curpcb->pcb_onfault != NULL) {


More information about the svn-src-stable-11 mailing list