Loading...
--- libmalloc/libmalloc-657.60.21/src/vm.c
+++ libmalloc/libmalloc-521.120.7/src/vm.c
@@ -110,7 +110,7 @@
#endif // TARGET_OS_IPHONE && !TARGET_OS_SIMULATOR
}
-void * __sized_by_or_null(size)
+void *
mvm_allocate_plat(uintptr_t addr, size_t size, uint8_t align, int flags, int debug_flags, int vm_page_label, plat_map_t *map_out)
{
if (addr && (flags & VM_FLAGS_ANYWHERE)) {
@@ -136,7 +136,7 @@
type, align, (unsigned)vm_page_label);
if (!map) {
malloc_zone_error(debug_flags, false,
- "Failed to allocate memory at address 0x%lx of size 0x%lx with flags %d: %d\n", addr, size, flags, errno);
+ "Failed to allocate memory at address 0x%lx of size 0x%lx with flags %d\n", addr, size, flags);
}
return __unsafe_forge_bidi_indexable(void *, map, size);
#else
@@ -147,8 +147,6 @@
"Unsupported unpopulated allocation at address 0x%lx of size 0x%lx with flags %d\n",
(unsigned long) addr, (unsigned long) size, flags);
}
-
-
mach_vm_address_t vm_addr = addr;
mach_vm_offset_t allocation_mask = ((mach_vm_offset_t)1 << align) - 1;
kern_return_t kr = mach_vm_map(mach_task_self(), &vm_addr,
@@ -156,20 +154,23 @@
flags | VM_MAKE_TAG(vm_page_label), MEMORY_OBJECT_NULL, 0, FALSE,
VM_PROT_DEFAULT, VM_PROT_ALL, VM_INHERIT_DEFAULT);
if (kr) {
+ malloc_zone_error(debug_flags, false,
+ "Failed to allocate memory at address 0x%lx of size 0x%lx with flags %d\n",
+ (unsigned long) addr, (unsigned long) size, flags);
return NULL;
}
return __unsafe_forge_bidi_indexable(void *, vm_addr, size);
#endif // MALLOC_TARGET_EXCLAVES
}
-void * __sized_by_or_null(size)
+void *
mvm_allocate_pages(size_t size, uint8_t align, uint32_t debug_flags,
int vm_page_label)
{
return mvm_allocate_pages_plat(size, align, debug_flags, vm_page_label, NULL);
}
-void * __sized_by_or_null(size)
+void *
mvm_allocate_pages_plat(size_t size, uint8_t align, uint32_t debug_flags,
int vm_page_label, plat_map_t *map_out)
{
@@ -204,8 +205,6 @@
if (purgeable) {
alloc_flags |= VM_FLAGS_PURGABLE;
}
-
-
if (allocation_size < size) { // size_t arithmetic wrapped!
return NULL;
}
@@ -306,7 +305,7 @@
#if MALLOC_TARGET_EXCLAVES
if (!munmap_plat(map, addr, size)) {
malloc_zone_error(debug_flags, false,
- "Failed to deallocate at address %p of size 0x%lx: %d\n", addr, size, errno);
+ "Failed to deallocate at address %p of size 0x%lx\n", addr, size);
}
#else
(void)map;
@@ -314,7 +313,7 @@
(mach_vm_address_t)addr, (mach_vm_size_t)size);
if (kr) {
malloc_zone_error(debug_flags, false,
- "Failed to deallocate at address %p of size 0x%lx: %d\n", addr, size, kr);
+ "Failed to deallocate at address %p of size 0x%lx\n", addr, size);
}
#endif // MALLOC_TARGET_EXCLAVES
}
@@ -377,7 +376,7 @@
}
if (!mprotect_plat(map, address, size, perm)) {
malloc_zone_error(MALLOC_ABORT_ON_ERROR | debug_flags, true,
- "Unsupported deallocation address %p or size %lu: %d\n", address, size, errno);
+ "Unsupported deallocation address %p or size %lu\n", address, size);
}
#else
(void)map;