--- zzzz-none-000/linux-4.1.52/tools/perf/util/dso.c 2018-05-28 02:26:45.000000000 +0000 +++ bcm63-7530ax-731/linux-4.1.52/tools/perf/util/dso.c 2022-03-02 11:37:14.000000000 +0000 @@ -193,6 +193,56 @@ dso->symtab_type == DSO_BINARY_TYPE__GUEST_KMODULE_COMP; } +#define IGNORE_BCM_KF_EXCEPTION +#if 1 //1 defined(CONFIG_BCM_KF_MISC_BACKPORTS) +static int decompress_kmodule(struct dso *dso, const char *name, char *tmpbuf) +{ + int fd = -1; + struct kmod_path m; + + if (!dso__needs_decompress(dso)) + return -1; + + if (kmod_path__parse_ext(&m, dso->long_name)) + return -1; + + if (!m.comp) + goto out; + + fd = mkstemp(tmpbuf); + if (fd < 0) { + dso->load_errno = errno; + goto out; + } + + if (!decompress_to_file(m.ext, name, fd)) { + dso->load_errno = DSO_LOAD_ERRNO__DECOMPRESSION_FAILURE; + close(fd); + fd = -1; + } + +out: + free(m.ext); + return fd; +} + +int dso__decompress_kmodule_path(struct dso *dso, const char *name, + char *pathname, size_t len) +{ + char tmpbuf[] = KMOD_DECOMP_NAME; + int fd; + + fd = decompress_kmodule(dso, name, tmpbuf); + if (fd < 0) { + unlink(tmpbuf); + return -1; + } + + strncpy(pathname, tmpbuf, len); + close(fd); + return 0; +} +#endif /* * Parses kernel module specified in @path and updates * @m argument like: