From nobody Tue Sep 23 12:03:26 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 4cWJXb13mVz68Y40; Tue, 23 Sep 2025 12:03:27 +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 4cWJXZ4kG4z3DBF; Tue, 23 Sep 2025 12:03:26 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1758629006; 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=HtXp5C0vOAJt1yCbyDDzm4yOClsO7kpMekRkogbzto4=; b=sF8nWO5DsfcPN1xw8qN18wikWe8ZDi4uZ/FAOuKrz08GsNOQ4cBtc4lH4rjrSCVsMDHk2l dZ4AhzhLYWepOI14KMAfVf/seeBqxj28/eVGR9rx766wwsfmRJj76uRRrTMFd5Mq2gVVgb Vnym3pkOQgeyHmSgPEfnxYH4qoYuLYSjzQCTKyhgx8r9o9vDOwVWREMEZklb01tq0MQvL/ 2zWFLuv+CBWmgnEfrrZOnwUxWx+WIIfmDo2aAtE0KQGT/lnPm4Wcr8d3my2oR97uXSg8L2 AN7THDOwasWONdsl9QFVKALyIsn3H5YBDkSkvSUc1J8I2IZ57b2s7Ex3gm6JIg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1758629006; 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=HtXp5C0vOAJt1yCbyDDzm4yOClsO7kpMekRkogbzto4=; b=VXhlumbKqruEren9PLjSLd3/w3/dqEcPSX8W4F1vPYqPSx+IGg7xdXm2ZFMuPt4FR3wncH 0TOAvkIx+8dkQqHNEEHtfpWpFf5UkfzwlVauxRSq966vrK+RFYre1F4R+lDBGtt8skTrOE PXiK6VKfBTsVzf9k13YW+VeFbfQgZcReuk/6emayEGChkoW7nzyqO2sdzw2C+Us9xCJJ7B 10G0RB1slyNd0IoF+y0m555xLScXPxYrhuFlt7KpN16Ud4lK6tECdarbqzI23qgTDuuRJk 2SbPDLUf1+omHBQsuGoODm/uBS4nTTvTh4CSO1EBrvH6eyqSmxJ0neysk0EczQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1758629006; a=rsa-sha256; cv=none; b=OptGIubvr3FuMf5aOuXRvYD1NWfFPdQXPhBzSjiJr9rj3++pihtvQ0wTy3gg68bCZ1vjsj lPDYCiCc4aiYzBGf5geRSE/VWcGVynUFV/ch62vfccMJVeHnPJ1Ms4lJVDQzyfwcVEESdD 0GMPOxc+6ORK+g60pjsSLNzQp1wLFUP18qiAgLf0vdatKznABodgm9A28/cGfiyybgtAYk lIiDtoB1odFmLEDvhhi9fLMW7yMIp4uTDi9NqrMDI+E+dM2iu5CTTCSAevWgKWIxXVxM0a LxHzUfuJZrvH59de7Bb6h5Ua+MrgzCjRoJ0Bii6q6jskIkht9PJAxnbG5XXADw== 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 4cWJXZ3lJdzlqc; Tue, 23 Sep 2025 12:03:26 +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 58NC3Q8p008227; Tue, 23 Sep 2025 12:03:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 58NC3QRE008224; Tue, 23 Sep 2025 12:03:26 GMT (envelope-from git) Date: Tue, 23 Sep 2025 12:03:26 GMT Message-Id: <202509231203.58NC3QRE008224@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: 052d8f6acf46 - stable/15 - 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/stable/15 X-Git-Reftype: branch X-Git-Commit: 052d8f6acf46843bd672f44ff2a09497408eed57 Auto-Submitted: auto-generated The branch stable/15 has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=052d8f6acf46843bd672f44ff2a09497408eed57 commit 052d8f6acf46843bd672f44ff2a09497408eed57 Author: Olivier Certner AuthorDate: 2025-08-26 17:01:03 +0000 Commit: Olivier Certner CommitDate: 2025-09-23 12:02:40 +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 (cherry picked from commit c5e920e49c0cf068da3962688cc60ab514ea1252) --- 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: