Minor 0 is the VFIO container device (/dev/vfio/vfio). On it's own the container does not provide a user with any privileged access. It only supports API version check and extension check ioctls. Only by attaching a VFIO group to the container does it gain any access. Set the mode of the container to allow access.
Unified · Split
| @@ -27,6 +27,7 @@ · 26 unmodified lines | ||
| 27 | 27 | #include <linux/rwsem.h> |
| 28 | 28 | #include <linux/sched.h> |
| 29 | 29 | #include <linux/slab.h> |
| 30 | +#include <linux/stat.h> | |
| 30 | 31 | #include <linux/string.h> |
| 31 | 32 | #include <linux/uaccess.h> |
| 32 | 33 | #include <linux/vfio.h> |
| @@ -1359,6 +1360,9 @@ static const struct file_operations vfio_device_fops = { · 1326 unmodified lines | ||
| 1359 | 1360 | */ |
| 1360 | 1361 | static char *vfio_devnode(struct device *dev, umode_t *mode) |
| 1361 | 1362 | { |
| 1363 | + if (MINOR(dev->devt) == 0) | |
| 1364 | + *mode = S_IRUGO | S_IWUGO; | |
| 1365 | + | |
| 1362 | 1366 | return kasprintf(GFP_KERNEL, "vfio/%s", dev_name(dev)); |
| 1363 | 1367 | } |
| 1364 | 1368 | |