diff options
| author | Olivier Certner <olce@FreeBSD.org> | 2025-08-26 13:41:49 +0000 |
|---|---|---|
| committer | Olivier Certner <olce@FreeBSD.org> | 2025-09-09 15:56:48 +0000 |
| commit | 5568b4441dff078733a76835312a6ce1ccb50a17 (patch) | |
| tree | 89408b06e364437f73e53497deca613088e67592 | |
| parent | d859d4c57eda8ad277611466b840637234712e42 (diff) | |
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
| -rw-r--r-- | sys/kern/imgact_elf.c | 4 |
1 files changed, 3 insertions, 1 deletions
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)); } |
