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
F176223693: D58584.diff
Sat, Oct 17, 2:45 AM
Unknown Object (File)
Thu, Oct 15, 8:49 PM
Unknown Object (File)
Wed, Oct 14, 9:37 AM
Unknown Object (File)
Wed, Oct 14, 4:16 AM
Unknown Object (File)
Tue, Oct 13, 8:26 PM
Unknown Object (File)
Mon, Oct 12, 1:33 PM
Unknown Object (File)
Mon, Oct 12, 1:28 PM
Unknown Object (File)
Sun, Oct 11, 8:40 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 Passed
Unit
No Test Coverage
Build Status
Buildable 75329
Build 72212: arc lint + arc unit