[PATCH v1] libperf rc_check: Enable implicitly with sanitizers
From: Ian Rogers
Date: Thu Apr 20 2023 - 13:18:37 EST
If using leak sanitizer then implicitly enable reference count
checking.
Signed-off-by: Ian Rogers <irogers@xxxxxxxxxx>
---
tools/lib/perf/include/internal/rc_check.h | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/tools/lib/perf/include/internal/rc_check.h b/tools/lib/perf/include/internal/rc_check.h
index c0626d8beb59..d5d771ccdc7b 100644
--- a/tools/lib/perf/include/internal/rc_check.h
+++ b/tools/lib/perf/include/internal/rc_check.h
@@ -5,6 +5,14 @@
#include <stdlib.h>
#include <linux/zalloc.h>
+/*
+ * Enable reference count checking implicitly with leak checking, which is
+ * integrated into address sanitizer.
+ */
+#if defined(LEAK_SANITIZER) || defined(ADDRESS_SANITIZER)
+#define REFCNT_CHECKING 1
+#endif
+
/*
* Shared reference count checking macros.
*
--
2.40.0.634.g4ca3ef3211-goog