This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
Re: New setre*id functions broken on alpha
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Mariusz Mazur <mmazur at kernel dot pl>
- Cc: libc-alpha at sources dot redhat dot com, qboosh at pld-linux dot org
- Date: Mon, 1 Nov 2004 09:17:13 +0100
- Subject: Re: New setre*id functions broken on alpha
- References: <200410310002.03356.mmazur@kernel.pl> <20041101070239.GP30497@sunsite.ms.mff.cuni.cz>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Mon, Nov 01, 2004 at 08:02:39AM +0100, Jakub Jelinek wrote:
> On Sun, Oct 31, 2004 at 12:02:03AM +0200, Mariusz Mazur wrote:
> > 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
>
> But uid_t is unsigned int on Alpha:
>
> asm-alpha/posix_types.h:typedef unsigned int __kernel_uid_t;
> asm-alpha/posix_types.h:typedef __kernel_uid_t __kernel_uid32_t;
> linux/types.h:typedef __kernel_uid32_t uid_t;
>
> asmlinkage long sys_setreuid(uid_t ruid, uid_t euid)
> ...
> if (ruid != (uid_t) -1) {
> ...
> if (euid != (uid_t) -1) {
But even unsigned int is sign-extended on Alpha:
For Alpha, we always store objects in a full register. 32-bit integers
are always sign-extended, but smaller objects retain their signedness.
#define PROMOTE_MODE(MODE,UNSIGNEDP,TYPE) \
if (GET_MODE_CLASS (MODE) == MODE_INT \
&& (TYPE == NULL || TREE_CODE (TYPE) != VECTOR_TYPE) \
&& GET_MODE_SIZE (MODE) < UNITS_PER_WORD) \
{ \
if ((MODE) == SImode) \
(UNSIGNEDP) = 0; \
(MODE) = DImode; \
}
In that case I think more INLINE_SYSCALL/INTERNAL_SYSCALL invocations
need to be audited...
Jakub