From nobody Tue Sep 23 12:03:34 2025 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4cWJXk68Hpz68XkQ; Tue, 23 Sep 2025 12:03:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R12" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4cWJXk418pz3DfQ; Tue, 23 Sep 2025 12:03:34 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1758629014; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=iuF/J9CNbfetdYpKWtuCvqFLK0/yCmA1X+9Xy0FSr8s=; b=fbMBO8uFSDQ/aLIzerkOgv0ozjN2kiittg+oQHQ60RLt2DedaQBQqZ6Hn8FVuRxu2fLB+/ lFtyaugrJe+zBIER718sCpWPGw/DsIgNwSo+HD0QsHKKK3vo8GeOzpmg4dLypFLzrenZji NECq2eIRyOlFqaP2stLgGXgN9m4w2nm13/IF8nzZbBQGy4B/96FcWIk+5+WvtjnLLyLBiy DbrDZPZFiSbiudE6xDnhscCKg+kcfOFkXQ1Elc5w8C2ksnRtgYD6uDA+AzujGyxHJYE1T8 B7sj/D+J55OIJEOXkLS3Z1e+vEzfjUk0/9o2mOTXpsY/6u07WOMS0Pkz4KyzCw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1758629014; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=iuF/J9CNbfetdYpKWtuCvqFLK0/yCmA1X+9Xy0FSr8s=; b=J3f8Ee9fOEZUvq7BxIVDv9RpN705agZAYm5qITW8xSPi2QI6udiIUOAV70ll0BkW4na6mS 6b3OybPT8P8/ExO6xGhgaDj+TWsFn0LUBiMkWkFePYfrtQPMNkoY5dO11fgqPPekypG6Ba dW0/7A0uP1sE1Np9GqkplQwtIjiYKj5gIobem2v+x0IVbHpwZvGOXJ/VYhxsVwd70AiaO/ tsInK73cQbmCoqgonAhWA1QfE5/ER/T0826YWXp8aZd+6ZW+NC8AQfEozmru8HkaO5A0zW Vw6CRdURPy1rsIIFOurQL70eYkb4QPN2KDAnJo3g+x82Jgv72t2gcNRxPYu97A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1758629014; a=rsa-sha256; cv=none; b=wp/S/HFuOM9i0JVc6pkTHiq883GkiI0pviSrWcLKyKQ+kOXPZlHEQlAOmLv8qCmfeua4d+ p4oTZ/2rpMnWhI7oa+2OQ/Z6FCC4divngi1B1WZFQiM8gS5e707ozzdf4hwurFynbbfuiX yMErDRW2/ie1r8ObTaTmYVn88BZIeeMUyE7DYhEVnyP9tvNK7ABiOi4abVgJR/naHxBlUv o+9KUlAQDIhCOV9gLbbSAs6j+IfiwpqO8xejLq1hRPMm6chV9lcp89lgAs361bL5iBgemm vT3o7YCxEZ4pRTtlAOzuG4CqhpYgfVd4o2jPYKS9lrtdzbkR7jt/Mze3LG6sCQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4cWJXk3Qb0zlqd; Tue, 23 Sep 2025 12:03:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 58NC3Ytl008470; Tue, 23 Sep 2025 12:03:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 58NC3YHg008467; Tue, 23 Sep 2025 12:03:34 GMT (envelope-from git) Date: Tue, 23 Sep 2025 12:03:34 GMT Message-Id: <202509231203.58NC3YHg008467@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Olivier Certner Subject: git: ee8c31c6dae4 - stable/15 - cred: 'struct ucred': Rework comment on 'cr_gid'/cr_groups[] List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: olce X-Git-Repository: src X-Git-Refname: refs/heads/stable/15 X-Git-Reftype: branch X-Git-Commit: ee8c31c6dae4069cb4f2f29bd23c6692882ca652 Auto-Submitted: auto-generated The branch stable/15 has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=ee8c31c6dae4069cb4f2f29bd23c6692882ca652 commit ee8c31c6dae4069cb4f2f29bd23c6692882ca652 Author: Olivier Certner AuthorDate: 2025-08-27 14:33:24 +0000 Commit: Olivier Certner CommitDate: 2025-09-23 12:02:42 +0000 cred: 'struct ucred': Rework comment on 'cr_gid'/cr_groups[] Make it more straightforward for consumers. Also, recommend using cr_sgroups[] for supplementary groups, as this can generally alleviate index problems and will help us spot and change consumers if/when 'struct ucred' is evolved incompatibly (and cr_sgroups[] suppressed). MFC after: 5 days MFC to: stable/15 Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D52269 (cherry picked from commit 0abeb8d8d8df1842b0c2d2276c958b0150579a1c) --- sys/sys/ucred.h | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/sys/sys/ucred.h b/sys/sys/ucred.h index 9c1d8545af34..254f58841993 100644 --- a/sys/sys/ucred.h +++ b/sys/sys/ucred.h @@ -112,15 +112,21 @@ struct xucred { short cr_ngroups; /* number of groups (incl. cr_gid). */ union { /* - * Special little hack to avoid needing a cr_gid macro, which - * would cause problems if one were to use it with struct ucred - * which also has a cr_groups member. + * The effective GID has been the first element of cr_groups[] + * for historical reasons. It should be accessed using the + * 'cr_gid' identifier. Supplementary groups should be accessed + * using cr_sgroups[]. Note that 'cr_ngroups' currently + * includes the effective GID. + * + * XXXOC: On the next API change (requires versioning), please + * replace this union with a true unaliased field 'cr_gid' and + * make sure that cr_groups[]/'cr_ngroups' only account for + * supplementary groups. */ struct { gid_t cr_gid; /* effective group id */ gid_t cr_sgroups[XU_NGROUPS - 1]; }; - gid_t cr_groups[XU_NGROUPS]; /* groups */ }; union {