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