HomeFreeBSD

kern: Fix credentials leaks on RACCT but no RCTL

Description

kern: Fix credentials leaks on RACCT but no RCTL

Affected system calls: setuid(), setreuid(), setresuid(), jail_attach(),
setloginclass().

In these system calls, the crhold() calls that, on RACCT, make the
just-installed process credentials survive a concurrent change of the
same credentials just after PROC_UNLOCK() were not matched by
a corresponding crfree() when RCTL is off. In fact, in that latter
case, they are simply not necessary, so wrap them with '#ifdef RCTL'
stances. 'kern_rctl.c' causes a compile error if RACCT is not defined
but RCTL is, so ease reading by not nesting '#ifdef's.

MFC after: 3 days
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D53456

Details

Provenance
olceAuthored on Wed, Oct 29, 4:46 PM
Differential Revision
D53456: kern: Fix credentials leaks on RACCT but no RCTL
Parents
rG9530c6f082ad: racct: Simplify skipping idle process in the throttling daemon
Branches
Unknown
Tags
Unknown