Jaihind Yadav | 78f021f | 2019-01-25 15:44:50 +0530 | [diff] [blame] | 1 | # Copyright (c) 2019, The Linux Foundation. All rights reserved. |
| 2 | # |
| 3 | # Redistribution and use in source and binary forms, with or without |
| 4 | # modification, are permitted provided that the following conditions are |
| 5 | # met: |
| 6 | # * Redistributions of source code must retain the above copyright |
| 7 | # notice, this list of conditions and the following disclaimer. |
| 8 | # * Redistributions in binary form must reproduce the above |
| 9 | # copyright notice, this list of conditions and the following |
| 10 | # disclaimer in the documentation and/or other materials provided |
| 11 | # with the distribution. |
| 12 | # * Neither the name of The Linux Foundation nor the names of its |
| 13 | # contributors may be used to endorse or promote products derived |
| 14 | # from this software without specific prior written permission. |
| 15 | # |
| 16 | # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED |
| 17 | # WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |
| 18 | # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT |
| 19 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS |
| 20 | # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
| 21 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
| 22 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR |
| 23 | # BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, |
| 24 | # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE |
| 25 | # OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN |
| 26 | # IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 | |
| 28 | type wcnss_service, domain; |
| 29 | type wcnss_service_exec, exec_type, vendor_file_type, file_type; |
| 30 | |
| 31 | init_daemon_domain(wcnss_service) |
| 32 | net_domain(wcnss_service) |
| 33 | |
| 34 | allow wcnss_service wcnss_device:chr_file rw_file_perms; |
| 35 | |
| 36 | qmux_socket(wcnss_service); |
| 37 | |
| 38 | allow wcnss_service wifi_vendor_data_file:dir create_dir_perms; |
| 39 | allow wcnss_service wifi_vendor_data_file:file create_file_perms; |
| 40 | |
| 41 | allow wcnss_service wpa_data_file:dir create_dir_perms; |
| 42 | allow wcnss_service wpa_data_file:file create_file_perms; |
| 43 | |
| 44 | allow wcnss_service mnt_vendor_file:dir r_dir_perms; |
| 45 | qmux_socket(wcnss_service); |
| 46 | |
| 47 | allow wcnss_service self:{ socket qipcrtr_socket } create_socket_perms; |
| 48 | # ioctlcmd=c304 |
| 49 | allowxperm wcnss_service self:{ socket qipcrtr_socket } ioctl msm_sock_ipc_ioctls; |
| 50 | allowxperm wcnss_service self:udp_socket ioctl SIOCIWFIRSTPRIV_05; |
| 51 | allow wcnss_service smem_log_device:chr_file rw_file_perms; |
| 52 | allow wcnss_service proc_net:file rw_file_perms; |
| 53 | |
| 54 | # allow wpa_supplicant to send back wifi information to cnd |
| 55 | allow wcnss_service cnd:unix_dgram_socket sendto; |
| 56 | allow wcnss_service self:capability { |
| 57 | net_admin |
| 58 | net_bind_service |
| 59 | }; |
| 60 | |
| 61 | allow wcnss_service self:netlink_socket create_socket_perms_no_ioctl; |
| 62 | allow wcnss_service self:netlink_generic_socket create_socket_perms_no_ioctl; |
| 63 | allow wcnss_service firmware_file:dir r_dir_perms; |
| 64 | allow wcnss_service firmware_file:file r_file_perms; |
| 65 | allow wcnss_service sysfs_data:file r_file_perms; |
| 66 | |
| 67 | # allow access to network performance tuner |
| 68 | unix_socket_connect(wcnss_service, wigignpt, wigignpt) |
| 69 | |
| 70 | userdebug_or_eng(` |
| 71 | allow wcnss_service fuse:dir create_dir_perms; |
| 72 | allow wcnss_service fuse:file create_file_perms; |
| 73 | allow wcnss_service vfat:dir create_dir_perms; |
| 74 | allow wcnss_service vfat:file create_file_perms; |
| 75 | allow wcnss_service sdcardfs:dir create_dir_perms; |
| 76 | allow wcnss_service sdcardfs:file create_file_perms; |
| 77 | allow wcnss_service mnt_vendor_file:file rw_file_perms; |
Himanshu Agrawal | 74e4904 | 2021-10-28 11:12:46 +0530 | [diff] [blame] | 78 | allow wcnss_service kmsg_device:chr_file { write open }; |
Jaihind Yadav | 78f021f | 2019-01-25 15:44:50 +0530 | [diff] [blame] | 79 | |
| 80 | # This is needed for ptt_socket app to write logs file collected to sdcard |
| 81 | r_dir_file(wcnss_service, proc_wifi_dbg) |
| 82 | r_dir_file(wcnss_service, storage_file) |
| 83 | r_dir_file(wcnss_service, mnt_user_file) |
| 84 | diag_use(wcnss_service) |
| 85 | ') |
| 86 | |
| 87 | #binder_use(wcnss_service) |
| 88 | use_vendor_per_mgr(wcnss_service) |
| 89 | |
| 90 | hwbinder_use(wcnss_service) |
| 91 | get_prop(wcnss_service, hwservicemanager_prop) |
| 92 | |
| 93 | #access to perflock |
| 94 | hal_client_domain(wcnss_service, hal_perf) |
| 95 | |
Jaihind Yadav | 78f021f | 2019-01-25 15:44:50 +0530 | [diff] [blame] | 96 | # allow to read /sys/class/net file |
| 97 | r_dir_file(wcnss_service, sysfs_net); |
Himanshu Agrawal | c549548 | 2021-03-24 17:33:37 +0530 | [diff] [blame] | 98 | |
| 99 | allow wcnss_service property_socket:sock_file write; |
| 100 | allow wcnss_service sysfs_soc:dir r_dir_perms; |
Bharat Pawar | 40453d1 | 2021-12-22 18:21:09 +0530 | [diff] [blame] | 101 | |
| 102 | allow wcnss_service wifi_vendor_wpa_socket:dir create_dir_perms; |
| 103 | allow wcnss_service wifi_vendor_wpa_socket:dir r_dir_perms; |
| 104 | allow wcnss_service wifi_vendor_wpa_socket:sock_file create_file_perms; |
| 105 | allow wcnss_service wifi_vendor_wpa_socket:sock_file rw_file_perms; |
| 106 | allow wcnss_service wifi_vendor_wpa_socket:file create_file_perms; |
| 107 | allow wcnss_service wifi_vendor_wpa_socket:file rw_file_perms; |
Karsten Tausche | 950b2a3 | 2022-08-22 16:34:58 +0200 | [diff] [blame] | 108 | |
| 109 | set_prop(wcnss_service, vendor_wifi_config_prop) |
| 110 | |
| 111 | allow wcnss_service vendor_shell_exec:file execute_no_trans; |
| 112 | |
| 113 | allow wcnss_service kmsg_device:chr_file w_file_perms; |