[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Bug#698102: eglibc: initgroups changes egid on kfreebsd

Unfortuantely, POSIX declined to specify setgroups() and initgroups() is
not in any standard, so it's hard to say which behavior is right and
which is wrong.  It seems possible to argue any of the following:

1. The bug is in kFreeBSD's implementation of setgroups(), which must
   be fixed so that eglibc's initgroups() implementation works as

2. The bug is in eglibc's implementation of initgroups(), which must be
   fixed so that it works properly with kFreeBSD's setgroups().

3. Since both behaviors of setgroups() and initgroups() are seen "in
   the wild", programs that depend on the linux kernel behavior are
   broken and should be fixed as they become known.

Personally I'm leaning towards 3 here, since these are buggy not only on
debian/kFreeBSD but on real FreeBSD as well.

Even POSIX point out that egid might be somewhere in supplementary groups

  The getgroups() function shall fill in the array grouplist with the
  current supplementary group IDs of the calling process. It is
  implementation-defined whether getgroups() also returns the effective
  group ID in the grouplist array.

Under FreeBSD kernel, the "egid" is groups[0], see

IMO, there is no bug, the behaviour is implementation-defined.


Reply to: