summaryrefslogtreecommitdiffstats
path: root/common/cnd.te
blob: bf885b3032704103a6f634269d490d2a278e540b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
#permissive cnd;
type cnd, domain, mlstrustedsubject;
type cnd_exec, exec_type, vendor_file_type, file_type;
file_type_auto_trans(cnd, socket_device, cnd_socket);

# cnd is started by init, type transit from init domain to cnd domain
init_daemon_domain(cnd)

# associate netdomain as an attribute of cnd domain
net_domain(cnd)

allow cnd smem_log_device:chr_file rw_file_perms;

# allow cnd the following capability
allow cnd self:capability {
    net_admin
    sys_module
    net_bind_service
};

allow cnd self:capability2 block_suspend;

# socket used to communicate with kernel via the netlink syscall
allow cnd self:{
    netlink_tcpdiag_socket
    netlink_route_socket
    netlink_socket
    netlink_generic_socket
    # allow cnd to perform socket operation on itself
    socket
} create_socket_perms_no_ioctl;

# allow cnd to read tcp diagnostics through netlink
allow cnd self:netlink_tcpdiag_socket nlmsg_read;

# allow cnd to set system property
set_prop(cnd, system_prop)

# allow cnd to access cnd_data_file
allow cnd cnd_data_file:file create_file_perms;
allow cnd cnd_data_file:sock_file { unlink create setattr };
allow cnd cnd_data_file:dir rw_dir_perms;

# allow cnd to access qmux_radio_socket
qmux_socket(cnd)

# allow cnd to access wpa_socket
unix_socket_send(cnd, wpa, hal_wifi_supplicant)
allow cnd wpa_socket:dir rw_dir_perms;
allow cnd wpa_socket:sock_file { create unlink setattr };
allow cnd wifi_data_file:dir r_dir_perms;
allow cnd wifi_vendor_data_file:dir r_dir_perms;
allow cnd wifi_vendor_wpa_socket:sock_file write;

# allow cnd to obtain wakelock
wakelock_use(cnd)

# allow cnd to get appname and use inet socket
#cnd_nims_socket_perm(appdomain)
#cnd_nims_socket_perm(system_server)
#cnd_nims_socket_perm(mediaserver)
#cnd_nims_socket_perm(mtp)
#cnd_nims_socket_perm(wfdservice)
#cnd_nims_socket_perm(drmserver)

# allow access to nims
allow cnd socket_device:dir remove_name;

# explicitly allow udp socket permissions for appdomain
#allow cnd appdomain:udp_socket rw_socket_perms;

#allow cnd daemon to invoke hostapd_cli
allow cnd vendor_shell_exec:file rx_file_perms;
domain_auto_trans(cnd, hostapd_exec, hostapd)
allow cnd hostapd_socket:dir r_dir_perms;
unix_socket_send(cnd, hostapd, hostapd)

# only allow getopt for appdomain
allow appdomain zygote:unix_dgram_socket getopt;
dontaudit { domain -appdomain } zygote:unix_dgram_socket getopt;

#diag
userdebug_or_eng(`
    diag_use(cnd)
')

allow cnd proc_meminfo:file r_file_perms;
allow cnd self:socket ioctl;
allowxperm cnd self:socket ioctl msm_sock_ipc_ioctls;

allow cnd self:udp_socket ioctl;
allowxperm cnd self:udp_socket ioctl wlan_sock_ioctls;

allow cnd sysfs:file r_file_perms;
allow cnd sysfs_data:file r_file_perms;

add_hwservice(cnd, hal_cne_hwservice)
add_hwservice(cnd, hal_latency_hwservice)
hwbinder_use(cnd)
get_prop(cnd, hwservicemanager_prop)
binder_call(cnd, dataservice_app)
binder_call(cnd, ims)