The branch stable/15 has been updated by olce:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=96a2fc56439ebd58622c484944ada9f2d4f2f468

commit 96a2fc56439ebd58622c484944ada9f2d4f2f468
Author:     Olivier Certner <o...@freebsd.org>
AuthorDate: 2025-08-26 13:41:49 +0000
Commit:     Olivier Certner <o...@freebsd.org>
CommitDate: 2025-09-18 08:50:30 +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
    
    (cherry picked from commit 5568b4441dff078733a76835312a6ce1ccb50a17)
---
 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));
        }

Reply via email to