blob: 563854368107938b62b9180a5e69c4db245167d8 [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
Trevor David Black4105da22024-02-15 22:10:39 +000028# Allow shell access
29allow gpuservice adbd:fd use;
30allow gpuservice adbd:unix_stream_socket { getattr read write };
31allow gpuservice shell:fifo_file { getattr read write };
Yiwei Zhangff0f79c2018-11-27 15:21:43 -080032
Adithya Srinivasan82911e92020-06-19 11:02:28 -070033# Needed for perfetto producer.
34perfetto_producer(gpuservice)
35
Yiwei Zhang6e8191e2019-01-23 14:28:56 -080036# Needed for interactive shell
37allow gpuservice devpts:chr_file { read write getattr };
38
Yiwei Zhang0051c932019-05-09 23:15:49 -070039# Needed for dumpstate to dumpsys gpu.
40allow gpuservice dumpstate:fd use;
41allow gpuservice dumpstate:fifo_file write;
42
Yiwei Zhangdbbe3bd2020-02-04 15:55:59 -080043# Needed for stats callback registration to statsd.
44allow gpuservice stats_service:service_manager find;
Jeffrey Huangb481e322020-02-06 11:54:33 -080045allow gpuservice statsmanager_service:service_manager find;
46# TODO(b/146461633): remove this once native pullers talk to StatsManagerService
Yiwei Zhangdbbe3bd2020-02-04 15:55:59 -080047binder_call(gpuservice, statsd);
48
Yiwei Zhang4b63ce92020-02-18 22:58:26 -080049# Needed for reading tracepoint ids in order to attach bpf programs.
50allow gpuservice debugfs_tracing:file r_file_perms;
51allow gpuservice self:perf_event { cpu kernel open write };
52neverallow gpuservice self:perf_event ~{ cpu kernel open write };
53
54# Needed for interact with bpf fs.
Paul Thomson4c834ad2022-01-17 16:34:03 +000055# Write is needed to open read/write bpf maps.
Paul Thomson4c834ad2022-01-17 16:34:03 +000056allow gpuservice fs_bpf:file { read write };
Yiwei Zhang4b63ce92020-02-18 22:58:26 -080057
Paul Thomson4c834ad2022-01-17 16:34:03 +000058# Needed for enabling bpf programs and accessing bpf maps (read-only and read/write).
59allow gpuservice bpfloader:bpf { map_read map_write prog_run };
Yiwei Zhang4b63ce92020-02-18 22:58:26 -080060
Peiyong Lin7924dc62018-11-01 13:47:51 -070061add_service(gpuservice, gpu_service)
62
Yuxin Hu889dd072023-04-09 00:15:43 +000063# Needed for enabling write access to persist.graphics.egl from developer option switch UI, through gpuservice.
64set_prop(gpuservice, graphics_config_writable_prop)
65
Peiyong Lin54229d82023-05-03 17:12:39 +000066neverallow { domain -init -vendor_init -gpuservice } graphics_config_writable_prop:property_service set;
67
Yuxin Hufce99d92023-04-17 04:12:43 +000068# Needed for querying permission
69allow gpuservice permission_service:service_manager find;
70
Peiyong Lin7924dc62018-11-01 13:47:51 -070071# Only uncomment below line when in development
72# userdebug_or_eng(`permissive gpuservice;')