This is the mail archive of the
glibc-bugs@sources.redhat.com
mailing list for the glibc project.
[Bug libc/492] New: New setre*id functions broken on alpha
- From: "mmazur at kernel dot pl" <sourceware-bugzilla at sources dot redhat dot com>
- To: glibc-bugs at sources dot redhat dot com
- Date: 30 Oct 2004 22:05:27 -0000
- Subject: [Bug libc/492] New: New setre*id functions broken on alpha
- Reply-to: sourceware-bugzilla at sources dot redhat dot com
Up to 2004-09-19 setreuid, setresuid, setregid and setresgid functions (and
lots of others) on alpha where generated from a couple of macros, that due to
the way function arguments are passed on alpha, generated stub functions
(literally a couple of lines of asm code) that just issued a syscall without
even touching the passed arguments. That worked fine.
But on that day fulltime C functions where added (ci log: "Call callback to
set IDs in all other threads as well.") which broke above functions on alpha.
Stub functions aren't used any more, now C compiler has controll of the what's
going on. Those functions take gid_t or uid_t as arguments and those types
are defines as unsigned int (32 bit). Later they are casted to type long to
put them into appropriate registers before making a syscall. The problem is
that although those are unsigned ints we're using, the kernel expects to get
a '-1' value in some cases (ask the designers what where they thinking). Now
according to "Calling Standard for Alpha Systems"* when passing a 32bit
signed to a function (that is putting it into a 64bit register) the signed
stuff should get expanded to full 64bits (0xffffffff should become
0xffffffffffffffff). But that doesn't happen, since those are unsigned ints
the compiler is handling, so it doesn't expand the signed stuff, but just
zeroes the first four bytes. So we're doing setreuid(-1, -1), but the kernel
gets setreuid(4294967295, 4294967295) and doesn't treat that as -1. Casting
that value to signed int before casting it to long fixes the problem. I'm attaching a
patch.
*
http://www.cs.arizona.edu/computer.help/policy/DIGITAL_unix/AA-PY8AC-TET1_html/callCH4.html#BLOCK52
--
Summary: New setre*id functions broken on alpha
Product: glibc
Version: unspecified
Status: NEW
Severity: normal
Priority: P2
Component: libc
AssignedTo: gotom at debian dot or dot jp
ReportedBy: mmazur at kernel dot pl
CC: glibc-bugs at sources dot redhat dot com
http://sources.redhat.com/bugzilla/show_bug.cgi?id=492
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.