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

=============================================================================
FreeBSD-EN-26:14.syslogd                                        Errata Notice
                                                          The FreeBSD Project

Topic:          syslogd(8) memory leak in casper_ttymsg()

Category:       core
Module:         syslogd
Announced:      2026-06-09
Affects:        FreeBSD 15.0 and later
Corrected:      2026-05-26 20:41:22 UTC (stable/15, 15.1-STABLE)
                2026-05-28 22:16:09 UTC (releng/15.1, 15.1-RC2)
                2026-06-09 19:19:32 UTC (releng/15.0, 15.0-RELEASE-p10)

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

syslogd(8) is the system log daemon, responsible for receiving log messages
from the kernel and from userland programs and dispatching them according to
syslog.conf(5).  It can be configured to log messages to a system console or
to logged-in users' TTYs.

As of FreeBSD 15.0, syslogd runs in a Capsicum sandbox, and delegates the
actual writing of console messages to a libcasper(3) service.

II.  Problem Description

When delivering a message to the console or to a terminal, the libcasper
service retrieved the message text with nvlist_take_string_array(9), which
transfers ownership of the array and its strings to the caller.  The
casper_ttymsg() and casper_wallmsg() functions never freed them, leaking
memory on every message routed to the console or a terminal.

III. Impact

On long-running systems that emit a steady stream of log messages routed to
/dev/console or to user terminals, the resident size of syslogd.casper
helper process grows without bound.  This may eventually lead to memory
pressure, including swap usage, or process termination by the out-of-memory
killer. syslogd itself continues to function.

IV.  Workaround

Periodically restarting syslogd will reclaim leaked memory. Systems that do
not direct syslog output to /dev/console, terminals, or wall destinations
are not affected.

V.   Solution

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

Perform one of the following:

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

Systems running a 15.0-RELEASE 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
# service syslogd restart

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
# service syslogd restart

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:14/syslogd.patch
# fetch https://security.FreeBSD.org/patches/EN-26:14/syslogd.patch.asc
# gpg --verify syslogd.patch.asc

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

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

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

Restart syslogd(8), or 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/                              be03b0fb2241    stable/15-n283693
releng/15.1/                            d51d91b07f5b  releng/15.1-n283540
releng/15.0/                            998de2d14e25  releng/15.0-n281049
- -------------------------------------------------------------------------

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

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

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

iQJPBAEBCgA5FiEEthUnfoEIffdcgYM7bljekB8AGu8FAmooiS0bFIAAAAAABAAO
bWFudTIsMi41KzEuMTIsMCwzAAoJEG5Y3pAfABrvi2gQAMf5aER4RND+DWh7qbbQ
ZuQwejCwW1MeX/oex0TAD8tvGgaBXOztAMMPQ4KRyrzjIYeo5+NpWAYlhqiAOOKE
DCctvWY2hMylj5NNV2etV4QpK0h2R4ZTRj2gnWhYIr/PkzRmaJu9tc3dOH5DQSQZ
WZTwo+Wu/vcAnevgIe4cOPI07YdZjl6bGlOo8q0qBaJ1xKk5NbY3Se9IJX3pCf31
KODaPY1Py9EuYyW1HoDfrZV7V0iV3X51lgLNmHa2l8Z2cFD/U7Xsk08wU/vtcY0o
la+hvXwMjzHrtie6a2FNV2twyH534B/2ye5Olsf/QnI+g6mEKr3Xif9tt5fYQHXW
Lku+Auc3Hy1d1vK5MUOUpf53SEtvLFkISBAAFIT5x/4kC9W+Kjvl7vspSw+2whuM
S4iLfBbx3DN9aHCNvL1rnkTvn9H7/nOtiaJ5SHBXmtWyYDS/ZptBuzq8L0NaLRfp
lHoSCwND6HXQNZZi3QGVctthFg24ZJoxZOZrx7cDHIphtf/AHMlYkpIPZMaCuiBa
Pw0B/m03VBFYgHCyXlKjQ1EKbAHpS3/pNv5EtCnAAWPNGNoiAjQDa5CnUg0nlz3d
wI+qXBAAM7dUndhvs10/ta/n15Dn6hf89Eojx4SDvPWWAmvtmhd0dDn7kIRDVzVf
2nqvCHY/6icyLLm3vbwjwgv5
=nmHp
-----END PGP SIGNATURE-----
