Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 20 Feb 2024 17:34:52 +0000
From:      bugzilla-noreply@freebsd.org
To:        bugs@FreeBSD.org
Subject:   [Bug 272965] 14.0-ALPHA1 too: armv7 'Alignment Fault' on read panic during udp_input for kyua's sys/netinet6/exthdr:exthdr ; other udp_input related panics
Message-ID:  <bug-272965-227-J3P0ZM802L@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-272965-227@https.bugs.freebsd.org/bugzilla/>
References:  <bug-272965-227@https.bugs.freebsd.org/bugzilla/>

next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D272965

--- Comment #11 from Gleb Smirnoff <glebius@FreeBSD.org> ---
On Thu Dec 21 04:15:04  2023 UTC, mmel@FreeBSD.org wrote:
> Unfortunately, I can't agree with that. Aligning the input mbuf is only p=
apering
> over the real problem and can only work for trivial cases.  It doesn't he=
lp for
> vlans (unless HW strips header), for various protocol encapsulations and =
most
> importantly it doesn't work at all for IPv6 :(
>=20
> The real problem is that our network stack uses undefined behavior. We ca=
n alias
> a byte buffer to a structure only if the given buffer pointer is conform =
with
> the desired structure alignment, otherwise the behavior is undefined. Thi=
s is,
> strictly speaking , required for every architecture. The only way we can =
reduce
> the required alignment is by using the packed attribute for the affected
> structures...

I could be wrong, but AFAIU, the network protocols are all designed in such=
 a
manner, that as they stack up on each other, all fields in protocol headers=
 are
aligned, as long as the base of the packet is aligned.  So, if the driver m=
akes
sure 'struct ether_header' is aligned, the upper protocols will also see th=
eir
headers aligned.  A misaligned read may happen only in something like an
accept_filter(9) that will read into packet payload.  And of course all
structures defining network headers are marked with __packed.

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-272965-227-J3P0ZM802L>