On Thu, Jul 20, 2017 at 11:03:18PM +0200, Mark Kettenis wrote:
> Already had the SEGV_ACCERR/SEGV_MAPERR bits right.  So this just
> fixes the SIGBUS of access beyond the mapped object.  Tried to follow
> amd64 since it was already close.
> 
> ok?

OK bluhm@

> Index: arch/arm/arm/fault.c
> ===================================================================
> RCS file: /cvs/src/sys/arch/arm/arm/fault.c,v
> retrieving revision 1.28
> diff -u -p -r1.28 fault.c
> --- arch/arm/arm/fault.c      30 Apr 2017 13:04:49 -0000      1.28
> +++ arch/arm/arm/fault.c      20 Jul 2017 20:51:08 -0000
> @@ -339,16 +339,21 @@ data_abort_handler(trapframe_t *tf)
>               dab_fatal(tf, fsr, far, p, NULL);
>       }
>  
> -     sv.sival_ptr = (u_int32_t *)far;
> +     sd.signo = SIGSEGV;
> +     sd.code = SEGV_MAPERR;
>       if (error == ENOMEM) {
>               printf("UVM: pid %d (%s), uid %d killed: "
>                   "out of swap\n", p->p_p->ps_pid, p->p_p->ps_comm,
>                   p->p_ucred ? (int)p->p_ucred->cr_uid : -1);
>               sd.signo = SIGKILL;
> -     } else
> -             sd.signo = SIGSEGV;
> -
> -     sd.code = (error == EACCES) ? SEGV_ACCERR : SEGV_MAPERR;
> +             sd.code = 0;
> +     }
> +     if (error == EACCES) 
> +             sd.code = SEGV_ACCERR;
> +     if (error == EIO) {
> +             sd.signo = SIGBUS;
> +             sd.code = BUS_OBJERR;
> +     }
>       sd.addr = far;
>       sd.trap = fsr;
>  do_trapsignal:

Reply via email to