]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - queue-4.19/powerpc-fsl-flush-branch-predictor-when-entering-kvm.patch
5.0-stable patches
[thirdparty/kernel/stable-queue.git] / queue-4.19 / powerpc-fsl-flush-branch-predictor-when-entering-kvm.patch
1 From foo@baz Fri Mar 29 16:04:51 CET 2019
2 From: Michael Ellerman <mpe@ellerman.id.au>
3 Date: Fri, 29 Mar 2019 22:26:15 +1100
4 Subject: powerpc/fsl: Flush branch predictor when entering KVM
5 To: stable@vger.kernel.org, gregkh@linuxfoundation.org
6 Cc: linuxppc-dev@ozlabs.org, diana.craciun@nxp.com, msuchanek@suse.de, christophe.leroy@c-s.fr
7 Message-ID: <20190329112620.14489-28-mpe@ellerman.id.au>
8
9 From: Diana Craciun <diana.craciun@nxp.com>
10
11 commit e7aa61f47b23afbec41031bc47ca8d6cb6516abc upstream.
12
13 Switching from the guest to host is another place
14 where the speculative accesses can be exploited.
15 Flush the branch predictor when entering KVM.
16
17 Signed-off-by: Diana Craciun <diana.craciun@nxp.com>
18 Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
19 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
20 ---
21 arch/powerpc/kvm/bookehv_interrupts.S | 4 ++++
22 1 file changed, 4 insertions(+)
23
24 --- a/arch/powerpc/kvm/bookehv_interrupts.S
25 +++ b/arch/powerpc/kvm/bookehv_interrupts.S
26 @@ -75,6 +75,10 @@
27 PPC_LL r1, VCPU_HOST_STACK(r4)
28 PPC_LL r2, HOST_R2(r1)
29
30 +START_BTB_FLUSH_SECTION
31 + BTB_FLUSH(r10)
32 +END_BTB_FLUSH_SECTION
33 +
34 mfspr r10, SPRN_PID
35 lwz r8, VCPU_HOST_PID(r4)
36 PPC_LL r11, VCPU_SHARED(r4)