]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
libprocstat kstack: fix race with thread creation
authorEric van Gyzen <vangyzen@FreeBSD.org>
Thu, 27 May 2021 16:33:22 +0000 (11:33 -0500)
committerEric van Gyzen <vangyzen@FreeBSD.org>
Wed, 2 Mar 2022 21:56:30 +0000 (15:56 -0600)
commitd89523644308afd24d47ca3dcf4098d0a719e919
tree043bc013866d26cfc9eab94e11371ac0eb44d0ba
parent94df301ac27e7df785d1d581a36dc14d456436c2
libprocstat kstack: fix race with thread creation

When collecting kernel stacks for a target process, if the process
adds a thread between the two calls to sysctl, ignore the additional
threads.  Previously, procstat would print only a useless error
message.  Now, it prints a consistent snapshot of the stacks.
We know that snapshot is already stale, but it could still be stale
even with a more complex fix to reallocate and retry, so such a fix
is hardly worth the effort.

Reported by: Daniel.Mitchell@emc.com
MFC after: 1 week
Sponsored by: Dell EMC Isilon

(cherry picked from commit 427f12f150e875c40acb84f292a80bfa0b90a1a2)
lib/libprocstat/libprocstat.c