[compiler-rt] Changes `HISTOGRAM_GRANULARITY` from 8U to 8ULL. (PR #100949)
Matthew Weingarten via llvm-commits
llvm-commits at lists.llvm.org
Sun Jul 28 15:16:52 PDT 2024
https://github.com/mattweingarten created https://github.com/llvm/llvm-project/pull/100949
This changes a bug in memprofiling with histogram where the shadow mask would be `0xFFFFFFF8` instead of `0xFFFFFFFFFFFFFFF8`, essentially discarding the upper 32 bits of the address. This can cause different addresses to be mapped to the same shadow address.
>From 1dadeee0c3f88fb87b14056cd4a2e9ce18f2a6c2 Mon Sep 17 00:00:00 2001
From: Matthew Weingarten <matt at weingarten.org>
Date: Sun, 28 Jul 2024 22:12:40 +0000
Subject: [PATCH] Changes `HISTOGRAM_GRANULARITY` from 8U to 8ULL.
This changes a bug in memprofiling with histogram where the shadow mask would be `0xFFFFFFF8` instead of
`0xFFFFFFFFFFFFFFF8`, essentially discarding the upper 32 bits of the address. This can cause different addresses to be mapped
to the same shadow address.
---
compiler-rt/lib/memprof/memprof_mapping.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/compiler-rt/lib/memprof/memprof_mapping.h b/compiler-rt/lib/memprof/memprof_mapping.h
index fef8acfcfc921..6da385ab3d6e2 100644
--- a/compiler-rt/lib/memprof/memprof_mapping.h
+++ b/compiler-rt/lib/memprof/memprof_mapping.h
@@ -55,7 +55,7 @@ extern uptr kHighMemEnd; // Initialized in __memprof_init.
// computed by summing up all individual 1 byte counters. This can incur an
// accuracy penalty.
-#define HISTOGRAM_GRANULARITY 8U
+#define HISTOGRAM_GRANULARITY 8ULL
#define HISTOGRAM_MAX_COUNTER 255U
More information about the llvm-commits
mailing list