android_kernel_samsung_a7y1.../arch/x86
Sean Christopherson f870cbe5ea KVM: x86: Manually calculate reserved bits when loading PDPTRS
commit 16cfacc8085782dab8e365979356ce1ca87fd6cc upstream.

Manually generate the PDPTR reserved bit mask when explicitly loading
PDPTRs.  The reserved bits that are being tracked by the MMU reflect the
current paging mode, which is unlikely to be PAE paging in the vast
majority of flows that use load_pdptrs(), e.g. CR0 and CR4 emulation,
__set_sregs(), etc...  This can cause KVM to incorrectly signal a bad
PDPTR, or more likely, miss a reserved bit check and subsequently fail
a VM-Enter due to a bad VMCS.GUEST_PDPTR.

Add a one off helper to generate the reserved bits instead of sharing
code across the MMU's calculations and the PDPTR emulation.  The PDPTR
reserved bits are basically set in stone, and pushing a helper into
the MMU's calculation adds unnecessary complexity without improving
readability.

Oppurtunistically fix/update the comment for load_pdptrs().

Note, the buggy commit also introduced a deliberate functional change,
"Also remove bit 5-6 from rsvd_bits_mask per latest SDM.", which was
effectively (and correctly) reverted by commit cd9ae5fe47df ("KVM: x86:
Fix page-tables reserved bits").  A bit of SDM archaeology shows that
the SDM from late 2008 had a bug (likely a copy+paste error) where it
listed bits 6:5 as AVL and A for PDPTEs used for 4k entries but reserved
for 2mb entries.  I.e. the SDM contradicted itself, and bits 6:5 are and
always have been reserved.

Fixes: 20c466b56168d ("KVM: Use rsvd_bits_mask in load_pdptrs()")
Cc: stable@vger.kernel.org
Cc: Nadav Amit <nadav.amit@gmail.com>
Reported-by: Doug Reiland <doug.reiland@intel.com>
Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
Reviewed-by: Peter Xu <peterx@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-04-07 07:40:10 +02:00
..
boot x86, boot: Remove multiple copy of static function sanitize_boot_params() 2020-04-06 21:35:01 +02:00
configs
crypto
entry x86/vdso: Remove direct HPET access through the vDSO 2020-04-06 20:50:21 +02:00
ia32
include x86/boot: Add missing bootparam that breaks boot on some platforms 2020-04-06 21:36:04 +02:00
kernel x86/apic: Soft disable APIC before initializing it 2020-04-07 07:38:04 +02:00
kvm KVM: x86: Manually calculate reserved bits when loading PDPTRS 2020-04-07 07:40:10 +02:00
lguest
lib
math-emu
mm x86/mm: Sync also unmappings in vmalloc_sync_all() 2020-04-06 20:38:19 +02:00
net
oprofile
pci
platform
power x86/CPU/AMD: Clear RDRAND CPUID bit on AMD family 15h/16h 2020-04-06 21:32:57 +02:00
purgatory
ras
realmode
tools
um
video
xen
Kbuild
Kconfig
Kconfig.cpu
Kconfig.debug
Makefile x86/build: Add -Wnoaddress-of-packed-member to REALMODE_CFLAGS, to silence GCC9 build warning 2020-04-06 21:35:54 +02:00
Makefile_32.cpu
Makefile.um