From nobody Wed Sep 17 12:18:59 2025 X-Original-To: dev-commits-src-main@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 4cRd9H5Vjrz67Hjq; Wed, 17 Sep 2025 12:18:59 +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 4cRd9H2NmBz3VYr; Wed, 17 Sep 2025 12:18:59 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1758111539; 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=Mlml3Kw6TPQDgNasxCSXuZ1fuWjkgs0e4UO0VZ1TbyU=; b=MjgUd6mlJnaIh2QyUjtUCV4Dvq8bd6Y8kXfked55x9l1LmEaAGQycCj21UD3uQchL+HLgi 2OLxsjg2ZSF4bkwssiZm9ZCETHQ23LSqtexmqiqH57F0jh58Hrv1iKKtY/3gty8rKSUx8f /+BnzzhIFechkFlyW45/7RFxabr6O98UUFxMqvRilwos0wHqLQcUeav1Bv1u3XuN86PsT7 IdgvnHWhRw6HpoOQ6SVapCyqibAuAPrLQfteiTTDaDVmcQ1IGUGh41EyYS9bz9GVWBDecs pHoVDzGpm5zh/jbP3VSvWjf89SGnJPMbNHzvNMcOfvEC9MuHrxNt6M7WdXL5FA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1758111539; 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=Mlml3Kw6TPQDgNasxCSXuZ1fuWjkgs0e4UO0VZ1TbyU=; b=ylMSwJToPmh+uPfu5+TE4GU8vztDfq0fDDW7q/TuLx6G2A3CsizXQs2qxF966z3IzVRr8y 7qREtJCOyo8dHkIJyFycwxa2axi1imw0W1PQhmkKtmVqL9fwKz9GLQCd0HbGwOWnLTISnw g914QWOcAfkhForq5QFbDyMvGYz2zTSJT+/FaBAlziRYBAzCTX55Y8mZw+EcKSn93sft1Z XocwMyoSx3JeHt+BAIK84NphXVd+72srRq82q+hMUmkm5OwKOByso5sXAwvw1Om2R/x6vQ chLF5KDPco/BvWI2tG1/Tp2V2RFVWfc653G+Vxl/Q1+RRiLapIqZwvqBDuvTYg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1758111539; a=rsa-sha256; cv=none; b=juQ1uOGZmlPQvw3CS6LJM+UjNXR6k9tisKNRDCn14TqaEzI/RPVyxx8Ow9NaafudOrSOfc r3yGTnBzsSfFmEOJcKuWn28kTvlWPq6SPrxwEoRRNuaCagbDgz5tyh1za9r2pR4z1otuEh ROZNTGcr9146iKHIN9pl7Az2QSrBwiaOGUwBMMEiKfHS4M/SYsoOFaopfcKxCoPDtTNEfI CTDakxpCkHPzhwkNIfpN0U1ZCED3tNwQdpTlCG7J1MIePfJstgpTREuQ2KR01NTY4dmQzf bCxrXhNu1U3Qk/Fxs3MB2ceHd5fxzzEFqZgO3+++hgA2DqH1wAmGZTaL2UIgrA== 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 4cRd9H1yQCz9Lp; Wed, 17 Sep 2025 12:18:59 +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 58HCIxYS085560; Wed, 17 Sep 2025 12:18:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 58HCIxWI085557; Wed, 17 Sep 2025 12:18:59 GMT (envelope-from git) Date: Wed, 17 Sep 2025 12:18:59 GMT Message-Id: <202509171218.58HCIxWI085557@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Olivier Certner Subject: git: 9397b2ef741c - main - cred: Update some comments after 'cr_gid' is no more cr_groups[0] List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@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/main X-Git-Reftype: branch X-Git-Commit: 9397b2ef741c57c8b2f0fdf796cc86267ecf2213 Auto-Submitted: auto-generated The branch main has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=9397b2ef741c57c8b2f0fdf796cc86267ecf2213 commit 9397b2ef741c57c8b2f0fdf796cc86267ecf2213 Author: Olivier Certner AuthorDate: 2025-08-27 14:07:03 +0000 Commit: Olivier Certner CommitDate: 2025-09-17 12:16:01 +0000 cred: Update some comments after 'cr_gid' is no more cr_groups[0] While here, fix style of some already-updated comments. Fixes: be1f7435ef218b1d ("kern: start tracking cr_gid outside of cr_groups[]") MFC after: 5 days MFC to: stable/15 Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D52266 --- sys/kern/kern_prot.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/sys/kern/kern_prot.c b/sys/kern/kern_prot.c index 0ca42d640767..3333a168a754 100644 --- a/sys/kern/kern_prot.c +++ b/sys/kern/kern_prot.c @@ -1803,12 +1803,6 @@ groupmember(gid_t gid, const struct ucred *cred) bool realgroupmember(gid_t gid, const struct ucred *cred) { - /* - * Although the equality test on 'cr_rgid' below doesn't access - * 'cr_groups', we check for the latter's length here as we assume that, - * if 'cr_ngroups' is 0, the passed 'struct ucred' is invalid, and - * 'cr_rgid' may not have been filled. - */ groups_check_positive_len(cred->cr_ngroups); if (gid == cred->cr_rgid) @@ -2921,8 +2915,8 @@ crextend(struct ucred *cr, int n) * Normalizes a set of groups to be applied to a 'struct ucred'. * * Normalization ensures that the supplementary groups are sorted in ascending - * order and do not contain duplicates. This allows group_is_supplementary - * to do a binary search. + * order and do not contain duplicates. This allows group_is_supplementary() to + * do a binary search. */ static void groups_normalize(int *ngrp, gid_t *groups) @@ -2985,9 +2979,9 @@ crsetgroups_internal(struct ucred *cr, int ngrp, const gid_t *groups) * Copy groups in to a credential after expanding it if required. * * May sleep in order to allocate memory (except if, e.g., crextend() was called - * before with 'ngrp' or greater). Truncates the list to ngroups_max if + * before with 'ngrp' or greater). Truncates the list to 'ngroups_max' if * it is too large. Array 'groups' doesn't need to be sorted. 'ngrp' must be - * strictly positive. + * positive. */ void crsetgroups(struct ucred *cr, int ngrp, const gid_t *groups) @@ -3018,8 +3012,8 @@ crsetgroups(struct ucred *cr, int ngrp, const gid_t *groups) * Same as crsetgroups() but sets the effective GID as well. * * This function ensures that an effective GID is always present in credentials. - * An empty array will only set the effective GID to the default_egid, while a - * non-empty array will peel off groups[0] to set as the effective GID and use + * An empty array will only set the effective GID to 'default_egid', while + * a non-empty array will peel off groups[0] to set as the effective GID and use * the remainder, if any, as supplementary groups. */ void