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)
Mar 15 2024, 1:12 AM
Unknown Object (File)
Dec 22 2023, 11:50 PM
Unknown Object (File)
Nov 1 2023, 6:18 PM
Unknown Object (File)
Oct 28 2023, 2:59 AM
Unknown Object (File)
Sep 4 2023, 12:44 AM
Unknown Object (File)
Jul 12 2023, 8:07 PM
Unknown Object (File)
Jun 22 2023, 6:45 PM
Unknown Object (File)
Jun 16 2023, 3:54 AM

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