Re: [PATCH] Add FUTEX_CMP_REQUEUE futex op

From: Andrew Morton
Date: Fri May 21 2004 - 21:25:02 EST


Ulrich Drepper <drepper@xxxxxxxxxx> wrote:
>
> Andrew Morton wrote:
>
> > Is it safe to go adding a new argument to an existing syscall in this manner?
>
> Yes. This is a multiplexed syscall and the opcode decides which syscall
> parameter is used.
>

Of course.

> > It'll work OK on x86 because of the stack layout but is the same true of
> > all other supported architectures?
>
> We add parameters at the end. This does not influence how previous
> values are passed. And especially for syscalls it makes no difference.
>

what we're effectively doing is:

void foo(int a, int b, int c)
{
}

and from another compilation unit:

foo(a, b);

and we're expecting the a's and b's to line up across all architectures and
compiler options. I thought that on some architectures that only works out
if the function has a vararg declaration.

Does it do the right thing on stack-grows-up machines?

If the compiler passes the first few args via registers and the rest on the
stack, are we sure that it won't at some level of complexity decide to pass
_all_ the args on the stack? It's free to do so, I think.

I have a vague memory of getting bitten by this trick once...
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/