]> git.baikalelectronics.ru Git - kernel.git/commit
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)
commit42ebaaaf2286a06e788813b7e2ad33d40cca0048
tree57edfd525c9dc14dac4921dff158a611be3f4a9f
parent6605d13116897685f4eec7072e9d506130f5cbea
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