HomeFreeBSD

proc: Fix proc_init / proc_dtor ordering issues

Description

proc: Fix proc_init / proc_dtor ordering issues

  • Move the initialization of p_ktr into proc_init() and make the check in proc_dtor() unconditional. Prior to this, it was possible to fail and invoke proc_dtor() after the first thread had been created (which was the condition for checking p_ktr in proc_dtor()) but before p_ktr had been initialized.
  • Move the p_klist initialization in fork1() past the last possible failure point so we don't have to free it on failure. We didn't, which meant we were leaking a knlist every time we failed to fork due to hitting the resource limit.

PR: 291470
MFC after: 1 week
Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D54215

Details

Provenance
desAuthored on Sun, Dec 14, 1:16 PM
Reviewer
kib
Differential Revision
D54215: proc: Fix proc_init / proc_dtor ordering issues
Parents
rGd4f25d0c7957: vfs: Let prison_enforce_statfs zero the fsid
Branches
Unknown
Tags
Unknown