linux-kernel-test/arch
Jim Mattson 671ddc700f KVM: nVMX: Don't leak L1 MMIO regions to L2
If the "virtualize APIC accesses" VM-execution control is set in the
VMCS, the APIC virtualization hardware is triggered when a page walk
in VMX non-root mode terminates at a PTE wherein the address of the 4k
page frame matches the APIC-access address specified in the VMCS. On
hardware, the APIC-access address may be any valid 4k-aligned physical
address.

KVM's nVMX implementation enforces the additional constraint that the
APIC-access address specified in the vmcs12 must be backed by
a "struct page" in L1. If not, L0 will simply clear the "virtualize
APIC accesses" VM-execution control in the vmcs02.

The problem with this approach is that the L1 guest has arranged the
vmcs12 EPT tables--or shadow page tables, if the "enable EPT"
VM-execution control is clear in the vmcs12--so that the L2 guest
physical address(es)--or L2 guest linear address(es)--that reference
the L2 APIC map to the APIC-access address specified in the
vmcs12. Without the "virtualize APIC accesses" VM-execution control in
the vmcs02, the APIC accesses in the L2 guest will directly access the
APIC-access page in L1.

When there is no mapping whatsoever for the APIC-access address in L1,
the L2 VM just loses the intended APIC virtualization. However, when
the APIC-access address is mapped to an MMIO region in L1, the L2
guest gets direct access to the L1 MMIO device. For example, if the
APIC-access address specified in the vmcs12 is 0xfee00000, then L2
gets direct access to L1's APIC.

Since this vmcs12 configuration is something that KVM cannot
faithfully emulate, the appropriate response is to exit to userspace
with KVM_INTERNAL_ERROR_EMULATION.

Fixes: fe3ef05c75 ("KVM: nVMX: Prepare vmcs02 from vmcs01 and vmcs12")
Reported-by: Dan Cross <dcross@google.com>
Signed-off-by: Jim Mattson <jmattson@google.com>
Reviewed-by: Peter Shier <pshier@google.com>
Reviewed-by: Sean Christopherson <sean.j.christopherson@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2019-10-22 19:04:40 +02:00
..
alpha
arc
arm Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2019-10-19 17:09:11 -04:00
arm64 KVM/arm fixes for 5.4, take #2 2019-10-22 13:31:29 +02:00
c6x
csky
h8300
hexagon
ia64
m68k
microblaze
mips USB fixes for 5.4-rc3 2019-10-12 15:37:12 -07:00
nds32
nios2
openrisc
parisc parisc: Fix vmap memory leak in ioremap()/iounmap() 2019-10-14 21:44:17 +02:00
powerpc KVM: PPC: Book3S HV: XIVE: Ensure VP isn't already in use 2019-10-15 16:09:11 +11:00
riscv RISC-V: fix virtual address overlapped in FIXADDR_START and VMEMMAP_START 2019-10-15 22:47:41 -07:00
s390 s390/uaccess: avoid (false positive) compiler warnings 2019-10-11 12:27:25 +02:00
sh
sparc sparc64: disable fast-GUP due to unexplained oopses 2019-10-15 09:56:36 -07:00
um
unicore32
x86 KVM: nVMX: Don't leak L1 MMIO regions to L2 2019-10-22 19:04:40 +02:00
xtensa xtensa: fix change_bit in exclusive access option 2019-10-16 00:14:33 -07:00
.gitignore
Kconfig