Re: compat syscall args

From: Arnd Bergmann
Date: Tue Jun 01 2004 - 04:09:22 EST


On Tuesday 01 June 2004 07:06, Stephen Rothwell wrote:
> On Sat, 29 May 2004 12:23:19 -0700 "David S. Miller" <davem@xxxxxxxxxx> wrote:
> > I remember discussing this with Andi Kleen before.
>
> Yeah, you and Andi and I (and others, I think) had this discussion, but it ended like this:
>
> > Subject: Re: [PATCH] Consolidate sys32_utime
> > From: "David S. Miller" <davem@xxxxxxxxxx>
> >
> > So be it, the convention is that all arguments are zero extended from
> > 32-bits to 64-bits when the syscall is invoked.
>
> Did something change along the way?

I wasn't aware of the convention but it absolutely makes sense. If I find
the time, I'll go through the existing compat_sys_* handlers to see if they
all do sign-extension correctly. Note that on s390, we also need 31-bit
zero-extension for pointers, which is done in architecture-specific code.
Otherwise every compat_* syscall would need to use compat_uptr_t arguments
which appears unnecessarily ugly to me.

Also, what should be the conversion for positive signed arguments like the
futex 'op' value? Sign-extension would be the formally correct solution,
but simply using the zero-extended value (like we do in most places) works
just as well.

Arnd <><

Attachment: pgp00000.pgp
Description: signature