blob: 15c51d4cd8561d64cc55fa7cb4002f9740d37abf [file] [log] [blame]
Primiano Tuccic80f9e02017-12-21 03:51:15 +01001# Perfetto tracing probes, has tracefs access.
2type traced_probes, domain, coredomain;
3type traced_probes_exec, exec_type, file_type;
4
5# Allow init to exec the daemon.
6init_daemon_domain(traced_probes)
7
8# Write trace data to the Perfetto traced damon. This requires connecting to its
9# producer socket and obtaining a (per-process) tmpfs fd.
10allow traced_probes traced:fd use;
11allow traced_probes traced_tmpfs:file { read write getattr map };
12unix_socket_connect(traced_probes, traced_producer, traced)
13
14# Allow traced_probes to access tracefs.
15# TODO(primiano): For the moment this is userdebug/eng only until we get an
16# approval for user builds.
17userdebug_or_eng(`
18allow traced_probes debugfs_tracing:dir r_dir_perms;
19allow traced_probes debugfs_tracing:file rw_file_perms;
20allow traced_probes debugfs_tracing_debug:file rw_file_perms;
21allow traced_probes debugfs_trace_marker:file getattr;
22')
23
24# Allow traced_probes to start with a higher scheduling class and then downgrade
25# itself.
26allow traced_probes self:global_capability_class_set { sys_nice };
27
28# Allow procfs access
29r_dir_file(traced_probes, domain)
30
31###
32### Neverallow rules
33###
34### traced_probes should NEVER do any of this
35
36# Disallow mapping executable memory (execstack and exec are already disallowed
37# globally in domain.te).
38neverallow traced_probes self:process execmem;
39
40# Block device access.
41neverallow traced_probes dev_type:blk_file { read write };
42
43# ptrace any other app
44neverallow traced_probes domain:process ptrace;
45
46# Disallows access to /data files.
47neverallow traced { data_file_type -system_data_file -zoneinfo_data_file }:dir *;
48neverallow traced system_data_file:dir ~{ getattr search };
49neverallow traced zoneinfo_data_file:dir ~r_dir_perms;
50neverallow traced { data_file_type -zoneinfo_data_file }:lnk_file *;
51neverallow traced { data_file_type -zoneinfo_data_file }:file *;
52
53# Only init is allowed to enter the traced_probes domain via exec()
54neverallow { domain -init } traced_probes:process transition;
55neverallow * traced_probes:process dyntransition;