Page MenuHomeFreeBSD

pf: Ensure that st->kif is obtained in a way which respects the r->rpool->mtx mutex
ClosedPublic

Authored by vegeta_tuxpowered.net on Feb 4 2024, 9:01 PM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Sep 27, 5:23 PM
Unknown Object (File)
Fri, Sep 27, 9:23 AM
Unknown Object (File)
Tue, Sep 24, 10:23 AM
Unknown Object (File)
Tue, Sep 24, 5:18 AM
Unknown Object (File)
Fri, Sep 20, 8:00 AM
Unknown Object (File)
Thu, Sep 19, 6:23 AM
Unknown Object (File)
Thu, Sep 19, 5:24 AM
Unknown Object (File)
Tue, Sep 17, 9:27 PM

Details

Summary

The redirection pool stored in r->rpool.cur is used for loadbalancing and cur can change whenever loadbalancing happens, which is for every new connection. Therefore it can't be trusted outside of pf_map_addr() and the r->rpool->mtx mutex. After evaluating the ruleset, loadbalancing decission is made in pf_map_addr() called from within pf_create_state() and stored in the state itself.

This patch modifies BOUND_IFACE() so that it only uses the information already stored in the state which has been obtained in a way which respects the r->rpool->mtx mutex.

Test Plan

I've ran the test suite.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

vegeta_tuxpowered.net retitled this revision from pf: Ensure state->kif override accesses locked redirection pool to pf: Ensure that st->kif is obtained in a way which respects the r->rpool->mtx mutex.
vegeta_tuxpowered.net edited the summary of this revision. (Show Details)

A slightly less invasive patch.

Thanks for catching that.

This revision is now accepted and ready to land.Feb 5 2024, 9:17 PM