KVM: x86: Clear flags field on return from KVM_GET_CLOCK
PATCH 1/1 KVM: x86: Clear flags field on return from KVM_GET_CLOCK
This field is supposed to indicate the availability of additional fields one day. There are none yet, so clear it - and drop the bogus check, too.
---
This alone fixes the savevm/loadvm issue around kvmclock reported today.
arch/x86/kvm/x86.c | 5 +---- 1 files changed, 1 insertions(+), 4 deletions(-)
arch/x86/kvm/x86.c +1 -4
@@ -2577,14 +2577,11 @@ long kvm_arch_vm_ioctl(struct file *filp,ktime_get_ts (&now); now_ns =timespec_to_ns (&now); user_ns.clock = kvm->arch.kvmclock_offset + now_ns; + user_ns.flags =0 ;if (copy_to_user (argp, &user_ns,sizeof (user_ns))) r = -EFAULT ; - r = -EINVAL ; -if (user_ns.flags) - goto out; -break ; }
Quoted 5 lines · Jan Kiszka
This field is supposed to indicate the availability of additional fields one day. There are none yet, so clear it - and drop the bogus check, too.
Signed-off-by Jan Kiszka <[email protected]>
Makes sense.
PATCH 1/1 KVM: x86: Fix KVM_GET_CLOCK
In reply to Jan KiszkaThe flags field of kvm_clock_data is supposed to indicate the availability of additional fields one day. There are none yet, so clear it. Moreover, drop the bogus check of this field and return 0 on success.
---
Note: This replaces "Clear flags field on return from KVM_GET_CLOCK".
arch/x86/kvm/x86.c | 8 +++----- 1 files changed, 3 insertions(+), 5 deletions(-)
arch/x86/kvm/x86.c +3 -5
@@ -2577,14 +2577,12 @@ long kvm_arch_vm_ioctl(struct file *filp,ktime_get_ts (&now); now_ns =timespec_to_ns (&now); user_ns.clock = kvm->arch.kvmclock_offset + now_ns; + user_ns.flags =0 ; + r = -EFAULT ;if (copy_to_user (argp, &user_ns,sizeof (user_ns))) - r = -EFAULT ; - - r = -EINVAL ; -if (user_ns.flags) goto out; - + r =0 ;break ; }
Marcelo Tosatti
AppliedRe: [PATCH] KVM: x86: Fix KVM_GET_CLOCK
Quoted 5 lines · Jan Kiszka
The flags field of
kvm_clock_datais supposed to indicate the availability of additional fields one day. There are none yet, so clear it. Moreover, drop the bogus check of this field and return 0 on success.
Quoted 7 lines
Signed-off-by Jan Kiszka <[email protected]>---
Note: This replaces "Clear flags field on return from
KVM_GET_CLOCK".arch/x86/kvm/x86.c | 8 +++----- 1 files changed, 3 insertions(+), 5 deletions(-)
Applied, thanks.