Page MenuHomeFreeBSD

Use pointer to fake bpf_if structure after bpfdetach()
ClosedPublic

Authored by ae on Apr 16 2018, 10:49 AM.
Tags
None
Referenced Files
F153187335: D15083.id41503.diff
Sun, Apr 19, 4:44 PM
Unknown Object (File)
Wed, Apr 15, 10:34 AM
Unknown Object (File)
Sat, Apr 11, 5:47 AM
Unknown Object (File)
Tue, Apr 7, 5:10 PM
Unknown Object (File)
Tue, Apr 7, 4:36 AM
Unknown Object (File)
Mon, Apr 6, 9:35 AM
Unknown Object (File)
Sat, Mar 28, 9:26 AM
Unknown Object (File)
Tue, Mar 24, 1:57 AM
Subscribers

Details

Summary
Add dead_bpf_if structure, that should be used as fake bpf_if
during ifnet detach.

Since destroying interface is not atomic operation and due to the
lack of synhronization during destroy, it is possible, that in the
time between bpfdetach() and if_free() some queued on destroying
interface mbuf will be used by ether_input_internal() and bpf_peers_present()
can dereference NULL bpf_if pointer. To protect from this, assign
pointer to empty bpf_if_ext structure instead of NULL pointer after
bpfdetach().

Diff Detail

Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 16157
Build 16110: arc lint + arc unit

Event Timeline

This revision is now accepted and ready to land.Apr 16 2018, 11:05 AM
melifaro added inline comments.
sys/net/bpf.c
102

Why do we explicitly zero bif_next?

This revision was automatically updated to reflect the committed changes.