kernel_optimize_test/virt/kvm/arm
Christoffer Dall 6794ad5443 KVM: arm/arm64: Fix unintended stage 2 PMD mappings
There are two things we need to take care of when we create block
mappings in the stage 2 page tables:

  (1) The alignment within a PMD between the host address range and the
  guest IPA range must be the same, since otherwise we end up mapping
  pages with the wrong offset.

  (2) The head and tail of a memory slot may not cover a full block
  size, and we have to take care to not map those with block
  descriptors, since we could expose memory to the guest that the host
  did not intend to expose.

So far, we have been taking care of (1), but not (2), and our commentary
describing (1) was somewhat confusing.

This commit attempts to factor out the checks of both into a common
function, and if we don't pass the check, we won't attempt any PMD
mappings for neither hugetlbfs nor THP.

Note that we used to only check the alignment for THP, not for
hugetlbfs, but as far as I can tell the check needs to be applied to
both scenarios.

Cc: Ralph Palutke <ralph.palutke@fau.de>
Cc: Lukas Braun <koomi@moshbit.net>
Reported-by: Lukas Braun <koomi@moshbit.net>
Signed-off-by: Christoffer Dall <christoffer.dall@arm.com>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
2018-12-19 17:47:52 +00:00
..
hyp arm64: KVM: Consistently advance singlestep when emulating instructions 2018-12-18 14:11:37 +00:00
vgic arm/arm64: KVM: vgic: Force VM halt when changing the active state of GICv3 PPIs/SGIs 2018-12-19 17:47:08 +00: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 KVM: arm/arm64: Fix VMID alloc race by reverting to lock-less 2018-12-18 15:14:45 +00:00
mmio.c arm64: KVM: Skip MMIO insn after emulation 2018-12-18 14:10:36 +00:00
mmu.c KVM: arm/arm64: Fix unintended stage 2 PMD mappings 2018-12-19 17:47:52 +00: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 KVM: arm/arm64: Fixup the kvm_exit tracepoint 2018-12-19 17:47:06 +00:00