Merge "Add rules for Perfetto to be used from system_server" into main
diff --git a/private/perfetto.te b/private/perfetto.te
index a87f2ad..aae61a6 100644
--- a/private/perfetto.te
+++ b/private/perfetto.te
@@ -40,7 +40,7 @@
# (both root and non-root) on stdin and also to write the resulting trace to
# stdout.
allow perfetto { statsd mm_events shell su }:fd use;
-allow perfetto { statsd mm_events shell su }:fifo_file { getattr read write };
+allow perfetto { statsd mm_events shell su system_server }:fifo_file { getattr read write ioctl };
# Allow to communicate use, read and write over the adb connection.
allow perfetto adbd:fd use;
diff --git a/private/system_server.te b/private/system_server.te
index 7836695..e5ade71 100644
--- a/private/system_server.te
+++ b/private/system_server.te
@@ -578,6 +578,10 @@
allow system_server perfetto_traces_data_file:file { read getattr };
allow system_server perfetto:fd use;
+# Allow system_server to exec the perfetto cmdline client and pass it a trace config
+domain_auto_trans(system_server, perfetto_exec, perfetto);
+allow system_server perfetto:fifo_file { read write };
+
# Manage /data/backup.
allow system_server backup_data_file:dir create_dir_perms;
allow system_server backup_data_file:file create_file_perms;
@@ -1292,7 +1296,7 @@
# Ensure that system_server doesn't perform any domain transitions other than
# transitioning to the crash_dump domain when a crash occurs or fork clatd.
-neverallow system_server { domain -clatd -crash_dump }:process transition;
+neverallow system_server { domain -clatd -crash_dump -perfetto }:process transition;
neverallow system_server *:process dyntransition;
# Only allow crash_dump to connect to system_ndebug_socket.