blob: b6d03117c87ee3f67c8c9a71d7e39e9373574d87 [file] [log] [blame]
Primiano Tuccic80f9e02017-12-21 03:51:15 +01001# Perfetto user-space tracing daemon (unprivileged)
Primiano Tucci5ef66692018-02-21 13:44:39 +00002type traced, domain, coredomain, mlstrustedsubject;
Primiano Tuccic80f9e02017-12-21 03:51:15 +01003type traced_exec, exec_type, file_type;
4
5# Allow init to exec the daemon.
6init_daemon_domain(traced)
7
Primiano Tucci5ef66692018-02-21 13:44:39 +00008# Allow apps in other MLS contexts (for multi-user) to access
9# share memory buffers created by traced.
10typeattribute traced_tmpfs mlstrustedobject;
11
Primiano Tuccic80f9e02017-12-21 03:51:15 +010012# Allow traced to start with a lower scheduling class and change
13# class accordingly to what defined in the config provided by
14# the privileged process that controls it.
15allow traced self:global_capability_class_set { sys_nice };
16
17###
18### Neverallow rules
19###
20### traced should NEVER do any of this
21
22# Disallow mapping executable memory (execstack and exec are already disallowed
23# globally in domain.te).
24neverallow traced self:process execmem;
25
26# Block device access.
27neverallow traced dev_type:blk_file { read write };
28
29# ptrace any other process
30neverallow traced domain:process ptrace;
31
32# Disallows access to /data files, still allowing to write to file descriptors
33# passed through the socket.
Jeff Vander Stoepd25ccab2018-02-07 16:29:06 -080034neverallow traced {
35 data_file_type
36 -system_data_file
37 # TODO(b/72998741) Remove vendor_data_file exemption. Further restricted in a
38 # subsequent neverallow. Currently only getattr and search are allowed.
39 -vendor_data_file
40 -zoneinfo_data_file
41}:dir *;
42neverallow traced { system_data_file }:dir ~{ getattr search };
Primiano Tuccic80f9e02017-12-21 03:51:15 +010043neverallow traced zoneinfo_data_file:dir ~r_dir_perms;
44neverallow traced { data_file_type -zoneinfo_data_file }:lnk_file *;
45neverallow traced { data_file_type -zoneinfo_data_file }:file ~write;
46
47# Only init is allowed to enter the traced domain via exec()
48neverallow { domain -init } traced:process transition;
49neverallow * traced:process dyntransition;