From 92ae21e8a155734f73589b7ef9fa19a6bb6d042f Mon Sep 17 00:00:00 2001 From: Piotr Kubaj Date: Thu, 11 Jun 2026 13:41:29 +0200 Subject: [PATCH] sys/arm64: fix return values of freebsd32_{set,swap}context() This patch aligns the return values of freebsd32_{set,swap}context() with their counterparts on amd64 and powerpc64, fixing the setcontext() and swapcontext() calls in armv7 applications running on aarch64. In particular, this fixes random crashes in armv7 Ruby applications running on aarch64 hosts. Tested by: fuz MFC after: 1 week --- sys/arm64/arm64/freebsd32_machdep.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/arm64/arm64/freebsd32_machdep.c b/sys/arm64/arm64/freebsd32_machdep.c index d0218dc1dc8..3c7040bf5bb 100644 --- a/sys/arm64/arm64/freebsd32_machdep.c +++ b/sys/arm64/arm64/freebsd32_machdep.c @@ -293,7 +293,7 @@ freebsd32_setcontext(struct thread *td, struct freebsd32_setcontext_args *uap) NULL, 0); } } - return (ret); + return (ret == 0 ? EJUSTRETURN : ret); } int @@ -341,7 +341,7 @@ freebsd32_swapcontext(struct thread *td, struct freebsd32_swapcontext_args *uap) } } } - return (ret); + return (ret == 0 ? EJUSTRETURN : ret); } void