git: 3638aba1ceb9 - stable/14 - tools/regression/priv: Don't call setgroups() with the effective GID
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 10 Oct 2025 17:16:29 UTC
The branch stable/14 has been updated by olce:
URL: https://cgit.FreeBSD.org/src/commit/?id=3638aba1ceb99b8d687834af349fb73e33b1b0b3
commit 3638aba1ceb99b8d687834af349fb73e33b1b0b3
Author: Olivier Certner <olce@FreeBSD.org>
AuthorDate: 2025-08-29 17:00:07 +0000
Commit: Olivier Certner <olce@FreeBSD.org>
CommitDate: 2025-10-10 17:15:59 +0000
tools/regression/priv: Don't call setgroups() with the effective GID
The 'setgroups(0, NULL);' stance works the same on all versions of
FreeBSD, getting rid of all supplementary groups. The replaced code
would force the effective GID to also be a supplementary group.
Fixes: 9da2fe96ff2e ("kern: fix setgroups(2) and getgroups(2) to match other platforms")
MFC after: 5 days
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D52289
(cherry picked from commit ff7252cdafbd9dab104a5e7b33b8bb84117a8789)
---
tools/regression/priv/main.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/tools/regression/priv/main.c b/tools/regression/priv/main.c
index dbcb5759f6b9..979e6ed65284 100644
--- a/tools/regression/priv/main.c
+++ b/tools/regression/priv/main.c
@@ -423,12 +423,10 @@ setup_file(const char *test, char *fpathp, uid_t uid, gid_t gid, mode_t mode)
static void
set_creds(const char *test, uid_t uid, gid_t gid)
{
- gid_t gids[1] = { gid };
-
if (setgid(gid) < 0)
err(-1, "test %s: setegid(%d)", test, gid);
- if (setgroups(sizeof(gids)/sizeof(gid_t), gids) < 0)
- err(-1, "test %s: setgroups(%d)", test, gid);
+ if (setgroups(0, NULL) < 0)
+ err(-1, "test %s: setgroups(NULL)", test);
if (setuid(uid) < 0)
err(-1, "test %s: seteuid(%d)", test, uid);
}