mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-22 13:02:19 +07:00
661e6b02b5
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>
49 lines
2.0 KiB
C
49 lines
2.0 KiB
C
/*
|
|
* Copyright (C) 2012 Rusty Russell IBM Corporation
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License, version 2, as
|
|
* published by the Free Software Foundation.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with this program; if not, write to the Free Software
|
|
* Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
*/
|
|
|
|
#ifndef __ARM_KVM_COPROC_H__
|
|
#define __ARM_KVM_COPROC_H__
|
|
#include <linux/kvm_host.h>
|
|
|
|
void kvm_reset_coprocs(struct kvm_vcpu *vcpu);
|
|
|
|
struct kvm_coproc_target_table {
|
|
unsigned target;
|
|
const struct coproc_reg *table;
|
|
size_t num;
|
|
};
|
|
void kvm_register_target_coproc_table(struct kvm_coproc_target_table *table);
|
|
|
|
int 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_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);
|
|
|
|
unsigned long kvm_arm_num_guest_msrs(struct kvm_vcpu *vcpu);
|
|
int kvm_arm_copy_msrindices(struct kvm_vcpu *vcpu, u64 __user *uindices);
|
|
void kvm_coproc_table_init(void);
|
|
|
|
struct kvm_one_reg;
|
|
int kvm_arm_copy_coproc_indices(struct kvm_vcpu *vcpu, u64 __user *uindices);
|
|
int kvm_arm_coproc_get_reg(struct kvm_vcpu *vcpu, const struct kvm_one_reg *);
|
|
int kvm_arm_coproc_set_reg(struct kvm_vcpu *vcpu, const struct kvm_one_reg *);
|
|
unsigned long kvm_arm_num_coproc_regs(struct kvm_vcpu *vcpu);
|
|
#endif /* __ARM_KVM_COPROC_H__ */
|