git: b0395b44974b - stable/15 - tools/regression/priv: Don't call setgroups() with the effective GID
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 23 Sep 2025 12:03:55 UTC
The branch stable/15 has been updated by olce: URL: https://cgit.FreeBSD.org/src/commit/?id=b0395b44974b9b7b7d3c1ef4aea0394478bec1f9 commit b0395b44974b9b7b7d3c1ef4aea0394478bec1f9 Author: Olivier Certner <olce@FreeBSD.org> AuthorDate: 2025-08-29 17:00:07 +0000 Commit: Olivier Certner <olce@FreeBSD.org> CommitDate: 2025-09-23 12:02:49 +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); }