Subject: Re: Issues with "x86, um: switch to generic fork/vfork/clone" commit

From: Al Viro <[email-masked]>
Date: Sat, 10 Nov 2012 18:59:03 +0000

On Sat, Nov 10, 2012 at 07:33:39AM +0000, Al Viro wrote:
> I think I see what's going on there.  It's PTREGSCALL blindly used for
> clone wrapper in ia32entry.S.  FWIW, it's wrong for all of those
> suckers, anyway:
> 	* fork/clone/vfork need to save extra registers, but don't need
> to restore them; after unification we don't need pt_regs argument for any
> of those - for fork/vfork it's useless, for clone it breaks things.
> 	* execve doesn't need pt_regs argument; harmless, but useless.
> 	* for sigaltstack() we simply need to get rid of stupid pt_regs
> argument, along with the wrapper; current_pt_regs()->sp is all it needs.
> 	* for sigreturn/rt_sigreturn we need to restore extra registers,
> but we do *not* need to save them; just leave the space on stack.  And
> no need to pass pt_regs either - it'll be current_pt_regs() anyway.
> 	* iopl() doesn't need to save/restore extras and it doesn't need
> pt_regs argument - it's going to be current_pt_regs().

Alas, sigaltack() and iopl() do need a bit of a wrapper; they don't care
about extras, but they wants ->sp and ->flags resp., which means needing
to go through FIXUP_TOP_OF_STACK on amd64 ;-/

> On top of all that, there's an extra piece of crap - different order of
> arguments for native and compat clone.

... and the same commit slightly buggers clone(2) on amd64 as well.  Grr...
Anyway, fixed and pushed; please, test for-next when it propagates, head
should be at fae45353de587ae6a949dbf21ee06d5dd652248c