Bug Report: Unaligned Access in BGP Code on ARMv7 Platforms
Ondrej Zajicek
santiago at crfreenet.org
Wed Dec 11 01:41:26 CET 2024
On Tue, Dec 10, 2024 at 09:15:46PM +0100, nick via Bird-users wrote:
> I also uploaded the coredumpfile:
> https://github.com/PolynomialDivision/coredumpupload/blob/main/bird_coredump
Thanks. This seems like an interesting issue. In BIRD, generic net_addr
structure is explicitly u64-aligned (to accomodate VPN variants), while
specific net_addr_ip4 and net_addr_ip6 are just u32-aligned. In this case
net_addr_ip6 is allocated with u32 alignment, but then copied with
net_copy(), which assumes generic net_addr for arguments, and compiler
probably used some u64-optimized copying, which required 64-bit alignment
despite being on 32-bit platform,
For starters, try the attached patch. But it is preliminary, we will revisit
alignment of these structures.
> > > > The root cause appears to be insufficient alignment of memory
> > > > allocated for
> > > > structures, specifically in this line:
> > > >
> > > > ```c
> > > > px = mb_alloc(c->pool, sizeof(struct bgp_prefix) + net->length);
> > > > ```
Note that it is really allocated two lines above, here:
px = sl_alloc(c->prefix_slab);
--
Elen sila lumenn' omentielvo
Ondrej 'Santiago' Zajicek (email: santiago at crfreenet.org)
"To err is human -- to blame it on a computer is even more so."
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fix-net-addr-alignment.patch
Type: text/x-diff
Size: 250 bytes
Desc: not available
URL: <http://trubka.network.cz/pipermail/bird-users/attachments/20241211/3f62f9f6/attachment.bin>
More information about the Bird-users
mailing list