atrace.te 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. # Domain for atrace process.
  2. # It is spawned either by traced_probes or by init for the boottrace service.
  3. type atrace, domain, coredomain;
  4. type atrace_exec, exec_type, file_type, system_file_type;
  5. # boottrace services uses /data/misc/boottrace/categories
  6. allow atrace boottrace_data_file:dir search;
  7. allow atrace boottrace_data_file:file r_file_perms;
  8. # Allow atrace to access tracefs.
  9. allow atrace debugfs_tracing:dir r_dir_perms;
  10. allow atrace debugfs_tracing:file rw_file_perms;
  11. allow atrace debugfs_trace_marker:file getattr;
  12. # Allow atrace to write data when a pipe is used for stdout/stderr
  13. # This is used by Perfetto to capture the output on error in atrace.
  14. allow atrace traced_probes:fd use;
  15. allow atrace traced_probes:fifo_file write;
  16. # atrace sets debug.atrace.* properties
  17. set_prop(atrace, debug_prop)
  18. # atrace pokes all the binder-enabled processes at startup with a
  19. # SYSPROPS_TRANSACTION, to tell them to reload the debug.atrace.* properties.
  20. # Allow discovery of binder services.
  21. allow atrace {
  22. service_manager_type
  23. -apex_service
  24. -incident_service
  25. -iorapd_service
  26. -netd_service
  27. -dnsresolver_service
  28. -stats_service
  29. -dumpstate_service
  30. -installd_service
  31. -vold_service
  32. -lpdump_service
  33. }:service_manager { find };
  34. allow atrace servicemanager:service_manager list;
  35. # Allow notifying the processes hosting specific binder services that
  36. # trace-related system properties have changed.
  37. binder_use(atrace)
  38. allow atrace healthd:binder call;
  39. allow atrace surfaceflinger:binder call;
  40. allow atrace system_server:binder call;
  41. allow atrace cameraserver:binder call;
  42. # Similarly, on debug builds, allow specific HALs to be notified that
  43. # trace-related system properties have changed.
  44. userdebug_or_eng(`
  45. # List HAL interfaces.
  46. allow atrace hwservicemanager:hwservice_manager list;
  47. # Notify the camera HAL.
  48. hal_client_domain(atrace, hal_camera)
  49. ')
  50. # Remove logspam from notification attempts to non-whitelisted services.
  51. dontaudit atrace hwservice_manager_type:hwservice_manager find;
  52. dontaudit atrace service_manager_type:service_manager find;
  53. dontaudit atrace domain:binder call;
  54. # atrace can call atrace HAL
  55. hal_client_domain(atrace, hal_atrace)
  56. get_prop(atrace, hwservicemanager_prop)
  57. userdebug_or_eng(`
  58. # atrace is generally invoked as a standalone binary from shell or perf
  59. # daemons like Perfetto traced_probes. However, in userdebug builds, there is
  60. # a further option to run atrace as an init daemon for boot tracing.
  61. init_daemon_domain(atrace)
  62. allow atrace debugfs_tracing_debug:dir r_dir_perms;
  63. allow atrace debugfs_tracing_debug:file rw_file_perms;
  64. ')