Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 27 Sep 2020 11:37:17 +0000 (UTC)
From:      Michal Meloun <mmel@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r366197 - head/sys/arm/arm
Message-ID:  <202009271137.08RBbHos043196@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mmel
Date: Sun Sep 27 11:37:17 2020
New Revision: 366197
URL: https://svnweb.freebsd.org/changeset/base/366197

Log:
  Don't send a signal with uninitialized 'sig' and 'code' fields.
  We have a few shortcuts in the arm trap code to speed up obvious "must fail"
  cases. In these situations, make sure that we fill in the "sig" and "code"
  fields of the generated signal.
  
  MFC after:	3 weeks

Modified:
  head/sys/arm/arm/trap-v6.c

Modified: head/sys/arm/arm/trap-v6.c
==============================================================================
--- head/sys/arm/arm/trap-v6.c	Sun Sep 27 10:15:03 2020	(r366196)
+++ head/sys/arm/arm/trap-v6.c	Sun Sep 27 11:37:17 2020	(r366197)
@@ -464,8 +464,11 @@ abort_handler(struct trapframe *tf, int prefetch)
 		/*
 		 * Don't allow user-mode faults in kernel address space.
 		 */
-		if (usermode)
+		if (usermode) {
+			ksig.sig = SIGSEGV;
+			ksig.code = SEGV_ACCERR;
 			goto nogo;
+		}
 
 		map = kernel_map;
 	} else {
@@ -474,8 +477,11 @@ abort_handler(struct trapframe *tf, int prefetch)
 		 * is NULL or curproc->p_vmspace is NULL the fault is fatal.
 		 */
 		vm = (p != NULL) ? p->p_vmspace : NULL;
-		if (vm == NULL)
+		if (vm == NULL) {
+			ksig.sig = SIGSEGV;
+			ksig.code = 0;
 			goto nogo;
+		}
 
 		map = &vm->vm_map;
 		if (!usermode && (td->td_intr_nesting_level != 0 ||



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