The branch stable/15 has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=32606eb5c4ddedc1ad9cf40625ca3f69de19bc24
commit 32606eb5c4ddedc1ad9cf40625ca3f69de19bc24 Author: Olivier Certner <o...@freebsd.org> AuthorDate: 2025-08-26 15:54:47 +0000 Commit: Olivier Certner <o...@freebsd.org> CommitDate: 2025-09-18 08:50:31 +0000 'kern.proc.groups' sysctl knob: Restore outputting the effective GID In particular, fixes 'procstat -s' on a live system (for processes with more than 16 groups). Reviewed by: kib, emaste Fixes: be1f7435ef218b1d ("kern: start tracking cr_gid outside of cr_groups[]") MFC after: 9 days Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D52261 (cherry picked from commit faf7e99375910fadb1b409a756be5477b561a517) --- sys/kern/kern_proc.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/sys/kern/kern_proc.c b/sys/kern/kern_proc.c index c2855034fabf..6e56664d12ce 100644 --- a/sys/kern/kern_proc.c +++ b/sys/kern/kern_proc.c @@ -2944,8 +2944,11 @@ sysctl_kern_proc_groups(SYSCTL_HANDLER_ARGS) cred = crhold(p->p_ucred); PROC_UNLOCK(p); - error = SYSCTL_OUT(req, cred->cr_groups, - cred->cr_ngroups * sizeof(gid_t)); + error = SYSCTL_OUT(req, &cred->cr_gid, sizeof(gid_t)); + if (error == 0) + error = SYSCTL_OUT(req, cred->cr_groups, + cred->cr_ngroups * sizeof(gid_t)); + crfree(cred); return (error); }