]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
In hwpmc, do not double-close the logging file.
authorKonstantin Belousov <kib@FreeBSD.org>
Wed, 1 Nov 2017 11:32:52 +0000 (11:32 +0000)
committerKonstantin Belousov <kib@FreeBSD.org>
Wed, 1 Nov 2017 11:32:52 +0000 (11:32 +0000)
commitea4d25f90b2916c8adfee3661f65520244f7f86d
tree23d737cff85445bd225613957f0ddac0fe21764f
parentbd63e829752b226482736efbcd897b7d24e1ce09
In hwpmc, do not double-close the logging file.

hwpmc(4) must not voluntarily call fo_close(), doing this causes
double-close of the file.  It seems to almost avoid bad consequences
for pipes, but other types of files demonstrate random memory access.

To fix, remove fo_close() calls, which also do not provide the
declared wake-up of waiters consistently.  Instead, send a signal to
the logger and configure the logger process to not block it.  Since
logger never returns to userspace, the signal only causes termination
of the interruptible sleeps in fo_write().

Reported and tested by: pho
Reviewed by: markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
X-Differential revision: https://reviews.freebsd.org/D12882
sys/dev/hwpmc/hwpmc_logging.c