Page MenuHomeFreeBSD

libprocstat: handle race condition while retrieving thread kernel stacks
Needs ReviewPublic

Authored by wollman on Mar 8 2016, 10:45 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mar 2 2024, 7:32 AM
Unknown Object (File)
Feb 5 2024, 11:36 AM
Unknown Object (File)
Dec 22 2023, 9:45 PM
Unknown Object (File)
Dec 6 2023, 1:48 AM
Unknown Object (File)
Nov 10 2023, 3:27 AM
Unknown Object (File)
Jun 25 2023, 1:48 PM
Unknown Object (File)
Jun 11 2023, 5:27 PM
Unknown Object (File)
Feb 18 2023, 7:46 AM
Subscribers
This revision needs review, but there are no reviewers specified.

Details

Reviewers
None
Summary

When retrieving kernel stacks using sysctl (as for procstat -kk on a running kernel), thread creation can race with allocating the buffer to hold the sysctl results, so the operation fails with [ENOMEM]. As a heuristic, assume that the number of threads (and thus the required buffer size) will at most double during this interval.

Test Plan

I have a machine where this happens somewhat regularly with nfsd and will be installing it there to see if the errors go away completely.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

wollman retitled this revision from to libprocstat: handle race condition while retrieving thread kernel stacks.
wollman updated this object.
wollman edited the test plan for this revision. (Show Details)
wollman set the repository for this revision to rS FreeBSD src repository - subversion.