Bug: on recent 32-bit-kernels uid_t is 16 Bit instead of 32 Bit
Frank Bergmann <[email protected]>
| Newsgroups | gmane.linux.lib.dietlibc |
|---|---|
| Message-ID | <[email protected]> |
Hi,
this was detected when a username wasn't properly mapped from name to uid
with getpwname_r.
The uid was something about 150000, but uid_t did hold only 16 bits. It
did luckily fail because the remainder 16 bit uid was not valid. :-)
At no point in header hierarchy I found a matching include of a
appropriate kernel header file.
The static defines of i386 => uid16_t and x86_64 => uint32_t in
dietlibc's header file doesn't respect linux 2.6 32 bit.
Test:
root@mon:~ > cat test_uid_t.c
#include <pwd.h>
#include <stdio.h>
main() {
printf("sizeof(uid_t) %d\n",sizeof(uid_t));
}
root@mon:~ > gcc -o test_uid_t_glibc test_uid_t.c
root@mon:~ > diet gcc -o test_uid_t_diet test_uid_t.c
root@mon:~ > ./test_uid_t_glibc
sizeof(uid_t) 4
root@mon:~ > ./test_uid_t_diet
sizeof(uid_t) 2
root@mon:~ > uname -a
Linux mon 2.6.23.12 #2 SMP Tue Jan 8 14:02:49 CET 2008 i686 GNU/Linux
best regards,
Frank
EDV Frank Bergmann Tel. 05221-9249753
LPIC-2 Linux Professional Fax 05221-9249754
Elverdisser Str. 25 email [email protected]
32052 Herford USt-IdNr DE237314606
--
Sending unsolicited commercial email to this address may be a violation
of the Washington State Consumer Protection Act, chapter 19.86 RCW.
Das Verschicken unverlangter kommerzieller email an diese Adresse ist
verboten (LG Traunstein, 2 HK O 3755/97 vom 14.10.1997, CR 1998, 171f).