| # 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. |
| # Restricted domain for shell processes spawned by init. |
| # Normally these are shell commands or scripts invoked via sh |
| # from an init*.rc file. No service should ever run in this domain. |
| type vendor_qti_init_shell, domain; |
| type vendor_qti_init_shell_exec, exec_type, vendor_file_type,file_type; |
| |
| init_daemon_domain(vendor_qti_init_shell) |
| |
| domain_auto_trans(init, vendor_shell_exec, vendor_qti_init_shell) |
| |
| # For executing init shell scripts (init.qcom.early_boot.sh) |
| allow vendor_qti_init_shell vendor_qti_init_shell_exec:file { rx_file_perms entrypoint }; |
| #execute init scripts |
| allow vendor_qti_init_shell vendor_shell_exec:file {rx_file_perms entrypoint }; |
| allow vendor_qti_init_shell vendor_toolbox_exec:file rx_file_perms; |
| |
| # For getting idle_time value |
| # this is needed for dynamic_fps and bw_mode_bitmap |
| allow vendor_qti_init_shell vendor_sysfs_graphics:file {rw_file_perms setattr}; |
| |
| allow vendor_qti_init_shell mnt_vendor_file:dir w_dir_perms; |
| allow vendor_qti_init_shell mnt_vendor_file:file create_file_perms; |
| allow vendor_qti_init_shell vendor_smd_device:chr_file rw_file_perms; |
| |
| # Run helpers from / or /system without changing domain. |
| allow vendor_qti_init_shell { rootfs vendor_shell_exec }:file execute_no_trans; |
| |
| allow vendor_qti_init_shell gpu_device:chr_file getattr; |
| |
| allow vendor_qti_init_shell vendor_sysfs_cpu_boost:dir r_dir_perms; |
| allow vendor_qti_init_shell vendor_sysfs_cpu_boost:file rw_file_perms; |
| |
| # for insmod of iris ko, this is needed. |
| # fowner and fsetid are needed for chmod display nodes. |
| allow vendor_qti_init_shell self:capability { |
| sys_module |
| net_admin |
| chown |
| fowner |
| fsetid |
| sys_admin |
| }; |
| |
| set_prop(vendor_qti_init_shell, vendor_ctl_netmgrd_prop) |
| set_prop(vendor_qti_init_shell, vendor_ctl_port-bridge_prop) |
| set_prop(vendor_qti_init_shell, vendor_ctl_rild_prop) |
| set_prop(vendor_qti_init_shell, vendor_ctl_qcrild_prop) |
| set_prop(vendor_qti_init_shell, vendor_ipacm-diag_prop) |
| set_prop(vendor_qti_init_shell, vendor_ipacm_prop) |
| set_prop(vendor_qti_init_shell, vendor_msm_irqbalance_prop) |
| set_prop(vendor_qti_init_shell, vendor_dataqti_prop) |
| set_prop(vendor_qti_init_shell, vendor_display_prop) |
| set_prop(vendor_qti_init_shell, vendor_alarm_boot_prop) |
| set_prop(vendor_qti_init_shell, vendor_gralloc_prop) |
| set_prop(vendor_qti_init_shell, vendor_usb_prop) |
| set_prop(vendor_qti_init_shell, vendor_system_prop) |
| set_prop(vendor_qti_init_shell, vendor_mpctl_prop) |
| set_prop(vendor_qti_init_shell, vendor_radio_prop) |
| set_prop(vendor_qti_init_shell, vendor_audio_prop) |
| get_prop(vendor_qti_init_shell, exported3_radio_prop) |
| set_prop(vendor_qti_init_shell, vendor_gpu_prop) |
| set_prop(vendor_qti_init_shell, vendor_sensors_prop) |
| set_prop(vendor_qti_init_shell, vendor_adsprpc_prop) |
| set_prop(vendor_qti_init_shell, vendor_opengles_prop) |
| |
| allow vendor_qti_init_shell { |
| sysfs_devices_system_cpu |
| sysfs_lowmemorykiller |
| vendor_sysfs_mmc_host |
| vendor_sysfs_process_reclaim |
| }:file w_file_perms; |
| |
| r_dir_file(vendor_qti_init_shell, sysfs_type) |
| r_dir_file(vendor_qti_init_shell, vendor_sysfs_devfreq) |
| allow vendor_qti_init_shell vendor_sysfs_devfreq:file w_file_perms; |
| allow vendor_qti_init_shell vendor_sysfs_soc:file write; |
| allow vendor_qti_init_shell sysfs:{ dir file lnk_file } relabelfrom; |
| allow vendor_qti_init_shell sysfs_devices_system_cpu: { dir file lnk_file } relabelto; |
| |
| # To start sensors for DSPS enabled platforms |
| r_dir_file(vendor_qti_init_shell, mnt_vendor_file) |
| r_dir_file(vendor_qti_init_shell, vendor_persist_bluetooth_file) |
| |
| allow vendor_qti_init_shell { proc proc_net}:file write; |
| allow vendor_qti_init_shell proc_net:file r_file_perms; |
| |
| allow vendor_qti_init_shell graphics_device:dir create_dir_perms; |
| allow vendor_qti_init_shell graphics_device:lnk_file create_file_perms; |
| |
| #insmod of ko from scripts need kernel key search |
| allow vendor_qti_init_shell kernel:key search; |
| |
| allow vendor_qti_init_shell cgroup:dir add_name; |
| |
| # To allow copy for mbn files |
| r_dir_file(vendor_qti_init_shell, firmware_file) |
| |
| # /dev/block/zram0 |
| allow vendor_qti_init_shell block_device:dir r_dir_perms; |
| allow vendor_qti_init_shell swap_block_device:blk_file rw_file_perms; |
| |
| #For configfs permission |
| allow vendor_qti_init_shell configfs:dir r_dir_perms; |
| allow vendor_qti_init_shell configfs:file rw_file_perms; |
| |
| #Allow /sys access to write zram disksize |
| allow vendor_qti_init_shell sysfs_zram:dir r_dir_perms; |
| allow vendor_qti_init_shell sysfs_zram:file rw_file_perms; |
| |
| # To get GPU frequencies and set attributes |
| allow vendor_qti_init_shell vendor_sysfs_kgsl:file { r_file_perms setattr }; |
| |
| allow vendor_qti_init_shell proc:file r_file_perms; |
| allow vendor_qti_init_shell rootfs:file r_file_perms; |
| |
| allow vendor_qti_init_shell vendor_radio_vendor_data_file:dir create_dir_perms; |
| allow vendor_qti_init_shell vendor_radio_vendor_data_file:file create_file_perms; |
| |
| allow vendor_qti_init_shell vendor_mbn_data_file:dir create_dir_perms; |
| allow vendor_qti_init_shell vendor_mbn_data_file:file create_file_perms; |
| |
| set_prop(vendor_qti_init_shell, vendor_ctl_vendor_hbtp_prop) |
| |
| # rules for vm_bms |
| allow vendor_qti_init_shell { |
| vendor_sysfs_battery_supply |
| vendor_sysfs_usb_supply |
| vendor_sysfs_usbpd_device |
| }:dir r_dir_perms; |
| |
| allow vendor_qti_init_shell { |
| vendor_sysfs_battery_supply |
| vendor_sysfs_usb_supply |
| vendor_sysfs_usbpd_device |
| }:file rw_file_perms; |
| |
| allow vendor_qti_init_shell vendor_sysfs_battery_supply:file setattr; |
| allow vendor_qti_init_shell vendor_sysfs_usb_supply:file setattr; |
| allow vendor_qti_init_shell vendor_sysfs_usbpd_device:file setattr; |
| |
| allow vendor_qti_init_shell sysfs_devices_system_cpu:file w_file_perms; |
| |
| allow vendor_qti_init_shell vendor_sysfs_msm_power:file rw_file_perms; |
| |
| allow vendor_qti_init_shell vendor_msm_irqbalanced_exec:file getattr; |
| |
| set_prop(vendor_qti_init_shell, vendor_alarm_boot_prop) |
| |
| set_prop(vendor_qti_init_shell, vendor_wifi_prop) |
| |
| # To read /proc/meminfo |
| allow vendor_qti_init_shell proc_meminfo:file r_file_perms; |
| |
| allow vendor_qti_init_shell vendor_sysfs_suspend:file w_file_perms; |
| |
| # Set ro.vendor.qti.soc_id to soc_id in QCV init script |
| set_prop(vendor_qti_init_shell, vendor_soc_id_prop); |
| # Set ro.vendor.qti.soc_name to soc_name in QCV init script |
| set_prop(vendor_qti_init_shell, vendor_soc_name_prop); |
| |
| # Get persist.vendor.console.silent.config for kernel console log level |
| get_prop(vendor_qti_init_shell, vendor_console_log_level_prop) |
| |
| set_prop(vendor_qti_init_shell,vendor_dcvs_prop) |