blob: 531ecc29cad320e0dd9a511d31b2bdc5109b873e [file] [log] [blame]
Primiano Tuccic80f9e02017-12-21 03:51:15 +01001# Perfetto user-space tracing daemon (unprivileged)
2type traced, domain, coredomain;
3type traced_exec, exec_type, file_type;
4
5# Allow init to exec the daemon.
6init_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.
11allow 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).
20neverallow traced self:process execmem;
21
22# Block device access.
23neverallow traced dev_type:blk_file { read write };
24
25# ptrace any other process
26neverallow 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 Stoepd25ccab2018-02-07 16:29:06 -080030neverallow 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 *;
38neverallow traced { system_data_file }:dir ~{ getattr search };
Primiano Tuccic80f9e02017-12-21 03:51:15 +010039neverallow traced zoneinfo_data_file:dir ~r_dir_perms;
40neverallow traced { data_file_type -zoneinfo_data_file }:lnk_file *;
41neverallow traced { data_file_type -zoneinfo_data_file }:file ~write;
42
43# Only init is allowed to enter the traced domain via exec()
44neverallow { domain -init } traced:process transition;
45neverallow * traced:process dyntransition;