sepolicy: Add support for fastbootd to flash dynamic partitions

Sepolicy changes needed for dynamic partition support for legacy
targets : SDM845 and SDM710
- Add rules to enable fastbootd mode flashing of dynamic partition
- Define labels for super, recovery and vbmeta_system partitions
- Allow update_engine to access recovery partition for OTA

Change-Id: I6f692da6ab687529833a87b6feb375fda26508b8
This commit is contained in:
Anuj Singhal 2019-05-24 22:00:26 +05:30
parent 0b9ecbe48c
commit 8c55793951
6 changed files with 55 additions and 0 deletions

38
legacy/vendor/common/fastbootd.te vendored Normal file
View file

@ -0,0 +1,38 @@
# Copyright (c) 2019, 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 fastbootd
recovery_only(`
allow fastbootd {
custom_ab_block_device
recovery_block_device
xbl_block_device
uefi_block_device
modem_block_device
mdtp_device
}:blk_file { rw_file_perms };
')

View file

@ -40,6 +40,7 @@ allow hal_bootctl {
ssd_device
modem_block_device
system_block_device
recovery_block_device
mdtp_device
}:blk_file { getattr };

View file

@ -49,6 +49,7 @@
/dev/block/platform/soc/1d84000.ufshc/by-name/mdtp u:object_r:mdtp_device:s0
/dev/block/platform/soc/1d84000.ufshc/by-name/dip u:object_r:dip_device:s0
/dev/block/platform/soc/1d84000.ufshc/by-name/storsec u:object_r:boot_block_device:s0
/dev/block/platform/soc/1d84000.ufshc/by-name/super u:object_r:super_block_device:s0
#rawdump partition
/dev/block/platform/soc/1d84000.ufshc/by-name/rawdump u:object_r:rawdump_block_device:s0
@ -81,8 +82,12 @@
/dev/block/platform/soc/1d84000.ufshc/by-name/xbl_config_[ab] u:object_r:custom_ab_block_device:s0
/dev/block/platform/soc/1d84000.ufshc/by-name/storsec_[ab] u:object_r:custom_ab_block_device:s0
/dev/block/platform/soc/1d84000.ufshc/by-name/ImageFv_[ab] u:object_r:custom_ab_block_device:s0
/dev/block/platform/soc/1d84000.ufshc/by-name/recovery_[ab] u:object_r:recovery_block_device:s0
/dev/block/platform/soc/1d84000.ufshc/by-name/vbmeta_system_[ab] u:object_r:custom_ab_block_device:s0
#for eMMC
/dev/block/platform/soc/7c4000.sdhci/by-name/super u:object_r:super_block_device:s0
# A/B partitions.
/dev/block/platform/soc/7c4000.sdhci/by-name/abl_[ab] u:object_r:custom_ab_block_device:s0
/dev/block/platform/soc/7c4000.sdhci/by-name/apdp_[ab] u:object_r:custom_ab_block_device:s0
@ -111,6 +116,8 @@
/dev/block/platform/soc/7c4000.sdhci/by-name/xbl_config_[ab] u:object_r:custom_ab_block_device:s0
/dev/block/platform/soc/7c4000.sdhci/by-name/storsec_[ab] u:object_r:custom_ab_block_device:s0
/dev/block/platform/soc/7c4000.sdhci/by-name/ImageFv_[ab] u:object_r:custom_ab_block_device:s0
/dev/block/platform/soc/7c4000.sdhci/by-name/recovery_[ab] u:object_r:recovery_block_device:s0
/dev/block/platform/soc/7c4000.sdhci/by-name/vbmeta_system_[ab] u:object_r:custom_ab_block_device:s0
#non A/B
/dev/block/platform/soc/7c4000.sdhci/by-name/system u:object_r:system_block_device:s0

View file

@ -36,5 +36,7 @@ allow update_engine_common {
system_block_device
boot_block_device
mdtp_device
recovery_block_device
}:blk_file rw_file_perms;
allow update_engine_common tmpfs:lnk_file r_file_perms;

View file

@ -46,6 +46,7 @@
/dev/block/platform/soc/1d84000.ufshc/by-name/mdtp u:object_r:mdtp_device:s0
/dev/block/platform/soc/1d84000.ufshc/by-name/dip u:object_r:dip_device:s0
/dev/block/platform/soc/1d84000.ufshc/by-name/storsec u:object_r:boot_block_device:s0
/dev/block/platform/soc/1d84000.ufshc/by-name/super u:object_r:super_block_device:s0
#rawdump partition
/dev/block/platform/soc/1d84000.ufshc/by-name/rawdump u:object_r:rawdump_block_device:s0
@ -79,6 +80,9 @@
/dev/block/platform/soc/1d84000.ufshc/by-name/storsec_[ab] u:object_r:custom_ab_block_device:s0
/dev/block/platform/soc/1d84000.ufshc/by-name/ImageFv_[ab] u:object_r:custom_ab_block_device:s0
/dev/block/platform/soc/1d84000.ufshc/by-name/persist u:object_r:persist_block_device:s0
/dev/block/platform/soc/1d84000.ufshc/by-name/recovery_[ab] u:object_r:recovery_block_device:s0
/dev/block/platform/soc/1d84000.ufshc/by-name/vbmeta_system_[ab] u:object_r:custom_ab_block_device:s0
/dev/block/platform/soc/1d84000.ufshc/by-name/uefisecapp_[ab] u:object_r:uefi_block_device:s0
# Block device holding the GPT, where the A/B attributes are stored.
/dev/block/platform/soc/1d84000.ufshc/sd[ade] u:object_r:gpt_block_device:s0

View file

@ -32,5 +32,8 @@ allow update_engine_common {
xbl_block_device
ssd_device
modem_block_device
uefi_block_device
recovery_block_device
}:blk_file rw_file_perms;
allow update_engine_common tmpfs:lnk_file r_file_perms;