Skip to contentSkip to conversation

kvm: remove CAP_SYS_RAWIO requirement from kvm_vm_ioctl_assign_irq

PATCH Applied Alex Williamson 3 participants 4 messages May 12, 2010 – May 13, 2010 KVM

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kvm: remove CAP_SYS_RAWIO requirement from kvm_vm_ioctl_assign_irq

Remove this check in an effort to allow kvm guests to run without root privileges. This capability check doesn't seem to add any security since the device needs to have already been added via the assign device ioctl and the io actually occurs through the pci sysfs interface.

---

 virt/kvm/assigned-dev.c |    3 ---
 1 files changed, 0 insertions(+), 3 deletions(-)
virt/kvm/assigned-dev.c +0 -3
index 4d10b1e..64672e2 100644
@@ -448,9 +448,6 @@ static int kvm_vm_ioctl_assign_irq(struct kvm *kvm,
 	struct kvm_assigned_dev_kernel *match;
 	unsigned long host_irq_type, guest_irq_type;
 
-	if (!capable(CAP_SYS_RAWIO))
-		return -EPERM;
-
 	if (!irqchip_in_kernel(kvm))
 		return r;
 
#1 lore raw
Quoted 5 lines · * Alex Williamson ([email protected]) wrote:

Remove this check in an effort to allow kvm guests to run without root privileges. This capability check doesn't seem to add any security since the device needs to have already been added via the assign device ioctl and the io actually occurs through the pci sysfs interface.

Right, so irq resource allocation can't be directly abused (by calling this ioctl out of order, for example) because the device must be assigned first via kvm_vm_ioctl_assign_device(). My only concern isn't with this patch per-se, but the exising kvm_vm_ioctl_assign_device().

thanks,
-chris

#2 lore raw
Quoted 11 lines · Chris Wright
Quoted 5 lines · * Alex Williamson ([email protected]) wrote:

Remove this check in an effort to allow kvm guests to run without root privileges. This capability check doesn't seem to add any security since the device needs to have already been added via the assign device ioctl and the io actually occurs through the pci sysfs interface.

Right, so irq resource allocation can't be directly abused (by calling this ioctl out of order, for example) because the device must be assigned first via kvm_vm_ioctl_assign_device(). My only concern isn't with this patch per-se, but the exising kvm_vm_ioctl_assign_device().

Yep, I agree. How do we decide the caller of the assign device ioctl has sufficient rights to the device without introducing another capabilities check? We won't get far if the resources are already claimed by a running driver, but we don't necessarily want anyone with /dev/kvm rights to be able to grab the remaining devices in the system.

Alex

#3 lore raw
In reply to Alex Williamson
Quoted 7 lines · Alex Williamson

Remove this check in an effort to allow kvm guests to run without root privileges. This capability check doesn't seem to add any security since the device needs to have already been added via the assign device ioctl and the io actually occurs through the pci sysfs interface.

Applied, thanks.