blob: adce9a4ff6dc38210d5ae7ad9e546a371415f0dc [file] [log] [blame]
Jeff Vander Stoep400d3ac2015-10-30 12:43:19 -07001###
2### AutoPlay apps.
3###
4### This file defines the security policy for apps with the autoplay
5### feature.
6###
7### The autoplay_app domain is a reduced permissions sandbox allowing
8### ephemeral applications to be safely installed and run. Non ephemeral
9### applications may also opt-in to autoplay to take advantage of the
10### additional security features.
11###
12### PackageManager flags an app as autoplay at install time.
13type autoplay_app, domain;
Jeff Vander Stoepae72bf22015-11-25 09:41:05 -080014
15# allow JITing
16allow autoplay_app self:process execmem;
17allow autoplay_app ashmem_device:chr_file execute;
18
19# Define and allow access to our own type for ashmem regions.
20# Label ashmem objects with our own unique type.
21tmpfs_domain(autoplay_app)
22# Map with PROT_EXEC.
23allow autoplay_app autoplay_app_tmpfs:file execute;
24
Jeff Vander Stoepb7baa7f2015-12-09 12:19:35 -080025# Read system properties managed by zygote.
26allow autoplay_app zygote_tmpfs:file read;
27
Jeff Vander Stoepae72bf22015-11-25 09:41:05 -080028# Send logcat messages to logd.
29write_logd(autoplay_app)
30
31# Receive and use open file descriptors inherited from zygote.
32allow autoplay_app zygote:fd use;
33
34# Notify zygote of death;
35allow autoplay_app zygote:process sigchld;
36
37# application inherit logd write socket (urge is to deprecate this long term)
38allow autoplay_app zygote:unix_dgram_socket write;
39
40# App sandbox file accesses.
41allow autoplay_app autoplay_data_file:dir create_dir_perms;
42allow autoplay_app autoplay_data_file:{ file sock_file fifo_file } create_file_perms;
43
44# For /acct/uid/*/tasks.
45allow autoplay_app cgroup:dir { search write };
46allow autoplay_app cgroup:file w_file_perms;
47
48# For art.
49allow autoplay_app dalvikcache_data_file:file { execute r_file_perms };
50allow autoplay_app dalvikcache_data_file:lnk_file r_file_perms;
51allow autoplay_app dalvikcache_data_file:dir getattr;
52
53# debugfs access
54allow autoplay_app debugfs:dir r_dir_perms;
55allow autoplay_app debugfs:file w_file_perms;
56
57# Grant GPU access. autoplay_app needs that to render the standard UI.
58allow autoplay_app gpu_device:chr_file rw_file_perms;
59
60# Use the Binder.
61binder_use(autoplay_app)
62# Perform binder IPC to binder services.
63binder_call(autoplay_app, surfaceflinger)
64binder_call(autoplay_app, system_server)
65
66# Allow read access to ion memory allocation device
67allow autoplay_app ion_device:chr_file { read open };
68
69# Use pipes and sockets provided by system_server via binder or local socket.
70allow autoplay_app system_server:fifo_file rw_file_perms;
71allow autoplay_app system_server:unix_stream_socket { read write setopt getattr getopt shutdown };
72allow autoplay_app system_server:tcp_socket { read write getattr getopt shutdown };
73
74# Inherit or receive open files from system_server.
75allow autoplay_app system_server:fd use;
76
77# Communicate with surfaceflinger.
78allow autoplay_app surfaceflinger:unix_stream_socket { read write setopt getattr getopt shutdown };
79
80# Read files already opened under /data.
81allow autoplay_app system_data_file:file { getattr read };
82allow autoplay_app system_data_file:lnk_file read;
83
84# System file accesses. Check for libraries
85allow autoplay_app system_file:dir getattr;
86
Jeff Vander Stoepb7baa7f2015-12-09 12:19:35 -080087# services
88allow autoplay_app accessibility_service:service_manager find;
89allow autoplay_app activity_service:service_manager find;
90allow autoplay_app assetatlas_service:service_manager find;
91allow autoplay_app connectivity_service:service_manager find;
92allow autoplay_app display_service:service_manager find;
93allow autoplay_app graphicsstats_service:service_manager find;
94allow autoplay_app input_method_service:service_manager find;
95allow autoplay_app input_service:service_manager find;
96allow autoplay_app surfaceflinger_service:service_manager find;
97allow autoplay_app textservices_service:service_manager find;
98
Jeff Vander Stoepae72bf22015-11-25 09:41:05 -080099###
100### neverallow rules
101###
102
103# Receive or send uevent messages.
104neverallow autoplay_app domain:netlink_kobject_uevent_socket *;
105
106# Receive or send generic netlink messages
107neverallow autoplay_app domain:netlink_socket *;
108
109# Too much leaky information in debugfs. It's a security
110# best practice to ensure these files aren't readable.
111neverallow autoplay_app debugfs:file read;
112
113# execute gpu_device
114neverallow autoplay_app gpu_device:chr_file execute;
Jeff Vander Stoepb7baa7f2015-12-09 12:19:35 -0800115
116# access files in /sys with the default sysfs label
117neverallow autoplay_app sysfs:file *;