1*e4a36f41SAndroid Build Coastguard Workertypeattribute netd coredomain; 2*e4a36f41SAndroid Build Coastguard Workertypeattribute netd bpfdomain; 3*e4a36f41SAndroid Build Coastguard Worker 4*e4a36f41SAndroid Build Coastguard Workerinit_daemon_domain(netd) 5*e4a36f41SAndroid Build Coastguard Worker 6*e4a36f41SAndroid Build Coastguard Worker# Allow netd to spawn dnsmasq in it's own domain 7*e4a36f41SAndroid Build Coastguard Workerdomain_auto_trans(netd, dnsmasq_exec, dnsmasq) 8*e4a36f41SAndroid Build Coastguard Worker 9*e4a36f41SAndroid Build Coastguard Workerallow netd { fs_bpf fs_bpf_netd_readonly fs_bpf_netd_shared }:dir search; 10*e4a36f41SAndroid Build Coastguard Workerallow netd { fs_bpf fs_bpf_netd_readonly fs_bpf_netd_shared }:file { getattr read }; 11*e4a36f41SAndroid Build Coastguard Workerallow netd { fs_bpf fs_bpf_netd_shared }:file write; 12*e4a36f41SAndroid Build Coastguard Worker 13*e4a36f41SAndroid Build Coastguard Worker# give netd permission to setup iptables rule with xt_bpf, attach program to cgroup, and read/write 14*e4a36f41SAndroid Build Coastguard Worker# the map created by bpfloader 15*e4a36f41SAndroid Build Coastguard Workerallow netd bpfloader:bpf { prog_run map_read map_write }; 16*e4a36f41SAndroid Build Coastguard Worker 17*e4a36f41SAndroid Build Coastguard Worker# in order to invoke side effect of close() on such a socket calling synchronize_rcu() 18*e4a36f41SAndroid Build Coastguard Worker# TODO: Remove this permission when 4.9 kernel is deprecated. 19*e4a36f41SAndroid Build Coastguard Worker# TODO: Remove this after we remove all bpf interactions from netd. 20*e4a36f41SAndroid Build Coastguard Workerallow netd self:key_socket create; 21*e4a36f41SAndroid Build Coastguard Worker 22*e4a36f41SAndroid Build Coastguard Workerset_prop(netd, ctl_mdnsd_prop) 23*e4a36f41SAndroid Build Coastguard Workerset_prop(netd, netd_stable_secret_prop) 24*e4a36f41SAndroid Build Coastguard Worker 25*e4a36f41SAndroid Build Coastguard Workerget_prop(netd, adbd_config_prop) 26*e4a36f41SAndroid Build Coastguard Workerget_prop(netd, hwservicemanager_prop) 27*e4a36f41SAndroid Build Coastguard Workerget_prop(netd, device_config_netd_native_prop) 28*e4a36f41SAndroid Build Coastguard Worker 29*e4a36f41SAndroid Build Coastguard Worker# Allow netd to write to statsd. 30*e4a36f41SAndroid Build Coastguard Workerunix_socket_send(netd, statsdw, statsd) 31*e4a36f41SAndroid Build Coastguard Worker 32*e4a36f41SAndroid Build Coastguard Worker# Allow netd to send callbacks to network_stack 33*e4a36f41SAndroid Build Coastguard Workerbinder_call(netd, network_stack) 34*e4a36f41SAndroid Build Coastguard Worker 35*e4a36f41SAndroid Build Coastguard Worker# Allow netd to send dump info to dumpstate 36*e4a36f41SAndroid Build Coastguard Workerallow netd dumpstate:fd use; 37*e4a36f41SAndroid Build Coastguard Workerallow netd dumpstate:fifo_file { getattr write }; 38*e4a36f41SAndroid Build Coastguard Worker 39*e4a36f41SAndroid Build Coastguard Worker# persist.netd.stable_secret contains RFC 7217 secret key which should never be 40*e4a36f41SAndroid Build Coastguard Worker# leaked to other processes. Make sure it never leaks. 41*e4a36f41SAndroid Build Coastguard Workerneverallow { domain -netd -init -dumpstate } netd_stable_secret_prop:file r_file_perms; 42*e4a36f41SAndroid Build Coastguard Worker 43*e4a36f41SAndroid Build Coastguard Worker# We want to ensure that no other process ever tries tampering with persist.netd.stable_secret, 44*e4a36f41SAndroid Build Coastguard Worker# the RFC 7217 secret key managed by netd. Doing so could compromise user privacy. 45*e4a36f41SAndroid Build Coastguard Workerneverallow { domain -netd -init } netd_stable_secret_prop:property_service set; 46