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. |
Jeff Vander Stoep | d25ccab | 2018-02-07 16:29:06 -0800 | [diff] [blame^] | 30 | neverallow traced { |
| 31 | data_file_type |
| 32 | -system_data_file |
| 33 | # TODO(b/72998741) Remove vendor_data_file exemption. Further restricted in a |
| 34 | # subsequent neverallow. Currently only getattr and search are allowed. |
| 35 | -vendor_data_file |
| 36 | -zoneinfo_data_file |
| 37 | }:dir *; |
| 38 | neverallow traced { system_data_file }:dir ~{ getattr search }; |
Primiano Tucci | c80f9e0 | 2017-12-21 03:51:15 +0100 | [diff] [blame] | 39 | neverallow traced zoneinfo_data_file:dir ~r_dir_perms; |
| 40 | neverallow traced { data_file_type -zoneinfo_data_file }:lnk_file *; |
| 41 | neverallow traced { data_file_type -zoneinfo_data_file }:file ~write; |
| 42 | |
| 43 | # Only init is allowed to enter the traced domain via exec() |
| 44 | neverallow { domain -init } traced:process transition; |
| 45 | neverallow * traced:process dyntransition; |