Merge "perfetto: allow producers to supply shared memory" am: 429ce33777

Change-Id: I231c8ac22c5645e356b7b5ad2c2ca9db6d231f23
This commit is contained in:
Treehugger Robot 2020-02-14 20:15:51 +00:00
commit 63b0c52392
3 changed files with 22 additions and 0 deletions

View file

@ -36,6 +36,23 @@ allow traced trace_data_file:file { read write };
allow traced iorapd:fd use;
allow traced iorapd_tmpfs:file { read write };
# Allow traced to use shared memory supplied by producers. Typically, traced
# (i.e. the tracing service) creates the shared memory used for data transfer
# from the producer. This rule allows an alternative scheme, where the producer
# creates the shared memory, that is then adopted by traced (after validating
# that it is appropriately sealed).
# This list has to replicate the tmpfs domains of all applicable domains that
# have perfetto_producer() macro applied to them.
# perfetto_tmpfs excluded as it should never need to use the producer-supplied
# shared memory scheme.
allow traced {
appdomain_tmpfs
heapprofd_tmpfs
surfaceflinger_tmpfs
traced_probes_tmpfs
userdebug_or_eng(`system_server_tmpfs')
}:file { getattr map read write };
# Allow traced to notify Traceur when a trace ends by setting the
# sys.trace.trace_end_signal property.
set_prop(traced, system_trace_prop)

View file

@ -1,8 +1,10 @@
# Perfetto tracing probes, has tracefs access.
type traced_probes_exec, system_file_type, exec_type, file_type;
type traced_probes_tmpfs, file_type;
# Allow init to exec the daemon.
init_daemon_domain(traced_probes)
tmpfs_domain(traced_probes)
# Write trace data to the Perfetto traced damon. This requires connecting to its
# producer socket and obtaining a (per-process) tmpfs fd.

View file

@ -748,6 +748,9 @@ define(`never_profile_perf', `
###################################
# perfetto_producer(domain)
# Allow processes within the domain to write data to Perfetto.
# When applying this macro, you might need to also allow traced to use the
# producer tmpfs domain, if the producer will be the one creating the shared
# memory.
define(`perfetto_producer', `
allow $1 traced:fd use;
allow $1 traced_tmpfs:file { read write getattr map };