blob: 26e005100a23554acb73e29ad6113f1c32c5a67f [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.
Jeff Vander Stoepd25ccab2018-02-07 16:29:06 -080047neverallow traced {
48 data_file_type
49 -system_data_file
50 # TODO(b/72998741) Remove vendor_data_file exemption. Further restricted in a
51 # subsequent neverallow. Currently only getattr and search are allowed.
52 -vendor_data_file
53 -zoneinfo_data_file
54}:dir *;
Primiano Tuccic80f9e02017-12-21 03:51:15 +010055neverallow traced system_data_file:dir ~{ getattr search };
56neverallow traced zoneinfo_data_file:dir ~r_dir_perms;
57neverallow traced { data_file_type -zoneinfo_data_file }:lnk_file *;
58neverallow traced { data_file_type -zoneinfo_data_file }:file *;
59
60# Only init is allowed to enter the traced_probes domain via exec()
61neverallow { domain -init } traced_probes:process transition;
62neverallow * traced_probes:process dyntransition;