From db3a89cdca350f609416d672cdf9d318f1c561ed Mon Sep 17 00:00:00 2001 From: Xianpu Liang Date: Sat, 18 Jan 2020 09:51:44 +0800 Subject: [PATCH] [ALPS03868216] wlan_assistant: allow to write nvram to driver Wlan driver has no permission to read nvram and wifi.cfg, wifi_fw.cfg, so need to read that in wlan_assistant, and then write it to wlan driver MTK-Commit-Id: 1df286414a6fefe023069318bd4e7f14606d9fe1 Change-Id: I5e8adcfeb17b043fedec5bd2d65b25fc58f59bae CR-Id: ALPS03868216 Feature: [Module]Wi-Fi HAL --- non_plat/file_contexts | 2 ++ non_plat/wlan_assistant.te | 40 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+) create mode 100644 non_plat/wlan_assistant.te diff --git a/non_plat/file_contexts b/non_plat/file_contexts index 7c00efb..a5e0d44 100644 --- a/non_plat/file_contexts +++ b/non_plat/file_contexts @@ -540,6 +540,8 @@ /(system\/vendor|vendor)/bin/lbs_hidl_service u:object_r:lbs_hidl_service_exec:s0 /(system\/vendor|vendor)/bin/meta_tst u:object_r:meta_tst_exec:s0 /(system\/vendor|vendor)/bin/pre_meta u:object_r:pre_meta_exec:s0 + +/(system\/vendor|vendor)/bin/wlan_assistant u:object_r:wlan_assistant_exec:s0 /(system\/vendor|vendor)/bin/wmt_loader u:object_r:wmt_loader_exec:s0 /(system\/vendor|vendor)/bin/spm_loader u:object_r:spm_loader_exec:s0 /(system\/vendor|vendor)/bin/ccci_mdinit u:object_r:ccci_mdinit_exec:s0 diff --git a/non_plat/wlan_assistant.te b/non_plat/wlan_assistant.te new file mode 100644 index 0000000..bb23601 --- /dev/null +++ b/non_plat/wlan_assistant.te @@ -0,0 +1,40 @@ +# ============================================== +# Policy File of /vendor/bin/wlan_assistant Executable File + +# ============================================== +# Type Declaration +# ============================================== +type wlan_assistant_exec , exec_type, file_type, vendor_file_type; +type wlan_assistant ,domain; + +# ============================================== +# MTK Policy Rule +# ============================================== +init_daemon_domain(wlan_assistant) + +# Date : WK14.34 +# Operation : Migration +# Purpose : for mtk debug mechanism. agpsd_data_file, mtk_agpsd are used +# to share wifi scan results with AGPS module. netlink_socket is used to +# listen events of wlan driver. udp_socket is used to do ioctl with wlan driver +# kernel-3.18 uses netlink_socket, but kernel-4.4 uses generic netlink_socket +allow wlan_assistant agpsd_data_file:sock_file write; +allow wlan_assistant mtk_agpsd:unix_dgram_socket sendto; +allow wlan_assistant agpsd_data_file:dir search; +### TBD, neverallowxperm on line 177 of system/sepolicy/public/domain.te +#allow wlan_assistant self:netlink_socket create_socket_perms; +allow wlan_assistant self:netlink_generic_socket create_socket_perms_no_ioctl; +allow wlan_assistant self:udp_socket { create ioctl }; + +# Date : WK18.17 +# Operation : Migration +# Purpose : To allow wlan_assistant monitor /vendor/nvdata/APCFG/APRDEB, +# /storage/sdcard0, /vendor/firmware. Which can help to check if nvram, +# driver config or firmware config file are changed, if yes, will write it +# to wlan driver in time. +# allow wlan_assistant wifi_data_file:file { read getattr open }; +# allow wlan_assistant wifi_data_file:dir { read search getattr open }; +allow wlan_assistant nvdata_file:dir { search read getattr open }; +allow wlan_assistant nvdata_file:file { read getattr open }; +allow wlan_assistant sysfs:file { open read }; +allow wlan_assistant wmtWifi_device:chr_file { read write getattr open }; \ No newline at end of file