perf inject jit: Ignore memfd and anonymous mmap events if jitdump present
authorBrian Robbins <brianrob@linux.microsoft.com>
Fri, 5 Aug 2022 22:06:45 +0000 (15:06 -0700)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Wed, 10 Aug 2022 13:44:02 +0000 (10:44 -0300)
commit46f7bd5e1b5732acb9b95037afd052a4d2eebb1a
treeb9200ff09fa414ac95764e2d7b60e4ff1b1065da
parente0b23af82d6f454c0bad6fb48d378e0099069b44
perf inject jit: Ignore memfd and anonymous mmap events if jitdump present

Some processes store jitted code in memfd mappings to avoid having rwx
mappings.  These processes map the code with a writeable mapping and a
read-execute mapping.  They write the code using the writeable mapping
and then unmap the writeable mapping.  All subsequent execution is
through the read-execute mapping.

perf inject --jit ignores //anon* mappings for each process where a
jitdump is present because it expects to inject mmap events for each
jitted code range, and said jitted code ranges will overlap with the
//anon* mappings.

Ignore /memfd: and [anon:* mappings so that jitted code contained in
/memfd: and [anon:* mappings is treated the same way as jitted code
contained in //anon* mappings.

Signed-off-by: Brian Robbins <brianrob@linux.microsoft.com>
Acked-by: Ian Rogers <irogers@google.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: https://lore.kernel.org/r/20220805220645.95855-1-brianrob@linux.microsoft.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/util/jitdump.c