aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Rogers <[email protected]>2024-03-20 09:32:44 -0700
committerArnaldo Carvalho de Melo <[email protected]>2024-04-26 22:13:10 -0300
commit8524d71cebfa6ddcfbb89f0fe0e174c8d0477c6d (patch)
tree30a010bed9cb209543edb150c652962f526a4821
parente101a05f79fd4ee3e89d2f3fb716493c33a33708 (diff)
perf build: Pretend scandirat is missing with msan
Memory sanitizer lacks an interceptor for scandirat, reporting all memory it allocates as uninitialized. Memory sanitizer has a scandir interceptor so use the fallback function in this case. This allows 'perf test' to run under memory sanitizer. Additional notes from Ian on running in this mode: Note, as msan needs to instrument memory allocations libraries need to be compiled with it. I lacked the msan built libraries and so built with: ``` $ make -C tools/perf O=/tmp/perf DEBUG=1 EXTRA_CFLAGS="-O0 -g -fno-omit-frame-pointer -fsanitize=memory -fsanitize-memory-track-origins" CC=clang CXX=clang++ HOSTCC=clang NO_LIBTRACEEVENT=1 NO_LIBELF=1 BUILD_BPF_SKEL=0 NO_LIBPFM=1 ``` oh, I disabled libbpf here as the bpf system call also lacks msan interceptors. Signed-off-by: Ian Rogers <[email protected]> Cc: Adrian Hunter <[email protected]> Cc: Alexander Shishkin <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Mark Rutland <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Peter Zijlstra <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
-rw-r--r--tools/perf/Makefile.config5
1 files changed, 4 insertions, 1 deletions
diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
index 7783479de691..7f1e016a9253 100644
--- a/tools/perf/Makefile.config
+++ b/tools/perf/Makefile.config
@@ -496,7 +496,10 @@ ifdef NO_DWARF
endif
ifeq ($(feature-scandirat), 1)
- CFLAGS += -DHAVE_SCANDIRAT_SUPPORT
+ # Ignore having scandirat with memory sanitizer that lacks an interceptor.
+ ifeq ($(filter s% -fsanitize=memory%,$(EXTRA_CFLAGS),),)
+ CFLAGS += -DHAVE_SCANDIRAT_SUPPORT
+ endif
endif
ifeq ($(feature-sched_getcpu), 1)