Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 8 Jan 2018 12:56:53 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org
Subject:   svn commit: r327694 - in stable/11/sys: amd64/amd64 i386/i386
Message-ID:  <201801081256.w08Cur5c067549@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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) {



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201801081256.w08Cur5c067549>