Skip to content

Commit e3d752e

Browse files
Andy Honigrtg-canonical
authored andcommitted
KVM: Improve create VCPU parameter (CVE-2013-4587)
CVE-2013-4587 BugLink: http://bugs.launchpad.net/bugs/1261564 In multiple functions the vcpu_id is used as an offset into a bitfield. Ag malicious user could specify a vcpu_id greater than 255 in order to set or clear bits in kernel memory. This could be used to elevate priveges in the kernel. This patch verifies that the vcpu_id provided is less than 255. The api documentation already specifies that the vcpu_id must be less than max_vcpus, but this is currently not checked. Reported-by: Andrew Honig <[email protected]> Cc: [email protected] Signed-off-by: Andrew Honig <[email protected]> Signed-off-by: Paolo Bonzini <[email protected]> (cherry picked from commit 338c7dbadd2671189cec7faf64c84d01071b3f96) Acked-by: Brad Figg <[email protected]> Signed-off-by: Luis Henriques <[email protected]> Signed-off-by: Tim Gardner <[email protected]>
1 parent f7bf4c4 commit e3d752e

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

virt/kvm/kvm_main.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1871,6 +1871,9 @@ static int kvm_vm_ioctl_create_vcpu(struct kvm *kvm, u32 id)
18711871
int r;
18721872
struct kvm_vcpu *vcpu, *v;
18731873

1874+
if (id >= KVM_MAX_VCPUS)
1875+
return -EINVAL;
1876+
18741877
vcpu = kvm_arch_vcpu_create(kvm, id);
18751878
if (IS_ERR(vcpu))
18761879
return PTR_ERR(vcpu);

0 commit comments

Comments
 (0)