Fixes regress/sys/kern/siginfo-fault on hppa.  For some reason the old
code munges EACCES into EFAULT so it never actually generated
SEGV_ACCERR.

ok?


Index: arch/hppa/hppa/trap.c
===================================================================
RCS file: /cvs/src/sys/arch/hppa/hppa/trap.c,v
retrieving revision 1.141
diff -u -p -r1.141 trap.c
--- arch/hppa/hppa/trap.c       19 Oct 2016 08:31:32 -0000      1.141
+++ arch/hppa/hppa/trap.c       21 Jul 2017 23:26:53 -0000
@@ -513,23 +513,27 @@ datacc:
                 * the current limit and we need to reflect that as an access
                 * error.
                 */
-               if (space != HPPA_SID_KERNEL &&
-                   va < (vaddr_t)vm->vm_minsaddr) {
-                       if (ret == 0)
-                               uvm_grow(p, va);
-                       else if (ret == EACCES)
-                               ret = EFAULT;
-               }
+               if (ret == 0 && space != HPPA_SID_KERNEL &&
+                   va < (vaddr_t)vm->vm_minsaddr)
+                       uvm_grow(p, va);
 
                KERNEL_UNLOCK();
 
                if (ret != 0) {
                        if (type & T_USER) {
+                               int signal, sicode;
+
+                               signal = SIGSEGV;
+                               sicode = SEGV_MAPERR;
+                               if (ret == EACCES)
+                                       sicode = SEGV_ACCERR;
+                               if (ret == EIO) {
+                                       signal = SIGBUS;
+                                       sicode = BUS_OBJERR;
+                               }
                                sv.sival_int = va;
                                KERNEL_LOCK();
-                               trapsignal(p, SIGSEGV, vftype,
-                                   ret == EACCES? SEGV_ACCERR : SEGV_MAPERR,
-                                   sv);
+                               trapsignal(p, signal, vftype, sicode, sv);
                                KERNEL_UNLOCK();
                        } else {
                                if (p && p->p_addr->u_pcb.pcb_onfault) {

Reply via email to