NetBSD aarch64: wrong `_ALIGNBYTES` breaks `CMSG_*` (CMSG_NXTHDR loops forever)
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
- #5724 của @ci4ic4 — đã đóng, không merge
Đánh giá
- Độ khó
- 1/5
- Thời gian dự kiến
- Dưới một giờ
- Mức phù hợp với người mới
- 35/100
Hướng nghiên cứu
Start in src/unix/bsd/netbsdlike/netbsd/aarch64.rs and compare _ALIGNBYTES with the AAPCS64 definition cited in the issue. The issue proposes using size_of::<u128>() - 1; done means the CMSG offsets and lengths match the reported NetBSD values and CMSG_NXTHDR advances correctly. Pull request #5724 is already open for this issue.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
src/unix/bsd/netbsdlike/netbsd/aarch64.rs defines
pub(crate) const _ALIGNBYTES: usize = size_of::<c_int>() - 1; // 3
but NetBSD/aarch64 uses the AAPCS64 branch of sys/arch/arm/include/cdefs.h:
#if defined(__ARM_PCS_AAPCS64)
#define __ALIGNBYTES (sizeof(__int128_t) - 1) /* 15 */
#elif defined(__ARM_EABI__)
#define __ALIGNBYTES (sizeof(long long) - 1)
#else
#define __ALIGNBYTES (sizeof(int) - 1)
#endif
_ALIGNBYTES is only used by CMSG_DATA, CMSG_LEN, CMSG_NXTHDR and CMSG_SPACE, and all four come out wrong:
| NetBSD 11.99.10 evbarm (aarch64) | C (<sys/socket.h>) |
libc 0.2.191 |
|---|---|---|
sizeof(struct cmsghdr) |
12 | 12 |
CMSG_DATA offset |
16 | 12 |
CMSG_LEN(4) |
20 | 16 |
CMSG_SPACE(4) |
32 | 16 |
C values came from a small program built with the system cc. The libc values follow from _ALIGN(12) == 12 with _ALIGNBYTES == 3.
Impact
Code that parses control messages from the kernel reads them at the wrong offsets. CMSG_NXTHDR steps into padding, reads cmsg_len == 0, and returns the same header again, so a loop like while !cmsg.is_null() never ends. I hit this with sendme / iroh (noq-udp, which is a fork of quinn-udp): the first received UDP datagram puts a tokio worker into a 100% CPU loop with no syscalls. quinn-udp should be affected the same way. Building control messages with CMSG_SPACE/CMSG_LEN is also wrong, so the kernel will reject or misread them.
x86_64 is unaffected, because both C and the crate use sizeof(long) - 1. I haven't checked NetBSD arm (32-bit) or riscv64 on real hardware. Their crate values (c_longlong, __BIGGEST_ALIGNMENT__) look consistent with the C headers.
Fix
pub(crate) const _ALIGNBYTES: usize = size_of::<u128>() - 1;
With this change (as a vendored patch in pkgsrc), sendme works on NetBSD/aarch64 (transfers in both directions with NetBSD/amd64, hashes verified).
- Ngôn ngữ chính
- Rust
- Star
- 2.7k
- Fork
- 1.4k
- Merge trung bình
- 3 ngày 2 giờ
- Pull request đã merge (30 ngày)
- 45
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của rust-lang/libc
-
NetBSD: `kevent()` updatedĐang mởC-bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
rust-lang/libc#5801 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Maintainer thường phản hồi trong vòng 1 ngày
-
C-bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
SYS_kexec_file_load missing for aarch64-unknown-linux-muslCó thể đã có người làm @AdmerPRO đã nhận 5 ngày trước. Đang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 90/100
rust-lang/libc#5722 · 3 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Expose `open_how` on AndroidCó thể đã có người làm @rizzabhdwaj đã nhận 35 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
rust-lang/libc#5673 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của rust-lang/libc
Issue tương tự
-
Android: a long press's `contextmenu` event carries no point (`clientX` and `clientY` are 0)Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Test connection's password prompt says the password is never saved, also for a keychain profileĐang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
Maintainer thường phản hồi trong vòng 1 ngày
-
area: settings bug Haiku review: no-score ui
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
MMFoundation/WallpaperMachine#346 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
rubys/roundhouse#2473 ·
-
bug mod: quantum info
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Qiskit/qiskit#17699 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày