Skip to content

netbsd/aarch64: fix _ALIGNBYTES to match AAPCS64 __ALIGNBYTES - #5724

Open
ci4ic4 wants to merge 1 commit into
rust-lang:mainfrom
ci4ic4:netbsd-aarch64-alignbytes
Open

ci4ic4 wants to merge 1 commit into
rust-lang:mainfrom
ci4ic4:netbsd-aarch64-alignbytes

Conversation

@ci4ic4

@ci4ic4 ci4ic4 commented Nov 7, 2026 •

Copy link
Copy Markdown

Description

On NetBSD/aarch64, __ALIGNBYTES is sizeof(__int128_t) - 1 (15) because of the AAPCS64 branch in sys/arch/arm/include/cdefs.h. libc currently uses size_of::<c_int>() - 1 (3), so all CMSG_* helpers disagree with C. On NetBSD 11.99.10 evbarm:

C before after
CMSG_DATA offset 16 12 16
CMSG_LEN(4) 20 16 20
CMSG_SPACE(4) 32 16 32

With the old value, CMSG_NXTHDR returns a zeroed header, and quinn-udp and noq-udp loop on it forever (100% CPU on the first received datagram).

Fixes #5723

Sources

Checklist

  • Relevant tests in libc-test/semver have been updated (n/a: crate-private constant)
  • No placeholder or unstable values like *LAST or *MAX are included
  • Tested locally: vendored into pkgsrc wip/sendme; transfers between NetBSD 11.99.10 aarch64 and amd64/Linux now work in both directions

@rustbot label +stable-nominated

🤖 Generated with Claude Code

https://claude.ai/code/session_01SW4KMjbF2VxYT6SUrquwYz

@rustbot

rustbot commented Nov 7, 2026

Copy link
Copy Markdown
Collaborator

Some changes occurred in a NetBSD-like module

cc @semarie

@rustbot rustbot added O-bsd O-unix S-waiting-on-review stable-nominated This PR should be considered for cherry-pick to libc's stable release branch labels Nov 7, 2026
@rustbot

This comment has been minimized.

NetBSD/aarch64 defines __ALIGNBYTES as sizeof(__int128_t) - 1
(sys/arch/arm/include/cdefs.h, __ARM_PCS_AAPCS64 branch), not
sizeof(int) - 1. The wrong value makes CMSG_DATA, CMSG_LEN,
CMSG_SPACE and CMSG_NXTHDR disagree with the C macros; CMSG_NXTHDR
lands in padding, reads cmsg_len 0 and loops forever.

Fixes rust-lang#5723

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SW4KMjbF2VxYT6SUrquwYz
@ci4ic4
ci4ic4 force-pushed the netbsd-aarch64-alignbytes branch from bd92588 to 053a86e Compare November 7, 2026 12:15

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

O-bsd O-unix S-waiting-on-review stable-nominated This PR should be considered for cherry-pick to libc's stable release branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

NetBSD aarch64: wrong _ALIGNBYTES breaks CMSG_* (CMSG_NXTHDR loops forever)

2 participants