blob: 5fe1000be0a863e86d6f04c40e8ec894b93f902b [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
Jeff Vander Stoepae72bf22015-11-25 09:41:05 -080019# Map with PROT_EXEC.
20allow autoplay_app autoplay_app_tmpfs:file execute;
21
Jeff Vander Stoepb7baa7f2015-12-09 12:19:35 -080022# Read system properties managed by zygote.
23allow autoplay_app zygote_tmpfs:file read;
24
Jeff Vander Stoepae72bf22015-11-25 09:41:05 -080025# Send logcat messages to logd.
26write_logd(autoplay_app)
27
28# Receive and use open file descriptors inherited from zygote.
29allow autoplay_app zygote:fd use;
30
31# Notify zygote of death;
32allow autoplay_app zygote:process sigchld;
33
34# application inherit logd write socket (urge is to deprecate this long term)
35allow autoplay_app zygote:unix_dgram_socket write;
36
37# App sandbox file accesses.
38allow autoplay_app autoplay_data_file:dir create_dir_perms;
39allow autoplay_app autoplay_data_file:{ file sock_file fifo_file } create_file_perms;
40
Jeff Vander Stoepae72bf22015-11-25 09:41:05 -080041# For art.
42allow autoplay_app dalvikcache_data_file:file { execute r_file_perms };
43allow autoplay_app dalvikcache_data_file:lnk_file r_file_perms;
44allow autoplay_app dalvikcache_data_file:dir getattr;
45
Jeff Vander Stoepae72bf22015-11-25 09:41:05 -080046# Grant GPU access. autoplay_app needs that to render the standard UI.
47allow autoplay_app gpu_device:chr_file rw_file_perms;
48
49# Use the Binder.
50binder_use(autoplay_app)
51# Perform binder IPC to binder services.
52binder_call(autoplay_app, surfaceflinger)
53binder_call(autoplay_app, system_server)
54
55# Allow read access to ion memory allocation device
56allow autoplay_app ion_device:chr_file { read open };
57
58# Use pipes and sockets provided by system_server via binder or local socket.
59allow autoplay_app system_server:fifo_file rw_file_perms;
60allow autoplay_app system_server:unix_stream_socket { read write setopt getattr getopt shutdown };
61allow autoplay_app system_server:tcp_socket { read write getattr getopt shutdown };
62
63# Inherit or receive open files from system_server.
64allow autoplay_app system_server:fd use;
65
66# Communicate with surfaceflinger.
67allow autoplay_app surfaceflinger:unix_stream_socket { read write setopt getattr getopt shutdown };
68
69# Read files already opened under /data.
70allow autoplay_app system_data_file:file { getattr read };
71allow autoplay_app system_data_file:lnk_file read;
72
73# System file accesses. Check for libraries
74allow autoplay_app system_file:dir getattr;
75
Jeff Vander Stoepb7baa7f2015-12-09 12:19:35 -080076# services
77allow autoplay_app accessibility_service:service_manager find;
78allow autoplay_app activity_service:service_manager find;
79allow autoplay_app assetatlas_service:service_manager find;
80allow autoplay_app connectivity_service:service_manager find;
81allow autoplay_app display_service:service_manager find;
82allow autoplay_app graphicsstats_service:service_manager find;
83allow autoplay_app input_method_service:service_manager find;
84allow autoplay_app input_service:service_manager find;
85allow autoplay_app surfaceflinger_service:service_manager find;
86allow autoplay_app textservices_service:service_manager find;
87
Jeff Vander Stoepae72bf22015-11-25 09:41:05 -080088###
89### neverallow rules
90###
91
92# Receive or send uevent messages.
93neverallow autoplay_app domain:netlink_kobject_uevent_socket *;
94
95# Receive or send generic netlink messages
96neverallow autoplay_app domain:netlink_socket *;
97
98# Too much leaky information in debugfs. It's a security
99# best practice to ensure these files aren't readable.
100neverallow autoplay_app debugfs:file read;
101
102# execute gpu_device
103neverallow autoplay_app gpu_device:chr_file execute;
Jeff Vander Stoepb7baa7f2015-12-09 12:19:35 -0800104
105# access files in /sys with the default sysfs label
106neverallow autoplay_app sysfs:file *;