]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: Device assignment permission checks
authorAlex Williamson <alex.williamson@redhat.com>
Wed, 21 Dec 2011 04:59:09 +0000 (21:59 -0700)
committerAvi Kivity <avi@redhat.com>
Sun, 25 Dec 2011 17:03:54 +0000 (19:03 +0200)
commit24b93b598488ec29cbad6eb686099cedcda9639f
treed3d87399212b2dda0bbf6616e4a580b35e7d7760
parent65b90b85a3b6d2dfc0c168134eb168ff95f4be82
KVM: Device assignment permission checks

Only allow KVM device assignment to attach to devices which:

 - Are not bridges
 - Have BAR resources (assume others are special devices)
 - The user has permissions to use

Assigning a bridge is a configuration error, it's not supported, and
typically doesn't result in the behavior the user is expecting anyway.
Devices without BAR resources are typically chipset components that
also don't have host drivers.  We don't want users to hold such devices
captive or cause system problems by fencing them off into an iommu
domain.  We determine "permission to use" by testing whether the user
has access to the PCI sysfs resource files.  By default a normal user
will not have access to these files, so it provides a good indication
that an administration agent has granted the user access to the device.

[Yang Bai: add missing #include]
[avi: fix comment style]

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Yang Bai <hamo.by@gmail.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Documentation/virtual/kvm/api.txt
virt/kvm/assigned-dev.c