]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
powerpc: Avoid load hit store in setup_sigcontext()
authorAnton Blanchard <anton@samba.org>
Sun, 29 May 2016 12:03:51 +0000 (22:03 +1000)
committerMichael Ellerman <mpe@ellerman.id.au>
Tue, 14 Jun 2016 03:58:25 +0000 (13:58 +1000)
In setup_sigcontext(), we set current->thread.vrsave then use it
straight after. Since current is hidden from the compiler via inline
assembly, it cannot optimise this and we end up with a load hit store.

Fix this by using a temporary.

Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
arch/powerpc/kernel/signal_64.c

index 25520794aa37905f3509c13955dcbf2134c0f36b..7e49984d4331543de9a3d88f24d23a67b48e76df 100644 (file)
@@ -104,6 +104,7 @@ static long setup_sigcontext(struct sigcontext __user *sc, struct pt_regs *regs,
         */
 #ifdef CONFIG_ALTIVEC
        elf_vrreg_t __user *v_regs = sigcontext_vmx_regs(sc);
+       unsigned long vrsave;
 #endif
        unsigned long msr = regs->msr;
        long err = 0;
@@ -125,9 +126,13 @@ static long setup_sigcontext(struct sigcontext __user *sc, struct pt_regs *regs,
        /* We always copy to/from vrsave, it's 0 if we don't have or don't
         * use altivec.
         */
-       if (cpu_has_feature(CPU_FTR_ALTIVEC))
-               current->thread.vrsave = mfspr(SPRN_VRSAVE);
-       err |= __put_user(current->thread.vrsave, (u32 __user *)&v_regs[33]);
+       vrsave = 0;
+       if (cpu_has_feature(CPU_FTR_ALTIVEC)) {
+               vrsave = mfspr(SPRN_VRSAVE);
+               current->thread.vrsave = vrsave;
+       }
+
+       err |= __put_user(vrsave, (u32 __user *)&v_regs[33]);
 #else /* CONFIG_ALTIVEC */
        err |= __put_user(0, &sc->v_regs);
 #endif /* CONFIG_ALTIVEC */