HomeFreeBSD

inpcb: Release the inpcb cred reference before freeing the structure

Description

inpcb: Release the inpcb cred reference before freeing the structure

Now that the inp_cred pointer is accessed only while the inpcb lock is
held, we can avoid deferring a crfree() call when freeing an inpcb.

This fixes a problem introduced when inpcb hash tables started being
synchronized with SMR: the credential reference previously could not be
released until all lockless readers have drained, and there is no
mechanism to explicitly purge cached, freed UMA items. Thus, ucred
references could linger indefinitely, and since ucreds hold a jail
reference, the jail would linger indefinitely as well. This manifests
as jails getting stuck in the DYING state.

Discussed with: glebius
Tested by: glebius
Sponsored by: Klara, Inc.
Sponsored by: Modirum MDPay
Differential Revision: https://reviews.freebsd.org/D38573

Details

Provenance
markjAuthored on Apr 20 2023, 3:48 PM
Differential Revision
D38573: inpcb: Release the inpcb cred reference before freeing the structure
Parents
rG7b92493ab1d4: inpcb: Avoid inp_cred dereferences in SMR-protected lookup
Branches
Unknown
Tags
Unknown