2019-02-08 00:00:55 +01:00
|
|
|
# gpuservice - server for gpu stats and other gpu related services
|
|
|
|
typeattribute gpuservice coredomain;
|
2022-02-10 01:32:44 +01:00
|
|
|
typeattribute gpuservice bpfdomain;
|
|
|
|
|
2018-11-01 21:47:51 +01:00
|
|
|
type gpuservice_exec, system_file_type, exec_type, file_type;
|
|
|
|
|
|
|
|
init_daemon_domain(gpuservice)
|
|
|
|
|
|
|
|
binder_call(gpuservice, adbd)
|
|
|
|
binder_call(gpuservice, shell)
|
2020-02-06 20:54:33 +01:00
|
|
|
binder_call(gpuservice, system_server)
|
2018-11-01 21:47:51 +01:00
|
|
|
binder_use(gpuservice)
|
|
|
|
|
|
|
|
# Access the GPU.
|
|
|
|
allow gpuservice gpu_device:chr_file rw_file_perms;
|
|
|
|
|
|
|
|
# GPU service will need to load GPU driver, for example Vulkan driver in order
|
|
|
|
# to get the capability of the driver.
|
|
|
|
allow gpuservice same_process_hal_file:file { open read getattr execute map };
|
|
|
|
allow gpuservice ion_device:chr_file r_file_perms;
|
|
|
|
get_prop(gpuservice, hwservicemanager_prop)
|
|
|
|
hwbinder_use(gpuservice)
|
|
|
|
|
|
|
|
# Access /dev/graphics/fb0.
|
|
|
|
allow gpuservice graphics_device:dir search;
|
|
|
|
allow gpuservice graphics_device:chr_file rw_file_perms;
|
|
|
|
|
2024-02-15 23:10:39 +01:00
|
|
|
# Allow shell access
|
|
|
|
allow gpuservice adbd:fd use;
|
|
|
|
allow gpuservice adbd:unix_stream_socket { getattr read write };
|
|
|
|
allow gpuservice shell:fifo_file { getattr read write };
|
2018-11-28 00:21:43 +01:00
|
|
|
|
2020-06-19 20:02:28 +02:00
|
|
|
# Needed for perfetto producer.
|
|
|
|
perfetto_producer(gpuservice)
|
|
|
|
|
2019-01-23 23:28:56 +01:00
|
|
|
# Needed for interactive shell
|
|
|
|
allow gpuservice devpts:chr_file { read write getattr };
|
|
|
|
|
2019-05-10 08:15:49 +02:00
|
|
|
# Needed for dumpstate to dumpsys gpu.
|
|
|
|
allow gpuservice dumpstate:fd use;
|
|
|
|
allow gpuservice dumpstate:fifo_file write;
|
|
|
|
|
2020-02-05 00:55:59 +01:00
|
|
|
# Needed for stats callback registration to statsd.
|
|
|
|
allow gpuservice stats_service:service_manager find;
|
2020-02-06 20:54:33 +01:00
|
|
|
allow gpuservice statsmanager_service:service_manager find;
|
|
|
|
# TODO(b/146461633): remove this once native pullers talk to StatsManagerService
|
2020-02-05 00:55:59 +01:00
|
|
|
binder_call(gpuservice, statsd);
|
|
|
|
|
2020-02-19 07:58:26 +01:00
|
|
|
# Needed for reading tracepoint ids in order to attach bpf programs.
|
|
|
|
allow gpuservice debugfs_tracing:file r_file_perms;
|
|
|
|
allow gpuservice self:perf_event { cpu kernel open write };
|
|
|
|
neverallow gpuservice self:perf_event ~{ cpu kernel open write };
|
|
|
|
|
|
|
|
# Needed for interact with bpf fs.
|
2022-01-17 17:34:03 +01:00
|
|
|
# Write is needed to open read/write bpf maps.
|
|
|
|
allow gpuservice fs_bpf:file { read write };
|
2020-02-19 07:58:26 +01:00
|
|
|
|
2022-01-17 17:34:03 +01:00
|
|
|
# Needed for enabling bpf programs and accessing bpf maps (read-only and read/write).
|
|
|
|
allow gpuservice bpfloader:bpf { map_read map_write prog_run };
|
2020-02-19 07:58:26 +01:00
|
|
|
|
2018-11-01 21:47:51 +01:00
|
|
|
add_service(gpuservice, gpu_service)
|
|
|
|
|
2023-04-09 02:15:43 +02:00
|
|
|
# Needed for enabling write access to persist.graphics.egl from developer option switch UI, through gpuservice.
|
|
|
|
set_prop(gpuservice, graphics_config_writable_prop)
|
|
|
|
|
2023-05-03 19:12:39 +02:00
|
|
|
neverallow { domain -init -vendor_init -gpuservice } graphics_config_writable_prop:property_service set;
|
|
|
|
|
2023-04-17 06:12:43 +02:00
|
|
|
# Needed for querying permission
|
|
|
|
allow gpuservice permission_service:service_manager find;
|
|
|
|
|
2018-11-01 21:47:51 +01:00
|
|
|
# Only uncomment below line when in development
|
|
|
|
# userdebug_or_eng(`permissive gpuservice;')
|