Page MenuHomeFreeBSD

pf: always mark states as unlinked before detaching them
ClosedPublic

Authored by kp on May 6 2024, 2:50 PM.
Tags
None
Referenced Files
F115169744: D45101.diff
Mon, Apr 21, 2:51 AM
Unknown Object (File)
Sat, Apr 19, 6:19 PM
Unknown Object (File)
Wed, Apr 9, 11:07 AM
Unknown Object (File)
Sun, Mar 30, 12:25 AM
Unknown Object (File)
Mar 22 2025, 6:21 AM
Unknown Object (File)
Mar 21 2025, 11:46 PM
Unknown Object (File)
Feb 22 2025, 2:22 PM
Unknown Object (File)
Feb 22 2025, 1:43 PM

Details

Summary

Users have reported crashes in pf_test_state_udp() where at least one state key
is NULL.

That suggests that pf_detach_state() ran concurrently with pf_test_state_udp().
pf_test_state_udp() holds the state lock (aka the id lock), but
pf_detach_state() does not.
The intent is that detached states are not returned by STATE_LOOKUP/
pf_find_state(), as the state's timeout is set to PFTM_UNLINKED and thus
pf_find_state() does not find the state.

There are other paths to pf_detach_state() (outside of pf_unlink_state())
though, where we did not set the timeout to PFTM_UNLINKED. Fix those, and assert
that the timeout is set correctly when we enter pf_detach_state().

MFC after: 1 week
See also: https://redmine.pfsense.org/issues/15413
Sponsored by: Rubicon Communications, LLC ("Netgate")

Diff Detail

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