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
F170026135: D53868.id167508.diff
Thu, Sep 3, 7:10 AM
Unknown Object (File)
Wed, Sep 2, 9:42 AM
Unknown Object (File)
Wed, Sep 2, 9:40 AM
Unknown Object (File)
Wed, Sep 2, 12:55 AM
Unknown Object (File)
Tue, Sep 1, 7:01 AM
Unknown Object (File)
Tue, Aug 25, 11:11 PM
Unknown Object (File)
Sun, Aug 23, 2:45 AM
Unknown Object (File)
Tue, Aug 18, 4:30 AM

Details

Summary

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

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 68836
Build 65719: arc lint + arc unit

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