[FreeBSD-Announce] FreeBSD Errata Notice FreeBSD-EN-19:05.kqueue

FreeBSD Errata Notices errata-notices at freebsd.org
Wed Jan 9 19:40:31 UTC 2019

Hash: SHA512

FreeBSD-EN-19:05.kqueue                                         Errata Notice
                                                          The FreeBSD Project

Topic:          kqueue race condition and kernel panic

Category:       core
Module:         kqueue
Announced:      2019-01-09
Credits:        Mark Johnston
Affects:        FreeBSD 11.2
Corrected:      2019-11-24 17:11:47 UTC (stable/11, 11.2-STABLE)
                2019-01-09 18:57:38 UTC (releng/11.2, 11.2-RELEASE-p8)

For general information regarding FreeBSD Errata Notices and Security
Advisories, including descriptions of the fields above, security
branches, and the following sections, please visit

I.   Background

kevent(2) is a system call which provides a generic method of notifying the
caller when a caller-specified event happens or a condition holds.  One use
for kevent(2) is to wait for a specified timeout to elapse.

II.  Problem Description

The kevent(2) implementation in the kernel contains a race condition which
can be triggered when an event is added and fires shortly after.  Most event
types are not affected, but timer events can trigger the race if the timeout
duration is very short.

III. Impact

The race condition can cause corruption of a queue structure, leading to
a kernel panic when it is later accessed.  Applications using kevent(2) may
trigger the panic if their usage causes the race condition to occur.

IV.  Workaround

No workaround is available.

V.   Solution

Perform one of the following:

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

2) To update your system via a binary patch:

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

# freebsd-update fetch
# freebsd-update install
# shutdown -r +30 "Rebooting for errata update"

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.

[FreeBSD 11.2]
# fetch https://security.FreeBSD.org/patches/EN-19:05/kqueue.patch
# fetch https://security.FreeBSD.org/patches/EN-19:05/kqueue.patch.asc
# gpg --verify kqueue.patch.asc

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

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

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

VI.  Correction details

The following list contains the correction revision numbers for each
affected branch.

Branch/path                                                      Revision
- -------------------------------------------------------------------------
stable/11/                                                        r340904
releng/11.2/                                                      r342899
- -------------------------------------------------------------------------

To see which files were modified by a particular revision, run the
following command, replacing NNNNNN with the revision number, on a
machine with Subversion installed:

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

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


VII. References

The latest revision of this advisory is available at


More information about the freebsd-announce mailing list