x86, kvm: Clear paravirt_enabled on KVM guests for espfix32's benefit
authorAndy Lutomirski <luto@amacapital.net>
Sat, 6 Dec 2014 03:03:28 +0000 (19:03 -0800)
committerZefan Li <lizefan@huawei.com>
Mon, 2 Feb 2015 09:05:24 +0000 (17:05 +0800)
commitea500805ef36f95b4126c2fdd00dc33e84ac3a0a
treef2b309ea317edc377287c2caa6998f66639ce8ec
parent66cc8f8440666b4ef0996ec76d9a208f5b54970f
x86, kvm: Clear paravirt_enabled on KVM guests for espfix32's benefit

commit 29fa6825463c97e5157284db80107d1bfac5d77b upstream.

paravirt_enabled has the following effects:

 - Disables the F00F bug workaround warning.  There is no F00F bug
   workaround any more because Linux's standard IDT handling already
   works around the F00F bug, but the warning still exists.  This
   is only cosmetic, and, in any event, there is no such thing as
   KVM on a CPU with the F00F bug.

 - Disables 32-bit APM BIOS detection.  On a KVM paravirt system,
   there should be no APM BIOS anyway.

 - Disables tboot.  I think that the tboot code should check the
   CPUID hypervisor bit directly if it matters.

 - paravirt_enabled disables espfix32.  espfix32 should *not* be
   disabled under KVM paravirt.

The last point is the purpose of this patch.  It fixes a leak of the
high 16 bits of the kernel stack address on 32-bit KVM paravirt
guests.  Fixes CVE-2014-8134.

Suggested-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Signed-off-by: Andy Lutomirski <luto@amacapital.net>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Zefan Li <lizefan@huawei.com>
arch/x86/kernel/kvm.c
arch/x86/kernel/kvmclock.c