From nobody Tue Sep 23 12:03:30 2025 X-Original-To: dev-commits-src-all@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 4cWJXg3LyGz68Xgn; Tue, 23 Sep 2025 12:03:31 +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 4cWJXg0stBz3DYR; Tue, 23 Sep 2025 12:03:31 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1758629011; 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=JVXUnFe1KIX8qNk8bgZTbWWWdc3GO2r6CXfjR8t3k04=; b=y3tBezGIIS5xTW7w+meCh7Bz5WeurHl2w+/xf6l+C6joo1eehHt1mGd8dSEzJEsPzRgqoD 0/nftvUcQWUQpUJJdUxlpEwHp7rULOLNkptcrO1PaPO/15KR+0oKO+pCLzg+0deEOK3mEJ 39lSLWHCuIILnOcrWmm2hYRmBE4ssLboQlP4+R5khEHETI+zRRJB/Sz/luIbIdrQ/KAkYc Dyq95QuV5FURKm/LpMmLJ5/zRPC0Zj7yXGHwnZVRccaYbBgFB0l8nWTChW/EGOKyhQIWU6 Kw+Nh7tgzWH9lFlGzzs97OTTqcrWkZWlbgO6Ql36iMIwSC4lsGldZqgEoRudiA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1758629011; 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=JVXUnFe1KIX8qNk8bgZTbWWWdc3GO2r6CXfjR8t3k04=; b=Cfen4OOwDVdPRXeVLPITmSauNfk0dggq1kaJ6Bbj6f48OJJQtApjmTWD5mBCrCw9poZSJq lJ3b5HSfFzGRm3UXB0CQRX4MWfyvvyIcHumlwxxRlYBBpbXx1lwXi9pdeG8eASvjltH50C ZjtsrXfRiLdJKqDgCzIbV01SiHieMcNQFN93KTZzquypdRr/Z+USmw7T3V38efMPEIifBw oSJvNB87d0S3vrg0RUFIkKDzmav6rf/n22fzuLGHCSOR9lym4JdBQp7yefUiv25yyZpQhR IjqqrhENm6B4Fzkz5NTgyfs06I5pwpvDY3d/GTyJILU7wd8hIyTdflmhxVGC5g== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1758629011; a=rsa-sha256; cv=none; b=IYm5Zpb0CX9LsQWwCkpToqzwuA/mIAGiseg0LP40EJkQUNKHQHUZEplEnFXAtsssc90gQv e3cvGfhVSc8Nx26XC5egz2t1lau7dl4vg1HcxF1fSUJhagoIdsMWVn+1hP6ZAuKA4SIqxX IQL2WgQZDGiUDLGPCQmBuozVYwRO3zUGV8y66iPFL561giFNRGFxEmL6tALNuKIkyxkdQj iCte7B0wKJwBuU09fsCaXS+Z81sfpY3B7COE2iggoAeQ11i9LB1lISyEFBpPgieWfCwnVe FIFaavR0BNEMIYH4IFPd5KZ52OjEYoFEv67YCNtYAJ2Oj1WbT2EEgobPLJHE7g== 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 4cWJXg0TKvzlch; Tue, 23 Sep 2025 12:03:31 +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 58NC3UNq008362; Tue, 23 Sep 2025 12:03:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 58NC3U5M008359; Tue, 23 Sep 2025 12:03:30 GMT (envelope-from git) Date: Tue, 23 Sep 2025 12:03:30 GMT Message-Id: <202509231203.58NC3U5M008359@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: 9466d35acc01 - stable/15 - cred: Update some comments after 'cr_gid' is no more cr_groups[0] List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@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: 9466d35acc010d445438b1a4b5343f1276d3112f Auto-Submitted: auto-generated The branch stable/15 has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=9466d35acc010d445438b1a4b5343f1276d3112f commit 9466d35acc010d445438b1a4b5343f1276d3112f Author: Olivier Certner AuthorDate: 2025-08-27 14:07:03 +0000 Commit: Olivier Certner CommitDate: 2025-09-23 12:02:41 +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 (cherry picked from commit 9397b2ef741c57c8b2f0fdf796cc86267ecf2213) --- 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