diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2023-04-18 22:33:48 +0200 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2023-04-19 15:52:54 +0200 |
commit | fe693d951e3c303b4fb6c712f8affecbe9e8b001 (patch) | |
tree | 8e38165abc611742b25d7a1f2bfed3406c361193 /tools/perf/util/maps.h | |
parent | perf dso: Fix use before NULL check introduced by map__dso() introduction (diff) | |
download | linux-fe693d951e3c303b4fb6c712f8affecbe9e8b001.tar.xz linux-fe693d951e3c303b4fb6c712f8affecbe9e8b001.zip |
perf maps: Add maps__refcnt() accessor to allow checking maps pointer
To remove one more direct access to 'struct maps' so that we can
intercept accesses to its instantiations and refcount check it to catch
use after free, etc.
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to '')
-rw-r--r-- | tools/perf/util/maps.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/tools/perf/util/maps.h b/tools/perf/util/maps.h index bde3390c7096..cfb1b79d1671 100644 --- a/tools/perf/util/maps.h +++ b/tools/perf/util/maps.h @@ -88,6 +88,11 @@ static inline unsigned int maps__nr_maps(const struct maps *maps) return maps->nr_maps; } +static inline refcount_t *maps__refcnt(struct maps *maps) +{ + return &maps->refcnt; +} + #ifdef HAVE_LIBUNWIND_SUPPORT static inline void *maps__addr_space(struct maps *maps) { |