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

=============================================================================
FreeBSD-EN-23:20.vm                                             Errata Notice
                                                          The FreeBSD Project

Topic:          Incorrect results from the kernel physical memory allocator

Category:       core
Module:         vm
Announced:      2023-12-05
Affects:        FreeBSD 14.0
Corrected:      2023-11-25 01:26:35 UTC (stable/14, 14.0-STABLE)
                2023-12-05 18:27:37 UTC (releng/14.0, 14.0-RELEASE-p2)

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

The FreeBSD kernel implements a physical memory allocator which is
responsible for managing the system's RAM.  This allocator provides
interfaces which allow kernel code to request the allocation of memory which
satisifies certain constraints, such as bounds on the physical address range
for returned memory, and alignment of the returned physical pages.

One use of the physical memory allocator is to allocate memory for DMA for
device drivers, which may have special requirements.  For example, a common
constraint is that DMA memory be allocated from the lowest 4GB of the
physical address space.

II.  Problem Description

The code which implements the physical memory allocator in FreeBSD 14.0
contains a bug such that the returned physical memory may, in some
circumstances, fail to satisfy the specified constraints.

III. Impact

The effects of the bug do not have a simple characterization, as different
users of the interface may be affected differently by the bug.  In one case,
the symptom was that the affected system would occasionally panic during
boot.  It is believed that most users will be unaffected by the problem.

IV.  Workaround

No workaround is available.

V.   Solution

<insert solution here>

Upgrade your system to a supported FreeBSD stable or release / security
branch (releng) dated after the correction date.  A reboot is required
following the upgrade.

Perform one of the following:

1) To update your system via a binary patch:

Systems running a RELEASE version of FreeBSD on the amd64 or arm64 platforms,
or the i386 platfrom on FreeBSD 13 and earlier, can be updated via
the freebsd-update(8) utility:

# freebsd-update fetch
# freebsd-update install

2) 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.

[FreeBSD 12.4]
# fetch https://security.FreeBSD.org/patches/EN-23:20/vm.patch
# fetch https://security.FreeBSD.org/patches/EN-23:20/vm.patch.asc
# gpg --verify vm.patch.asc

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

# cd /usr/src
# patch < /path/to/patch

<for a userland utility:>

c) Recompile the operating system using buildworld and installworld as
described in <URL:https://www.FreeBSD.org/handbook/makeworld.html>.

<for a daemons>

c) Recompile the operating system using buildworld and installworld as
described in <URL:https://www.FreeBSD.org/handbook/makeworld.html>.

Restart the applicable daemons, or reboot the system.

<for a common library>

c) Recompile the operating system using buildworld and installworld as
described in <URL:https://www.FreeBSD.org/handbook/makeworld.html>.

Restart all daemons that use the library, or reboot the system.

<for a kernel bug:>

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 or Subversion
revision number in the following stable and release branches:

Branch/path                             Hash                     Revision
- -------------------------------------------------------------------------
stable/14/                              210fce73ae0e    stable/14-n265801
releng/14.0/                            4be96902ba82  releng/14.0-n265391
- -------------------------------------------------------------------------

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

For FreeBSD 12 and earlier:

Run the following command to see which files were modified by a particular
revision, replacing NNNNNN with the revision number:

# svn diff -cNNNNNN --summarize svn://svn.freebsd.org/base

Or visit the following URL, replacing NNNNNN with the revision number:

<URL:https://svnweb.freebsd.org/base?view=revision&revision=NNNNNN>

VII. References

<URL:https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=274592>

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

iQIzBAEBCgAdFiEEthUnfoEIffdcgYM7bljekB8AGu8FAmVvmWUACgkQbljekB8A
Gu+kRhAAtUSzuLKhrxQc3+FfL4M+GvebvPkQASFygFCzQR1mXJJFnFl4UkLMNlnN
83zzFbSC5jVxGUrlu1BDmgIZobmB1/INKE/dcl/GRTqJuQhzYGJ+Q5lAGX5AQV2H
kmYEUuGmMT8YR1KsDY9f+4yB61hkSbm8snOO4VRb1D+CBUCF2skKPrZu25+xDsxV
888LY1X0LAO7Udvk9DEldWRM6IYeXuIn24mfUIkPYF62sBb82jW1w+LC148W2xIz
F6jr9N9CBqhthpujWSMmKymOFSEg9HcKPJ55CEE1LCIhuxtz7h0GxP+GN9l4vc3b
FfvQHcoxin9wpmaYevPXLoAW415lMvvgurP12NirDgB5lEadPEfnhckLO9ndw5y7
PmSOKwKQlDfBHMwjTnlUUE3G8kw5FOXcT7/qr3x++Cl3tBNTGaei9A6EpFD3mzNS
y0BH7bwYbr/GjSMJAeH3SI9il3hTA9/4jP8KATIUGuIWJJGqlFJR3uuubh2pIdR9
qrHpA6JqcYjbRyK3+AkV1EXPoRmOjt/uYbRld/8HIkFMrD/cBvh7R+mP4+XU4k5y
eYgoPxjJat63XIfzqtFPkAVH+h+bbvUpzaikrArQuvshq/4IrO3NV1ub6gZWc6N7
QfsBKolQQ37FgHKmIbrBFOegmDuiaaXGVLDH3s7fWYmKl9DRr/8=
=con6
-----END PGP SIGNATURE-----