Page MenuHomeFreeBSD

pf: fix cleanup deadlock
ClosedPublic

Authored by kp on Dec 14 2024, 7:36 PM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Sep 17, 4:47 AM
Unknown Object (File)
Thu, Sep 17, 3:54 AM
Unknown Object (File)
Thu, Sep 17, 3:49 AM
Unknown Object (File)
Sun, Sep 13, 1:43 AM
Unknown Object (File)
Tue, Sep 8, 7:24 PM
Unknown Object (File)
Sat, Sep 5, 3:59 AM
Unknown Object (File)
Fri, Sep 4, 7:16 PM
Unknown Object (File)
Fri, Sep 4, 6:27 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 Not Applicable
Unit
Tests Not Applicable

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.