[FreeBSD-Announce] FreeBSD Errata Notice FreeBSD-EN-22:05.tail

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

FreeBSD-EN-22:05.tail                                           Errata Notice
                                                          The FreeBSD Project

Topic:          tail -F fails to follow some types of log rotation

Category:       core
Module:         tail
Announced:      2022-01-11
Affects:        FreeBSD 13.0
Corrected:      2021-03-18 20:12:24 UTC (stable/13, 13.0-STABLE)
                2022-01-11 18:15:01 UTC (releng/13.0, 13.0-RELEASE-p6)

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

tail(1) displays the last part of a file, and can wait for and print any data
appended to the file.  As of FreeBSD 13.0, tail(1) runs in capability mode
via Capsicum.

II.  Problem Description

When comparing the inode number of the current file to the file tail(1) has
open (in order to detect log rotation), tail(1) compared the inode number of
the already open file descriptor, rather than the file that currently has the
filename that was passed to tail(1).

III. Impact

When using tail(1)'s -F flag to follow a log file through log rotation,
depending on the type of log rotation performed, tail(1) may continue to
follow the original file after it is renamed, rather than detecting the
rotation and re-opening the original filename, and then following the new log

The rotated log is usually never written to after it is rotated, causing
tail(1)'s -F flag to not perform its intended function.

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

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

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/                              8c59e863e2c0    stable/13-n244979
releng/13.0/                            60cacd2e41e1  releng/13.0-n244771
- -------------------------------------------------------------------------

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:


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

The latest revision of this advisory is available at