Page MenuHomeFreeBSD

pf: fix cleanup deadlock
ClosedPublic

Authored by kp on Dec 14 2024, 7:36 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Oct 5, 11:23 PM
Unknown Object (File)
Fri, Oct 3, 11:17 AM
Unknown Object (File)
Fri, Oct 3, 11:15 AM
Unknown Object (File)
Wed, Oct 1, 4:45 PM
Unknown Object (File)
Mon, Sep 29, 6:43 AM
Unknown Object (File)
Mon, Sep 22, 5:14 AM
Unknown Object (File)
Sep 15 2025, 1:15 PM
Unknown Object (File)
Sep 14 2025, 12:40 AM

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.