| # Copyright (c) 2018-2020, The Linux Foundation. All rights reserved. |
| # |
| # Redistribution and use in source and binary forms, with or without |
| # modification, are permitted provided that the following conditions are |
| # met: |
| # * Redistributions of source code must retain the above copyright |
| # notice, this list of conditions and the following disclaimer. |
| # * Redistributions in binary form must reproduce the above |
| # copyright notice, this list of conditions and the following |
| # disclaimer in the documentation and/or other materials provided |
| # with the distribution. |
| # * Neither the name of The Linux Foundation nor the names of its |
| # contributors may be used to endorse or promote products derived |
| # from this software without specific prior written permission. |
| # |
| # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED |
| # WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |
| # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT |
| # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS |
| # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
| # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
| # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR |
| # BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, |
| # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE |
| # OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN |
| # IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| type vendor_cnd, domain; |
| type vendor_cnd_exec, exec_type, vendor_file_type, file_type; |
| file_type_auto_trans(vendor_cnd, socket_device, vendor_cnd_socket); |
| |
| # vendor_cnd is started by init, type transit from init domain to vendor_cnd domain |
| init_daemon_domain(vendor_cnd) |
| |
| #communicating with QTI wlan driver for WFC/ VTiWLAN quality |
| allow vendor_cnd self:capability net_bind_service; |
| unix_socket_send(vendor_cnd, wpa, hal_wifi_supplicant) |
| allow vendor_cnd wpa_data_file:dir w_dir_perms; |
| allow vendor_cnd wpa_data_file:sock_file create_file_perms; |
| |
| #allow processing of VoWifi indications from modem over QMI while dozing |
| allow vendor_cnd self:capability2 block_suspend; |
| |
| allow vendor_cnd self:udp_socket create_socket_perms; |
| allow vendor_cnd self:{ |
| # Allow receiving NETLINK responses from WLAN driver. |
| netlink_socket |
| netlink_generic_socket |
| qipcrtr_socket |
| } create_socket_perms_no_ioctl; |
| |
| allowxperm vendor_cnd self:udp_socket ioctl SIOCGIFMTU; |
| |
| allow vendor_cnd vendor_sysfs_data:file r_file_perms; |
| |
| allow vendor_cnd proc_meminfo:file r_file_perms; |
| |
| set_prop(vendor_cnd, vendor_cnd_prop) |
| |
| # allow vendor_cnd to access vendor_cnd_data_file |
| allow vendor_cnd vendor_cnd_data_file:file create_file_perms; |
| allow vendor_cnd vendor_cnd_data_file:sock_file { unlink create setattr }; |
| allow vendor_cnd vendor_cnd_data_file:dir rw_dir_perms; |
| |
| # allow vendor_cnd to obtain wakelock |
| wakelock_use(vendor_cnd) |
| |
| allow vendor_cnd vendor_ipa_vendor_data_file:dir r_dir_perms; |
| allow vendor_cnd vendor_ipa_vendor_data_file:file r_file_perms; |
| |
| netmgr_socket(vendor_cnd) |
| allow vendor_cnd vendor_netmgrd:fd use; |
| allow vendor_cnd vendor_netmgrd:udp_socket { read write }; |
| |
| # To register vendor_cnd to hwbinder |
| hal_server_domain_bypass(vendor_cnd, vendor_hal_datafactory_qti) |
| binder_call(vendor_hal_datafactory_qti_client, vendor_hal_datafactory_qti_server) |
| binder_call(vendor_hal_datafactory_qti_server, vendor_hal_datafactory_qti_client) |
| hal_attribute_hwservice(vendor_hal_datafactory_qti, vendor_hal_datafactory_hwservice) |
| hal_attribute_service(vendor_hal_datafactory_qti, vendor_hal_factory_aidlservice) |
| |
| r_dir_file(vendor_cnd, vendor_sysfs_ssr) |
| |
| #diag |
| userdebug_or_eng(` |
| diag_use(vendor_cnd) |
| r_dir_file(vendor_cnd, vendor_sysfs_diag) |
| ') |