Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 17 Sep 2025 12:19:08 GMT
From:      Olivier Certner <olce@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: bbdea7c9f4ae - main - linux: setgroups(): Fix the group number's upper limit
Message-ID:  <202509171219.58HCJ8Ow085850@gitrepo.freebsd.org>

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

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

commit bbdea7c9f4aeae26b35f842382df0203fcda24a5
Author:     Olivier Certner <olce@FreeBSD.org>
AuthorDate: 2025-08-28 16:58:53 +0000
Commit:     Olivier Certner <olce@FreeBSD.org>
CommitDate: 2025-09-17 12:16:04 +0000

    linux: setgroups(): Fix the group number's upper limit
    
    'ngroups_max' is the maximum number of supplementary groups the system
    will accept, and this has not changed.
    
    Fixes:          9da2fe96ff2e ("kern: fix setgroups(2) and getgroups(2) to match other platforms")
    MFC after:      5 days
    MFC to:         stable/15
    Sponsored by:   The FreeBSD Foundation
    Differential Revision:  https://reviews.freebsd.org/D52277
---
 sys/compat/linux/linux_misc.c  | 2 +-
 sys/compat/linux/linux_uid16.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys/compat/linux/linux_misc.c b/sys/compat/linux/linux_misc.c
index 755eae057406..fb86de6e7302 100644
--- a/sys/compat/linux/linux_misc.c
+++ b/sys/compat/linux/linux_misc.c
@@ -1034,7 +1034,7 @@ linux_setgroups(struct thread *td, struct linux_setgroups_args *args)
 	int error;
 	struct proc *p;
 
-	if (ngrp < 0 || ngrp >= ngroups_max)
+	if (ngrp < 0 || ngrp > ngroups_max)
 		return (EINVAL);
 	linux_gidset = malloc(ngrp * sizeof(*linux_gidset), M_LINUX, M_WAITOK);
 	error = copyin(args->grouplist, linux_gidset, ngrp * sizeof(l_gid_t));
diff --git a/sys/compat/linux/linux_uid16.c b/sys/compat/linux/linux_uid16.c
index 07430f5b399b..dd681f971746 100644
--- a/sys/compat/linux/linux_uid16.c
+++ b/sys/compat/linux/linux_uid16.c
@@ -91,7 +91,7 @@ linux_setgroups16(struct thread *td, struct linux_setgroups16_args *args)
 	int error;
 	struct proc *p;
 
-	if (ngrp < 0 || ngrp >= ngroups_max)
+	if (ngrp < 0 || ngrp > ngroups_max)
 		return (EINVAL);
 	linux_gidset = malloc(ngrp * sizeof(*linux_gidset), M_LINUX, M_WAITOK);
 	error = copyin(args->gidset, linux_gidset, ngrp * sizeof(l_gid16_t));



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