blob: 2a0bd374d1a0e3525066b1a98a58a4d99c08018c [file] [log] [blame]
Inseob Kim825056d2023-08-01 11:00:49 +09001# vfio_handler is a helper service for VFIO tasks, like binding platform devices to VFIO driver.
2# vfio_handler is separate from virtualizationservice as VFIO tasks require root.
3type vfio_handler, domain, coredomain;
4type vfio_handler_exec, system_file_type, exec_type, file_type;
5
6# When init runs a file labelled with vfio_handler_exec, run it in the vfio_handler domain.
7init_daemon_domain(vfio_handler)
8
9# Let the vfio_handler domain register the vfio_handler_service with ServiceManager.
10add_service(vfio_handler, vfio_handler_service)
11
12# Let the vfio_handler domain use Binder.
13binder_use(vfio_handler)
14
15# Allow vfio_handler to check if VFIO is supported
16allow vfio_handler vfio_device:chr_file getattr;
17allow vfio_handler vfio_device:dir r_dir_perms;
18
19# Allow vfio_handler to bind/unbind platform devices
20allow vfio_handler sysfs:dir r_dir_perms;
21allow vfio_handler sysfs:file rw_file_perms;
22
Inseob Kimbbe514d2023-08-03 12:53:48 +090023# Allow vfio_handler to write to VM DTBO via a file created by virtualizationmanager.
24allow vfio_handler virtualizationmanager:fd use;
25allow vfio_handler virtualizationservice_data_file:file write;
26
27# vfio_handler can only use fd from virtualizationmanager, and can't open files itself
28neverallow vfio_handler virtualizationservice_data_file:file { open create };
29
Inseob Kim825056d2023-08-01 11:00:49 +090030# Only vfio_handler can add vfio_handler_service
31neverallow { domain -vfio_handler } vfio_handler_service:service_manager add;