From e37743292464cd8ae4f3d198c318bbe4ab3e71a8 Mon Sep 17 00:00:00 2001 From: Jakob Vukalovic Date: Tue, 11 Jul 2023 10:28:53 +0100 Subject: [PATCH] ueventd: Fix creation of VFIO dev nodes VFIO nodes, both the container (`vfio`) node and group (numbered) nodes, should be located in `/dev/vfio`. This change prevents ueventd from flattening that structure. Test: Bind a device to VFIO driver to create a VFIO group Change-Id: I635e9febe6bb52718df263e735479f361eacad4c --- init/devices.cpp | 2 ++ rootdir/ueventd.rc | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/init/devices.cpp b/init/devices.cpp index d29ffd604..7c234924b 100644 --- a/init/devices.cpp +++ b/init/devices.cpp @@ -568,6 +568,8 @@ void DeviceHandler::HandleUevent(const Uevent& uevent) { return; } else if (uevent.subsystem == "misc" && StartsWith(uevent.device_name, "dm-user/")) { devpath = "/dev/dm-user/" + uevent.device_name.substr(8); + } else if (uevent.subsystem == "misc" && uevent.device_name == "vfio/vfio") { + devpath = "/dev/" + uevent.device_name; } else { devpath = "/dev/" + Basename(uevent.path); } diff --git a/rootdir/ueventd.rc b/rootdir/ueventd.rc index 0b7ffb8ea..60dcc2a95 100644 --- a/rootdir/ueventd.rc +++ b/rootdir/ueventd.rc @@ -23,6 +23,11 @@ subsystem sound subsystem dma_heap devname uevent_devpath dirname /dev/dma_heap + +subsystem vfio + devname uevent_devpath + dirname /dev/vfio + # ueventd can only set permissions on device nodes and their associated # sysfs attributes, not on arbitrary paths. # @@ -43,6 +48,7 @@ subsystem dma_heap /dev/binder 0666 root root /dev/hwbinder 0666 root root /dev/vndbinder 0666 root root +/dev/vfio/* 0666 root root /dev/pmsg0 0222 root log /dev/dma_heap/system 0444 system system