tech-net archive

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

Re: Patches fixing unaligned access in the networking code




> On May 28, 2019, at 4:09 AM, Mouse <mouse%Rodents-Montreal.ORG@localhost> wrote:
> 
> More siginificant, to me, is that the addresses are indeed misaligned,
> but everyone seems to think they should be aligned.  Whether the bug is
> in code (this code or other code) or in people's mental model, I don't
> know, but I would say it needs fixing.

The Ethernet header is not helping us here... If the Ethernet header starts on a 4-byte boundary, then the IP header will not.  Some drivers scoot the start of the packet forward 2 bytes into the receive buffer to ensure IP header alignment, but hooray, the hardware people often forget to talk to the software people, and as a result, some hardware requires buffers to start on a 4-byte boundary.  In drivers for such devices, we are forced to copy the packet (lots of expensive memory access) **OR** live with the unaligned IP header if we know the CPU can access it.

-- thorpej



Home | Main Index | Thread Index | Old Index