Patch "KVM: arm: plug potential guest hardware debug leakage" has been added to the 4.11-stable tree
Subsystems (2)
This is a note to let you know that I've just added the patch titled
KVM: arm: plug potential guest hardware debug leakage
to the 4.11-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
kvm-arm-plug-potential-guest-hardware-debug-leakage.patch
and it can be found in the queue-4.11 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.
Quoted 1 line
From
661e6b02b5aa82db31897f36e96324b77450fd7aMon Sep 17 00:00:00 2001
From: Zhichao Huang <[email protected]>
Date: Thu, 11 May 2017 13:46:11 +0100
Subject: KVM: arm: plug potential guest hardware debug leakage
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
From: Zhichao Huang <[email protected]>
commit 661e6b02b5aa82db31897f36e96324b77450fd7a upstream.
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.
--- arch/arm/include/asm/kvm_coproc.h | 3 - arch/arm/kvm/coproc.c | 77 +++++++++++++++++++++++++++++--------- arch/arm/kvm/handle_exit.c | 4 - arch/arm/kvm/hyp/switch.c | 4 + 4 files changed, 66 insertions(+), 22 deletions(-)
arch/arm/include/asm/kvm_coproc.h +2 -1
@@ -31,7 +31,8 @@ void kvm_register_target_coproc_table(stint kvm_handle_cp10_id (struct kvm_vcpu *vcpu,struct kvm_run *run);int kvm_handle_cp_0_13_access (struct kvm_vcpu *vcpu,struct kvm_run *run);int kvm_handle_cp14_load_store (struct kvm_vcpu *vcpu,struct kvm_run *run); -int kvm_handle_cp14_access (struct kvm_vcpu *vcpu,struct kvm_run *run); +int kvm_handle_cp14_32 (struct kvm_vcpu *vcpu,struct kvm_run *run); +int kvm_handle_cp14_64 (struct kvm_vcpu *vcpu,struct kvm_run *run);int kvm_handle_cp15_32 (struct kvm_vcpu *vcpu,struct kvm_run *run);int kvm_handle_cp15_64 (struct kvm_vcpu *vcpu,struct kvm_run *run);
arch/arm/kvm/coproc.c +59 -18
113 lines not on this page · raw message
arch/arm/kvm/handle_exit.c +2 -2
@@ -95,9 +95,9 @@ static exit_handle_fn arm_exit_handlers[ [HSR_EC_WFI] = kvm_handle_wfx, [HSR_EC_CP15_32] = kvm_handle_cp15_32, [HSR_EC_CP15_64] = kvm_handle_cp15_64, - [HSR_EC_CP14_MR] = kvm_handle_cp14_access, + [HSR_EC_CP14_MR] = kvm_handle_cp14_32, [HSR_EC_CP14_LS] = kvm_handle_cp14_load_store, - [HSR_EC_CP14_64] = kvm_handle_cp14_access, + [HSR_EC_CP14_64] = kvm_handle_cp14_64, [HSR_EC_CP_0_13] = kvm_handle_cp_0_13_access, [HSR_EC_CP10_ID] = kvm_handle_cp10_id, [HSR_EC_HVC] = handle_hvc,
arch/arm/kvm/hyp/switch.c +3 -1
@@ -48,7 +48,9 @@ static void __hyp_text __activate_traps(write_sysreg (HSTR_T (15 ),HSTR );write_sysreg (HCPTR_TTA |HCPTR_TCP (10 ) |HCPTR_TCP (11 ),HCPTR ); val =read_sysreg (HDCR ); -write_sysreg (val |HDCR_TPM |HDCR_TPMCR ,HDCR ); + val |=HDCR_TPM |HDCR_TPMCR ;/* trap performance monitors */ + val |=HDCR_TDRA |HDCR_TDOSA |HDCR_TDA ;/* trap debug regs */ +write_sysreg (val,HDCR ); } static void __hyp_text __deactivate_traps(struct kvm_vcpu *vcpu)
Patches currently in stable-queue which might be from [email protected] are
queue-4.11/kvm-arm-plug-potential-guest-hardware-debug-leakage.patch