blob: 3bf147132d4da58d4cb6e96ed1bede993a2ce7af [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.
Primiano Tuccic80f9e02017-12-21 03:51:15 +010015allow traced_probes debugfs_tracing:dir r_dir_perms;
16allow traced_probes debugfs_tracing:file rw_file_perms;
Primiano Tuccic80f9e02017-12-21 03:51:15 +010017allow traced_probes debugfs_trace_marker:file getattr;
Primiano Tuccib4b31f92018-02-09 11:15:22 +000018
19# TODO(primiano): temporarily I/O tracing categories are still
20# userdebug only until we nail down the blacklist/whitelist.
21userdebug_or_eng(`
22allow traced_probes debugfs_tracing_debug:file rw_file_perms;
Primiano Tuccic80f9e02017-12-21 03:51:15 +010023')
24
25# Allow traced_probes to start with a higher scheduling class and then downgrade
26# itself.
27allow traced_probes self:global_capability_class_set { sys_nice };
28
29# Allow procfs access
30r_dir_file(traced_probes, domain)
31
32###
33### Neverallow rules
34###
35### traced_probes should NEVER do any of this
36
37# Disallow mapping executable memory (execstack and exec are already disallowed
38# globally in domain.te).
39neverallow traced_probes self:process execmem;
40
41# Block device access.
42neverallow traced_probes dev_type:blk_file { read write };
43
44# ptrace any other app
45neverallow traced_probes domain:process ptrace;
46
47# Disallows access to /data files.
Jeff Vander Stoepd25ccab2018-02-07 16:29:06 -080048neverallow traced {
49 data_file_type
50 -system_data_file
51 # TODO(b/72998741) Remove vendor_data_file exemption. Further restricted in a
52 # subsequent neverallow. Currently only getattr and search are allowed.
53 -vendor_data_file
54 -zoneinfo_data_file
55}:dir *;
Primiano Tuccic80f9e02017-12-21 03:51:15 +010056neverallow traced system_data_file:dir ~{ getattr search };
57neverallow traced zoneinfo_data_file:dir ~r_dir_perms;
58neverallow traced { data_file_type -zoneinfo_data_file }:lnk_file *;
59neverallow traced { data_file_type -zoneinfo_data_file }:file *;
60
61# Only init is allowed to enter the traced_probes domain via exec()
62neverallow { domain -init } traced_probes:process transition;
63neverallow * traced_probes:process dyntransition;