blob: 8388e899718ee96dbd6676b2317857afe0c59b40 [file] [log] [blame]
Yiwei Zhang544d6b32019-02-07 15:00:55 -08001# gpuservice - server for gpu stats and other gpu related services
2typeattribute gpuservice coredomain;
Steven Moreland65981752022-02-10 00:32:44 +00003typeattribute gpuservice bpfdomain;
4
Peiyong Lin7924dc62018-11-01 13:47:51 -07005type gpuservice_exec, system_file_type, exec_type, file_type;
6
7init_daemon_domain(gpuservice)
8
9binder_call(gpuservice, adbd)
10binder_call(gpuservice, shell)
Jeffrey Huangb481e322020-02-06 11:54:33 -080011binder_call(gpuservice, system_server)
Peiyong Lin7924dc62018-11-01 13:47:51 -070012binder_use(gpuservice)
13
14# Access the GPU.
15allow gpuservice gpu_device:chr_file rw_file_perms;
16
17# GPU service will need to load GPU driver, for example Vulkan driver in order
18# to get the capability of the driver.
19allow gpuservice same_process_hal_file:file { open read getattr execute map };
20allow gpuservice ion_device:chr_file r_file_perms;
21get_prop(gpuservice, hwservicemanager_prop)
22hwbinder_use(gpuservice)
23
24# Access /dev/graphics/fb0.
25allow gpuservice graphics_device:dir search;
26allow gpuservice graphics_device:chr_file rw_file_perms;
27
Yiwei Zhangff0f79c2018-11-27 15:21:43 -080028# Needed for dumpsys pipes.
29allow gpuservice shell:fifo_file write;
30
Adithya Srinivasan82911e92020-06-19 11:02:28 -070031# Needed for perfetto producer.
32perfetto_producer(gpuservice)
33
Peiyong Lin7924dc62018-11-01 13:47:51 -070034# Use socket supplied by adbd, for cmd gpu vkjson etc.
35allow gpuservice adbd:unix_stream_socket { read write getattr };
36
Yiwei Zhang6e8191e2019-01-23 14:28:56 -080037# Needed for interactive shell
38allow gpuservice devpts:chr_file { read write getattr };
39
Yiwei Zhang0051c932019-05-09 23:15:49 -070040# Needed for dumpstate to dumpsys gpu.
41allow gpuservice dumpstate:fd use;
42allow gpuservice dumpstate:fifo_file write;
43
Yiwei Zhangdbbe3bd2020-02-04 15:55:59 -080044# Needed for stats callback registration to statsd.
45allow gpuservice stats_service:service_manager find;
Jeffrey Huangb481e322020-02-06 11:54:33 -080046allow gpuservice statsmanager_service:service_manager find;
47# TODO(b/146461633): remove this once native pullers talk to StatsManagerService
Yiwei Zhangdbbe3bd2020-02-04 15:55:59 -080048binder_call(gpuservice, statsd);
49
Yiwei Zhang4b63ce92020-02-18 22:58:26 -080050# Needed for reading tracepoint ids in order to attach bpf programs.
51allow gpuservice debugfs_tracing:file r_file_perms;
52allow gpuservice self:perf_event { cpu kernel open write };
53neverallow gpuservice self:perf_event ~{ cpu kernel open write };
54
55# Needed for interact with bpf fs.
Paul Thomson4c834ad2022-01-17 16:34:03 +000056# Write is needed to open read/write bpf maps.
Paul Thomson4c834ad2022-01-17 16:34:03 +000057allow gpuservice fs_bpf:file { read write };
Yiwei Zhang4b63ce92020-02-18 22:58:26 -080058
Paul Thomson4c834ad2022-01-17 16:34:03 +000059# Needed for enabling bpf programs and accessing bpf maps (read-only and read/write).
60allow gpuservice bpfloader:bpf { map_read map_write prog_run };
Yiwei Zhang4b63ce92020-02-18 22:58:26 -080061
Peiyong Lin7924dc62018-11-01 13:47:51 -070062add_service(gpuservice, gpu_service)
63
64# Only uncomment below line when in development
65# userdebug_or_eng(`permissive gpuservice;')