[FreeBSD-Announce] FreeBSD Errata Notice FreeBSD-EN-22:04.pcid

From: FreeBSD Errata Notices <errata-notices_at_freebsd.org>
Date: Tue, 11 Jan 2022 19:39:14 UTC
Hash: SHA512

FreeBSD-EN-22:04.pcid                                           Errata Notice
                                                          The FreeBSD Project

Topic:          Incorrect PCID mode invalidations

Category:       core
Module:         kernel
Announced:      2022-01-11
Affects:        FreeBSD 12.x
Corrected:      2021-12-14 14:46:07 UTC (stable/12, 12.3-STABLE)
                2022-01-11 18:19:29 UTC (releng/12.3, 12.3-RELEASE-p1)
                2022-01-11 18:33:17 UTC (releng/12.2, 12.2-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

I.   Background

When switching address spaces the kernel must flush stale Translation
Lookaside Buffer (TLB) entries to ensure that correct data is visible to the
CPU.  An Inter Processor Interrupt (IPI) is used to signal other CPUs of the
need to flush TLB entries.

PCID is an optimization that associates each page table with an identifier
(i.e., Process ID) to allow for efficient context switching.

II.  Problem Description

Operations specific to TLB invalidation in PCID mode were misordered with
respect to IPI transmission.

III. Impact

This issue may cause stale TLB translation entries (and hence invalid data)
in multithreaded applications, leading to application misbehaviour.

IV.  Workaround

PCID may be disabled by adding the following line to /boot/loader.conf:


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 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
# shutdown -r +10min "Rebooting for an errata update"

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.

# fetch https://security.FreeBSD.org/patches/EN-22:04/pcid.patch
# fetch https://security.FreeBSD.org/patches/EN-22:04/pcid.patch.asc
# gpg --verify pcid.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

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/12/                                                        r371237
releng/12.3/                                                      r371485
releng/12.2/                                                      r371490
- -------------------------------------------------------------------------

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:


VII. References


The latest revision of this advisory is available at