git: 5568b4441dff - main - imgact_elf: procstat groups: Restore sending the effective GID
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 09 Sep 2025 15:58:04 UTC
The branch main has been updated by olce:
URL: https://cgit.FreeBSD.org/src/commit/?id=5568b4441dff078733a76835312a6ce1ccb50a17
commit 5568b4441dff078733a76835312a6ce1ccb50a17
Author: Olivier Certner <olce@FreeBSD.org>
AuthorDate: 2025-08-26 13:41:49 +0000
Commit: Olivier Certner <olce@FreeBSD.org>
CommitDate: 2025-09-09 15:56:48 +0000
imgact_elf: procstat groups: Restore sending the effective GID
Fixes 'procstat -s' run on a core file when the number of groups in
effect at the moment of core dump exceeds KI_NGROUPS (16).
Reviewed by: kib
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/D52258
---
sys/kern/imgact_elf.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/sys/kern/imgact_elf.c b/sys/kern/imgact_elf.c
index 5a53fac50f2c..1bc2491a1a12 100644
--- a/sys/kern/imgact_elf.c
+++ b/sys/kern/imgact_elf.c
@@ -2610,11 +2610,13 @@ note_procstat_groups(void *arg, struct sbuf *sb, size_t *sizep)
int structsize;
p = arg;
- size = sizeof(structsize) + p->p_ucred->cr_ngroups * sizeof(gid_t);
+ size = sizeof(structsize) +
+ (1 + p->p_ucred->cr_ngroups) * sizeof(gid_t);
if (sb != NULL) {
KASSERT(*sizep == size, ("invalid size"));
structsize = sizeof(gid_t);
sbuf_bcat(sb, &structsize, sizeof(structsize));
+ sbuf_bcat(sb, &p->p_ucred->cr_gid, sizeof(gid_t));
sbuf_bcat(sb, p->p_ucred->cr_groups, p->p_ucred->cr_ngroups *
sizeof(gid_t));
}