dhd: fix wifi driver caused selinux denied issue [1/1]
authorShuide Chen <shuide.chen@amlogic.com>
Tue, 22 Oct 2019 07:20:32 +0000 (15:20 +0800)
committerShuide Chen <shuide.chen@amlogic.com>
Tue, 22 Oct 2019 07:20:32 +0000 (15:20 +0800)
PD#SWPL-15494

Problem:
type=1400 audit(1571727793.256:4): avc: denied { search } for comm=
"init" name="wifi" dev="mmcblk0p17" ino=153543 scontext=u:r:vendor_
init:s0 tcontext=u:object_r:wifi_data_file:s0 tclass=dir permissive=0

when insmod dhd driver, trigger avc denied

Solution:
from android O, wifi related path changed from /data/misc/wifi
to /data/vendor/misc/wifi

Verify:
Locally

Change-Id: I69255412f9b666fd66981e7adc358132abcb43f6
Signed-off-by: Shuide Chen <shuide.chen@amlogic.com>
bcmdhd.1.363.59.144.x.cn/dhd.h
bcmdhd.1.363.59.144.x.cn/dhd_linux.c
bcmdhd.1.579.77.41.1.cn/dhd.h
bcmdhd.1.579.77.41.1.cn/dhd_linux.c
bcmdhd.100.10.315.x/dhd.h
bcmdhd.100.10.315.x/dhd_linux.c
bcmdhd.100.10.315.x/dhd_linux_exportfs.c
bcmdhd.100.10.315.x/wl_cfg80211.c

index 135c92f8d536de0bfebc9f36a96ae97a91b545d7..c48ea8836b545b463c772147ed709518d1599b54 100644 (file)
@@ -402,7 +402,7 @@ struct dhd_log_dump_buf
 extern void dhd_log_dump_print(const char *fmt, ...);
 extern char *dhd_log_dump_get_timestamp(void);
 #endif /* DHD_LOG_DUMP */
