Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bird2-babelpatch: fix unaligned access on ARMv7 targets #454

Merged
merged 1 commit into from
Dec 5, 2024

Conversation

PolynomialDivision
Copy link
Contributor

@PolynomialDivision PolynomialDivision commented Dec 5, 2024

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.

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.
@PolynomialDivision PolynomialDivision merged commit fcce390 into main Dec 5, 2024
7 checks passed
@PolynomialDivision PolynomialDivision deleted the fix-bird branch December 5, 2024 20:24
@PolynomialDivision
Copy link
Contributor Author

cc @tohojo

@PolynomialDivision
Copy link
Contributor Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant