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

On Sat, 29 May 2004 12:23:19 -0700 "David S. Miller" <> 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: <>
Subject: Re: [PATCH] Consolidate sys32_utime
From: "David S. Miller" <>

From: Andi Kleen <>
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?
Stephen Rothwell
[unhandled content-type:application/pgp-signature]
 \ /
  Last update: 2005-03-22 14:03    [W:0.061 / U:0.580 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site