Re: [PATCH v6 01/21] KVM: x86: Fix potential race in KVM_GET_CLOCK

2021-08-13 Thread Oliver Upton
On Fri, Aug 13, 2021 at 3:44 AM Paolo Bonzini wrote: > > On 13/08/21 12:39, Oliver Upton wrote: > > Might it make sense to fix this issue under the existing locking > > scheme, then shift to what you're proposing? I say that, but the > > locking change in 03/21 would most certainly have a short

Re: [PATCH v6 01/21] KVM: x86: Fix potential race in KVM_GET_CLOCK

2021-08-13 Thread Oliver Upton
Hi Paolo, On Wed, Aug 11, 2021 at 5:23 AM Paolo Bonzini wrote: > > On 04/08/21 10:57, Oliver Upton wrote: > > Sean noticed that KVM_GET_CLOCK was checking kvm_arch.use_master_clock > > outside of the pvclock sync lock. This is problematic, as the clock > > value written to the user may or may

Re: [PATCH v6 01/21] KVM: x86: Fix potential race in KVM_GET_CLOCK

2021-08-13 Thread Paolo Bonzini
On 13/08/21 12:39, Oliver Upton wrote: Might it make sense to fix this issue under the existing locking scheme, then shift to what you're proposing? I say that, but the locking change in 03/21 would most certainly have a short lifetime until this patch supersedes it. Yes, definitely. The

Re: [PATCH v6 01/21] KVM: x86: Fix potential race in KVM_GET_CLOCK

2021-08-11 Thread Paolo Bonzini
On 04/08/21 10:57, Oliver Upton wrote: Sean noticed that KVM_GET_CLOCK was checking kvm_arch.use_master_clock outside of the pvclock sync lock. This is problematic, as the clock value written to the user may or may not actually correspond to a stable TSC. Fix the race by populating the entire

[PATCH v6 01/21] KVM: x86: Fix potential race in KVM_GET_CLOCK

2021-08-04 Thread Oliver Upton
Sean noticed that KVM_GET_CLOCK was checking kvm_arch.use_master_clock outside of the pvclock sync lock. This is problematic, as the clock value written to the user may or may not actually correspond to a stable TSC. Fix the race by populating the entire kvm_clock_data structure behind the