Primiano Tucci | c80f9e0 | 2017-12-21 03:51:15 +0100 | [diff] [blame] | 1 | # Perfetto user-space tracing daemon (unprivileged) |
| 2 | type traced, domain, coredomain; |
| 3 | type traced_exec, exec_type, file_type; |
| 4 | |
| 5 | # Allow init to exec the daemon. |
| 6 | init_daemon_domain(traced) |
| 7 | |
| 8 | # Allow traced to start with a lower scheduling class and change |
| 9 | # class accordingly to what defined in the config provided by |
| 10 | # the privileged process that controls it. |
| 11 | allow traced self:global_capability_class_set { sys_nice }; |
| 12 | |
| 13 | ### |
| 14 | ### Neverallow rules |
| 15 | ### |
| 16 | ### traced should NEVER do any of this |
| 17 | |
| 18 | # Disallow mapping executable memory (execstack and exec are already disallowed |
| 19 | # globally in domain.te). |
| 20 | neverallow traced self:process execmem; |
| 21 | |
| 22 | # Block device access. |
| 23 | neverallow traced dev_type:blk_file { read write }; |
| 24 | |
| 25 | # ptrace any other process |
| 26 | neverallow traced domain:process ptrace; |
| 27 | |
| 28 | # Disallows access to /data files, still allowing to write to file descriptors |
| 29 | # passed through the socket. |
| 30 | neverallow traced { data_file_type -system_data_file -zoneinfo_data_file }:dir *; |
| 31 | neverallow traced system_data_file:dir ~{ getattr search }; |
| 32 | neverallow traced zoneinfo_data_file:dir ~r_dir_perms; |
| 33 | neverallow traced { data_file_type -zoneinfo_data_file }:lnk_file *; |
| 34 | neverallow traced { data_file_type -zoneinfo_data_file }:file ~write; |
| 35 | |
| 36 | # Only init is allowed to enter the traced domain via exec() |
| 37 | neverallow { domain -init } traced:process transition; |
| 38 | neverallow * traced:process dyntransition; |