Subject: unaligned access in in_delayed_cksum()
To: None <tech-net@netbsd.org>
From: Manuel Bouyer <bouyer@antioche.eu.org>
List: tech-net
Date: 09/29/2002 18:16:51
Hi,
I tried enabling ip4csum|tcp4csum|udp4csum on an alpha today. It's 
tigon II adapter which is used with VLAN (no IP on the interface itself).
First I have a question: are hadware-assised checksums supposed to work
with VLAN ? I found nothing in the code that could pass ec_capenable
from the parent interface to the ip stack though if_vlan. Maybe I should
just set *4csum on all vlan interfaces too.

I tried enabling ip4csum|tcp4csum|udp4csum on ti0 only (not the vlan,
didn't have time).
Almost immediatly the machine paniced with:
CPU 0: fatal kernel trap:

CPU 0    trap entry = 0x4 (unaligned access fault)
CPU 0    a0         = 0xfffffc000599757b
CPU 0    a1         = 0xd
CPU 0    a2         = 0x2
CPU 0    pc         = 0xfffffc0000493770
CPU 0    ra         = 0xfffffc00004936f0
CPU 0    pv         = 0xffffffffffff0001
CPU 0    curproc    = 0x0

gdb shows that pc is in in_delayed_cksum() line 814:
0xfffffc0000493770 is in in_delayed_cksum (/home/src/sys/arch/alpha/compile/DISCO/../../../../netinet/ip_output.c:814).
809                     printf("in_delayed_cksum: pullup len %d off %d proto %d\n",
810                         m->m_len, offset, ip->ip_p);
811                      */
812                     m_copyback(m, offset, sizeof(csum), (caddr_t) &csum);
813             } else
814                     *(u_int16_t *)(mtod(m, caddr_t) + offset) = csum;
815     }
816     
817     /*
818      * Determine the maximum length of the options to be inserted;

Any idea ?

If I enable ip4csum|tcp4csum|udp4csum on both ti0 and the associated vlans
before assigning IP addresses, all seem to go well.

-- 
Manuel Bouyer <bouyer@antioche.eu.org>
--