2018-03-02 20:27:06 +01:00
|
|
|
# Domain for atrace process.
|
|
|
|
# It is spawned either by traced_probes or by init for the boottrace service.
|
2017-02-07 19:54:20 +01:00
|
|
|
|
2018-09-27 19:21:37 +02:00
|
|
|
type atrace_exec, exec_type, file_type, system_file_type;
|
2017-02-07 19:54:20 +01:00
|
|
|
|
2018-03-02 20:27:06 +01:00
|
|
|
# boottrace services uses /data/misc/boottrace/categories
|
|
|
|
allow atrace boottrace_data_file:dir search;
|
|
|
|
allow atrace boottrace_data_file:file r_file_perms;
|
2017-02-07 19:54:20 +01:00
|
|
|
|
2018-03-02 20:27:06 +01:00
|
|
|
# Allow atrace to access tracefs.
|
|
|
|
allow atrace debugfs_tracing:dir r_dir_perms;
|
|
|
|
allow atrace debugfs_tracing:file rw_file_perms;
|
|
|
|
allow atrace debugfs_trace_marker:file getattr;
|
2017-02-07 19:54:20 +01:00
|
|
|
|
2022-02-24 14:04:21 +01:00
|
|
|
# Allow atrace to write data when a pipe is used for stdout/stderr.
|
|
|
|
# This is used by Perfetto to capture atrace stdout/stderr.
|
2018-11-16 13:17:24 +01:00
|
|
|
allow atrace traced_probes:fd use;
|
2022-02-24 14:04:21 +01:00
|
|
|
allow atrace traced_probes:fifo_file { getattr write };
|
2018-11-16 13:17:24 +01:00
|
|
|
|
2018-03-02 20:27:06 +01:00
|
|
|
# atrace sets debug.atrace.* properties
|
|
|
|
set_prop(atrace, debug_prop)
|
2017-02-07 19:54:20 +01:00
|
|
|
|
2018-03-02 20:27:06 +01:00
|
|
|
# atrace pokes all the binder-enabled processes at startup with a
|
|
|
|
# SYSPROPS_TRANSACTION, to tell them to reload the debug.atrace.* properties.
|
|
|
|
|
2019-05-15 17:45:04 +02:00
|
|
|
# Allow discovery of binder services.
|
2018-03-02 20:27:06 +01:00
|
|
|
allow atrace {
|
|
|
|
service_manager_type
|
2018-08-17 09:35:42 +02:00
|
|
|
-apex_service
|
2021-06-24 01:53:45 +02:00
|
|
|
-dnsresolver_service
|
|
|
|
-dumpstate_service
|
2018-03-02 20:27:06 +01:00
|
|
|
-incident_service
|
2021-06-24 01:53:45 +02:00
|
|
|
-installd_service
|
|
|
|
-lpdump_service
|
2021-12-09 04:49:23 +01:00
|
|
|
-mdns_service
|
2018-03-02 20:27:06 +01:00
|
|
|
-netd_service
|
|
|
|
-stats_service
|
2021-06-24 01:53:45 +02:00
|
|
|
-tracingproxy_service
|
2018-03-02 20:27:06 +01:00
|
|
|
-vold_service
|
2020-01-21 19:18:57 +01:00
|
|
|
-default_android_service
|
2018-03-02 20:27:06 +01:00
|
|
|
}:service_manager { find };
|
|
|
|
allow atrace servicemanager:service_manager list;
|
2017-02-07 19:54:20 +01:00
|
|
|
|
2019-05-15 17:45:04 +02:00
|
|
|
# Allow notifying the processes hosting specific binder services that
|
|
|
|
# trace-related system properties have changed.
|
|
|
|
binder_use(atrace)
|
|
|
|
allow atrace surfaceflinger:binder call;
|
|
|
|
allow atrace system_server:binder call;
|
|
|
|
allow atrace cameraserver:binder call;
|
|
|
|
|
|
|
|
# Similarly, on debug builds, allow specific HALs to be notified that
|
|
|
|
# trace-related system properties have changed.
|
|
|
|
userdebug_or_eng(`
|
|
|
|
# List HAL interfaces.
|
|
|
|
allow atrace hwservicemanager:hwservice_manager list;
|
|
|
|
# Notify the camera HAL.
|
|
|
|
hal_client_domain(atrace, hal_camera)
|
2019-06-17 05:25:05 +02:00
|
|
|
hal_client_domain(atrace, hal_vibrator)
|
2019-05-15 17:45:04 +02:00
|
|
|
')
|
|
|
|
|
2020-07-31 20:28:11 +02:00
|
|
|
# Remove logspam from notification attempts to non-allowlisted services.
|
2019-05-15 17:45:04 +02:00
|
|
|
dontaudit atrace hwservice_manager_type:hwservice_manager find;
|
|
|
|
dontaudit atrace service_manager_type:service_manager find;
|
|
|
|
dontaudit atrace domain:binder call;
|
|
|
|
|
|
|
|
# atrace can call atrace HAL
|
|
|
|
hal_client_domain(atrace, hal_atrace)
|
|
|
|
|
|
|
|
get_prop(atrace, hwservicemanager_prop)
|
|
|
|
|
2018-03-02 20:27:06 +01:00
|
|
|
userdebug_or_eng(`
|
|
|
|
# atrace is generally invoked as a standalone binary from shell or perf
|
|
|
|
# daemons like Perfetto traced_probes. However, in userdebug builds, there is
|
|
|
|
# a further option to run atrace as an init daemon for boot tracing.
|
|
|
|
init_daemon_domain(atrace)
|
|
|
|
|
|
|
|
allow atrace debugfs_tracing_debug:dir r_dir_perms;
|
|
|
|
allow atrace debugfs_tracing_debug:file rw_file_perms;
|
2016-12-10 05:14:31 +01:00
|
|
|
')
|