Loading...
--- libmalloc/libmalloc-657.80.3/src/magazine_zone.h
+++ libmalloc/libmalloc-474.0.13/src/magazine_zone.h
@@ -23,9 +23,6 @@
#ifndef __MAGAZINE_ZONE_H
#define __MAGAZINE_ZONE_H
-
-#include <malloc/_ptrcheck.h>
-__ptrcheck_abi_assume_single()
/********************* DEFINITIONS ************************/
@@ -45,7 +42,7 @@
// In-place free list entry. Unlike the out-of-band entry, the in-place entries
// are stored at the start of the range that has been freed.
-typedef struct _inplace_free_entry_s * __single inplace_free_entry_t;
+typedef struct _inplace_free_entry_s *inplace_free_entry_t;
typedef struct {
void *ptr;
@@ -60,7 +57,7 @@
typedef struct _inplace_free_entry_s {
inplace_union previous;
inplace_union next;
-} inplace_free_entry_s, * __single inplace_free_entry_t;
+} inplace_free_entry_s, *inplace_free_entry_t;
#ifdef __LP64__
MALLOC_STATIC_ASSERT(sizeof(inplace_free_entry_s) == 16, "inplace free list must be 16-bytes long");
@@ -92,6 +89,10 @@
} tiny_free_list_t;
typedef unsigned int grain_t; // N.B. wide enough to index all free slots
+
+#define CHECK_REGIONS (1 << 31)
+#define DISABLE_ASLR (1 << 30)
+#define DISABLE_LARGE_ASLR (1 << 29)
#define MAX_RECORDER_BUFFER 256
@@ -189,12 +190,12 @@
* Beginning and end pointers for a region's heap.
*/
#define TINY_REGION_HEAP_BASE(region) ((void *)(((tiny_region_t)region)->blocks))
-#define TINY_REGION_HEAP_END(region) __unsafe_forge_single(void *, ((uintptr_t)TINY_REGION_HEAP_BASE(region)) + TINY_HEAP_SIZE)
+#define TINY_REGION_HEAP_END(region) ((void *)(((uintptr_t)TINY_REGION_HEAP_BASE(region)) + TINY_HEAP_SIZE))
/*
* Locate the region for a pointer known to be within a tiny region.
*/
-#define TINY_REGION_FOR_PTR(ptr) __unsafe_forge_single(tiny_region_t, (uintptr_t)(ptr) & ~((1 << TINY_BLOCKS_ALIGN) - 1))
+#define TINY_REGION_FOR_PTR(ptr) ((tiny_region_t)((uintptr_t)(ptr) & ~((1 << TINY_BLOCKS_ALIGN) - 1)))
/*
* Convert between byte and msize units.
@@ -419,7 +420,7 @@
/*
* Locate the heap base for a pointer known to be within a small region.
*/
-#define SMALL_REGION_FOR_PTR(ptr) __unsafe_forge_single(small_region_t, (uintptr_t)(ptr) & ~((1 << SMALL_BLOCKS_ALIGN) - 1))
+#define SMALL_REGION_FOR_PTR(ptr) ((small_region_t)((uintptr_t)(ptr) & ~((1 << SMALL_BLOCKS_ALIGN) - 1)))
#define SMALL_REGION_OFFSET_FOR_PTR(ptr) ((uintptr_t)(ptr) & ((1 << SMALL_BLOCKS_ALIGN) - 1))
/*
@@ -623,7 +624,7 @@
/*
* Locate the heap base for a pointer known to be within a medium region.
*/
-#define MEDIUM_REGION_FOR_PTR(ptr) __unsafe_forge_single(void *, (uintptr_t)(ptr) & ~((1ull << MEDIUM_BLOCKS_ALIGN) - 1))
+#define MEDIUM_REGION_FOR_PTR(ptr) ((void *)((uintptr_t)(ptr) & ~((1ull << MEDIUM_BLOCKS_ALIGN) - 1)))
#define MEDIUM_REGION_OFFSET_FOR_PTR(ptr) ((uintptr_t)(ptr) & ((1ull << MEDIUM_BLOCKS_ALIGN) - 1))
/*
@@ -785,7 +786,7 @@
// Take magazine_lock first, Depot lock when needed for recirc, then szone->{tiny,small}_regions_lock when needed for alloc
_malloc_lock_s magazine_lock MALLOC_CACHE_ALIGN;
// Protection for the crtical section that does allocate_pages outside the magazine_lock
- _malloc_lock_s magazine_alloc_lock;
+ volatile boolean_t alloc_underway;
// One element deep "death row", optimizes malloc/free/malloc for identical size.
void *mag_last_free;