Skip to content

kvm: Lock down device assignment

Alex Williamson kvm lkml 3 versions – Applied

Status from this message: Applied, thanks.

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest2 patches 2 repliesApplied
  2. v22 patches 2 repliesSuperseded
  3. v12 patches 8 repliesSuperseded

Patches in v3 Applied

#Subject and filesSizeRepliesApplied
1/2kvm: Remove ability to assign a device without iommu supportDocumentation/virtual/kvm/api.txt virt/kvm/assigned-dev.c+12 -90 replies
2/2kvm: Device assignment permission checksDocumentation/virtual/kvm/api.txt virt/kvm/assigned-dev.c+76 -01 reply

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v3 yet.

Read the v3 thread

Cover letter [PATCH v3 0/2] kvm: Lock down device assignment

v2: Update API documentation for each patch
v3: Incorporate Sasha's comments: kobject path, separate func, and CONFIG_SYSFS

Two patches to try to better secure the device assignment ioctl. This firt patch makes KVM_DEV_ASSIGN_ENABLE_IOMMU a mandatory option when assigning a device. I don't believe we have any users of this option, so I think we can skip any deprecation period, especially since it's existence is rather dangerous.

The second patch introduces some file permission checking that Avi suggested. If a user has been granted read/write permission to the PCI sysfs BAR resource files, this is a good indication that they have access to the device. We can't call sys_faccessat directly (not exported), but the important bits are self contained enough to include directly. This still works with sudo and libvirt usage, the latter already grants qemu permission to these files. Thanks,

Alex

---

Alex Williamson (2):
kvm: Device assignment permission checks
kvm: Remove ability to assign a device without iommu support

 Documentation/virtual/kvm/api.txt |    7 +++
 virt/kvm/assigned-dev.c           |   90 +++++++++++++++++++++++++++++++++----
 2 files changed, 88 insertions(+), 9 deletions(-)