git: faf7e9937591 - main - 'kern.proc.groups' sysctl knob: Restore outputting the effective GID
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 09 Sep 2025 15:58:07 UTC
The branch main has been updated by olce:
URL: https://cgit.FreeBSD.org/src/commit/?id=faf7e99375910fadb1b409a756be5477b561a517
commit faf7e99375910fadb1b409a756be5477b561a517
Author: Olivier Certner <olce@FreeBSD.org>
AuthorDate: 2025-08-26 15:54:47 +0000
Commit: Olivier Certner <olce@FreeBSD.org>
CommitDate: 2025-09-09 15:56:50 +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
---
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);
}