-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

=============================================================================
FreeBSD-EN-26:16.arm64                                         Errata Notice
                                                          The FreeBSD Project

Topic:          32-bit setcontext(2) and swapcontext(2) fail on arm64

Category:       core
Module:         arm64
Announced:      2026-06-30
Affects:        All supported versions of FreeBSD.
Corrected:      2026-06-29 08:11:12 UTC (stable/15, 15.1-STABLE)
                2026-06-30 17:21:50 UTC (releng/15.1, 15.1-RELEASE-p1)
                2026-06-30 17:21:18 UTC (releng/15.0, 15.0-RELEASE-p11)
                2026-06-29 08:14:41 UTC (stable/14, 14.4-STABLE)
                2026-06-30 17:20:53 UTC (releng/14.4, 14.4-RELEASE-p7)
                2026-06-30 17:20:26 UTC (releng/14.3, 14.3-RELEASE-p16)

For general information regarding FreeBSD Errata Notices and Security
Advisories, including descriptions of the fields above, security
branches, and the following sections, please visit
<URL:https://security.FreeBSD.org/>.

I.   Background

FreeBSD/arm64 supports running 32-bit (armv7) binaries via its
freebsd32 compatibility layer.

The setcontext(2) and swapcontext(2) system calls allow a process to
save and restore its execution context.

II.  Problem Description

The freebsd32 implementations of setcontext(2) and swapcontext(2) on
arm64 returned incorrect values on success, causing the system call to
be treated as though it had failed.

III. Impact

32-bit armv7 applications that use setcontext(2) or swapcontext(2)
may crash or behave incorrectly when running on arm64 hosts.  This
has been observed to cause random crashes in Ruby applications in
particular.

IV.  Workaround

No workaround is available.  Systems that do not run 32-bit armv7
binaries on arm64 are not affected.

V.   Solution

Upgrade your system to a supported FreeBSD stable or release / security
branch (releng) dated after the correction date and reboot.

Perform one of the following:

1) To update your system installed from base system packages:

Systems running a 15.0-RELEASE or later version of FreeBSD on the amd64 or
arm64 platforms, which were installed using base system packages, can be
updated via the pkg(8) utility:

# pkg upgrade -r FreeBSD-base
# shutdown -r now

2) To update your system installed from binary distribution sets:

Systems running a RELEASE version of FreeBSD on the amd64 or arm64 platforms
which were not installed using base system packages can be updated via the
freebsd-update(8) utility:

# freebsd-update fetch
# freebsd-update install
# shutdown -r now

3) To update your system via a source code patch:

The following patches have been verified to apply to the applicable
FreeBSD release branches.

a) Download the relevant patch from the location below, and verify the
detached PGP signature using your PGP utility.

# fetch https://security.FreeBSD.org/patches/EN-26:16/arm64.patch
# fetch https://security.FreeBSD.org/patches/EN-26:16/arm64.patch.asc
# gpg --verify arm64.patch.asc

b) Apply the patch.  Execute the following commands as root:

# cd /usr/src
# patch -E -p0 < /path/to/patch

c) Recompile your kernel as described in
<URL:https://www.FreeBSD.org/handbook/kernelconfig.html> and reboot the
system.

VI.  Correction details

This issue is corrected as of the corresponding Git commit hash in the
following stable and release branches:

Branch/path                             Hash                     Revision
- -------------------------------------------------------------------------
stable/15/                              964215aa1347    stable/15-n284267
releng/15.1/                            a2235baa622b  releng/15.1-n283563
releng/15.0/                            b77d19dcc0d5  releng/15.0-n281065
stable/14/                              58a15fe75cc5    stable/14-n274442
releng/14.4/                            f902821db095  releng/14.4-n273727
releng/14.3/                            e96d0e1fccf5  releng/14.3-n271527
- -------------------------------------------------------------------------

Run the following command to see which files were modified by a
particular commit:

# git show --stat <commit hash>

Or visit the following URL, replacing NNNNNN with the hash:

<URL:https://cgit.freebsd.org/src/commit/?id=NNNNNN>

To determine the commit count in a working tree (for comparison against
nNNNNNN in the table above), run:

# git rev-list --count --first-parent HEAD

VII. References

The latest revision of this advisory is available at
<URL:https://security.FreeBSD.org/advisories/FreeBSD-EN-26:16.arm64.asc>
-----BEGIN PGP SIGNATURE-----

iQJPBAEBCgA5FiEEthUnfoEIffdcgYM7bljekB8AGu8FAmpEEicbFIAAAAAABAAO
bWFudTIsMi41KzEuMTIsMCwzAAoJEG5Y3pAfABrvs+0P/1v4QrAHy1/m9y7/c4UY
QNrdbnidEFMSzQiAUXaKJyJmIU9kTDlLcrsGgRw7r5KoUCux7DgW9gJ4xX9HgaDM
X4x4a5BueaU5XJtUQ+tiMWm0TRsWpiGhBc6ZvqSiHVGwQHvQrrQ4T2nBl7NdM29G
19sdVRzjj/gvytXZCrQ9FJrkUkrWb24AX9HF6LmtIifphp47uLAdqGSZtDTLyvGZ
U1zYTP0a4PETYaCk2gAfr8qQuZrx+7gDLFLnDJ9YPGIbhFVBv1ig1tMDHuwZed8o
LsLf0pVoStazpnG+G+e8VHbA31I5hN041N9q2fNU79KFcLr1ADm7X6vEniL3pqsA
CvhDq8WyQ9lhM7FLx9kfcFOOat/eWEBxjZN1gDU2asuROhcm1P9pVHlCTA5/96i2
y/HJSUYdIgScQQ6RVV5K0ZQSfj8gJF73twhmQqRXNXekUypMwVTw0E1wXFWIE80f
kOtQmviV4j9R59efv+CTSZs73XVnx/yv97cayk/pRwxrc0ZNu3cc6B1GY7AZfu02
jx0bsOSLF/nBz+eQYSr8+jZTT+Qv5RY5ep0uDPmqlN/QBBvT+Mccdd3lWeBbuOah
8+qaGy360hfo3PVjv+e/yMkaXJ3Gmn766TvPn4LeTwSeL+SEzHrpF/Bq4jlBXP+C
bdvDqx+46YN/96VdSl5KpnoK
=+mor
-----END PGP SIGNATURE-----