OSDN Git Service

KVM: PPC: Book3S HV: Flush link stack on guest exit to host kernel
authorMichael Ellerman <mpe@ellerman.id.au>
Wed, 13 Nov 2019 10:05:44 +0000 (21:05 +1100)
committerMichael Ellerman <mpe@ellerman.id.au>
Thu, 14 Nov 2019 04:37:59 +0000 (15:37 +1100)
commitaf2e8c68b9c5403f77096969c516f742f5bb29e0
tree57edfd525c9dc14dac4921dff158a611be3f4a9f
parent39e72bf96f5847ba87cc5bd7a3ce0fed813dc9ad
KVM: PPC: Book3S HV: Flush link stack on guest exit to host kernel

On some systems that are vulnerable to Spectre v2, it is up to
software to flush the link stack (return address stack), in order to
protect against Spectre-RSB.

When exiting from a guest we do some house keeping and then
potentially exit to C code which is several stack frames deep in the
host kernel. We will then execute a series of returns without
preceeding calls, opening up the possiblity that the guest could have
poisoned the link stack, and direct speculative execution of the host
to a gadget of some sort.

To prevent this we add a flush of the link stack on exit from a guest.

Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
arch/powerpc/include/asm/asm-prototypes.h
arch/powerpc/kernel/security.c
arch/powerpc/kvm/book3s_hv_rmhandlers.S