This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
New setre*id functions broken on alpha
- From: Mariusz Mazur <mmazur at kernel dot pl>
- To: libc-alpha at sources dot redhat dot com
- Cc: qboosh at pld-linux dot org
- Date: Sun, 31 Oct 2004 00:02:03 +0200
- Subject: New setre*id functions broken on alpha
Note: this bug together with bugs #467 and #461 render glibc
unbuildable/broken on sparc, ia64 and alpha.
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. Here's
my patch:
http://cvs.pld-linux.org/cgi-bin/cvsweb/SOURCES/glibc-alpha_giduidfix.patch?rev=1.1
*
http://www.cs.arizona.edu/computer.help/policy/DIGITAL_unix/AA-PY8AC-TET1_html/callCH4.html#BLOCK52
--
In the year eighty five ten
God is gonna shake his mighty head
He'll either say,
"I'm pleased where man has been"
Or tear it down, and start again