git: 498a4c7f48a3 - stable/14 - aio: fix alignment of struct (o)aiocb32 on non-amd64

From: Robert Clausecker <fuz_at_FreeBSD.org>
Date: Fri, 14 Nov 2025 01:05:03 UTC
The branch stable/14 has been updated by fuz:

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

commit 498a4c7f48a33c60b1768b8a6daf519bad84e18d
Author:     Robert Clausecker <fuz@FreeBSD.org>
AuthorDate: 2025-11-14 00:55:59 +0000
Commit:     Robert Clausecker <fuz@FreeBSD.org>
CommitDate: 2025-11-14 01:04:53 +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.
    
    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 f0af21824331648a41b4e5d3323bea9216bcb7e2)
---
 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 8842d8409e01..75a6a7355eed 100644
--- a/sys/kern/vfs_aio.c
+++ b/sys/kern/vfs_aio.c
@@ -2778,7 +2778,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 */
@@ -2790,7 +2794,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];