Page MenuHomeFreeBSD

pf: fix cleanup deadlock
ClosedPublic

Authored by kp on Dec 14 2024, 7:36 PM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Mar 27, 3:07 PM
Unknown Object (File)
Thu, Mar 26, 11:25 PM
Unknown Object (File)
Thu, Mar 26, 9:31 AM
Unknown Object (File)
Thu, Mar 26, 4:16 AM
Unknown Object (File)
Tue, Mar 24, 12:42 PM
Unknown Object (File)
Mon, Mar 23, 3:25 PM
Unknown Object (File)
Mon, Mar 23, 3:51 AM
Unknown Object (File)
Wed, Mar 18, 1:15 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.