2019-11-22 18:33:37 +01:00
|
|
|
# Networking service app
|
2020-11-26 02:55:56 +01:00
|
|
|
typeattribute network_stack coredomain, mlstrustedsubject;
|
2018-11-14 09:07:41 +01:00
|
|
|
|
|
|
|
app_domain(network_stack);
|
|
|
|
net_domain(network_stack);
|
|
|
|
|
|
|
|
allow network_stack self:global_capability_class_set {
|
|
|
|
net_admin
|
|
|
|
net_bind_service
|
|
|
|
net_broadcast
|
|
|
|
net_raw
|
|
|
|
};
|
|
|
|
|
|
|
|
# Allow access to net_admin ioctl, DHCP server uses SIOCSARP
|
|
|
|
allowxperm network_stack self:udp_socket ioctl priv_sock_ioctls;
|
|
|
|
|
|
|
|
# The DhcpClient uses packet_sockets
|
|
|
|
allow network_stack self:packet_socket create_socket_perms_no_ioctl;
|
|
|
|
|
2019-01-28 05:08:42 +01:00
|
|
|
# Monitor neighbors via netlink.
|
|
|
|
allow network_stack self:netlink_route_socket nlmsg_write;
|
|
|
|
|
2019-01-10 23:35:17 +01:00
|
|
|
allow network_stack app_api_service:service_manager find;
|
2019-02-25 13:12:15 +01:00
|
|
|
allow network_stack dnsresolver_service:service_manager find;
|
2018-11-14 09:07:41 +01:00
|
|
|
allow network_stack netd_service:service_manager find;
|
2019-01-15 08:57:32 +01:00
|
|
|
allow network_stack radio_service:service_manager find;
|
2019-03-08 04:33:03 +01:00
|
|
|
allow network_stack radio_data_file:dir create_dir_perms;
|
|
|
|
allow network_stack radio_data_file:file create_file_perms;
|
2018-11-14 09:07:41 +01:00
|
|
|
|
|
|
|
binder_call(network_stack, netd);
|
2019-10-01 22:49:21 +02:00
|
|
|
|
2021-01-29 23:36:32 +01:00
|
|
|
# in order to invoke side effect of close() on such a socket calling synchronize_rcu()
|
|
|
|
# TODO: Remove this permission when 4.9 kernel is deprecated.
|
|
|
|
allow network_stack self:key_socket create;
|
|
|
|
|
|
|
|
# Grant read permission of connectivity namespace system property prefix.
|
|
|
|
get_prop(network_stack, device_config_connectivity_prop)
|
|
|
|
|
2019-10-12 13:49:23 +02:00
|
|
|
# Create/use netlink_tcpdiag_socket to get tcp info
|
|
|
|
allow network_stack self:netlink_tcpdiag_socket { create_socket_perms_no_ioctl nlmsg_read nlmsg_write };
|
2019-11-21 05:58:31 +01:00
|
|
|
############### Tethering Service app - Tethering.apk ##############
|
|
|
|
hal_client_domain(network_stack, hal_tetheroffload)
|
|
|
|
# Create and share netlink_netfilter_sockets for tetheroffload.
|
|
|
|
allow network_stack self:netlink_netfilter_socket create_socket_perms_no_ioctl;
|
2019-12-12 05:54:57 +01:00
|
|
|
allow network_stack network_stack_service:service_manager find;
|
2020-11-26 02:55:56 +01:00
|
|
|
# allow Tethering(network_stack process) to run/update/read the eBPF maps to offload tethering traffic by eBPF.
|
2021-01-29 23:36:32 +01:00
|
|
|
allow network_stack { fs_bpf fs_bpf_tethering }:dir search;
|
|
|
|
allow network_stack { fs_bpf fs_bpf_tethering }:file { read write };
|
2020-11-26 02:55:56 +01:00
|
|
|
allow network_stack bpfloader:bpf { map_read map_write prog_run };
|
2020-12-03 05:45:36 +01:00
|
|
|
|
2021-01-29 23:36:32 +01:00
|
|
|
# Only the bpfloader and the network_stack should ever touch 'fs_bpf_tethering' programs/maps.
|
|
|
|
# TODO: remove netd once netd/tethering mainline module split is complete
|
|
|
|
# Unfortunately init/vendor_init have all sorts of extra privs
|
|
|
|
neverallow { domain -bpfloader -init -netd -network_stack -vendor_init } fs_bpf_tethering:dir ~getattr;
|
|
|
|
neverallow { domain -bpfloader -init -netd -network_stack -vendor_init } fs_bpf_tethering:file *;
|
2021-02-02 11:27:38 +01:00
|
|
|
|
2021-01-29 23:36:32 +01:00
|
|
|
neverallow { domain -bpfloader -netd -network_stack } fs_bpf_tethering:dir ~{ getattr open read search setattr };
|
|
|
|
neverallow { domain -bpfloader -netd -network_stack } fs_bpf_tethering:file ~{ map open read setattr };
|