Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

perf kcore_copy: Do not check /proc/modules is unchanged

/proc/kallsyms and /proc/modules are compared before and after the copy
in order to ensure no changes during the copy.

However /proc/modules also might change due to reference counts changing
even though that does not make any difference.

Any modules loaded or unloaded should be visible in changes to kallsyms,
so it is not necessary to check /proc/modules also anyway.

Remove the comparison checking that /proc/modules is unchanged.

Fixes: fc1b691d7651d949 ("perf buildid-cache: Add ability to add kcore to the cache")
Reported-by: Daniel Dao <dqminh@cloudflare.com>
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Tested-by: Daniel Dao <dqminh@cloudflare.com>
Acked-by: Namhyung Kim <namhyung@kernel.org>
Cc: Ian Rogers <irogers@google.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Link: https://lore.kernel.org/r/20220914122429.8770-1-adrian.hunter@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

authored by

Adrian Hunter and committed by
Arnaldo Carvalho de Melo
5b427df2 6cc44796

+2 -5
+2 -5
tools/perf/util/symbol-elf.c
··· 2102 2102 * unusual. One significant peculiarity is that the mapping (start -> pgoff) 2103 2103 * is not the same for the kernel map and the modules map. That happens because 2104 2104 * the data is copied adjacently whereas the original kcore has gaps. Finally, 2105 - * kallsyms and modules files are compared with their copies to check that 2106 - * modules have not been loaded or unloaded while the copies were taking place. 2105 + * kallsyms file is compared with its copy to check that modules have not been 2106 + * loaded or unloaded while the copies were taking place. 2107 2107 * 2108 2108 * Return: %0 on success, %-1 on failure. 2109 2109 */ ··· 2165 2165 if (copy_bytes(kcore.fd, p->offset, extract.fd, offs, p->len)) 2166 2166 goto out_extract_close; 2167 2167 } 2168 - 2169 - if (kcore_copy__compare_file(from_dir, to_dir, "modules")) 2170 - goto out_extract_close; 2171 2168 2172 2169 if (kcore_copy__compare_file(from_dir, to_dir, "kallsyms")) 2173 2170 goto out_extract_close;