From 2a612a1b343dcc0d3dd44df4866f6c6af5cc090f Mon Sep 17 00:00:00 2001 From: Matthew Weingarten Date: Mon, 29 Jul 2024 12:44:34 -0700 Subject: [PATCH] [Memprof] Changes `HISTOGRAM_GRANULARITY` from 8U to 8ULL. (#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. --- 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 fef8acfcfc9219..6da385ab3d6e2d 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