From nobody Wed Sep 17 12:18:54 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 4cRd9C1mHwz67HhW; Wed, 17 Sep 2025 12:18:55 +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 4cRd9B69Qrz3V3k; Wed, 17 Sep 2025 12:18:54 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1758111534; 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=3cF6ymYqE9a1Xsg1HE66tI6gN45wwh9XoqQ4Xz3XJTc=; b=wWQnBwNCtUQcJygXbUu/61+QYAcoLZ7jqEwCT63W2ZJAotSDtB/2rvE0686f0Mo2cimyT2 FQpncJvZCuVg98fQu0GEdGUcm3HD/BjI0lVFwDhFwo2ctJZD8kdGLqPpliqwTGlvEbwWTC xYY1RAd6EHnukuvJrU52Nz3xHgDtIv7q0XsEolNvfhsoyO6HsH2YP7k1LhELu3eJ8ipg0q LtWE6w8G65EH/xHLIb+g2t5k3of+aGTufpSFtXXPvU/kTgwqjA+fHS2pQJSzFUXDsIuMcO mjmaFewEaHobJM5wT+YhWTC0rQyw3giSpEWUD4mS32kS+oOjGWgb1A/JsengBg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1758111534; 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=3cF6ymYqE9a1Xsg1HE66tI6gN45wwh9XoqQ4Xz3XJTc=; b=uXQAqGI7GlAy2XfT28Xixm1Cm51nDmrJ75Cj7DeBPkGSmgUehZlIusytV3v0Qcl+4MpEsS kB7AVBpjBxXGFyLpq0B3GjWsQgjcbUfiSjzjygya0aLJ4ap21ccNyreQqNdv8Ix54jJH78 wcjVrIFDF03wAu5ONkd9k/9ie/5JtYSuSCqI4Ezd3cAIvJBsocV1jAtnQ64AypjBgOCTU/ 3Sgh6YpIQTlMRZMXDBTuNxmKrH82Q5AfFBVXd2KeBUIJTVtlUKoJmqf2SbB1E6zXDwkDhv 3lqFvQk6m4mCWaBF+sCrwVYKYAsicDMipCN4FqRfywptBFWisksEVFhSebdDkw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1758111534; a=rsa-sha256; cv=none; b=chb3l8pZgLi8FPUX1PXGji/XEo1dMeqNwMi5IcE5VOKVRlRzNrAi7SuMv0EPwwmycmISbo gpX/In0XilQXaC0/IDEHxRvpzkoofzA6TSFtFLTUQCoWKxldXMkxZg/6jf3kBR30vfsPuD CZJvTq4HssxjhBy68g+w+E+lBcSG8S7fQeagsWblraW6bZtwqeOJBAvucJfmNInnWGZQqf yAGfdpVoySdXDxj/6YVegSZH22NZtNHrUuf1u9rfo5m/DqnPAMTXSJ/po8bZ4prpyQ4f7u B4PwzqAyTJYzP02R0754qLsFny0kdr7FtHDZ6ADf45kC16JWeML3CR8/H61ysQ== 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 4cRd9B4vSMz8wQ; Wed, 17 Sep 2025 12:18:54 +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 58HCIsUX085416; Wed, 17 Sep 2025 12:18:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 58HCIs8O085413; Wed, 17 Sep 2025 12:18:54 GMT (envelope-from git) Date: Wed, 17 Sep 2025 12:18:54 GMT Message-Id: <202509171218.58HCIs8O085413@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: c5e920e49c0c - main - unix: SCM_CREDS: Restore passing the effective GID 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/main X-Git-Reftype: branch X-Git-Commit: c5e920e49c0cf068da3962688cc60ab514ea1252 Auto-Submitted: auto-generated The branch main has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=c5e920e49c0cf068da3962688cc60ab514ea1252 commit c5e920e49c0cf068da3962688cc60ab514ea1252 Author: Olivier Certner AuthorDate: 2025-08-26 17:01:03 +0000 Commit: Olivier Certner CommitDate: 2025-09-17 12:16:00 +0000 unix: SCM_CREDS: Restore passing the effective GID cmcred_groups[0] in 'struct cmsgcred' must be the effective GID. Note that the code in unp_addsockcred() filling up 'struct sockcred'/'struct sockcred2' (LOCAL_CREDS/LOCAL_CREDS_PERSISTENT options) was in fact "wrong" before 'cr_gid' was moved out of cr_groups[], in the sense that it would transmit the effective GID twice, both separately as 'sc_egid' and as the first element of 'sc_groups'. It is now exact, so is left unchanged, which causes a difference in output (the effective GID is no more in 'sc_groups', unless it is also a supplementary group) that is unlikely to affect applications in practice. Reviewed by: glebius 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/D52262 --- sys/kern/uipc_usrreq.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/sys/kern/uipc_usrreq.c b/sys/kern/uipc_usrreq.c index 6138e543fae7..340d84666459 100644 --- a/sys/kern/uipc_usrreq.c +++ b/sys/kern/uipc_usrreq.c @@ -3667,11 +3667,14 @@ unp_internalize(struct mbuf *control, struct mchain *mc, struct thread *td) cmcred->cmcred_uid = td->td_ucred->cr_ruid; cmcred->cmcred_gid = td->td_ucred->cr_rgid; cmcred->cmcred_euid = td->td_ucred->cr_uid; - cmcred->cmcred_ngroups = MIN(td->td_ucred->cr_ngroups, + _Static_assert(CMGROUP_MAX >= 1, + "Room needed for the effective GID."); + cmcred->cmcred_ngroups = MIN(td->td_ucred->cr_ngroups + 1, CMGROUP_MAX); - for (i = 0; i < cmcred->cmcred_ngroups; i++) + cmcred->cmcred_groups[0] = td->td_ucred->cr_gid; + for (i = 1; i < cmcred->cmcred_ngroups; i++) cmcred->cmcred_groups[i] = - td->td_ucred->cr_groups[i]; + td->td_ucred->cr_groups[i - 1]; break; case SCM_RIGHTS: