aboutsummaryrefslogtreecommitdiff
path: root/tools/perf/util/maps.h
diff options
context:
space:
mode:
authorGravatar Arnaldo Carvalho de Melo <acme@redhat.com> 2023-04-18 17:33:48 -0300
committerGravatar Arnaldo Carvalho de Melo <acme@redhat.com> 2023-04-19 10:52:54 -0300
commitfe693d951e3c303b4fb6c712f8affecbe9e8b001 (patch)
tree8e38165abc611742b25d7a1f2bfed3406c361193 /tools/perf/util/maps.h
parentperf dso: Fix use before NULL check introduced by map__dso() introduction (diff)
downloadlinux-fe693d951e3c303b4fb6c712f8affecbe9e8b001.tar.gz
linux-fe693d951e3c303b4fb6c712f8affecbe9e8b001.tar.bz2
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 'tools/perf/util/maps.h')
-rw-r--r--tools/perf/util/maps.h5
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)
{