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
Unknown Object (File)
Thu, Jan 22, 6:04 PM
Unknown Object (File)
Thu, Jan 22, 6:02 PM
Unknown Object (File)
Thu, Jan 22, 5:53 PM
Unknown Object (File)
Wed, Jan 14, 11:35 AM
Unknown Object (File)
Mon, Jan 12, 11:30 AM
Unknown Object (File)
Mon, Jan 12, 11:13 AM
Unknown Object (File)
Sat, Jan 10, 3:58 PM
Unknown Object (File)
Sat, Jan 10, 4:42 AM

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