linux-stable/arch
Lai Jiangshan 8b2ae2de53 KVM: X86: Disable hardware breakpoints unconditionally before kvm_x86->run()
commit f85d401606 upstream.

When the host is using debug registers but the guest is not using them
nor is the guest in guest-debug state, the kvm code does not reset
the host debug registers before kvm_x86->run().  Rather, it relies on
the hardware vmentry instruction to automatically reset the dr7 registers
which ensures that the host breakpoints do not affect the guest.

This however violates the non-instrumentable nature around VM entry
and exit; for example, when a host breakpoint is set on vcpu->arch.cr2,

Another issue is consistency.  When the guest debug registers are active,
the host breakpoints are reset before kvm_x86->run(). But when the
guest debug registers are inactive, the host breakpoints are delayed to
be disabled.  The host tracing tools may see different results depending
on what the guest is doing.

To fix the problems, we clear %db7 unconditionally before kvm_x86->run()
if the host has set any breakpoints, no matter if the guest is using
them or not.

Signed-off-by: Lai Jiangshan <laijs@linux.alibaba.com>
Message-Id: <20210628172632.81029-1-jiangshanlai@gmail.com>
Cc: stable@vger.kernel.org
[Only clear %db7 instead of reloading all debug registers. - Paolo]
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-07-20 16:05:36 +02:00
..
alpha sched/core: Initialize the idle task with preemption disabled 2021-07-14 16:55:50 +02:00
arc sched/core: Initialize the idle task with preemption disabled 2021-07-14 16:55:50 +02:00
arm sched/core: Initialize the idle task with preemption disabled 2021-07-14 16:55:50 +02:00
arm64 arm64: tlb: fix the TTL value of tlb_get_level 2021-07-19 09:44:59 +02:00
c6x arch-cleanup-2020-10-22 2020-10-23 10:06:38 -07:00
csky csky: syscache: Fixup duplicate cache flush 2021-07-14 16:56:52 +02:00
h8300 h8300: fix PREEMPTION build, TI_PRE_COUNT undefined 2021-02-17 11:02:28 +01:00
hexagon Hexagon: change jumps to must-extend in futex_atomic_* 2021-07-11 12:53:31 +02:00
ia64 ia64: mca_drv: fix incorrect array size calculation 2021-07-14 16:56:02 +02:00
m68k m68k: atari: Fix ATARI_KBD_CORE kconfig unmet dependency warning 2021-07-14 16:56:05 +02:00
microblaze local64.h: make <asm/local64.h> mandatory 2021-01-12 20:18:16 +01:00
mips MIPS: MT extensions are not available on MIPS32r1 2021-07-19 09:44:55 +02:00
nds32 nds32: flush_dcache_page: use page_mapping_file to avoid races with swapoff 2021-04-14 08:41:58 +02:00
nios2 nios2: fixed broken sys_clone syscall 2021-03-04 11:38:16 +01:00
openrisc sched/core: Initialize the idle task with preemption disabled 2021-07-14 16:55:50 +02:00
parisc sched/core: Initialize the idle task with preemption disabled 2021-07-14 16:55:50 +02:00
powerpc powerpc/powernv/vas: Release reference to tgid during window close 2021-07-19 09:44:56 +02:00
riscv sched/core: Initialize the idle task with preemption disabled 2021-07-14 16:55:50 +02:00
s390 s390: preempt: Fix preempt_count initialization 2021-07-14 16:56:54 +02:00
sh sched/core: Initialize the idle task with preemption disabled 2021-07-14 16:55:50 +02:00
sparc sched/core: Initialize the idle task with preemption disabled 2021-07-14 16:55:50 +02:00
um um: Disable CONFIG_GCOV with MODULES 2021-05-22 11:40:53 +02:00
x86 KVM: X86: Disable hardware breakpoints unconditionally before kvm_x86->run() 2021-07-20 16:05:36 +02:00
xtensa sched/core: Initialize the idle task with preemption disabled 2021-07-14 16:55:50 +02:00
.gitignore
Kconfig fanotify: Fix sys_fanotify_mark() on native x86-32 2021-01-17 14:16:59 +01:00