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
On poniedziałek 01 listopad 2004 09:17, Jakub Jelinek wrote:
> > 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) {
Yes, it should work. Unfortunately it doesn't. And I don't think I'm willing
to look for the bug, since it's obviously non obvious :)
> 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...
If that is what gcc's supposed to do, it doesn't do it. Unsigned ints are
casted to long in a way my logic tells me they should - by doing nothing
(just copying those four bytes to a fully zeroed long).
--
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