From 12cae11ecf31c225807745af5a3f36403f3cbf10 Mon Sep 17 00:00:00 2001 From: Shuide Chen Date: Tue, 22 Oct 2019 15:20:32 +0800 Subject: [PATCH] dhd: fix wifi driver caused selinux denied issue [1/1] 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 --- bcmdhd.1.363.59.144.x.cn/dhd.h | 2 +- bcmdhd.1.363.59.144.x.cn/dhd_linux.c | 6 +++--- bcmdhd.1.579.77.41.1.cn/dhd.h | 2 +- bcmdhd.1.579.77.41.1.cn/dhd_linux.c | 22 +++++++++++----------- bcmdhd.100.10.315.x/dhd.h | 2 +- bcmdhd.100.10.315.x/dhd_linux.c | 10 +++++----- bcmdhd.100.10.315.x/dhd_linux_exportfs.c | 4 ++-- bcmdhd.100.10.315.x/wl_cfg80211.c | 2 +- 8 files changed, 25 insertions(+), 25 deletions(-) diff --git a/bcmdhd.1.363.59.144.x.cn/dhd.h b/bcmdhd.1.363.59.144.x.cn/dhd.h index 135c92f..c48ea88 100644 --- a/bcmdhd.1.363.59.144.x.cn/dhd.h +++ b/bcmdhd.1.363.59.144.x.cn/dhd.h @@ -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 { diff --git a/bcmdhd.1.363.59.144.x.cn/dhd_linux.c b/bcmdhd.1.363.59.144.x.cn/dhd_linux.c index c04d185..84539b4 100644 --- a/bcmdhd.1.363.59.144.x.cn/dhd_linux.c +++ b/bcmdhd.1.363.59.144.x.cn/dhd_linux.c @@ -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 */ diff --git a/bcmdhd.1.579.77.41.1.cn/dhd.h b/bcmdhd.1.579.77.41.1.cn/dhd.h index 2ce59b2..b82291e 100644 --- a/bcmdhd.1.579.77.41.1.cn/dhd.h +++ b/bcmdhd.1.579.77.41.1.cn/dhd.h @@ -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 diff --git a/bcmdhd.1.579.77.41.1.cn/dhd_linux.c b/bcmdhd.1.579.77.41.1.cn/dhd_linux.c index 0264224..ef5053d 100644 --- a/bcmdhd.1.579.77.41.1.cn/dhd_linux.c +++ b/bcmdhd.1.579.77.41.1.cn/dhd_linux.c @@ -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 */ diff --git a/bcmdhd.100.10.315.x/dhd.h b/bcmdhd.100.10.315.x/dhd.h index c7956a6..97b0598 100644 --- a/bcmdhd.100.10.315.x/dhd.h +++ b/bcmdhd.100.10.315.x/dhd.h @@ -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 */ diff --git a/bcmdhd.100.10.315.x/dhd_linux.c b/bcmdhd.100.10.315.x/dhd_linux.c index 7d858fd..9495648 100644 --- a/bcmdhd.100.10.315.x/dhd_linux.c +++ b/bcmdhd.100.10.315.x/dhd_linux.c @@ -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"; diff --git a/bcmdhd.100.10.315.x/dhd_linux_exportfs.c b/bcmdhd.100.10.315.x/dhd_linux_exportfs.c index 6631cd7..5e85bb3 100644 --- a/bcmdhd.100.10.315.x/dhd_linux_exportfs.c +++ b/bcmdhd.100.10.315.x/dhd_linux_exportfs.c @@ -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) { diff --git a/bcmdhd.100.10.315.x/wl_cfg80211.c b/bcmdhd.100.10.315.x/wl_cfg80211.c index 886ba04..7a58237 100644 --- a/bcmdhd.100.10.315.x/wl_cfg80211.c +++ b/bcmdhd.100.10.315.x/wl_cfg80211.c @@ -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 -- 2.20.1