]> git.kernelconcepts.de Git - karo-tx-linux.git/commit
KVM: arm: plug potential guest hardware debug leakage
authorZhichao Huang <zhichao.huang@linaro.org>
Thu, 11 May 2017 12:46:11 +0000 (13:46 +0100)
committerChristoffer Dall <cdall@linaro.org>
Mon, 15 May 2017 12:29:19 +0000 (14:29 +0200)
commit661e6b02b5aa82db31897f36e96324b77450fd7a
tree188465d531beaca405cb976c8d123381d2835be7
parent6c0d706b563af732adb094c5bf807437e8963e84
KVM: arm: plug potential guest hardware debug leakage

Hardware debugging in guests is not intercepted currently, it means
that a malicious guest can bring down the entire machine by writing
to the debug registers.

This patch enable trapping of all debug registers, preventing the
guests to access the debug registers. This includes access to the
debug mode(DBGDSCR) in the guest world all the time which could
otherwise mess with the host state. Reads return 0 and writes are
ignored (RAZ_WI).

The result is the guest cannot detect any working hardware based debug
support. As debug exceptions are still routed to the guest normal
debug using software based breakpoints still works.

To support debugging using hardware registers we need to implement a
debug register aware world switch as well as special trapping for
registers that may affect the host state.

Cc: stable@vger.kernel.org
Signed-off-by: Zhichao Huang <zhichao.huang@linaro.org>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Christoffer Dall <cdall@linaro.org>
Signed-off-by: Christoffer Dall <cdall@linaro.org>
arch/arm/include/asm/kvm_coproc.h
arch/arm/kvm/coproc.c
arch/arm/kvm/handle_exit.c
arch/arm/kvm/hyp/switch.c