libvirt-bin apparmor settings for usb host device
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
libvirt (Ubuntu) |
Fix Released
|
Medium
|
Unassigned | ||
Xenial |
Confirmed
|
Undecided
|
Unassigned | ||
Zesty |
Confirmed
|
Undecided
|
Unassigned | ||
Artful |
Fix Released
|
Medium
|
Unassigned |
Bug Description
[Impact]
* A while ago qemu switched to libusb, since then qemu fails to scan for
usb devices. Thereby it fails to use them for passthrough.
* This
* Fix by back-porting small upstream change
[Test Case]
* Create a VM Guest (e.g. via uvtool)
* Create a XMl file desrcibing a usb hostdev from your System (check lsusb for IDs)
* See the c#3 for XML examples
* Then add that to your guest with
$ virsh attach-device <guestname> <xml-describing
* Without the fix you'll see apparmor blocks and a fail to generate the rules
* With the fix it works
[Regression Potential]
* The change "only" allows to access a few more files udev populates. In
those it is still restricted to just USB types - that seems safe to me.
* If no USB devices are used in the guest config (or via hot-add) then it
is not initialized and thereby the rules not needed.
* But if users use USB Host devices they now can work due to the fix. And
"suddenly working" is not a regression but a fix.
[Other Info]
* I waited to be accepted upstream to be more confident which is
partially why this took so long but provides some extra confidence.
* This was long in discussion here since the suggestions always had a bit
of a very open blanket apparmor rule, but we now found a minimal one to
work and that was upstreamable.
---
This fix is for Ubuntu Xenial
The following file needs some fixes in order to work for usb host device access:
/etc/apparmor.
The line is wrong:
/sys/
correct is:
/sys/
This line is missing:
/run/udev/data/** r,
"The line is wrong: devices/ **/usb[ 0-9]*/* * r, devices/ */*/usb[ 0-9]*/* * r,"
/sys/
correct is:
/sys/
'/sys/devices/ **/usb[ 0-9]*/* *' is a superset of '/sys/devices/ */*/usb[ 0-9]*/* *', so this change should not be needed. '/run/udev/data/** r' grants a lot of information to all VMs and should not be added without more information.
Can you give steps to reproduce?