Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 04 Oct 2017 20:33:16 +0000
From:      bugzilla-noreply@freebsd.org
To:        freebsd-standards@FreeBSD.org
Subject:   [Bug 220779] getgroups result is affected by setegid
Message-ID:  <bug-220779-15-CQnO4Q4MLF@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-220779-15@https.bugs.freebsd.org/bugzilla/>
References:  <bug-220779-15@https.bugs.freebsd.org/bugzilla/>

next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D220779

paulm <paulm@tetrardus.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |paulm@tetrardus.net

--- Comment #5 from paulm <paulm@tetrardus.net> ---
The effective GID is stored in cr_groups[0] in the ucred struct.

kern_setgroups() writes to cr_groups[0] in the ucred struct.

Therefore, the syscall setgroups(int ngroups, const gid_t *gidset) overwrit=
es
the effective GID at cr_groups[0] with the first GID in *gidset.

(Because setgroups() writes to cr_groups[0], a subsequent call to setegid()
will overwrite the supplementary GID at that location.  I think this is the
symptom Michael Zuo is calling attention to.)=20=20=20=20=20=20

Unless I'm confused about something, the implementation of setgroups() shou=
ld
write the supplementary group list starting at an offset of +1 in the cr_gr=
oups
array in struct ucred in order to preserve the effective GID at cr_groups[0=
].

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-220779-15-CQnO4Q4MLF>