diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2023-04-12 17:36:58 +0200 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2023-04-12 17:49:16 +0200 |
commit | 4e8db2d7520f780f86055465c680e20327008a34 (patch) | |
tree | f357bfc617432f8cb6f3a5e29a9b500b34d3ddc0 /tools/perf/util/map.h | |
parent | perf scripts python intel-pt-events: Delete unused 'event_attr variable (diff) | |
download | linux-4e8db2d7520f780f86055465c680e20327008a34.tar.xz linux-4e8db2d7520f780f86055465c680e20327008a34.zip |
perf map: Add map__refcnt() accessor to use in the maps test
To remove one more direct access to 'struct map' so that we can intecept
accesses to its instantiations and refcount check it to catch use after
free, etc.
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexey Bayduraev <alexey.v.bayduraev@linux.intel.com>
Cc: Dmitriy Vyukov <dvyukov@google.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Riccardo Mancini <rickyman7@gmail.com>
Cc: Stephane Eranian <eranian@google.com>
Cc: Stephen Brennan <stephen.s.brennan@oracle.com>
Link: https://lore.kernel.org/lkml/ZDbRIJknafLnDwtO@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/map.h')
-rw-r--r-- | tools/perf/util/map.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/tools/perf/util/map.h b/tools/perf/util/map.h index 102485699aa8..f89ab7c2d327 100644 --- a/tools/perf/util/map.h +++ b/tools/perf/util/map.h @@ -97,6 +97,11 @@ static inline bool map__priv(const struct map *map) return map->priv; } +static inline refcount_t *map__refcnt(struct map *map) +{ + return &map->refcnt; +} + static inline size_t map__size(const struct map *map) { return map__end(map) - map__start(map); |