]> git.kernelconcepts.de Git - karo-tx-linux.git/commit
kvm: x86: fix kvmclock update protocol
authorRadim Krčmář <rkrcmar@redhat.com>
Wed, 25 Mar 2015 11:08:14 +0000 (12:08 +0100)
committerPaolo Bonzini <pbonzini@redhat.com>
Mon, 27 Apr 2015 13:48:59 +0000 (15:48 +0200)
commit5dca0d9147458be9b9363b8a484aa77d710b412a
treec1614d2156f3d2b28ecc003e81cee39e8513f023
parentb787f68c36d49bb1d9236f403813641efa74a031
kvm: x86: fix kvmclock update protocol

The kvmclock spec says that the host will increment a version field to
an odd number, then update stuff, then increment it to an even number.
The host is buggy and doesn't do this, and the result is observable
when one vcpu reads another vcpu's kvmclock data.

There's no good way for a guest kernel to keep its vdso from reading
a different vcpu's kvmclock data, but we don't need to care about
changing VCPUs as long as we read a consistent data from kvmclock.
(VCPU can change outside of this loop too, so it doesn't matter if we
return a value not fit for this VCPU.)

Based on a patch by Radim Krčmář.

Reviewed-by: Radim Krčmář <rkrcmar@redhat.com>
Acked-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/x86.c