Re: [patch] x86: fix taking DNA during 64bit sigreturn

Andi Kleen
2007-11-12T21:17:15Z

>
> The *real* fix for this is almost certainly to just get rid of the 64-bit
> code entirely, and use the 32-bit code as the base for one single unified
> setup.

That would likely break the ABI. x86-64 ABI is completely different here --
no ibcs, just pure x86 ISA.

I always thought direct FXSAVE from/to user space to be a cute trick, but yes
the exception Suresh noticed makes it lose some of its beauty.

> The 32-bit code should be largely a superset of the 64-bit code
> anyway, since it has to handle more cases, and does it more cleanly.

If you consider compat code 64bit handles as many cases as 32bit.

> which isn't exactly pretty, but the memory address generation works fine
> in 32-bit code too, and the rex override is easily done with
>
> #ifdef CONFIG_X86_64
> #define REX64 "rex64/"
> #else
> #define REX64 ""
> #endif
>
> and then you just use
>
> REX64 "fxsave"

That didn't work on older assemblers.

> But maybe I'm missing some reason why it doesn't matter. The 32-bit code
> was fixed back in 2003 (commit 5bff44fc272b948a85e893a007d01b9dfb3ad04f

64bit FPU semantics are somewhat different. I don't remember if this
particular issue was addressed or not, but I fixed a few shared
bugs in a quite different way on 64bit vs 32bit. If anybody wants
to change something here don't assume they are the same.

>From a cursory look it's probably broken though.

-Andi