-#define DHD_COMMON_DUMP_PATH   "/data/misc/wifi/log/"
+#define DHD_COMMON_DUMP_PATH   "/data/vendor/misc/wifi/log/"
 
 /* Common structure for module and instance linkage */
 typedef struct dhd_pub {
index c04d1850f8ced6400ab8873282e589262838e360..84539b43ee1e025f4fdfcf3e0b454a9b57906f30 100644 (file)
@@ -11788,7 +11788,7 @@ write_to_file(dhd_pub_t *dhd, uint8 *buf, int size)
        file_mode = O_CREAT | O_WRONLY | O_SYNC;
 #elif defined(CUSTOMER_HW2)
        snprintf(memdump_path, sizeof(memdump_path), "%s_%s_%ld.%ld",
-               "/data/misc/wifi/mem_dump", memdump_type,
+               "/data/vendor/misc/wifi/mem_dump", memdump_type,
                (unsigned long)curtime.tv_sec, (unsigned long)curtime.tv_usec);
        file_mode = O_CREAT | O_WRONLY | O_SYNC;
 #else
@@ -13210,7 +13210,7 @@ int dhd_set_ap_isolate(dhd_pub_t *dhdp, uint32 idx, int val)
 #define MEMDUMPINFO "/data/.memdump.info"
 #endif /* PLATFORM_SLP */
 #elif defined(CUSTOMER_HW2)
-#define MEMDUMPINFO "/data/misc/wifi/.memdump.info"
+#define MEMDUMPINFO "/data/vendor/misc/wifi/.memdump.info"
 #else
 #define MEMDUMPINFO "/installmedia/.memdump.info"
 #endif /* CUSTOMER_HW4_DEBUG */
@@ -13415,7 +13415,7 @@ exit:
 #define ASSERTINFO "/data/.assert.info"
 #endif /* PLATFORM_SLP */
 #elif defined(CUSTOMER_HW2)
-#define ASSERTINFO "/data/misc/wifi/.assert.info"
+#define ASSERTINFO "/data/vendor/misc/wifi/.assert.info"
 #else
 #define ASSERTINFO "/installmedia/.assert.info"
 #endif /* CUSTOMER_HW4_DEBUG */
index 2ce59b20267a3c322878830f424e0395ed889eb0..b82291e6dd2557694537ac82a3c984d6b755e21b 100644 (file)
@@ -601,7 +601,7 @@ extern char *dhd_log_dump_get_timestamp(void);
 #endif /* DHD_LOG_DUMP */
 
 #if defined(CUSTOMER_HW2)
-#define DHD_COMMON_DUMP_PATH   "/data/misc/wifi/"
+#define DHD_COMMON_DUMP_PATH   "/data/vendor/misc/wifi/"
 #else
 #define DHD_COMMON_DUMP_PATH   "/installmedia/"
 #endif 
index 0264224a271d97adaa6f9abb028368d5fe141140..ef5053d7f8798ca36d78aea961223bbb64424eec 100644 (file)
@@ -1147,11 +1147,11 @@ static char *map_file_path = PLATFORM_PATH"rtecdc.map";
 static char *rom_st_str_file_path = PLATFORM_PATH"roml.bin";
 static char *rom_map_file_path = PLATFORM_PATH"roml.map";
 #elif defined(CUSTOMER_HW2)
-static char *logstrs_path = "/data/misc/wifi/logstrs.bin";
-static char *st_str_file_path = "/data/misc/wifi/rtecdc.bin";
-static char *map_file_path = "/data/misc/wifi/rtecdc.map";
-static char *rom_st_str_file_path = "/data/misc/wifi/roml.bin";
-static char *rom_map_file_path = "/data/misc/wifi/roml.map";
+static char *logstrs_path = "/data/vendor/misc/wifi/logstrs.bin";
+static char *st_str_file_path = "/data/vendor/misc/wifi/rtecdc.bin";
+static char *map_file_path = "/data/vendor/misc/wifi/rtecdc.map";
+static char *rom_st_str_file_path = "/data/vendor/misc/wifi/roml.bin";
+static char *rom_map_file_path = "/data/vendor/misc/wifi/roml.map";
 #else
 static char *logstrs_path = "/installmedia/logstrs.bin";
 static char *st_str_file_path = "/installmedia/rtecdc.bin";
@@ -16287,12 +16287,12 @@ write_dump_to_file(dhd_pub_t *dhd, uint8 *buf, int size, char *fname)
        file_mode = O_CREAT | O_WRONLY | O_SYNC;
 #elif defined(CUSTOMER_HW2)
        snprintf(memdump_path, sizeof(memdump_path), "%s%s_%s_%ld.%ld",
-               "/data/misc/wifi/", fname, memdump_type,
+               "/data/vendor/misc/wifi/", fname, memdump_type,
                (unsigned long)curtime.tv_sec, (unsigned long)curtime.tv_usec);
        file_mode = O_CREAT | O_WRONLY | O_SYNC;
 #elif (defined(BOARD_PANDA) || defined(__ARM_ARCH_7A__))
        snprintf(memdump_path, sizeof(memdump_path), "%s%s_%s_%ld.%ld",
-               "/data/misc/wifi/", fname, memdump_type,
+               "/data/vendor/misc/wifi/", fname, memdump_type,
                (unsigned long)curtime.tv_sec, (unsigned long)curtime.tv_usec);
        file_mode = O_CREAT | O_WRONLY;
 #else
@@ -17768,11 +17768,11 @@ int dhd_set_ap_isolate(dhd_pub_t *dhdp, uint32 idx, int val)
 #ifdef CUSTOMER_HW4_DEBUG
 #define MEMDUMPINFO PLATFORM_PATH".memdump.info"
 #elif defined(CUSTOMER_HW2)
-#define MEMDUMPINFO "/data/misc/wifi/.memdump.info"
+#define MEMDUMPINFO "/data/vendor/misc/wifi/.memdump.info"
 #elif (defined(BOARD_PANDA) || defined(__ARM_ARCH_7A__))
-#define MEMDUMPINFO "/data/misc/wifi/.memdump.info"
+#define MEMDUMPINFO "/data/vendor/misc/wifi/.memdump.info"
 #else
-#define MEMDUMPINFO "/data/misc/wifi/.memdump.info"
+#define MEMDUMPINFO "/data/vendor/misc/wifi/.memdump.info"
 #endif /* CUSTOMER_HW4_DEBUG */
 
 void dhd_get_memdump_info(dhd_pub_t *dhd)
@@ -18127,7 +18127,7 @@ exit:
 #ifdef CUSTOMER_HW4_DEBUG
 #define ASSERTINFO PLATFORM_PATH".assert.info"
 #elif defined(CUSTOMER_HW2)
-#define ASSERTINFO "/data/misc/wifi/.assert.info"
+#define ASSERTINFO "/data/vendor/misc/wifi/.assert.info"
 #else
 #define ASSERTINFO "/installmedia/.assert.info"
 #endif /* CUSTOMER_HW4_DEBUG */
index c7956a6bd3cfffffdd5346b461dfbc8103bd8ad5..97b05987bdc5ab1e7b947152e1e3e477c4dfad94 100644 (file)
@@ -820,7 +820,7 @@ extern void clear_debug_dump_time(char *str);
 
 #define DHDIF_FWDER(dhdif)      FALSE
 
-#define DHD_COMMON_DUMP_PATH   "/data/misc/wifi/"
+#define DHD_COMMON_DUMP_PATH   "/data/vendor/misc/wifi/"
 
 struct cntry_locales_custom {
        char iso_abbrev[WLC_CNTRY_BUF_SZ];      /* ISO 3166-1 country abbreviation */
index 7d858fd28530e1c0281c5ec4409a6767456d186e..9495648148370a3c6517dee80e5911047729174b 100644 (file)
@@ -655,11 +655,11 @@ module_param(tpoweron_scale, uint, 0644);
 #endif /* FORCE_TPOWERON */
 
 #ifdef SHOW_LOGTRACE
-static char *logstrs_path = "/data/misc/wifi/logstrs.bin";
-char *st_str_file_path = "/data/misc/wifi/rtecdc.bin";
-static char *map_file_path = "/data/misc/wifi/rtecdc.map";
-static char *rom_st_str_file_path = "/data/misc/wifi/roml.bin";
-static char *rom_map_file_path = "/data/misc/wifi/roml.map";
+static char *logstrs_path = "/data/vendor/misc/wifi/logstrs.bin";
+char *st_str_file_path = "/data/vendor/misc/wifi/rtecdc.bin";
+static char *map_file_path = "/data/vendor/misc/wifi/rtecdc.map";
+static char *rom_st_str_file_path = "/data/vendor/misc/wifi/roml.bin";
+static char *rom_map_file_path = "/data/vendor/misc/wifi/roml.map";
 static char *ram_file_str = "rtecdc";
 static char *rom_file_str = "roml";
 
index 6631cd729841222d80cc6bf512d2ba61264e8d15..5e85bb3f9925cb5c6ac12bd386997d8e0850f3c9 100644 (file)
@@ -558,7 +558,7 @@ static struct dhd_attr dhd_attr_cntl_macaddr =
 
 #ifdef DHD_FW_COREDUMP
 
-#define MEMDUMPINFO "/data/misc/wifi/.memdump.info"
+#define MEMDUMPINFO "/data/vendor/misc/wifi/.memdump.info"
 
 uint32
 get_mem_val_from_file(void)
@@ -674,7 +674,7 @@ static struct dhd_attr dhd_attr_cntl_memdump =
 #endif /* DHD_FW_COREDUMP */
 
 #ifdef BCMASSERT_LOG
-#define ASSERTINFO "/data/misc/wifi/.assert.info"
+#define ASSERTINFO "/data/vendor/misc/wifi/.assert.info"
 int
 get_assert_val_from_file(void)
 {
index 886ba04cfa98664f2d58b3c1c616055741b01a3b..7a5823776fc1a77815358bcae2760902dea0dc1f 100644 (file)
@@ -18180,7 +18180,7 @@ static s32 __wl_cfg80211_up(struct bcm_cfg80211 *cfg)
 #if 0
        /* terence 20180108: this patch will cause to kernel panic with below
        * steps in Android 4.4 with kernel 3.4
-       * insmod bcmdhd.ko; hostapd /data/misc/wifi/hostapd.conf
+       * insmod bcmdhd.ko; hostapd /data/vendor/misc/wifi/hostapd.conf
        */
        /* Always bring up interface in STA mode.
        * Did observe , if previous SofAP Bringup/cleanup