Loading...
--- xnu/xnu-12377.101.15/iokit/Kernel/IOKitDebug.cpp
+++ xnu/xnu-10002.61.3/iokit/Kernel/IOKitDebug.cpp
@@ -28,7 +28,7 @@
#include <sys/sysctl.h>
extern "C" {
-#include <vm/vm_kern_xnu.h>
+#include <vm/vm_kern.h>
#include <kern/task.h>
#include <kern/debug.h>
}
@@ -1021,6 +1021,7 @@
is = ml_set_interrupts_enabled(false);
clock_interval_to_deadline(10, kMillisecondScale, &deadline);
}
+
ppn = kernel_pmap_present_mapping(vaddr, &vincr, &vphysaddr);
// check noencrypt to avoid VM structs (map entries) with pointers
if (ppn && (!pmap_valid_page(ppn) || (!ref->zoneSize && pmap_is_noencrypt(ppn)))) {
@@ -1030,7 +1031,6 @@
continue;
}
- vm_memtag_disable_checking();
for (ptrIdx = 0; ptrIdx < (page_size / sizeof(uintptr_t)); ptrIdx++) {
ptr = ((uintptr_t *)vphysaddr)[ptrIdx];
#if defined(HAS_APPLE_PAC)
@@ -1076,7 +1076,6 @@
// else move left
}
}
- vm_memtag_enable_checking();
ref->bytes += page_size;
}
@@ -1128,11 +1127,7 @@
uintptr_t inst;
uint32_t count, idx, numSites, dups, siteCount;
- /* BEGIN IGNORE CODESTYLE */
- __typed_allocators_ignore_push
instances = (typeof(instances))data->getBytesNoCopy();
- __typed_allocators_ignore_pop
- /* END IGNORE CODESTYLE */
count = (data->getLength() / sizeof(*instances));
qsort(instances, count, sizeof(*instances), &IOTrackingAddressCompare);
@@ -1149,11 +1144,7 @@
}
}
- /* BEGIN IGNORE CODESTYLE */
- __typed_allocators_ignore_push
leakData = OSData::withCapacity(128 * sizeof(IOTrackingCallSiteInfo));
- __typed_allocators_ignore_pop
- /* END IGNORE CODESTYLE */
for (numSites = 0, idx = 0; idx < count; idx++) {
inst = instances[idx];
@@ -1178,16 +1169,11 @@
instances[dups] = 0;
}
}
- // leak byte size is reported as:
- // (total bytes allocated by the callsite * number of leaked instances)
- // divided by (number of allocations by callsite)
siteInfo.count = siteCount;
- siteInfo.size[0] = (site->size[0] * siteCount) / site->count;
- siteInfo.size[1] = (site->size[1] * siteCount) / site->count;
+ siteInfo.size[0] = (site->size[0] * site->count) / siteCount;
+ siteInfo.size[1] = (site->size[1] * site->count) / siteCount;
CopyOutBacktraces(site, &siteInfo);
- __typed_allocators_ignore_push
leakData->appendBytes(&siteInfo, sizeof(siteInfo));
- __typed_allocators_ignore_pop
}
data->release();
@@ -1314,11 +1300,7 @@
}
if (!data) {
- /* BEGIN IGNORE CODESTYLE */
- __typed_allocators_ignore_push
data = OSData::withCapacity(1024 * sizeof(uintptr_t));
- __typed_allocators_ignore_pop
- /* END IGNORE CODESTYLE */
}
IOTRecursiveLockLock(&queue->lock);
@@ -1356,11 +1338,7 @@
}
if (!data) {
- /* BEGIN IGNORE CODESTYLE */
- __typed_allocators_ignore_push
data = OSData::withCapacity(128 * sizeof(IOTrackingCallSiteInfo));
- __typed_allocators_ignore_pop
- /* END IGNORE CODESTYLE */
}
IOTRecursiveLockLock(&queue->lock);
@@ -1434,9 +1412,7 @@
siteInfo.size[0] = tsize[0];
siteInfo.size[1] = tsize[1];
CopyOutBacktraces(site, &siteInfo);
- __typed_allocators_ignore_push
data->appendBytes(&siteInfo, sizeof(siteInfo));
- __typed_allocators_ignore_pop
}
}
assert(idx == num);
@@ -1494,9 +1470,7 @@
siteInfo.bt[1][j] = bt64[j];
}
}
- __typed_allocators_ignore_push
data->appendBytes(&siteInfo, sizeof(siteInfo));
- __typed_allocators_ignore_pop
}
}
assert(idx == num);
@@ -1533,11 +1507,7 @@
uint8_t sLen;
if (!data) {
- /* BEGIN IGNORE CODESTYLE */
- __typed_allocators_ignore_push
data = OSData::withCapacity(4096 * sizeof(uintptr_t));
- __typed_allocators_ignore_pop
- /* END IGNORE CODESTYLE */
}
// <len><name>...<len><name><0>
@@ -1556,9 +1526,8 @@
};
btref_decode_unslide(ref, siteInfo.bt[0]);
- __typed_allocators_ignore_push
+
data->appendBytes(&siteInfo, sizeof(siteInfo));
- __typed_allocators_ignore_pop
});
if (KERN_SUCCESS == kr) {
ret = kIOReturnSuccess;
@@ -1576,11 +1545,7 @@
case kIOTrackingGetMappings:
{
IOTrackingCallSiteInfo * siteInfos;
- /* BEGIN IGNORE CODESTYLE */
- __typed_allocators_ignore_push
siteInfos = (typeof(siteInfos))data->getBytesNoCopy();
- __typed_allocators_ignore_pop
- /* END IGNORE CODESTYLE */
num = (data->getLength() / sizeof(*siteInfos));
qsort(siteInfos, num, sizeof(*siteInfos), &IOTrackingCallSiteInfoCompare);
break;