| # Copyright (c) 2019-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. |
| # |
| # |
| # |
| # Changes from Qualcomm Innovation Center are provided under the following license: |
| # |
| # Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved. |
| # |
| # Redistribution and use in source and binary forms, with or without |
| # modification, are permitted (subject to the limitations in the |
| # disclaimer below) 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 Qualcomm Innovation Center, Inc. nor the names of its |
| # contributors may be used to endorse or promote products derived |
| # from this software without specific prior written permission. |
| # |
| # NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE |
| # GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT |
| # HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED |
| # WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |
| # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
| # IN NO EVENT SHALL THE COPYRIGHT HOLDER 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_qms, domain; |
| type vendor_qms_0, domain; |
| type vendor_qms_1, domain; |
| type vendor_qms_exec, exec_type, vendor_file_type, file_type; |
| init_daemon_domain(vendor_qms) |
| |
| allow vendor_qms self:capability { |
| net_admin |
| }; |
| |
| allow vendor_qms vendor_qms:{ |
| netlink_socket |
| qipcrtr_socket |
| netlink_generic_socket |
| netlink_route_socket |
| }create_socket_perms_no_ioctl; |
| |
| allow vendor_qms self:udp_socket create_socket_perms; |
| allowxperm vendor_qms self:udp_socket ioctl priv_sock_ioctls; |
| hal_server_domain_bypass(vendor_qms, vendor_hal_qms_qti) |
| hal_attribute_service(vendor_hal_qms_qti, vendor_hal_qms_service) |
| binder_call(vendor_hal_qms_qti_server, servicemanager) |
| binder_call(vendor_hal_qms_qti_client, vendor_hal_qms_qti_server) |
| binder_call(vendor_hal_qms_qti_server, vendor_hal_qms_qti_client) |
| allow vendor_qms self:netlink_route_socket nlmsg_readpriv; |
| |
| hal_client_domain(vendor_qms,hal_wifi_hostapd) |
| hal_client_domain(vendor_qms,hal_wifi_supplicant) |
| hal_client_domain(vendor_qms, hal_bluetooth) |
| |
| net_domain(vendor_qms) |
| |
| #glink |
| allow vendor_qms vendor_qmc_dma_device:chr_file rw_file_perms; |
| allow vendor_qms vendor_qmc_cma_device:chr_file rw_file_perms; |
| |
| #allow QMS to use QTR SDK |
| qtr_sdk_use(vendor_qms) |
| allow vendor_qms vendor_qms_vndr_data_file:dir create_dir_perms; |
| allow vendor_qms vendor_qms_vndr_data_file:file create_file_perms; |
| |
| userdebug_or_eng(` |
| unix_socket_connect(vendor_qms, logdr, logd); |
| ') |
| # QMS child process |
| allow vendor_qms self:process setcurrent; |
| allow vendor_qms { |
| vendor_qms_0 |
| vendor_qms_1 |
| }:process dyntransition; |
| |
| neverallow { domain - vendor_qms } { |
| vendor_qms_0 |
| vendor_qms_1 |
| }:process dyntransition; |
| |
| neverallow vendor_qms ~{ |
| vendor_qms_0 |
| vendor_qms_1 |
| }:process dyntransition; |
| |
| neverallow { vendor_qms_0 vendor_qms_1 } self:capability_class_set *; |
| |
| allow vendor_qms_0 vendor_qms:fd use; |
| allow vendor_qms_0 vendor_qms:unix_dgram_socket write; |
| allow vendor_qms_0 vendor_qms:unix_stream_socket { read write }; |
| allow vendor_qms_0 vendor_qms_exec:file execute_no_trans; |
| crash_dump_fallback(vendor_qms_0); |
| allow vendor_qms_0 self:{ |
| qipcrtr_socket |
| }create_socket_perms_no_ioctl; |
| qesdk_access(vendor_qms_0) |
| userdebug_or_eng(` |
| get_prop(vendor_qms_0, vendor_qms_prop) |
| ') |
| |
| allow vendor_qms_1 vendor_qms:fd use; |
| allow vendor_qms_1 vendor_qms:unix_dgram_socket write; |
| allow vendor_qms_1 vendor_qms:unix_stream_socket { read write }; |
| allow vendor_qms_1 vendor_qms_exec:file execute_no_trans; |
| allow vendor_qms_1 self:{ |
| qipcrtr_socket |
| }create_socket_perms_no_ioctl; |
| qesdk_access(vendor_qms_1) |
| crash_dump_fallback(vendor_qms_1); |
| userdebug_or_eng(` |
| get_prop(vendor_qms_1, vendor_qms_prop) |
| ') |
| |
| # allow qms to access wpa_socket |
| allow vendor_qms vendor_wifi_vendor_data_file:dir r_dir_perms; |
| allow vendor_qms vendor_wifi_vendor_wpa_socket:sock_file write; |
| |
| #communicating with wpa supplicant for sending commands/listening to events |
| unix_socket_send(vendor_qms, wpa, hal_wifi_supplicant) |
| allow vendor_qms wpa_data_file:dir w_dir_perms; |
| allow vendor_qms wpa_data_file:sock_file create_file_perms; |
| |
| allow vendor_qms firmware_file:dir r_dir_perms; |
| allow vendor_qms firmware_file:file r_file_perms; |
| |
| # Allow vendor_qms to read vendor_soc_model_prop |
| get_prop(vendor_qms, vendor_soc_model_prop); |
| |
| #communicating with hostapd for sending commands/listening to events |
| allow vendor_qms hostapd_data_file:dir rw_dir_perms; |
| allow vendor_qms hostapd_data_file:sock_file create_file_perms; |
| allow vendor_qms { hal_wifi_hostapd_default }:unix_dgram_socket sendto; |
| |
| add_service(vendor_qms, vendor_qms_service) |
| vndbinder_use(vendor_qms) |
| allow vendor_qms vendor_qms_service:service_manager find; |
| |
| wakelock_use(vendor_qms) |
| |
| # Policies needed for SoS |
| allow vendor_qms vendor_xtra_service:service_manager find; |
| binder_call(vendor_qms, vendor_location_xtra_daemon) |
| qesdk_access(vendor_qms) |
| |
| get_prop(vendor_qms, vendor_qms_prop) |
| |
| allow vendor_qms vendor_sysfs_battery_supply:dir search; |
| allow vendor_qms vendor_sysfs_battery_supply:file { open read }; |
| |
| # collect tombstone |
| crash_dump_fallback(vendor_qms); |
| |
| allow vendor_qms vendor_qms_app:udp_socket { read write }; |
| allow vendor_qms vendor_qms_app:tcp_socket { connect getopt read write }; |