[compiler-rt] a66dc46 - [scudo] allocation_ring_buffer_size <= 0 disables buffer (#71791)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 14 14:58:09 PST 2023
Author: Florian Mayer
Date: 2023-11-14T14:58:05-08:00
New Revision: a66dc461ace46e9edc8364c077d68f910b1d8ce5
URL: https://github.com/llvm/llvm-project/commit/a66dc461ace46e9edc8364c077d68f910b1d8ce5
DIFF: https://github.com/llvm/llvm-project/commit/a66dc461ace46e9edc8364c077d68f910b1d8ce5.diff
LOG: [scudo] allocation_ring_buffer_size <= 0 disables buffer (#71791)
Prevent a null pointer exception for allocation_ring_buffer_size < 0.
Added:
Modified:
compiler-rt/lib/scudo/standalone/combined.h
compiler-rt/lib/scudo/standalone/flags.inc
Removed:
################################################################################
diff --git a/compiler-rt/lib/scudo/standalone/combined.h b/compiler-rt/lib/scudo/standalone/combined.h
index b1700e5ecef7f5b..25c597199a65825 100644
--- a/compiler-rt/lib/scudo/standalone/combined.h
+++ b/compiler-rt/lib/scudo/standalone/combined.h
@@ -886,7 +886,7 @@ class Allocator {
void setTrackAllocationStacks(bool Track) {
initThreadMaybe();
- if (getFlags()->allocation_ring_buffer_size == 0) {
+ if (getFlags()->allocation_ring_buffer_size <= 0) {
DCHECK(!Primary.Options.load().get(OptionBit::TrackAllocationStacks));
return;
}
@@ -1490,10 +1490,10 @@ class Allocator {
}
void mapAndInitializeRingBuffer() {
+ if (getFlags()->allocation_ring_buffer_size <= 0)
+ return;
u32 AllocationRingBufferSize =
static_cast<u32>(getFlags()->allocation_ring_buffer_size);
- if (AllocationRingBufferSize < 1)
- return;
MemMapT MemMap;
MemMap.map(
/*Addr=*/0U,
diff --git a/compiler-rt/lib/scudo/standalone/flags.inc b/compiler-rt/lib/scudo/standalone/flags.inc
index 60aeb1f1df570ac..f5a2bab5057ae13 100644
--- a/compiler-rt/lib/scudo/standalone/flags.inc
+++ b/compiler-rt/lib/scudo/standalone/flags.inc
@@ -47,4 +47,5 @@ SCUDO_FLAG(int, release_to_os_interval_ms, SCUDO_ANDROID ? INT32_MIN : 5000,
"memory to the OS. Negative values disable the feature.")
SCUDO_FLAG(int, allocation_ring_buffer_size, 32768,
- "Entries to keep in the allocation ring buffer for scudo.")
+ "Entries to keep in the allocation ring buffer for scudo. "
+ "Values less or equal to zero disable the buffer.")
More information about the llvm-commits
mailing list