Loading...
--- libmalloc/libmalloc-474.0.13/src/vm.c
+++ libmalloc/libmalloc-409.40.6/src/vm.c
@@ -44,15 +44,15 @@
mvm_aslr_init(void)
{
// Prepare ASLR
-#if defined(__i386__) || defined(__x86_64__) || defined(__arm64__) || TARGET_OS_DRIVERKIT || (TARGET_OS_IPHONE && !TARGET_OS_SIMULATOR)
-#if defined(__i386__)
+#if __i386__ || __x86_64__ || __arm64__ || TARGET_OS_DRIVERKIT || (TARGET_OS_IPHONE && !TARGET_OS_SIMULATOR)
+#if __i386__
uintptr_t stackbase = 0x8fe00000;
int entropic_bits = 3;
-#elif defined(__x86_64__)
+#elif __x86_64__
uintptr_t stackbase = USRSTACK64;
int entropic_bits = 16;
-#elif defined(__arm64__)
-#if defined(__LP64__)
+#elif __arm64__
+#if __LP64__
uintptr_t stackbase = USRSTACK64;
int entropic_bits = 7;
#else // __LP64__
@@ -82,7 +82,7 @@
* we mask off the address to a PTE boundary.
*/
if (KERN_SUCCESS == mach_vm_allocate(mach_task_self(), (mach_vm_address_t *)&addr,
- vm_page_quanta_size, VM_FLAGS_ANYWHERE | VM_MAKE_TAG(VM_MEMORY_MALLOC_TINY))) {
+ vm_page_quanta_size, VM_FLAGS_ANYWHERE | VM_MAKE_TAG(VM_MEMORY_MALLOC))) {
// Fall through and use existing base if addr < stackbase
if (addr > stackbase) {
t = (addr + ENTROPIC_USER_RANGE_SIZE) & ~((1 << ENTROPIC_SHIFT) - 1);
@@ -278,7 +278,7 @@
if (pgHi > pgLo) {
size_t len = pgHi - pgLo;
- if (scribble && malloc_zero_policy != MALLOC_ZERO_ON_FREE) {
+ if (scribble && !malloc_zero_on_free) {
memset((void *)pgLo, SCRUBBLE_BYTE, len); // Scribble on MADV_FREEd memory
}