svn commit: r366197 - head/sys/arm/arm

Michal Meloun mmel at FreeBSD.org
Sun Sep 27 11:37:18 UTC 2020


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 ||


More information about the svn-src-head mailing list