[Bug 220779] getgroups result is affected by setegid

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Wed Oct 4 20:33:17 UTC 2017


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=220779

paulm <paulm at tetrardus.net> changed:

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

--- Comment #5 from paulm <paulm at 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) overwrites
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.)      

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

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


More information about the freebsd-standards mailing list