Page MenuHomeFreeBSD

bpf: calculate net.bpf.stats buffer size dynamically
ClosedPublic

Authored by glebius on Nov 21 2025, 10:56 PM.
Tags
None
Referenced Files
F164697816: D53868.id167070.diff
Mon, Aug 3, 5:55 AM
Unknown Object (File)
Mon, Aug 3, 12:56 AM
Unknown Object (File)
Sun, Aug 2, 1:33 AM
Unknown Object (File)
Sat, Aug 1, 1:22 AM
Unknown Object (File)
Thu, Jul 30, 4:59 PM
Unknown Object (File)
Thu, Jul 30, 7:21 AM
Unknown Object (File)
Tue, Jul 28, 7:09 PM
Unknown Object (File)
Tue, Jul 28, 5:42 PM

Details

Summary

This removed the global counter, that was updated in a racy manner.

Diff Detail

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

Event Timeline

markj added inline comments.
sys/net/bpf.c
3091

Why not allocate bpfd_cnt * sizeof(*xbd) bytes instead? req->oldlen is not clamped, I believe, so userspace can request any allocation size they want.

markj added inline comments.
sys/net/bpf.c
3094

To be useful, this assertion should be inside the inner loops below.

This revision is now accepted and ready to land.Nov 25 2025, 2:00 PM