kernel_optimize_test/virt/kvm/arm
Sean Christopherson 152482580a KVM: Call kvm_arch_memslots_updated() before updating memslots
kvm_arch_memslots_updated() is at this point in time an x86-specific
hook for handling MMIO generation wraparound.  x86 stashes 19 bits of
the memslots generation number in its MMIO sptes in order to avoid
full page fault walks for repeat faults on emulated MMIO addresses.
Because only 19 bits are used, wrapping the MMIO generation number is
possible, if unlikely.  kvm_arch_memslots_updated() alerts x86 that
the generation has changed so that it can invalidate all MMIO sptes in
case the effective MMIO generation has wrapped so as to avoid using a
stale spte, e.g. a (very) old spte that was created with generation==0.

Given that the purpose of kvm_arch_memslots_updated() is to prevent
consuming stale entries, it needs to be called before the new generation
is propagated to memslots.  Invalidating the MMIO sptes after updating
memslots means that there is a window where a vCPU could dereference
the new memslots generation, e.g. 0, and incorrectly reuse an old MMIO
spte that was created with (pre-wrap) generation==0.

Fixes: e59dbe09f8 ("KVM: Introduce kvm_arch_memslots_updated()")
Cc: <stable@vger.kernel.org>
Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2019-02-20 22:48:32 +01:00
..
hyp arm64: KVM: Consistently advance singlestep when emulating instructions 2018-12-18 14:11:37 +00:00
vgic Merge branch 'core-rcu-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2018-12-26 13:07:19 -08:00
aarch32.c kvm/arm: use PSR_AA32 definitions 2018-07-05 17:24:15 +01:00
arch_timer.c KVM: arm/arm64: arch_timer: Simplify kvm_timer_vcpu_terminate 2018-12-19 17:47:07 +00:00
arm.c * ARM: selftests improvements, large PUD support for HugeTLB, 2018-12-26 11:46:28 -08:00
mmio.c arm64: KVM: Skip MMIO insn after emulation 2018-12-18 14:10:36 +00:00
mmu.c KVM: Call kvm_arch_memslots_updated() before updating memslots 2019-02-20 22:48:32 +01:00
perf.c KVM: arm/arm64: Move shared files to virt/kvm/arm 2017-05-04 13:57:26 +02:00
pmu.c KVM: arm64: Rewrite system register accessors to read/write functions 2018-03-19 10:53:16 +00:00
psci.c sched/swait: Rename to exclusive 2018-06-20 11:35:56 +02:00
trace.h arm/arm64: KVM: Add ARM_EXCEPTION_IS_TRAP macro 2018-12-19 17:47:53 +00:00