From c9e1ce17291b8e4d47c20b908795f12eaa32a60c Mon Sep 17 00:00:00 2001 From: chenpaul Date: Mon, 29 Apr 2019 19:18:22 +0800 Subject: [PATCH] wifi - Add sepolicy for set driver/fw version by hal. ag/6722341 will set WLAN driver/FW when start legacy HAL. The patch have some change to for the same purpose: 1. Add sepolicy for wifi hal to set WLAN driver/FW into property 2. Remove sepolicy for init.qcom.wlan.sh, because it no necessary Bug: 127715974 Test: Property with wlan driver/FW version at enforcing mode: It can be verified by the below command: # adb shell getprop vendor.wlan.driver.version # adb shell getprop vendor.wlan.firmware.version Change-Id: I48f1752749db376a19235676af116cbbdeb63811 --- sepolicy/vendor/file_contexts | 1 - sepolicy/vendor/hal_wifi_default.te | 5 ++++- sepolicy/vendor/init-wlan-sh.te | 14 -------------- 3 files changed, 4 insertions(+), 16 deletions(-) delete mode 100644 sepolicy/vendor/init-wlan-sh.te diff --git a/sepolicy/vendor/file_contexts b/sepolicy/vendor/file_contexts index 8011c8f8..b66f65ae 100644 --- a/sepolicy/vendor/file_contexts +++ b/sepolicy/vendor/file_contexts @@ -174,7 +174,6 @@ /vendor/bin/imsrcsd u:object_r:hal_rcsservice_exec:s0 /vendor/bin/init\.qcom\.devstart\.sh u:object_r:init-qcom-devstart-sh_exec:s0 /vendor/bin/init\.qcom\.ipastart\.sh u:object_r:init-qcom-ipastart-sh_exec:s0 -/vendor/bin/init\.qcom\.wlan\.sh u:object_r:init-qcom-wlan-sh_exec:s0 /vendor/bin/init\.insmod\.sh u:object_r:init-insmod-sh_exec:s0 /vendor/etc/init\.insmod\.cfg u:object_r:init-insmod-sh_exec:s0 /vendor/bin/init\.power\.sh u:object_r:init_power_exec:s0 diff --git a/sepolicy/vendor/hal_wifi_default.te b/sepolicy/vendor/hal_wifi_default.te index a0155584..d6f02d59 100644 --- a/sepolicy/vendor/hal_wifi_default.te +++ b/sepolicy/vendor/hal_wifi_default.te @@ -11,6 +11,9 @@ allow hal_wifi_default wlan_device:chr_file w_file_perms; # Allow wifi hal to read debug info from the driver. r_dir_file(hal_wifi_default, proc_wifi_dbg) +# Write wlan driver/fw version into property +set_prop(hal_wifi_default, vendor_wifi_version) + dontaudit hal_wifi_default kernel:system module_request; dontaudit hal_wifi_default self:capability sys_module; @@ -19,4 +22,4 @@ userdebug_or_eng(` # Allow wifi hal to access wlan debugfs files and directories allow hal_wifi_default debugfs_wlan:dir r_dir_perms; -') \ No newline at end of file +') diff --git a/sepolicy/vendor/init-wlan-sh.te b/sepolicy/vendor/init-wlan-sh.te deleted file mode 100644 index 3380c861..00000000 --- a/sepolicy/vendor/init-wlan-sh.te +++ /dev/null @@ -1,14 +0,0 @@ -type init-qcom-wlan-sh, domain; -type init-qcom-wlan-sh_exec, exec_type, vendor_file_type, file_type; - -init_daemon_domain(init-qcom-wlan-sh) - -allow init-qcom-wlan-sh vendor_shell_exec:file rx_file_perms; -allow init-qcom-wlan-sh vendor_toolbox_exec:file rx_file_perms; - -# Set the vendor.wlan.driver.version and vendor.wlan.firmware.version property -set_prop(init-qcom-wlan-sh, vendor_wifi_version) - -# /sys/kernel/wifi/wlan/driver_version and /sys/kernel/wifi/wlan/fw/0/version -allow init-qcom-wlan-sh sysfs_msm_wlan:dir r_dir_perms; -allow init-qcom-wlan-sh sysfs_msm_wlan:file r_file_perms;