freebsd-skq/sys
andre 73f239a63e 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
2013-08-27 20:52:02 +00:00
..
amd64 Add support for emulating the byte move instruction "mov r/m8, r8". 2013-08-27 16:49:20 +00:00
arm Introduce superpages support for ARMv6/v7. 2013-08-26 17:12:30 +00:00
boot Update copyright. 2013-08-27 06:09:28 +00:00
bsm
cam If a drive returns ASC/ASCQ 0x04,0x11 "Logical unit not ready, 2013-08-27 19:47:03 +00:00
cddl Rename the kld_unload event handler to kld_unload_try, and add a new 2013-08-24 21:13:38 +00:00
compat Add the ability to display the default FIB number for a process to the 2013-08-26 23:48:21 +00:00
conf Assemble linux32_locore.s and ia32_sigtramp.S with clang integrated assembler. 2013-08-27 18:35:04 +00:00
contrib drm/radeon: Import the Radeon KMS driver 2013-08-25 19:37:15 +00:00
crypto
ddb
dev Remove duplicate dev.xbd.*.max_requests sysctl added in r252260. 2013-08-27 19:10:36 +00:00
fs Remove most of the remaining sysctl name list macros. They were only 2013-08-26 18:16:05 +00:00
gdb
geom MFprojects/camlock r254895: 2013-08-26 20:39:02 +00:00
gnu/fs/reiserfs
i386
ia64
isa
kern Pad m_hdr on 32bit architectures to to prevent alignment and padding 2013-08-27 20:52:02 +00:00
kgssapi
libkern
mips Fixes for compatibility with QEMU: 2013-08-27 01:40:13 +00:00
modules Assemble linux32_locore.s and ia32_sigtramp.S with clang integrated assembler. 2013-08-27 18:35:04 +00:00
net Remove include opt_ofed.h since OFED is unifdef'd. 2013-08-27 16:45:00 +00:00
net80211 Create a new function to complete 802.11 mbuf transmission. 2013-08-27 14:37:13 +00:00
netatalk
netgraph
netinet Remove most of the remaining sysctl name list macros. They were only 2013-08-26 18:16:05 +00:00
netinet6 Remove most of the remaining sysctl name list macros. They were only 2013-08-26 18:16:05 +00:00
netipsec Remove most of the remaining sysctl name list macros. They were only 2013-08-26 18:16:05 +00:00
netipx
netnatm
netpfil Make dummynet use new direct callout(9) execution mechanism. Since the only 2013-08-24 13:34:36 +00:00
netsmb
nfs
nfsclient
nfsserver
nlm
ofed Change m->pkthdr.header to m->pkthdr.PH_loc.ptr after r254804 2013-08-25 09:45:26 +00:00
opencrypto
pc98
pci
powerpc Return EIO iso -1, the kiic_transfer has an signed return. 2013-08-23 20:39:41 +00:00
rpc
security
sparc64
sys Pad m_hdr on 32bit architectures to to prevent alignment and padding 2013-08-27 20:52:02 +00:00
teken
tools
ufs
vm Remove comment that is no longer relevant since r254182. 2013-08-26 14:14:25 +00:00
x86
xdr
xen
Makefile