Skip to contentSkip to conversation

KVM: x86: Clear flags field on return from KVM_GET_CLOCK

PATCH In review Jan Kiszka 3 participants 4 messages Nov 2, 2009 – Nov 3, 2009

Subsystems (3)
lore
Share & tools
lore

Jan Kiszka

author
#0 lore raw

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
index 1f68798..dd229b6 100644
@@ -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;
 	}
 
author
#2 lore raw

PATCH 1/1 KVM: x86: Fix KVM_GET_CLOCK

In reply to Jan Kiszka

The 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
index 1f68798..7344405 100644
@@ -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;
 	}
 
#3 lore raw

Re: [PATCH] KVM: x86: Fix KVM_GET_CLOCK

Quoted 5 lines · Jan Kiszka

The 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.

Quoted 7 lines

---

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.