Page MenuHomeFreeBSD

pf: fix cleanup deadlock
ClosedPublic

Authored by kp on Dec 14 2024, 7:36 PM.
Tags
None
Referenced Files
F154710622: D48082.diff
Wed, Apr 29, 7:08 AM
F154709038: D48082.diff
Wed, Apr 29, 7:04 AM
F154644745: D48082.id148125.diff
Wed, Apr 29, 3:14 AM
F154642544: D48082.id148125.diff
Wed, Apr 29, 3:08 AM
Unknown Object (File)
Mon, Apr 20, 9:03 PM
Unknown Object (File)
Mon, Apr 6, 3:04 PM
Unknown Object (File)
Sun, Apr 5, 9:39 PM
Unknown Object (File)
Mar 27 2026, 3:07 PM

Details

Reviewers
None
Group Reviewers
network
pfsense
Commits
rG358c5f5c0899: pf: fix cleanup deadlock
Summary

We can get to pfi_kkif_remove_if_unref() via at least two distinct paths:

  • when the struct ifnet is removed, via pfi_detach_ifnet_event()
  • when a rule referencing us is removed, via pfi_kkif_unref().

These two events can race against each other, leading us to free this kif twice.
That leads to loop in V_pfi_unlinked_kifs, and an eventual deadlock.

Avoid this by making sure we only ever insert the kif into V_pfi_unlinked_kifs
once. If we don't find it in V_pfi_ifs it's already been removed. Check that it
exists in V_pfi_unlinked_kifs (for INVARIANTS).

Sponsored by: Rubicon Communications, LLC ("Netgate")

Diff Detail

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

Event Timeline

kp requested review of this revision.Dec 14 2024, 7:36 PM
This revision was not accepted when it landed; it landed in state Needs Review.Dec 16 2024, 10:34 PM
Closed by commit rG358c5f5c0899: pf: fix cleanup deadlock (authored by kp). · Explain Why
This revision was automatically updated to reflect the committed changes.