[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 01/23] KVM: x86: do not fail if software breakpoint has already be
From: |
Paolo Bonzini |
Subject: |
[PULL 01/23] KVM: x86: do not fail if software breakpoint has already been removed |
Date: |
Sat, 6 Mar 2021 11:53:57 +0100 |
If kvm_arch_remove_sw_breakpoint finds that a software breakpoint does not
have an INT3 instruction, it fails. This can happen if one sets a
software breakpoint in a kernel module and then reloads it. gdb then
thinks the breakpoint cannot be deleted and there is no way to add it
back.
Suggested-by: Maxim Levitsky <mlevitsk@redhat.com>
Reviewed-by: Maxim Levitsky <mlevitsk@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
target/i386/kvm/kvm.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/target/i386/kvm/kvm.c b/target/i386/kvm/kvm.c
index 0b5755e42b..c8d61daf68 100644
--- a/target/i386/kvm/kvm.c
+++ b/target/i386/kvm/kvm.c
@@ -4352,8 +4352,13 @@ int kvm_arch_remove_sw_breakpoint(CPUState *cs, struct
kvm_sw_breakpoint *bp)
{
uint8_t int3;
- if (cpu_memory_rw_debug(cs, bp->pc, &int3, 1, 0) || int3 != 0xcc ||
- cpu_memory_rw_debug(cs, bp->pc, (uint8_t *)&bp->saved_insn, 1, 1)) {
+ if (cpu_memory_rw_debug(cs, bp->pc, &int3, 1, 0)) {
+ return -EINVAL;
+ }
+ if (int3 != 0xcc) {
+ return 0;
+ }
+ if (cpu_memory_rw_debug(cs, bp->pc, (uint8_t *)&bp->saved_insn, 1, 1)) {
return -EINVAL;
}
return 0;
--
2.29.2
- [PULL 00/23] Misc patches for 2021-03-06, Paolo Bonzini, 2021/03/06
- [PULL 01/23] KVM: x86: do not fail if software breakpoint has already been removed,
Paolo Bonzini <=
- [PULL 02/23] KVM: x86: deprecate -M kernel-irqchip=off except for -M isapc, Paolo Bonzini, 2021/03/06
- [PULL 03/23] qga-vss: Use dynamic linking for GLib, Paolo Bonzini, 2021/03/06
- [PULL 04/23] chardev: add nodelay option, Paolo Bonzini, 2021/03/06
- [PULL 05/23] qom: Check for wellformed id in user_creatable_add_type(), Paolo Bonzini, 2021/03/06
- [PULL 06/23] vl.c: do not execute trace_init_backends() before daemonizing, Paolo Bonzini, 2021/03/06
- [PULL 07/23] accel: kvm: Fix memory waste under mismatch page size, Paolo Bonzini, 2021/03/06
- [PULL 10/23] elf_ops: correct loading of 32 bit PVH kernel, Paolo Bonzini, 2021/03/06
- [PULL 11/23] x86/pvh: extract only 4 bytes of start address for 32 bit kernels, Paolo Bonzini, 2021/03/06
- [PULL 13/23] scsi: Rename linux-specific SG_ERR codes to generic SCSI_HOST error codes, Paolo Bonzini, 2021/03/06
- [PULL 12/23] qemu-config: add error propagation to qemu_config_parse, Paolo Bonzini, 2021/03/06