Skip to contentSkip to conversation

x86: kvm: fix information leak to userland

PATCH Superseded Vasiliy Kulikov 1 participant 1 message Oct 30, 2010

Subsystems (4)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86: kvm: fix information leak to userland

Structure kvm_ppc_pvinfo is copied to userland with pad field unitialized. Structure kvm_clock_data is copied to userland with flags and pad fields unitialized. It leads to leaking of contents of kernel stack memory.

---
I cannot compile this driver, so it is not tested at all.

 arch/x86/kvm/x86.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
arch/x86/kvm/x86.c +2 -1
index b0818f6..261f3d0 100644
@@ -2896,6 +2896,7 @@ long kvm_arch_vcpu_ioctl(struct file *filp,
 	case KVM_GET_DEBUGREGS: {
 		struct kvm_debugregs dbgregs;
 
+		memset(&gdgr, 0, sizeof(gdgr));
 		kvm_vcpu_ioctl_x86_get_debugregs(vcpu, &dbgregs);
 
 		r = -EFAULT;
@@ -3481,11 +3482,11 @@ long kvm_arch_vm_ioctl(struct file *filp,
 		struct kvm_clock_data user_ns;
 		u64 now_ns;
 
+		memset(&user_ns, 0, sizefo(user_ns));
 		local_irq_disable();
 		now_ns = get_kernel_ns();
 		user_ns.clock = kvm->arch.kvmclock_offset + now_ns;
 		local_irq_enable();
-		user_ns.flags = 0;
 
 		r = -EFAULT;
 		if (copy_to_user(argp, &user_ns, sizeof(user_ns)))
Signature · 1 line
1.7.0.4