Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 23 Sep 2025 12:03:41 GMT
From:      Olivier Certner <olce@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: fa96d3e64efc - stable/15 - linux: setgroups(): Avoid allocation under the process lock
Message-ID:  <202509231203.58NC3fqC008684@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/15 has been updated by olce:

URL: https://cgit.FreeBSD.org/src/commit/?id=fa96d3e64efc8f789524f3871bc4e68f61d3d213

commit fa96d3e64efc8f789524f3871bc4e68f61d3d213
Author:     Olivier Certner <olce@FreeBSD.org>
AuthorDate: 2025-08-28 15:47:38 +0000
Commit:     Olivier Certner <olce@FreeBSD.org>
CommitDate: 2025-09-23 12:02:44 +0000

    linux: setgroups(): Avoid allocation under the process lock
    
    This was missed in commit 838d9858251e ("Rework the credential code to
    support larger values of NGROUPS (...)").
    
    No functional change (intended).
    
    MFC after:      5 days
    Sponsored by:   The FreeBSD Foundation
    Differential Revision:  https://reviews.freebsd.org/D52278
    
    (cherry picked from commit b7a87d7c0dd19016e82f5d33f2c5ec90479c31fe)
---
 sys/compat/linux/linux_misc.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/sys/compat/linux/linux_misc.c b/sys/compat/linux/linux_misc.c
index fb86de6e7302..0925ffb64480 100644
--- a/sys/compat/linux/linux_misc.c
+++ b/sys/compat/linux/linux_misc.c
@@ -1045,8 +1045,7 @@ linux_setgroups(struct thread *td, struct linux_setgroups_args *args)
 	crextend(newcred, ngrp);
 	p = td->td_proc;
 	PROC_LOCK(p);
-	oldcred = p->p_ucred;
-	crcopy(newcred, oldcred);
+	oldcred = crcopysafe(p, newcred);
 
 	if ((error = priv_check_cred(oldcred, PRIV_CRED_SETGROUPS)) != 0) {
 		PROC_UNLOCK(p);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202509231203.58NC3fqC008684>