| # Copyright (c) 2018, 2021, 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. |
| allow init { |
| adsprpcd_file |
| cache_file |
| mnt_vendor_file |
| storage_file |
| vendor_vm_system_file |
| same_process_hal_file |
| }:dir mounton; |
| |
| # symlink /sdcard to backing block |
| allow init tmpfs:lnk_file create; |
| |
| allow init tty_device:chr_file rw_file_perms; |
| |
| allow init mnt_vendor_file:dir mounton; |
| |
| allow init vendor_ab_block_device:lnk_file relabelto; |
| |
| #Allow init to mount non-hlos partitions in A/B builds |
| allow init { bt_firmware_file vendor_firmware_file firmware_file } :dir mounton; |
| |
| allow init { bt_firmware_file firmware_file }:filesystem { relabelfrom mount }; |
| allow { bt_firmware_file firmware_file }self:filesystem associate; |
| |
| allow init vendor_qmcs_file:dir { mounton }; |
| allow init vendor_qmcs_file:filesystem { relabelfrom mount unmount relabelto }; |
| |
| dontaudit init kernel:system module_request; |
| |
| allow init sysfs_leds:lnk_file r_file_perms; |
| |
| allow init socket_device:sock_file create_file_perms; |
| |
| #Needed for restorecon. Init already has these permissions |
| #for generic block devices, but is unable to access those |
| #which have a custom lable added by us. |
| allow init { |
| vendor_custom_ab_block_device |
| boot_block_device |
| vendor_xbl_block_device |
| vendor_ssd_block_device |
| vendor_modem_block_device |
| vendor_mdtp_device |
| vendor_vm_data_block_device |
| }:{ blk_file lnk_file } relabelto; |
| |
| #Allow /sys access to write zram disksize |
| allow init sysfs_zram:dir r_dir_perms; |
| allow init sysfs_zram:file r_file_perms; |
| |
| allow init vendor_sysfs_boot_adsp:file w_file_perms; |
| |
| allow init bt_firmware_file:filesystem getattr; |
| allow init firmware_file:filesystem getattr; |
| |
| # Search and write access for vendor_sysfs_graphics for backlight in recovery |
| recovery_only(` |
| allow init vendor_sysfs_graphics:file w_file_perms; |
| allow init vendor_sysfs_graphics:dir search; |
| allow init vendor_sysfs_usb_device:file w_file_perms; |
| ') |