From 81839414488cf4a5235bdf1bdb3b498eea88fe26 Mon Sep 17 00:00:00 2001 From: Peter Wang Date: Sat, 18 Jan 2020 09:52:26 +0800 Subject: [PATCH] [ALPS03901606] eMMC&UFS : Combo feature [Detail] 1. Change type name from sysfs_boot to sysfs_boot_mode 2. Add type name sysfs_boot_type MTK-Commit-Id: 54d5bb31fc8ad1d9ac2e931fe5dc01ef4c1083cf Change-Id: I445ecdf5a5e334a49ccc1d747daa87f6be351d20 Signed-off-by: Peter Wang CR-Id: ALPS03901606 Feature: UFS Booting --- non_plat/aee_aedv.te | 2 +- non_plat/ccci_fsd.te | 1 + non_plat/cmddumper.te | 2 +- non_plat/connsyslogger.te | 2 +- non_plat/emdlogger.te | 2 +- non_plat/factory.te | 3 ++- non_plat/file.te | 5 +++-- non_plat/file_contexts | 3 ++- non_plat/mdlogger.te | 2 +- non_plat/mobile_log_d.te | 2 +- prebuilts/api/26.0/plat_private/file.te | 5 ++++- prebuilts/api/26.0/plat_private/file_contexts | 3 +++ prebuilts/api/26.0/plat_private/recovery.te | 3 +++ 13 files changed, 24 insertions(+), 11 deletions(-) diff --git a/non_plat/aee_aedv.te b/non_plat/aee_aedv.te index 9254d66..bbd8af1 100644 --- a/non_plat/aee_aedv.te +++ b/non_plat/aee_aedv.te @@ -414,7 +414,7 @@ allow aee_aedv proc_msdc_debug:file r_file_perms; allow aee_aedv sysfs_vcore_debug:file r_file_perms; # Purpose: Allow aee_aedv to read /sys/devices/virtual/BOOT/BOOT/boot/boot_mode -allow aee_aedv sysfs_boot:file r_file_perms; +allow aee_aedv sysfs_boot_mode:file r_file_perms; #Purpose: Allow aee_aedv to read/write /sys/kernel/debug/tracing/buffer_total_size_kb userdebug_or_eng(` diff --git a/non_plat/ccci_fsd.te b/non_plat/ccci_fsd.te index e0c7971..742aebe 100644 --- a/non_plat/ccci_fsd.te +++ b/non_plat/ccci_fsd.te @@ -40,6 +40,7 @@ allow ccci_fsd c2k_file:file create_file_perms; allow ccci_fsd otp_part_block_device:blk_file rw_file_perms; allow ccci_fsd otp_device:chr_file rw_file_perms; allow ccci_fsd sysfs:file r_file_perms; +allow ccci_fsd sysfs_boot_type:file { read open }; #============= ccci_fsd MD block data============== allow ccci_fsd block_device:dir search; allow ccci_fsd nvram_device:blk_file rw_file_perms; diff --git a/non_plat/cmddumper.te b/non_plat/cmddumper.te index 2c145a1..c10f721 100644 --- a/non_plat/cmddumper.te +++ b/non_plat/cmddumper.te @@ -25,5 +25,5 @@ allow cmddumper media_rw_data_file:dir { create_dir_perms }; allow cmddumper file_contexts_file:file { read getattr open }; # purpose: access /sys/devices/virtual/BOOT/BOOT/boot/boot_mode -allow cmddumper sysfs_boot:file { read open }; +allow cmddumper sysfs_boot_mode:file { read open }; diff --git a/non_plat/connsyslogger.te b/non_plat/connsyslogger.te index a0ae516..3fdaf14 100755 --- a/non_plat/connsyslogger.te +++ b/non_plat/connsyslogger.te @@ -68,7 +68,7 @@ allow connsyslogger storage_file:dir { create_dir_perms }; allow connsyslogger storage_file:file { create_file_perms }; #permission for read boot mode -allow connsyslogger sysfs_boot:file { read open }; +allow connsyslogger sysfs_boot_mode:file { read open }; allow connsyslogger fw_log_wifi_device:chr_file {read write open ioctl}; allow connsyslogger fw_log_bt_device:chr_file {read write open ioctl}; diff --git a/non_plat/emdlogger.te b/non_plat/emdlogger.te index f791b7d..38e8800 100644 --- a/non_plat/emdlogger.te +++ b/non_plat/emdlogger.te @@ -57,7 +57,7 @@ allow emdlogger storage_file:file { create_file_perms }; #permission for read boot mode #avc: denied { open } path="/sys/devices/virtual/BOOT/BOOT/boot/boot_mode" dev="sysfs" -allow emdlogger sysfs_boot:file { read open }; +allow emdlogger sysfs_boot_mode:file { read open }; # Allow read to sys/kernel/ccci/* files allow emdlogger sysfs_ccci:dir search; diff --git a/non_plat/factory.te b/non_plat/factory.te index dd743d9..0b91700 100644 --- a/non_plat/factory.te +++ b/non_plat/factory.te @@ -227,7 +227,8 @@ allow factory sysfs_ccci:file r_file_perms; # avc: denied { read } for name="boot_mode" dev="sysfs" ino=117 # scontext=u:r:factory:s0 tcontext=u:object_r:sysfs:s0 # tclass=file permissive=0 -allow factory sysfs_boot:file rw_file_perms; +allow factory sysfs_boot_mode:file { read open }; +allow factory sysfs_boot_type:file { read open }; # Date: WK16.30 #Purpose: For gps test diff --git a/non_plat/file.te b/non_plat/file.te index be49646..5d53c27 100644 --- a/non_plat/file.te +++ b/non_plat/file.te @@ -248,8 +248,9 @@ type mtk_powerhal_data_file, file_type, data_file_type; type mddb_data_file, file_type, data_file_type; # Date : WK1814 -# Purpose : for factory to get boot mode -type sysfs_boot, fs_type, sysfs_type; +# Purpose : for factory to get boot mode and type +type sysfs_boot_mode, fs_type, sysfs_type; +type sysfs_boot_type, fs_type, sysfs_type; # consys Log folder type consyslog_data_file, file_type, data_file_type; diff --git a/non_plat/file_contexts b/non_plat/file_contexts index a5e0d44..d5fab5b 100644 --- a/non_plat/file_contexts +++ b/non_plat/file_contexts @@ -479,7 +479,8 @@ /sys/firmware/devicetree/base/chosen/atag\,devinfo u:object_r:sysfs_devinfo:s0 /sys/devices/virtual/thermal(/.*)? u:object_r:sysfs_therm:s0 /sys/devices/virtual/switch/fps(/.*)? u:object_r:sysfs_fps:s0 -/sys/devices/virtual/BOOT/BOOT/boot/boot_mode(/.*)? u:object_r:sysfs_boot:s0 +/sys/devices/virtual/BOOT/BOOT/boot/boot_mode(/.*)? u:object_r:sysfs_boot_mode:s0 +/sys/devices/virtual/BOOT/BOOT/boot/boot_type(/.*)? u:object_r:sysfs_boot_type:s0 /sys/bus/platform/drivers/meta_com_type_info/meta_com_type_info(/.*)? u:object_r:sysfs_comport_type:s0 /sys/bus/platform/drivers/meta_uart_port_info/meta_uart_port_info(/.*)? u:object_r:sysfs_uart_info:s0 /sys/devices/platform/(charger|battery)/ADC_Charger_Voltage u:object_r:sysfs_vbus:s0 diff --git a/non_plat/mdlogger.te b/non_plat/mdlogger.te index aab6a7c..52bc958 100644 --- a/non_plat/mdlogger.te +++ b/non_plat/mdlogger.te @@ -56,4 +56,4 @@ allow emdlogger file_contexts_file:file { read getattr open}; #permission for read boot mode #avc: denied { open } path="/sys/devices/virtual/BOOT/BOOT/boot/boot_mode" dev="sysfs" -allow mdlogger sysfs_boot:file { read open }; \ No newline at end of file +allow mdlogger sysfs_boot_mode:file { read open }; \ No newline at end of file diff --git a/non_plat/mobile_log_d.te b/non_plat/mobile_log_d.te index e1e6435..5087c3a 100644 --- a/non_plat/mobile_log_d.te +++ b/non_plat/mobile_log_d.te @@ -1,5 +1,5 @@ # boot_mdoe file access -allow mobile_log_d sysfs_boot:file { open read }; +allow mobile_log_d sysfs_boot_mode:file { open read }; #proc/ access #allow mobile_log_d proc:file r_file_perms; diff --git a/prebuilts/api/26.0/plat_private/file.te b/prebuilts/api/26.0/plat_private/file.te index e1d7a89..53aaadf 100755 --- a/prebuilts/api/26.0/plat_private/file.te +++ b/prebuilts/api/26.0/plat_private/file.te @@ -3,4 +3,7 @@ # ============================================== # For drmserver -type access_sys_file, fs_type, sysfs_type; \ No newline at end of file +type access_sys_file, fs_type, sysfs_type; + +# For boot type +type sysfs_boot_type, fs_type, sysfs_type; \ No newline at end of file diff --git a/prebuilts/api/26.0/plat_private/file_contexts b/prebuilts/api/26.0/plat_private/file_contexts index 2392bc0..fc4c9b6 100755 --- a/prebuilts/api/26.0/plat_private/file_contexts +++ b/prebuilts/api/26.0/plat_private/file_contexts @@ -39,3 +39,6 @@ # For drmserver /sys/block/mmcblk0rpmb/size u:object_r:access_sys_file:s0 + +# For boot type +/sys/devices/virtual/BOOT/BOOT/boot/boot_type(/.*)? u:object_r:sysfs_boot_type:s0 diff --git a/prebuilts/api/26.0/plat_private/recovery.te b/prebuilts/api/26.0/plat_private/recovery.te index 2d22997..3d92389 100755 --- a/prebuilts/api/26.0/plat_private/recovery.te +++ b/prebuilts/api/26.0/plat_private/recovery.te @@ -2,3 +2,6 @@ allow recovery mtd_device:dir search; allow recovery mtd_device:chr_file { read write open ioctl getattr }; allow recovery self:capability sys_resource; + +# For boot type +allow recovery sysfs_boot_type:file { read open };