Bug 9213 - setgroups call does not work under glibc 2.0
setgroups call does not work under glibc 2.0
Status: CLOSED NOTABUG
Product: Red Hat Linux
Classification: Retired
Component: strace (Show other bugs)
5.2
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Cristian Gafton
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2000-02-08 05:35 EST by Henning P. Schmiedehausen
Modified: 2008-05-01 11:37 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2000-02-08 08:29:44 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Henning P. Schmiedehausen 2000-02-08 05:35:58 EST
There seems to be a disagreement in the size of the gid_t component between
the shipped 2.0.3x kernel and the glibc. Consider the following test
program:

--- cut ---
#include <sys/types.h>
#include <grp.h>

main()
{
  gid_t test[2];


  test[0] = 100;
  test[1] = 200;

  setgroups(2, test);
}
--- cut ---

This results in the following trace:

% strace ./testprog
execve("./testprog", ["./testprog"], [/* 49 vars */]) = 0
brk(0)                                  = 0x80495ac
open("/etc/ld.so.preload", O_RDONLY)    = -1 ENOENT (No such file or
directory)
open("/usr/local/lib/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or
directory)
open("/etc/ld.so.cache", O_RDONLY)      = 3
fstat(3, {st_mode=0, st_size=0, ...})   = 0
mmap(0, 11626, PROT_READ, MAP_PRIVATE, 3, 0) = 0x4000b000
close(3)                                = 0
open("/lib/libc.so.6", O_RDONLY)        = 3
mmap(0, 4096, PROT_READ, MAP_PRIVATE, 3, 0) = 0x4000e000
munmap(0x4000e000, 4096)                = 0
mmap(0, 672712, PROT_READ|PROT_EXEC, MAP_PRIVATE, 3, 0) = 0x4000e000
mprotect(0x4009f000, 78792, PROT_NONE)  = 0
mmap(0x4009f000, 32768, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 3,
0x90000) = 0x4009f000
mmap(0x400a7000, 46024, PROT_READ|PROT_WRITE,
MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x400a7000
close(3)                                = 0
munmap(0x4000b000, 11626)               = 0
personality(PER_LINUX)                  = 0
getpid()                                = 15176
setgroups(2, [13107300, 1073783752])    = 0
_exit(0)                                = ?

As you can see, there is a setgroups(2, [13107300, 1073783752]);

The same code works fine under Solaris 2.x:

(truss -v setgroups ./testprog)
[...]
setgroups(2, 0xEFFFF978)                        = 0
           100   200
[...]
personality(PER_LINUX)                  = 0
geteuid()                               = 0
getuid()                                = 0
getgid()                                = 0
getegid()                               = 0
setgroups(2, [100, 200])                = 0
_exit(0)                                = ?


So this is definitely a bug in the glibc setgroups() call or the parameter
passing to setgroups().

	Regards
		Henning

and under libc5:

[...]
Comment 1 Henning P. Schmiedehausen 2000-02-08 08:29:59 EST
Sorry, false alarm. It is not a glibc bug, in fact we were able to verify
the function to be correct, but a strace bug. It seems that it displays the
parameters incorrect. Apologies.

Note You need to log in before you can comment on or make changes to this bug.