]> git.karo-electronics.de Git - karo-tx-linux.git/commit
KVM: Device assignment permission checks
authorAlex Williamson <alex.williamson@redhat.com>
Wed, 21 Dec 2011 04:59:09 +0000 (21:59 -0700)
committerPaul Gortmaker <paul.gortmaker@windriver.com>
Fri, 17 Aug 2012 19:35:04 +0000 (15:35 -0400)
commit46d9757e3c6e018f9b95d93752b5051d6100bb06
tree617cb52bdbbe82933786f171a7a4055540cc2790
parentbf46eeaae85b75371290f97f57e8f85afc1fd02c
KVM: Device assignment permission checks

commit 3d27e23b17010c668db311140b17bbbb70c78fb9 upstream.

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>
[PG: Drop Documentation api.txt chunk; 2.6.34 doesn't have the file]
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
virt/kvm/assigned-dev.c