Page MenuHomeFreeBSD

kqueue: stream the knote report instead of buffering all of it
ClosedPublic

Authored by seuros on Aug 1 2026, 8:01 AM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Sep 11, 1:10 AM
Unknown Object (File)
Thu, Sep 10, 7:58 PM
Unknown Object (File)
Thu, Sep 10, 2:00 AM
Unknown Object (File)
Wed, Sep 9, 10:21 AM
Unknown Object (File)
Mon, Sep 7, 8:53 AM
Unknown Object (File)
Sun, Sep 6, 8:52 PM
Unknown Object (File)
Sun, Sep 6, 10:34 AM
Unknown Object (File)
Fri, Sep 4, 5:05 PM
Subscribers

Details

Summary

kern_proc_kqueues_out() sized its intermediate sbuf from the preceding
sizing pass, so dumping core for a process with many knotes wired a
buffer as large as the entire report.

Shrank the intermediate to one page and added a drain that copied into
the caller's sbuf up to maxlen, stopping the walk once it was reached.
Truncation stayed byte exact.
A dump of 384k knotes peaked at 20 KB of M_SBUF instead of 445 MB.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable