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

=============================================================================
FreeBSD-EN-21:19.libcasper                                      Errata Notice
                                                          The FreeBSD Project

Topic:          libcasper assertion failure

Category:       core
Module:         libcasper
Announced:      2021-06-29
Credits:	Borja Marcos, Jung-uk Kim
Affects:        All supported versions of FreeBSD.
Corrected:      2021-06-15 18:14:43 UTC (stable/13, 13.0-STABLE)
                2021-06-29 17:09:02 UTC (releng/13.0, 13.0-RELEASE-p3)
                2021-06-16 20:25:22 UTC (stable/12, 12.2-STABLE)
                2021-06-29 20:26:12 UTC (releng/12.2, 12.2-RELEASE-p9)
                2021-06-16 20:30:46 UTC (stable/11, 11.4-STABLE)
                2021-06-29 20:25:32 UTC (releng/11.4, 11.4-RELEASE-p12)

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

libcasper(3) allows Capsicum-sandboxed applications to define and use
system interfaces which are ordinarily disallowed.  It is used by
multiple programs in the base system, such as logger(1).

II.  Problem Description

libcasper(3) creates service processes by forking the calling process,
so they initially inherit the calling process' file descriptor table.
Casper services expect the lowest 3 file descriptors, traditionally
corresponding to standard input, output, and error, are redirected to
/dev/null.  libcasper(3) ensures this is the case.  However, it did not
handle the possibility that one of them is closed, and this scenario
would trigger an assertion failure during service creation, resulting in
a crash.

III. Impact

Some applications, such as logger(1), may crash if one of the standard
descriptors is closed when Casper services are started, typically during
program initialization.

IV.  Workaround

No workaround is available.

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 via a binary patch:

Systems running a RELEASE version of FreeBSD on the amd64, i386, or
(on FreeBSD 13 and later) arm64 platforms 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 13.0]
# fetch https://security.FreeBSD.org/patches/EN-21:19/libcasper.13.patch
# fetch https://security.FreeBSD.org/patches/EN-21:19/libcasper.13.patch.asc
# gpg --verify libcasper.13.patch.asc

[FreeBSD 12.2]
# fetch https://security.FreeBSD.org/patches/EN-21:19/libcasper.12.patch
# fetch https://security.FreeBSD.org/patches/EN-21:19/libcasper.12.patch.asc
# gpg --verify libcasper.12.patch.asc

[FreeBSD 11.4]
# fetch https://security.FreeBSD.org/patches/EN-21:19/libcasper.11.patch
# fetch https://security.FreeBSD.org/patches/EN-21:19/libcasper.11.patch.asc
# gpg --verify libcasper.11.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 all daemons that use the library, or reboot the system.

VI.  Correction details

This issue is corrected by the corresponding Git commit hash or Subversion
revision number in the following stable and release branches:

Branch/path                             Hash                     Revision
- -------------------------------------------------------------------------
stable/13/                              934e10b4a388    stable/13-n246041
releng/13.0/                            ba5ed8109cc9  releng/13.0-n244748
stable/12/                                                        r369994
releng/12.2/                                                      r370063
stable/11/                                                        r370004
releng/11.4/                                                      r370059
- -------------------------------------------------------------------------

For FreeBSD 13 and later:

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=255339>

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

iQIzBAEBCgAdFiEE/A6HiuWv54gCjWNV05eS9J6n5cIFAmDcD0QACgkQ05eS9J6n
5cJ3oRAAhTR7w6yCDjLSExq+/mizNNPy/EHyTxnoexUV6vGnPL3wEno6IVhqTPS3
Vuq9m7noXOgwHGO0Mbbuc9vkZJWjfoXoeEqylfkSxH3mDb+hkBKPGyZNZWup6XCd
ykm2FB+c65t/neF9n/6OesT7mIUp+k4UIwTOXuO5rRolWkGrSawHLYWucww3LAF1
p2bD7Gdc8m/Ymj5FDJBPMWAtFW7QNmocyQI4vGAgqoW2DXokoy/BVTYE6pU3RQ3G
ZTkXMa5Vb6LlbnP3ho14Jap/6gXcUAnB96bXuWG3JIsNvslZzSLe1jRKD0QXNJvw
PFRLe8LBOA/VZ02xyoHdlAkAnTMk+vv7LU6K6Z7UIr8YzwkS0UYvvVvEr03E1Psm
qvzhs+qml2ATn4/C4sjzUEAq5YRqBPQOSmKFmGDAOzy179L1YM8IFIdm11hpGlu5
8T+n/egH5IVQ7U35MiXUkomvO7F2PWBP7oGI0GDIvKa7UuR+gsMwkVyE68W2442i
3JaBCqntchJjS2P+ixnXR2qCI81zCRlG+/m/1gBgztA8+K85l0P0gt8VAhcakbES
WXh4rX6BSvMqDI1Ex3wS00zjZOSM/HoNz+HGmpUiQ7RYVinrt4Av3vdbv2hLm96l
Iu28g8UCf4HNUAVAbgtiHmU74TBKGSyDPVcQVvegMG/YEhof9Fw=
=LQ0r
-----END PGP SIGNATURE-----