HomeFreeBSD

buffer pager: deref ucred immediately after read.

Description

buffer pager: deref ucred immediately after read.

Ucred is passed to bread(9) so that non-local filesystems use proper
credentials. But, since clean buffer might be cached unless
buf_pager_relbuf is not enabled, it makes credentials to have extra
reference until buffer is reclaimed. Ucred reference would prevent
jail from destroying if creds are jailed.

Dereferencing the read credentials on the valid buffer avoid that, and
should be fine because the buffer is valid and does not need re-read.

PR: 238032
Reported by: bz
Reproduced and tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D23775

Details

Provenance
kibAuthored on
Differential Revision
D23775: buffer pager: deref ucred immediately after read.
Parents
rS358675: umtx_op.2: correct typo
Branches
Unknown
Tags
Unknown