Alex Klyubin | c42d134 | 2017-01-09 14:52:59 -0800 | [diff] [blame] | 1 | ### |
| 2 | ### Apps signed with the platform key. |
| 3 | ### |
| 4 | |
Alex Klyubin | f5446eb | 2017-03-23 14:27:32 -0700 | [diff] [blame] | 5 | typeattribute platform_app coredomain; |
Alex Klyubin | c42d134 | 2017-01-09 14:52:59 -0800 | [diff] [blame] | 6 | |
Nick Kralevich | b56e6ef | 2016-12-09 20:14:31 -0800 | [diff] [blame] | 7 | app_domain(platform_app) |
Alex Klyubin | c42d134 | 2017-01-09 14:52:59 -0800 | [diff] [blame] | 8 | |
| 9 | # Access the network. |
| 10 | net_domain(platform_app) |
| 11 | # Access bluetooth. |
| 12 | bluetooth_domain(platform_app) |
| 13 | # Read from /data/local/tmp or /data/data/com.android.shell. |
| 14 | allow platform_app shell_data_file:dir search; |
| 15 | allow platform_app shell_data_file:file { open getattr read }; |
| 16 | allow platform_app icon_file:file { open getattr read }; |
Chad Brubaker | 4c40d73 | 2017-01-25 14:55:56 -0800 | [diff] [blame] | 17 | # Populate /data/app/vmdl*.tmp, /data/app-private/vmdl*.tmp files |
Alex Klyubin | c42d134 | 2017-01-09 14:52:59 -0800 | [diff] [blame] | 18 | # created by system server. |
Chad Brubaker | 4c40d73 | 2017-01-25 14:55:56 -0800 | [diff] [blame] | 19 | allow platform_app { apk_tmp_file apk_private_tmp_file }:dir rw_dir_perms; |
| 20 | allow platform_app { apk_tmp_file apk_private_tmp_file }:file rw_file_perms; |
Alex Klyubin | c42d134 | 2017-01-09 14:52:59 -0800 | [diff] [blame] | 21 | allow platform_app apk_private_data_file:dir search; |
| 22 | # ASEC |
| 23 | allow platform_app asec_apk_file:dir create_dir_perms; |
| 24 | allow platform_app asec_apk_file:file create_file_perms; |
| 25 | |
| 26 | # Access to /data/media. |
| 27 | allow platform_app media_rw_data_file:dir create_dir_perms; |
| 28 | allow platform_app media_rw_data_file:file create_file_perms; |
| 29 | |
| 30 | # Write to /cache. |
| 31 | allow platform_app cache_file:dir create_dir_perms; |
| 32 | allow platform_app cache_file:file create_file_perms; |
| 33 | |
| 34 | # Direct access to vold-mounted storage under /mnt/media_rw |
| 35 | # This is a performance optimization that allows platform apps to bypass the FUSE layer |
| 36 | allow platform_app mnt_media_rw_file:dir r_dir_perms; |
Jeff Sharkey | 000cafc | 2018-03-30 12:22:54 -0600 | [diff] [blame] | 37 | allow platform_app sdcard_type:dir create_dir_perms; |
| 38 | allow platform_app sdcard_type:file create_file_perms; |
Alex Klyubin | c42d134 | 2017-01-09 14:52:59 -0800 | [diff] [blame] | 39 | |
Jeff Vander Stoep | a12aad4 | 2017-07-10 20:39:50 -0700 | [diff] [blame] | 40 | # com.android.systemui |
| 41 | allow platform_app rootfs:dir getattr; |
Beth Thibodeau | a279bdb | 2021-09-14 13:44:49 -0400 | [diff] [blame] | 42 | get_prop(platform_app, radio_cdma_ecm_prop) |
Evan Rosky | 5cfdf2b | 2022-03-02 22:13:58 +0000 | [diff] [blame] | 43 | userdebug_or_eng(` |
| 44 | set_prop(platform_app, persist_wm_debug_prop) |
| 45 | ') |
Pierre Barbier de Reuille | 2874c40 | 2025-01-17 14:33:16 +0000 | [diff] [blame] | 46 | neverallow { domain -init -dumpstate -system_server userdebug_or_eng(`-domain') } persist_wm_debug_prop:property_service set; |
Jeff Vander Stoep | a12aad4 | 2017-07-10 20:39:50 -0700 | [diff] [blame] | 47 | |
Alexander Roederer | 829d974 | 2023-03-23 02:19:22 +0000 | [diff] [blame] | 48 | userdebug_or_eng(` |
| 49 | set_prop(platform_app, persist_sysui_builder_extras_prop) |
| 50 | ') |
Alexander Roederer | 584a862 | 2023-05-31 21:25:50 +0000 | [diff] [blame] | 51 | userdebug_or_eng(` |
| 52 | set_prop(platform_app, persist_sysui_ranking_update_prop) |
| 53 | ') |
Ben Murdoch | d310497 | 2024-08-23 13:10:51 +0000 | [diff] [blame] | 54 | set_prop(platform_app, debug_tracing_desktop_mode_visible_tasks_prop) |
Alexander Roederer | 829d974 | 2023-03-23 02:19:22 +0000 | [diff] [blame] | 55 | |
Jeff Vander Stoep | c15d54e | 2017-07-25 16:43:49 -0700 | [diff] [blame] | 56 | # com.android.captiveportallogin reads /proc/vmstat |
Tri Vo | 06d7dca | 2018-01-10 12:51:51 -0800 | [diff] [blame] | 57 | allow platform_app { |
| 58 | proc_vmstat |
| 59 | }:file r_file_perms; |
Jeff Vander Stoep | c15d54e | 2017-07-25 16:43:49 -0700 | [diff] [blame] | 60 | |
Jeff Vander Stoep | 7a4af30 | 2018-04-10 12:47:48 -0700 | [diff] [blame] | 61 | # /proc/net access. |
| 62 | # TODO(b/9496886) Audit access for removal. |
| 63 | r_dir_file(platform_app, proc_net_type) |
| 64 | userdebug_or_eng(` |
| 65 | auditallow platform_app proc_net_type:{ dir file lnk_file } { getattr open read }; |
| 66 | ') |
| 67 | |
Stefan Andonian | ff413fd | 2024-01-24 22:04:52 +0000 | [diff] [blame] | 68 | # Allow sharing traces to betterbug from /data/misc/wmtrace. |
| 69 | userdebug_or_eng(` |
| 70 | allow platform_app trace_data_file:file create_file_perms; |
| 71 | allow platform_app trace_data_file:dir rw_dir_perms; |
| 72 | ') |
| 73 | |
Hongwei Wang | 9372026 | 2023-01-20 12:14:31 -0800 | [diff] [blame] | 74 | # Allow writing and removing wmshell protolog in /data/misc/wmtrace. |
| 75 | userdebug_or_eng(` |
| 76 | allow platform_app wm_trace_data_file:dir rw_dir_perms; |
Stefan Andonian | ff413fd | 2024-01-24 22:04:52 +0000 | [diff] [blame] | 77 | allow platform_app wm_trace_data_file:file { getattr setattr create unlink rw_file_perms }; |
| 78 | ') |
| 79 | |
| 80 | |
| 81 | # To exec the perfetto cmdline client and pass it the trace config on |
| 82 | # stdint through a pipe. Allow to access traced's privileged consumer socket. |
| 83 | userdebug_or_eng(` |
| 84 | allow platform_app perfetto_exec:file rx_file_perms; |
| 85 | unix_socket_connect(platform_app, traced_consumer, traced); |
Hongwei Wang | 9372026 | 2023-01-20 12:14:31 -0800 | [diff] [blame] | 86 | ') |
| 87 | |
Alex Klyubin | c42d134 | 2017-01-09 14:52:59 -0800 | [diff] [blame] | 88 | allow platform_app audioserver_service:service_manager find; |
| 89 | allow platform_app cameraserver_service:service_manager find; |
| 90 | allow platform_app drmserver_service:service_manager find; |
| 91 | allow platform_app mediaserver_service:service_manager find; |
Ray Essick | 3918540 | 2017-01-24 12:53:45 -0800 | [diff] [blame] | 92 | allow platform_app mediametrics_service:service_manager find; |
Alex Klyubin | c42d134 | 2017-01-09 14:52:59 -0800 | [diff] [blame] | 93 | allow platform_app mediaextractor_service:service_manager find; |
Alex Klyubin | c42d134 | 2017-01-09 14:52:59 -0800 | [diff] [blame] | 94 | allow platform_app mediadrmserver_service:service_manager find; |
| 95 | allow platform_app persistent_data_block_service:service_manager find; |
| 96 | allow platform_app radio_service:service_manager find; |
Todd Poynor | bbc692c | 2017-07-12 18:12:52 -0700 | [diff] [blame] | 97 | allow platform_app thermal_service:service_manager find; |
Alex Klyubin | c42d134 | 2017-01-09 14:52:59 -0800 | [diff] [blame] | 98 | allow platform_app app_api_service:service_manager find; |
| 99 | allow platform_app system_api_service:service_manager find; |
| 100 | allow platform_app vr_manager_service:service_manager find; |
joshmccloskey | 6f5a7b8 | 2019-02-07 14:02:06 -0800 | [diff] [blame] | 101 | allow platform_app stats_service:service_manager find; |
David Anderson | 290f005 | 2024-10-11 09:32:02 -0700 | [diff] [blame] | 102 | allow platform_app tradeinmode_service:service_manager find; |
Yiwei Zhang | 544d6b3 | 2019-02-07 15:00:55 -0800 | [diff] [blame] | 103 | |
joshmccloskey | 6f5a7b8 | 2019-02-07 14:02:06 -0800 | [diff] [blame] | 104 | # Allow platform apps to log via statsd. |
Jeffrey Huang | 215dd2a | 2019-12-12 10:17:58 -0800 | [diff] [blame] | 105 | binder_call(platform_app, statsd) |
joshmccloskey | 6f5a7b8 | 2019-02-07 14:02:06 -0800 | [diff] [blame] | 106 | |
Chris Wailes | 3486acb | 2021-06-07 14:20:47 -0700 | [diff] [blame] | 107 | # Allow platform applications to find and call artd for testing |
| 108 | userdebug_or_eng(` |
| 109 | allow platform_app artd_service:service_manager find; |
| 110 | binder_call(platform_app, artd) |
| 111 | ') |
| 112 | |
Alex Klyubin | c42d134 | 2017-01-09 14:52:59 -0800 | [diff] [blame] | 113 | # Access to /data/preloads |
| 114 | allow platform_app preloads_data_file:file r_file_perms; |
| 115 | allow platform_app preloads_data_file:dir r_dir_perms; |
Fyodor Kupolov | b238fe6 | 2017-03-14 11:42:03 -0700 | [diff] [blame] | 116 | allow platform_app preloads_media_file:file r_file_perms; |
| 117 | allow platform_app preloads_media_file:dir r_dir_perms; |
Alex Klyubin | c42d134 | 2017-01-09 14:52:59 -0800 | [diff] [blame] | 118 | |
Mark Salyzyn | d33a9a1 | 2016-11-07 15:11:39 -0800 | [diff] [blame] | 119 | read_runtime_log_tags(platform_app) |
Nick Kralevich | 45766d4 | 2017-04-26 11:40:48 -0700 | [diff] [blame] | 120 | |
Nathan Harold | ee26864 | 2017-12-14 18:20:30 -0800 | [diff] [blame] | 121 | # allow platform apps to use UDP sockets provided by the system server but not |
| 122 | # modify them other than to connect |
Nathan Harold | 252b015 | 2018-03-27 06:34:54 -0700 | [diff] [blame] | 123 | allow platform_app system_server:udp_socket { |
| 124 | connect getattr read recvfrom sendto write getopt setopt }; |
Nathan Harold | ee26864 | 2017-12-14 18:20:30 -0800 | [diff] [blame] | 125 | |
Mark Salyzyn | 3443caf | 2015-10-24 16:20:18 -0700 | [diff] [blame] | 126 | # allow platform apps to connect to the property service |
| 127 | set_prop(platform_app, test_boot_reason_prop) |
| 128 | |
Inseob Kim | 04f435c | 2020-07-07 12:46:24 +0900 | [diff] [blame] | 129 | # allow platform apps to read keyguard.no_require_sim |
| 130 | get_prop(platform_app, keyguard_config_prop) |
| 131 | |
Weilun Du | e2a8a14 | 2021-02-17 17:54:30 +0000 | [diff] [blame] | 132 | # allow platform apps to read qemu.hw.mainkeys |
| 133 | get_prop(platform_app, qemu_hw_prop) |
| 134 | |
Alexei Nicoara | 957e8f3 | 2023-09-11 17:43:45 +0100 | [diff] [blame] | 135 | # allow platform apps to read sys.boot.reason.last |
| 136 | get_prop(platform_app, last_boot_reason_prop) |
| 137 | |
felkachang | 0c40201 | 2019-01-30 15:44:24 +0800 | [diff] [blame] | 138 | # allow platform apps to create symbolic link |
| 139 | allow platform_app app_data_file:lnk_file create_file_perms; |
| 140 | |
Adam Shih | 2543715 | 2020-12-07 16:30:29 +0800 | [diff] [blame] | 141 | # suppress denials caused by debugfs_tracing |
| 142 | dontaudit platform_app debugfs_tracing:file rw_file_perms; |
| 143 | |
Alan Stokes | f96cd65 | 2021-09-07 12:25:38 +0100 | [diff] [blame] | 144 | # Allow platform apps to create VMs |
| 145 | virtualizationservice_use(platform_app) |
| 146 | |
Nick Kralevich | 45766d4 | 2017-04-26 11:40:48 -0700 | [diff] [blame] | 147 | ### |
| 148 | ### Neverallow rules |
| 149 | ### |
| 150 | |
Alexander Roederer | 829d974 | 2023-03-23 02:19:22 +0000 | [diff] [blame] | 151 | neverallow { domain -init userdebug_or_eng(`-shell -platform_app') } persist_sysui_builder_extras_prop:property_service set; |
| 152 | |
Nick Kralevich | 45766d4 | 2017-04-26 11:40:48 -0700 | [diff] [blame] | 153 | # app domains which access /dev/fuse should not run as platform_app |
| 154 | neverallow platform_app fuse_device:chr_file *; |