Page MenuHomeFreeBSD

bpf: don't clear pointer from descriptor to the tap on descriptor close
Needs ReviewPublic

Authored by glebius on Mon, Feb 2, 9:59 PM.

Details

Reviewers
ae
Group Reviewers
network
Summary

During packet processing the descriptor is looked up using epoch(9) and it
can be accessed after bpf_detachd(). In scenario of descriptor close the
tap point is alive (it actually produces packets) and thus the pointer can
be legitimately dereferenced. This fixes a race on a bpf(4) device close
that would otherwise result in panic.

Diff Detail

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

Event Timeline

Is bpf_chkdir() dereferencing a NULL d->bd_bif in net epoch ?

bpfwrite() is locked checking d->bd_bif == NULL and returns ENXIO incase true, and if not, will bpfwrite() then possibly reference a freed bpf_if ?