[compiler-rt] 2a612a1 - [Memprof] Changes `HISTOGRAM_GRANULARITY` from 8U to 8ULL. (#100949)

via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 29 12:44:38 PDT 2024


Author: Matthew Weingarten
Date: 2024-07-29T12:44:34-07:00
New Revision: 2a612a1b343dcc0d3dd44df4866f6c6af5cc090f

URL: https://github.com/llvm/llvm-project/commit/2a612a1b343dcc0d3dd44df4866f6c6af5cc090f
DIFF: https://github.com/llvm/llvm-project/commit/2a612a1b343dcc0d3dd44df4866f6c6af5cc090f.diff

LOG: [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.

Added: 
    

Modified: 
    compiler-rt/lib/memprof/memprof_mapping.h

Removed: 
    


################################################################################
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