blob: 31ad7881548dd7f3045bb080bdcbf6a9e51f20c2 [file] [log] [blame]
Yiwei Zhang544d6b32019-02-07 15:00:55 -08001# gpuservice - server for gpu stats and other gpu related services
2typeattribute gpuservice coredomain;
Peiyong Lin7924dc62018-11-01 13:47:51 -07003type gpuservice_exec, system_file_type, exec_type, file_type;
4
5init_daemon_domain(gpuservice)
6
7binder_call(gpuservice, adbd)
8binder_call(gpuservice, shell)
Jeffrey Huangb481e322020-02-06 11:54:33 -08009binder_call(gpuservice, system_server)
Peiyong Lin7924dc62018-11-01 13:47:51 -070010binder_use(gpuservice)
11
12# Access the GPU.
13allow gpuservice gpu_device:chr_file rw_file_perms;
14
15# GPU service will need to load GPU driver, for example Vulkan driver in order
16# to get the capability of the driver.
17allow gpuservice same_process_hal_file:file { open read getattr execute map };
18allow gpuservice ion_device:chr_file r_file_perms;
19get_prop(gpuservice, hwservicemanager_prop)
20hwbinder_use(gpuservice)
21
22# Access /dev/graphics/fb0.
23allow gpuservice graphics_device:dir search;
24allow gpuservice graphics_device:chr_file rw_file_perms;
25
Yiwei Zhangff0f79c2018-11-27 15:21:43 -080026# Needed for dumpsys pipes.
27allow gpuservice shell:fifo_file write;
28
Peiyong Lin7924dc62018-11-01 13:47:51 -070029# Use socket supplied by adbd, for cmd gpu vkjson etc.
30allow gpuservice adbd:unix_stream_socket { read write getattr };
31
Yiwei Zhang6e8191e2019-01-23 14:28:56 -080032# Needed for interactive shell
33allow gpuservice devpts:chr_file { read write getattr };
34
Yiwei Zhang0051c932019-05-09 23:15:49 -070035# Needed for dumpstate to dumpsys gpu.
36allow gpuservice dumpstate:fd use;
37allow gpuservice dumpstate:fifo_file write;
38
Yiwei Zhangdbbe3bd2020-02-04 15:55:59 -080039# Needed for stats callback registration to statsd.
40allow gpuservice stats_service:service_manager find;
Jeffrey Huangb481e322020-02-06 11:54:33 -080041allow gpuservice statsmanager_service:service_manager find;
42# TODO(b/146461633): remove this once native pullers talk to StatsManagerService
Yiwei Zhangdbbe3bd2020-02-04 15:55:59 -080043binder_call(gpuservice, statsd);
44
Yiwei Zhang4b63ce92020-02-18 22:58:26 -080045# Needed for reading tracepoint ids in order to attach bpf programs.
46allow gpuservice debugfs_tracing:file r_file_perms;
47allow gpuservice self:perf_event { cpu kernel open write };
48neverallow gpuservice self:perf_event ~{ cpu kernel open write };
49
50# Needed for interact with bpf fs.
51allow gpuservice fs_bpf:dir search;
52allow gpuservice fs_bpf:file read;
53
54# Needed for enable the bpf program and read the map.
55allow gpuservice bpfloader:bpf { map_read prog_run };
56
57# Needed for getting a prop to ensure bpf programs loaded.
58get_prop(gpuservice, bpf_progs_loaded_prop)
59
Peiyong Lin7924dc62018-11-01 13:47:51 -070060add_service(gpuservice, gpu_service)
61
62# Only uncomment below line when in development
63# userdebug_or_eng(`permissive gpuservice;')