git: cb2921924549 - stable/14 - sys/arm64: fix COMPAT_FREEBSD32 __syscall()

From: Robert Clausecker <fuz_at_FreeBSD.org>
Date: Wed, 29 Oct 2025 11:17:22 UTC
The branch stable/14 has been updated by fuz:

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

commit cb2921924549b8068c67c6e35331d72b9b71e658
Author:     Robert Clausecker <fuz@FreeBSD.org>
AuthorDate: 2025-10-21 21:35:24 +0000
Commit:     Robert Clausecker <fuz@FreeBSD.org>
CommitDate: 2025-10-29 11:16:47 +0000

    sys/arm64: fix COMPAT_FREEBSD32 __syscall()
    
    It seems like _QUAD_LOWWORD was incorrectly expanded into 1,
    which is correct for big endian but not little endian.  This
    means we always grab the padding word for the syscall number,
    which is usually 0, causing SIGSYS to be delivered to the caller.
    Reintroduce _QUAD_LOWWORD to fix the syscall.
    
    PR:             290411
    MFC after:      1 week
    Discussed with: jrtc27
    Reviewed by:    cognet, emaste
    Approved by:    markj (mentor)
    Fixes:          8c9c3144ccfa3061879b8cec015ee7d1010e4766
    Differential Revision:  https://reviews.freebsd.org/D53250
    
    (cherry picked from commit 1ca09538d94273601dac08204c1d0b3ca9115864)
---
 sys/arm64/arm64/elf32_machdep.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys/arm64/arm64/elf32_machdep.c b/sys/arm64/arm64/elf32_machdep.c
index 5f35d01f9ac0..285be3d89cbb 100644
--- a/sys/arm64/arm64/elf32_machdep.c
+++ b/sys/arm64/arm64/elf32_machdep.c
@@ -208,7 +208,7 @@ freebsd32_fetch_syscall_args(struct thread *td)
 		sa->code = *ap++;
 		nap--;
 	} else if (sa->code == SYS___syscall) {
-		sa->code = ap[1];
+		sa->code = ap[_QUAD_LOWWORD];
 		nap -= 2;
 		ap += 2;
 	}