Page MenuHomeFreeBSD

inpcb: Fix some bugs in _in_pcbinshash_wild()
AbandonedPublic

Authored by markj on Apr 23 2023, 3:12 PM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Oct 22, 2:18 AM
Unknown Object (File)
Sep 25 2024, 2:37 PM
Unknown Object (File)
Sep 20 2024, 11:26 PM
Unknown Object (File)
Sep 11 2024, 12:54 AM
Unknown Object (File)
Sep 5 2024, 10:53 AM
Unknown Object (File)
Sep 2 2024, 3:23 PM
Unknown Object (File)
Aug 23 2024, 2:39 PM
Unknown Object (File)
Aug 23 2024, 2:38 PM

Details

Reviewers
glebius
karels
Group Reviewers
network
Summary
  • In _in_pcbinshash_wild(), we should avoid returning v6 sockets unless no other matches are available. This preserves pre-existing semantics.
  • Fix an inverted test: when inserting a non-jailed PCB, we want to search for the first non-jailed PCB in the hash chain.
  • Test the right PCB when searching for a non-jailed PCB.

While here, add a required locking assertion.

Fixes: 7b92493ab1d4 ("inpcb: Avoid inp_cred dereferences in SMR-protected lookup")

Test Plan

The second bug broke ntpd, and with this patch the problem is gone.

I'm working on some regression tests for the PCB matching logic.

Diff Detail

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