Skip to content

Commit

Permalink
KVM: Device assignment: Check for privileges before assigning irq
Browse files Browse the repository at this point in the history
Even though we don't share irqs at the moment, we should ensure
regular user processes don't try to allocate system resources.

We check for capability to access IO devices (CAP_SYS_RAWIO) before
we request_irq on behalf of the guest.

Noticed by Avi.

Signed-off-by: Amit Shah <amit.shah@qumranet.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
  • Loading branch information
Amit Shah authored and Avi Kivity committed Oct 15, 2008
1 parent dc7404c commit 6762b72
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions arch/x86/kvm/x86.c
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,11 @@ static int kvm_vm_ioctl_assign_irq(struct kvm *kvm,
kvm_assigned_dev_interrupt_work_handler);

if (irqchip_in_kernel(kvm)) {
if (!capable(CAP_SYS_RAWIO)) {
return -EPERM;
goto out;
}

if (assigned_irq->host_irq)
match->host_irq = assigned_irq->host_irq;
else
Expand Down

0 comments on commit 6762b72

Please sign in to comment.