Re: [patch 1/1] x86-64: forgot asmlinkage on sys_mmap

From: Andi Kleen
Date: Wed Mar 09 2005 - 14:41:11 EST


On Wed, Mar 09, 2005 at 07:24:00PM +0100, Blaisorblade wrote:
> On Wednesday 09 March 2005 18:24, Andi Kleen wrote:
> > blaisorblade@xxxxxxxx writes:
> > > CC: Andi Kleen <ak@xxxxxxx>
> > >
> > > I think it should be there, please check better.
> >
> > It doesn't matter. asmlinkage is a nop on x86-64.
>
> Yes, otherwise nothing would work on x86-64 with mmap broken, but for
> cleanness and for the case this change it should be there (otherwise why
> asmlinkage is used in the rest of the file).

Only because it was cut'n'pasted from i386 originally.

>
> And for i386 asmlinkage acquired significance only recently.

Actually it doesn't neither on i386. That's because entry.S happens to put the
arguments both into registers and the stack in the right order, so both
register and stack argument calling conventions work.

But it is slightly safer to have it. When you use the stack arguments
the C code is allowed to modify it, and when the system call is restarted
later you could see garbage. In practice that's not a big issue because
only very few system calls are restartable.

ptrace also could see corrupted state, but that's in general a non issue.

-Andi

-
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/