1# webview_zygote is an auxiliary zygote process that is used to spawn 2# isolated_app processes for rendering untrusted web content. 3 4typeattribute webview_zygote coredomain; 5 6# The webview_zygote needs to be able to transition domains. 7typeattribute webview_zygote mlstrustedsubject; 8 9# Allow access to temporary files, which is normally permitted through 10# a domain macro. 11tmpfs_domain(webview_zygote); 12 13# Allow reading/executing installed binaries to enable preloading the 14# installed WebView implementation. 15allow webview_zygote apk_data_file:dir r_dir_perms; 16allow webview_zygote apk_data_file:file { r_file_perms execute }; 17 18# Access to the WebView relro file. 19allow webview_zygote shared_relro_file:dir search; 20allow webview_zygote shared_relro_file:file r_file_perms; 21 22# Set the UID/GID of the process. 23allow webview_zygote self:global_capability_class_set { setgid setuid }; 24# Drop capabilities from bounding set. 25allow webview_zygote self:global_capability_class_set setpcap; 26# Switch SELinux context to app domains. 27allow webview_zygote self:process setcurrent; 28allow webview_zygote isolated_app:process dyntransition; 29 30# For art. 31allow webview_zygote dalvikcache_data_file:dir r_dir_perms; 32allow webview_zygote dalvikcache_data_file:lnk_file r_file_perms; 33allow webview_zygote dalvikcache_data_file:file { r_file_perms execute }; 34 35# Allow webview_zygote to create JIT memory. 36allow webview_zygote self:process execmem; 37 38# Allow webview_zygote to stat the files that it opens. It must 39# be able to inspect them so that it can reopen them on fork 40# if necessary: b/30963384. 41allow webview_zygote debugfs_trace_marker:file getattr; 42 43# Allow webview_zygote to manage the pgroup of its children. 44allow webview_zygote system_server:process getpgid; 45 46# Interaction between the webview_zygote and its children. 47allow webview_zygote isolated_app:process setpgid; 48 49# TODO (b/63631799) fix this access 50# Suppress denials to storage. Webview zygote should not be accessing. 51dontaudit webview_zygote mnt_expand_file:dir getattr; 52 53# TODO (b/72957399) remove this when webview_zygote is reparented to 54# app_process zygote 55dontaudit webview_zygote dex2oat_exec:file execute; 56 57# Get seapp_contexts 58allow webview_zygote seapp_contexts_file:file r_file_perms; 59# Check validity of SELinux context before use. 60selinux_check_context(webview_zygote) 61# Check SELinux permissions. 62selinux_check_access(webview_zygote) 63 64# Directory listing in /system. 65allow webview_zygote system_file:dir r_dir_perms; 66 67# Read system properties managed by zygote. 68allow webview_zygote zygote_tmpfs:file read; 69# Child of zygote. 70allow webview_zygote zygote:fd use; 71allow webview_zygote zygote:process sigchld; 72 73# Allow apps access to /vendor/overlay 74r_dir_file(webview_zygote, vendor_overlay_file) 75 76allow webview_zygote same_process_hal_file:file { execute read open getattr map }; 77 78allow webview_zygote system_data_file:lnk_file r_file_perms; 79 80##### 81##### Neverallow 82##### 83 84# Only permit transition to isolated_app. 85neverallow webview_zygote { domain -isolated_app }:process dyntransition; 86 87# Only setcon() transitions, no exec() based transitions, except for crash_dump. 88neverallow webview_zygote { domain -crash_dump }:process transition; 89 90# Must not exec() a program without changing domains. 91# Having said that, exec() above is not allowed. 92neverallow webview_zygote *:file execute_no_trans; 93 94# The only way to enter this domain is for the zygote to fork a new 95# webview_zygote child. 96neverallow { domain -zygote } webview_zygote:process dyntransition; 97 98# Disallow write access to properties. 99neverallow webview_zygote property_socket:sock_file write; 100neverallow webview_zygote property_type:property_service set; 101 102# Should not have any access to app data files. 103neverallow webview_zygote { 104 app_data_file 105 privapp_data_file 106 system_app_data_file 107 bluetooth_data_file 108 nfc_data_file 109 radio_data_file 110 shell_data_file 111}:file { rwx_file_perms }; 112 113neverallow webview_zygote { 114 service_manager_type 115 -activity_service 116 -ashmem_device_service 117 -webviewupdate_service 118}:service_manager find; 119 120# Isolated apps shouldn't be able to access the driver directly. 121neverallow webview_zygote gpu_device:chr_file { rwx_file_perms }; 122 123# Do not allow webview_zygote access to /cache. 124neverallow webview_zygote cache_file:dir ~{ r_dir_perms }; 125neverallow webview_zygote cache_file:file ~{ read getattr }; 126 127# Do not allow most socket access. This is socket_class_set, excluding unix_dgram_socket, 128# unix_stream_socket, and netlink_selinux_socket. 129neverallow webview_zygote domain:{ 130 socket tcp_socket udp_socket rawip_socket netlink_socket packet_socket key_socket 131 appletalk_socket netlink_route_socket netlink_tcpdiag_socket 132 netlink_nflog_socket netlink_xfrm_socket netlink_audit_socket 133 netlink_dnrt_socket netlink_kobject_uevent_socket tun_socket netlink_iscsi_socket 134 netlink_fib_lookup_socket netlink_connector_socket netlink_netfilter_socket 135 netlink_generic_socket netlink_scsitransport_socket netlink_rdma_socket netlink_crypto_socket 136 sctp_socket icmp_socket ax25_socket ipx_socket netrom_socket atmpvc_socket 137 x25_socket rose_socket decnet_socket atmsvc_socket rds_socket irda_socket 138 pppox_socket llc_socket can_socket tipc_socket bluetooth_socket iucv_socket 139 rxrpc_socket isdn_socket phonet_socket ieee802154_socket caif_socket 140 alg_socket nfc_socket vsock_socket kcm_socket qipcrtr_socket smc_socket 141 xdp_socket 142} *; 143 144# Do not allow access to Bluetooth-related system properties. 145# neverallow rules for Bluetooth-related data files are listed above. 146neverallow webview_zygote { 147 bluetooth_a2dp_offload_prop 148 bluetooth_audio_hal_prop 149 bluetooth_prop 150 exported_bluetooth_prop 151}:file create_file_perms; 152