summaryrefslogtreecommitdiffstats
path: root/etc/defaults
diff options
context:
space:
mode:
authorandre <andre@FreeBSD.org>2013-08-27 20:52:02 +0000
committerandre <andre@FreeBSD.org>2013-08-27 20:52:02 +0000
commit73f239a63e71d117bcfaca20d9b5bf28b434d9fd (patch)
treed69535d6b1277d0b2a912f5cbb38816634a08e75 /etc/defaults
parent6c5aea24dd45d3738833a1a7eea28c964eb00d66 (diff)
downloadFreeBSD-src-73f239a63e71d117bcfaca20d9b5bf28b434d9fd.zip
FreeBSD-src-73f239a63e71d117bcfaca20d9b5bf28b434d9fd.tar.gz
Pad m_hdr on 32bit architectures to to prevent alignment and padding
problems with the way MLEN, MHLEN, and struct mbuf are set up. CTASSERT's are provided to detect such issues at compile time in the future. The #define MLEN and MHLEN calculation do not take actual compiler- induced alignment and padding inside the complete struct mbuf into account. Accordingly appropriate attention is required when changing members of struct mbuf. Ideally one would calculate MLEN as (MSIZE - sizeof(((struct mbuf *)0)->m_hdr) but that doesn't work as the compiler refuses to operate on an as of yet incomplete structure. In particular ARM 32bit has more strict alignment requirements which caused 4 bytes of padding between m_hdr and pkthdr in struct mbuf because of the 64bit members in pkthdr. This wasn't picked up by MLEN and MHLEN causing an overflow of the mbuf provided data storage by overestimating its size. I386 didn't show this problem because it handles unaligned access just fine, albeit at a small performance penalty. On 64bit architectures the struct mbuf layout is 64bit aligned in all places. Reported by: Thomas Skibo <ThomasSkibo-at-sbcglobal-dot-net> Tested by: tuexen, ian, Thomas Skibo (extended patch) Sponsored by: The FreeBSD Foundation
Diffstat (limited to 'etc/defaults')
0 files changed, 0 insertions, 0 deletions
OpenPOWER on IntegriCloud