git: cb9075718bc6 - releng/15.0 - aio: fix alignment of struct (o)aiocb32 on non-amd64

From: Colin Percival <cperciva_at_FreeBSD.org>
Date: Fri, 14 Nov 2025 02:30:10 UTC
The branch releng/15.0 has been updated by cperciva:

URL: https://cgit.FreeBSD.org/src/commit/?id=cb9075718bc66844c6d25fed1df18de61af5267b

commit cb9075718bc66844c6d25fed1df18de61af5267b
Author:     Robert Clausecker <fuz@FreeBSD.org>
AuthorDate: 2025-11-14 00:55:59 +0000
Commit:     Colin Percival <cperciva@FreeBSD.org>
CommitDate: 2025-11-14 02:27:28 +0000

    aio: fix alignment of struct (o)aiocb32 on non-amd64
    
    Only i386 has a four-byte alignment for uint64_t, others have
    eight-byte alignment.  This causes the structure to mismatch
    on armv7 binaries running under aarch64, breaking the aio interface.
    
    Approved by:    re (cperciva)
    Fixes:          3858a1f4f501d00000447309aae14029f8133946
    Approved by:    markj (mentor)
    Reported by:    Mark Millard <marklmi26-fbsd@yahoo.com>
    Discussed with: jrtc27
    PR:             290962
    MFC after:      immediately (for 15.0)
    
    (cherry picked from commit ea26fd52a949116d03f59066d364eee2af6c9f51)
---
 sys/kern/vfs_aio.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/sys/kern/vfs_aio.c b/sys/kern/vfs_aio.c
index e63fa4c01434..a81aafb2ecc4 100644
--- a/sys/kern/vfs_aio.c
+++ b/sys/kern/vfs_aio.c
@@ -2750,7 +2750,11 @@ struct __aiocb_private32 {
 #ifdef COMPAT_FREEBSD6
 typedef struct oaiocb32 {
 	int	aio_fildes;		/* File descriptor */
+#ifdef __amd64__
 	uint64_t aio_offset __packed;	/* File offset for I/O */
+#else
+	uint64_t aio_offset;		/* File offset for I/O */
+#endif
 	uint32_t aio_buf;		/* I/O buffer in process space */
 	uint32_t aio_nbytes;		/* Number of bytes for I/O */
 	struct	osigevent32 aio_sigevent; /* Signal to deliver */
@@ -2762,7 +2766,11 @@ typedef struct oaiocb32 {
 
 typedef struct aiocb32 {
 	int32_t	aio_fildes;		/* File descriptor */
+#ifdef __amd64__
 	uint64_t aio_offset __packed;	/* File offset for I/O */
+#else
+	uint64_t aio_offset;		/* File offset for I/O*/
+#endif
 	uint32_t aio_buf;	/* I/O buffer in process space */
 	uint32_t aio_nbytes;	/* Number of bytes for I/O */
 	int	__spare__[2];