Port-arm archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: earmhf issues on Beaglebone Black



On Tue, Jul 22, 2014 at 01:17:29PM +0200, Manuel Bouyer wrote:
> 
> So it looks like the fault happens inside the execve(), but before the
> new executable has actually been loaded (which could explain
> why there's no core dump). 

I tracked this down to an error in copyin() or copyout() (which is not
so surprising, given the data_aborts message).

I used the attached patch to try to find the associated physical address.
To my surprise, pmap_extract() returned NULL, which would mean that
this address is actually not mapped (several samples of the same problem):
data_abort_handler: data_aborts fsr=0x183e far=0x40062000
dab_buserr far 0x40062000 -> NULL
copyin_vmspace: copyin 0x40062000 0xc8f94000 372 return 14

data_abort_handler: data_aborts fsr=0x180e far=0x7fffcb80
dab_buserr far 0x7fffcb80 -> NULL
copyargs, 1620: copyout @0x7fffcb80 4
copyoutargs: copyargs failed 14

data_abort_handler: data_aborts fsr=0x18be far=0x40062000
dab_buserr far 0x40062000 -> NULL
copyin_vmspace: copyin 0x40062000 0xc923c000 372 return 14

Does the patch below to print the PA makes sense ?
If so, could it be that the CPU, on some conditions, returns the
wrong fault type ?

-- 
Manuel Bouyer <bouyer%antioche.eu.org@localhost>
     NetBSD: 26 ans d'experience feront toujours la difference
--
Index: arm32/fault.c
===================================================================
RCS file: /cvsroot/src/sys/arch/arm/arm32/fault.c,v
retrieving revision 1.100
diff -u -p -u -r1.100 fault.c
--- arm32/fault.c       12 Apr 2014 09:11:47 -0000      1.100
+++ arm32/fault.c       22 Jul 2014 20:42:37 -0000
@@ -492,6 +492,7 @@ data_abort_handler(trapframe_t *tf)
 
        if (user == 0) {
                if (pcb->pcb_onfault) {
+                       printf("va 0x%lx ftype 0x%x pcb_onfault %p error %d\n", 
va, ftype, pcb->pcb_onfault, error);
                        tf->tf_r0 = error;
                        tf->tf_pc = (register_t)(intptr_t) pcb->pcb_onfault;
                        return;
@@ -695,6 +696,17 @@ dab_buserr(trapframe_t *tf, u_int fsr, u
 #endif /* __XSCALE__ */
 
        if (pcb->pcb_onfault) {
+               void *onfault = pcb->pcb_onfault;
+               paddr_t pa;
+
+               pcb->pcb_onfault = NULL;
+               if 
(pmap_extract(vm_map_pmap(&curlwp->l_proc->p_vmspace->vm_map),
+                   far, &pa)) {
+                       printf("dab_buserr far 0x%x -> 0x%lx\n", far, pa);
+               } else {
+                       printf("dab_buserr far 0x%x -> NULL\n", far);
+               }
+               pcb->pcb_onfault = onfault;
                KDASSERT(TRAP_USERMODE(tf) == 0);
                tf->tf_r0 = EFAULT;
                tf->tf_pc = (register_t)(intptr_t) pcb->pcb_onfault;


Home | Main Index | Thread Index | Old Index