lkml.org 
[lkml]   [2004]   [Jun]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: compat syscall args
Hi Dave,

On Sat, 29 May 2004 12:23:19 -0700 "David S. Miller" <davem@redhat.com> wrote:
>
>
> Arnd asked:
>
> > If sparc64 has this problem only for the fifth syscall argument,
> > does that mean that e.g. compat_sys_futex and
> > compat_sys_mq_timed{send,receive} have the same bug? If this is
> > a more general, i.e. not limited to the last argument, there is a
> > potential problem in lots of syscalls.
>
> Here is the issue. In the sparc64 C calling conventions, it is
> assumed that 32-bit signed values are sign extended by the
> caller.
>
> This means that, at syscall invocation time, we have to choose
> between either:
>
> 1) sign extending all syscall args for the C code, then explicitly
> zero-extending all non-signed syscall args. This would require
> the most amount of compat layer code help.
>
> 2) zero extending all syscall args for the C code, then expliticly
> sign-extending all signed syscall args.
>
> 3) some mixture of 1 and 2
>
> #3 is what sparc64 does, it hits the highest number of system
> call arguments correctly. Specifically we:
>
> arg0: zero-extend
> arg1: zero-extend
> arg2: zero-extend
> arg3: zero-extend
> arg4: leave as-is
> arg5: leave as-is
>
> 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:

--------------------
Date: Thu, 13 Jun 2002 22:56:52 -0700 (PDT)
Message-Id: <20020613.225652.109741623.davem@redhat.com>
To: ak@suse.de
Cc: sfr@canb.auug.org.au, ralf@gnu.org, engebret@us.ibm.com,
schwidefsky@de.ibm.com, linux390@de.ibm.com, anton@samba.org
Subject: Re: [PATCH] Consolidate sys32_utime
From: "David S. Miller" <davem@redhat.com>
From: Andi Kleen <ak@suse.de>
Date: Fri, 14 Jun 2002 07:53:10 +0200

On Thu, Jun 13, 2002 at 10:37:23PM -0700, David S. Miller wrote:
> We could easily change that to "all args zero-extended" if that makes
> everything easier. It probably does.
I've had good experiences with zero extension at least so far.
Would be probably good just for consistency.

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?
--
Cheers,
Stephen Rothwell sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/
[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2005-03-22 14:03    [from the cache]
©2003-2011 Jasper Spaans