powerpc: Don't corrupt user registers on 32-bit
authorPaul Mackerras <paulus@samba.org>
Wed, 23 Oct 2013 08:40:02 +0000 (09:40 +0100)
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>
Wed, 23 Oct 2013 11:34:19 +0000 (22:34 +1100)
commit955c1cab809edfb5429603c68493363074ac20cf
tree366056342adca338a8efc6b7e8caf52279765647
parent18461960cbf50bf345ef0667d45d5f64de8fb893
powerpc: Don't corrupt user registers on 32-bit

Commit de79f7b9f6 ("powerpc: Put FP/VSX and VR state into structures")
modified load_up_fpu() and load_up_altivec() in such a way that they
now use r7 and r8.  Unfortunately, the callers of these functions on
32-bit machines then return to userspace via fast_exception_return,
which doesn't restore all of the volatile GPRs, but only r1, r3 -- r6
and r9 -- r12.  This was causing userspace segfaults and other
userspace misbehaviour on 32-bit machines.

This fixes the problem by changing the register usage of load_up_fpu()
and load_up_altivec() to avoid using r7 and r8 and instead use r6 and
r10.  This also adds comments to those functions saying which registers
may be used.

Signed-off-by: Paul Mackerras <paulus@samba.org>
Tested-by: Scott Wood <scottwood@freescale.com> (on e500mc, so no altivec)
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
arch/powerpc/kernel/fpu.S
arch/powerpc/kernel/vector.S