The branch main has been updated by olce:

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

commit de974a0f1b73e79466c25f3c85fe727004576fea
Author:     Olivier Certner <o...@freebsd.org>
AuthorDate: 2025-08-26 08:56:54 +0000
Commit:     Olivier Certner <o...@freebsd.org>
CommitDate: 2025-09-09 15:56:40 +0000

    ddb ps: Print again the effective GID, separately
    
    Following commit be1f7435ef218b1d ("kern: start tracking cr_gid outside
    of cr_groups[]"), cr_groups[] doesn't contain the effective GID anymore.
    Fix the 'show proc' DDB command to show it again, and make it stand out
    with respect to the supplementary ones.
    
    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/D52251
---
 sys/ddb/db_ps.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/sys/ddb/db_ps.c b/sys/ddb/db_ps.c
index 733c440f5ee3..a26cf8161294 100644
--- a/sys/ddb/db_ps.c
+++ b/sys/ddb/db_ps.c
@@ -459,12 +459,11 @@ DB_SHOW_COMMAND(proc, db_show_proc)
                db_printf("??? (%#x)\n", p->p_state);
        }
        if (p->p_ucred != NULL) {
-               db_printf(" uid: %d  gids: ", p->p_ucred->cr_uid);
-               for (i = 0; i < p->p_ucred->cr_ngroups; i++) {
-                       db_printf("%d", p->p_ucred->cr_groups[i]);
-                       if (i < (p->p_ucred->cr_ngroups - 1))
-                               db_printf(", ");
-               }
+               db_printf(" uid: %d gid: %d supp gids: ",
+                   p->p_ucred->cr_uid, p->p_ucred->cr_gid);
+               for (i = 0; i < p->p_ucred->cr_ngroups; i++)
+                       db_printf(i == 0 ? "%d" : ", %d",
+                           p->p_ucred->cr_groups[i]);
                db_printf("\n");
        }
        if (p->p_pptr != NULL)

Reply via email to