Skip to content

Commit

Permalink
bird2-babelpatch: fix unaligned access on ARMv7 targets
Browse files Browse the repository at this point in the history
An assembler instruction "vst1.8 {d16-d17}, [r0 :64]" requires `r0` to
be 64-bit (8-byte) aligned. However, in certain cases, `r0` was not
aligned, leading to a SIGBUS error on ARMv7 platforms:

    kern.err kernel: [90636.175853] Alignment trap: not handling
    instruction f4400a1f at [<00056fbc>]
    kern.alert kernel: [90636.182044] Unhandled fault: alignment
    exception (0x801) at 0xb6dec01c

A backtrace shows the crash occurring in `bgp_get_prefix` due to the
misaligned memory address.

Fix this issue by passing the `-mno-unaligned-access` flag to GCC/Clang.
This ensures unaligned accesses are avoided on platforms like ARMv7,
preventing alignment-related exceptions and ensuring reliable execution.

(cherry picked from commit fcce390)
  • Loading branch information
PolynomialDivision committed Dec 5, 2024
1 parent 5c396ff commit ca4958f
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/bird2-babelpatch/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ This is the 2.0 branch of Bird which integrates support for IPv4 and IPv6
into a single branch, and also adds support for the Babel routing protocol.
endef

ifeq ($(ARCH),arm)
TARGET_CFLAGS+=-mno-unaligned-access
endif

CONFIGURE_ARGS += --disable-libssh

define Package/bird2/conffiles
Expand Down

0 comments on commit ca4958f

Please sign in to comment.