Source-Changes-D archive

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

re: CVS commit: src/sys/dev/usb



Christos Zoulas writes:
> In article <20190106003905.60969FB17%cvs.NetBSD.org@localhost>,
> Rin Okuyama <source-changes-d%NetBSD.org@localhost> wrote:
> >-=-=-=-=-=-
> >
> >Module Name:	src
> >Committed By:	rin
> >Date:		Sun Jan  6 00:39:05 UTC 2019
> >
> >Modified Files:
> >	src/sys/dev/usb: if_axe.c
> >
> >Log Message:
> >Fix kernel panic on arm reported by @furandon_pig on Twitter.
> >
> >Hardware header is 2-byte aligned in RX buffer, not 4-byte.
> >For some architectures, __builtin_memcpy() of GCC 6 attempts to
> >copy 4-byte header at once, which results in alignment error.
> 
> This is really ugly..
> 
> https://stackoverflow.com/questions/24883410/armcc-problems-with-memcpy-alignment-exceptions
> 
> Perhaps there is a better solution? Can't memcpy be smarter?

hmmm, what happens if struct axe_sframe_hdr is not marked
"packed"?  this feels like a compiler bug, but perhaps it
is assuming it can write 4 bytes to the structure when it
is only 2 byte aligned.

is there a small test case that reproduces the problem?
preferably in user land?


.mrg.


Home | Main Index | Thread Index | Old Index