From f20ee5e7abc8c8f739cff18d048ec5521bedf7b6 Mon Sep 17 00:00:00 2001 From: mtk12101 Date: Sat, 18 Jan 2020 10:06:36 +0800 Subject: [PATCH] [ALPS04017619] SELinux policy rule optimization Spending more bootup time after label kernel interface node in file_contexts, there is another way to label kerner interface node on genfs_contexts file. When move the label rule to genfs_contexts file, the bootup time will speed more than 500ms. MTK-Commit-Id: e237c9367e74f2953b843cc9224a98b4e7cfddbc Change-Id: I1a1e369c3eaaf359c3bf7c051793a3ffba4c71fc CR-Id: ALPS04017619 Feature: [Android Default] SELinux, SEAndroid, and SE-MTK --- non_plat/file_contexts | 41 -------------------------------- non_plat/genfs_contexts | 48 +++++++++++++++++++++++++++++++++++++- plat_private/file_contexts | 1 - 3 files changed, 47 insertions(+), 43 deletions(-) diff --git a/non_plat/file_contexts b/non_plat/file_contexts index 2cb6f20..47cffdb 100644 --- a/non_plat/file_contexts +++ b/non_plat/file_contexts @@ -473,25 +473,7 @@ /sys/power/vcorefs/pwr_ctrl -- u:object_r:sysfs_vcorefs_pwrctrl:s0 /sys/power/dcm_state u:object_r:sysfs_dcm:s0 /sys/power/mtkdcs/mode u:object_r:sysfs_dcs:s0 -/sys/devices/virtual/misc/md32(/.*)? u:object_r:sysfs_md32:s0 -/sys/devices/virtual/misc/scp(/.*)? u:object_r:sysfs_scp:s0 -/sys/devices/virtual/misc/scp_B(/.*)? u:object_r:sysfs_scp:s0 -/sys/devices/virtual/misc/sspm(/.*)? u:object_r:sysfs_sspm:s0 -/sys/devices/virtual/misc/adsp(/.*)? u:object_r:sysfs_adsp:s0 -/sys/kernel/ccci(/.*)? u:object_r:sysfs_ccci:s0 /sys/mtk_ssw(/.*)? u:object_r:sysfs_ssw:s0 -/sys/bus/platform/drivers/dev_info/dev_info u:object_r:sysfs_devinfo:s0 -/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_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 -/sys/devices/platform/(charger|battery)/Pump_Express u:object_r:sysfs_pump_express:s0 -/sys/devices/platform/mt_usb/musb-hdrc/dual_role_usb(/.*)? u:object_r:sysfs_dual_role_usb20:s0 -/sys/devices/platform/mt_usb/musb-hdrc/cmode(/.*)? u:object_r:sysfs_usb_cmode:s0 ############################# # debugfs files @@ -634,34 +616,11 @@ /vendor/bin/hw/android\.hardware\.drm@1\.1-service\.clearkey u:object_r:hal_drm_clearkey_exec:s0 /vendor/bin/loghidlvendorservice u:object_r:loghidlvendorservice_exec:s0 -# Date : 2018/06/15 -# Purpose : mtk EM touchscreen settings -/sys/module/tpd_debug(/.*)? u:object_r:sysfs_tpd_debug:s0 # Date : 2018/06/15 # Purpose : mtk EM flash reading /proc/mounts u:object_r:proc_flash:s0 -# Date : 2018/06/15 -# Purpose : mtk EM PMU reading/setting -/sys/devices/platform/mt-pmic(/.*)? u:object_r:sysfs_pmu:s0 -/sys/devices/platform/mt6333-user(/.*)? u:object_r:sysfs_pmu:s0 -/sys/devices/platform/mt6311-user(/.*)? u:object_r:sysfs_pmu:s0 - -# Date : 2018/06/15 -# Purpose : mtk EM Power debug_log setting -/sys/devices/platform/spm(/.*)? u:object_r:sysfs_spm:s0 - -# Date : 2018/06/15 -# Purpose : mtk EM Audio headset detect -/sys/bus/platform/drivers/Accdet_Driver/state u:object_r:sysfs_headset:s0 - -# Date: 2018/07/02 -#Purpose : MTK Vibrator -/sys/devices/virtual/timed_output/vibrator(/.*)? u:object_r:sysfs_vibrator:s0 -/sys/devices/platform/leds-mt65xx/leds(/.*)? u:object_r:sysfs_leds:s0 -/sys/devices/platform/odm/odm:vibrator@0/leds/vibrator(/.*)? u:object_r:sysfs_vibrator:s0 - # Date: 2018/07/06 # Purpose for same-process HAL files and their dependencies: libGLES_mali.so need libm4u.so on mali GPU. /vendor/lib(64)?/libm4u\.so u:object_r:same_process_hal_file:s0 diff --git a/non_plat/genfs_contexts b/non_plat/genfs_contexts index f74aed8..d5d10b6 100644 --- a/non_plat/genfs_contexts +++ b/non_plat/genfs_contexts @@ -42,11 +42,57 @@ genfscon iso9660 / u:object_r:iso9660:s0 genfscon rawfs / u:object_r:rawfs:s0 genfscon fuseblk / u:object_r:fuseblk:s0 +# Date : 2018/06/15 +# Purpose : mtk EM Audio headset detect +genfscon sysfs /bus/platform/drivers/Accdet_Driver/state u:object_r:sysfs_headset:s0 +genfscon sysfs /bus/platform/drivers/dev_info/dev_info u:object_r:sysfs_devinfo:s0 +genfscon sysfs /bus/platform/drivers/meta_com_type_info/meta_com_type_info u:object_r:sysfs_comport_type:s0 +genfscon sysfs /bus/platform/drivers/meta_uart_port_info/meta_uart_port_info u:object_r:sysfs_uart_info:s0 + genfscon sysfs /devices/platform/battery u:object_r:sysfs_batteryinfo:s0 +genfscon sysfs /devices/platform/charger/ADC_Charger_Voltage u:object_r:sysfs_vbus:s0 +genfscon sysfs /devices/platform/battery/ADC_Charger_Voltage u:object_r:sysfs_vbus:s0 +genfscon sysfs /devices/platform/charger/Pump_Express u:object_r:sysfs_pump_express:s0 +genfscon sysfs /devices/platform/battery/Pump_Express u:object_r:sysfs_pump_express:s0 genfscon sysfs /devices/platform/mt_charger/power_supply u:object_r:sysfs_batteryinfo:s0 +genfscon sysfs /devices/platform/mt-rtc/rtc u:object_r:sysfs_rtc:s0 +genfscon sysfs /devices/platform/mt-pmic u:object_r:sysfs_pmu:s0 +genfscon sysfs /devices/platform/mt6333-user u:object_r:sysfs_pmu:s0 +genfscon sysfs /devices/platform/mt6311-user u:object_r:sysfs_pmu:s0 +genfscon sysfs /devices/platform/mt_usb/musb-hdrc/dual_role_usb u:object_r:sysfs_dual_role_usb20:s0 +genfscon sysfs /devices/platform/mt_usb/musb-hdrc/cmode u:object_r:sysfs_usb_cmode:s0 + +genfscon sysfs /devices/virtual/BOOT/BOOT/boot/boot_mode u:object_r:sysfs_boot_mode:s0 +genfscon sysfs /devices/virtual/BOOT/BOOT/boot/boot_type u:object_r:sysfs_boot_type:s0 + +genfscon sysfs /devices/virtual/misc/md32 u:object_r:sysfs_md32:s0 +genfscon sysfs /devices/virtual/misc/scp u:object_r:sysfs_scp:s0 +genfscon sysfs /devices/virtual/misc/scp_B u:object_r:sysfs_scp:s0 +genfscon sysfs /devices/virtual/misc/sspm u:object_r:sysfs_sspm:s0 +genfscon sysfs /devices/virtual/misc/adsp u:object_r:sysfs_adsp:s0 + +genfscon sysfs /devices/virtual/thermal u:object_r:sysfs_therm:s0 +genfscon sysfs /devices/virtual/switch/fps u:object_r:sysfs_fps:s0 + +genfscon sysfs /firmware/devicetree/base/chosen/atag,devinfo u:object_r:sysfs_devinfo:s0 + +genfscon sysfs /kernel/ccci u:object_r:sysfs_ccci:s0 + +# Date : 2018/06/15 +# Purpose : mtk EM touchscreen settings +genfscon sysfs /module/tpd_debug u:object_r:sysfs_tpd_debug:s0 +genfscon sysfs /module/tpd_setting u:object_r:sysfs_tpd_setting:s0 genfscon sysfs /power/vcorefs/vcore_debug u:object_r:sysfs_vcore_debug:s0 genfscon sysfs /power/vcorefs/opp_table u:object_r:sysfs_vcore_debug:s0 -genfscon sysfs /devices/platform/mt-rtc/rtc u:object_r:sysfs_rtc:s0 + +# Date: 2018/08/09 +#Purpose : MTK Vibrator +genfscon sysfs /devices/virtual/timed_output/vibrator u:object_r:sysfs_vibrator:s0 +genfscon sysfs /devices/platform/odm/odm:vibrator@0/leds/vibrator u:object_r:sysfs_vibrator:s0 +genfscon sysfs /devices/platform/leds-mt65xx/leds u:object_r:sysfs_leds:s0 +# Date : 2018/08/109 +# Purpose : mtk EM Power debug_log setting +genfscon sysfs /devices/platform/spm u:object_r:sysfs_spm:s0 # mtk EM FreqHopping setting genfscon proc /freqhopping/freqhopping_debug u:object_r:proc_freqhop:s0 diff --git a/plat_private/file_contexts b/plat_private/file_contexts index f643753..cc10034 100644 --- a/plat_private/file_contexts +++ b/plat_private/file_contexts @@ -43,6 +43,5 @@ #MTK vibrator /sys/devices/platform/vibrator@0/leds/vibrator(/.*)? u:object_r:sysfs_vibrator:s0 -/sys/module/tpd_setting(/.*)? u:object_r:sysfs_tpd_setting:s0 /sys/block/mmcblk0rpmb/size u:object_r:access_sys_file:s0