@@ -14,19 +14,24 @@ private class MallocAllocationFunction extends AllocationFunction {
1414 int sizeArg ;
1515
1616 MallocAllocationFunction ( ) {
17+ // --- C library allocation
1718 hasGlobalOrStdName ( "malloc" ) and // malloc(size)
1819 sizeArg = 0
1920 or
2021 hasGlobalName ( [
22+ // --- Windows Memory Management for Windows Drivers
2123 "MmAllocateContiguousMemory" , // MmAllocateContiguousMemory(size, maxaddress)
2224 "MmAllocateContiguousNodeMemory" , // MmAllocateContiguousNodeMemory(size, minaddress, maxaddress, bound, flag, prefer)
2325 "MmAllocateContiguousMemorySpecifyCache" , // MmAllocateContiguousMemorySpecifyCache(size, minaddress, maxaddress, bound, type)
2426 "MmAllocateContiguousMemorySpecifyCacheNode" , // MmAllocateContiguousMemorySpecifyCacheNode(size, minaddress, maxaddress, bound, type, prefer)
2527 "MmAllocateNonCachedMemory" , // MmAllocateNonCachedMemory(size)
2628 "MmAllocateMappingAddress" , // MmAllocateMappingAddress(size, tag)
29+ // --- Windows COM allocation
2730 "CoTaskMemAlloc" , // CoTaskMemAlloc(size)
31+ // --- Linux kernel memory allocator
2832 "kmem_alloc" , // kmem_alloc(size, flags)
2933 "kmem_zalloc" , // kmem_zalloc(size, flags)
34+ // --- OpenSSL memory allocation
3035 "CRYPTO_malloc" , // CRYPTO_malloc(size_t num, const char *file, int line)
3136 "CRYPTO_zalloc" , // CRYPTO_zalloc(size_t num, const char *file, int line)
3237 "CRYPTO_secure_malloc" , // CRYPTO_secure_malloc(size_t num, const char *file, int line)
@@ -35,15 +40,18 @@ private class MallocAllocationFunction extends AllocationFunction {
3540 sizeArg = 0
3641 or
3742 hasGlobalName ( [
43+ // --- Windows Memory Management for Windows Drivers
3844 "ExAllocatePool" , // ExAllocatePool(type, size)
3945 "ExAllocatePoolWithTag" , // ExAllocatePool(type, size, tag)
4046 "ExAllocatePoolWithTagPriority" , // ExAllocatePoolWithTagPriority(type, size, tag, priority)
4147 "ExAllocatePoolWithQuota" , // ExAllocatePoolWithQuota(type, size)
4248 "ExAllocatePoolWithQuotaTag" , // ExAllocatePoolWithQuotaTag(type, size, tag)
4349 "IoAllocateMdl" , // IoAllocateMdl(address, size, flag, flag, irp)
4450 "IoAllocateErrorLogEntry" , // IoAllocateErrorLogEntry(object, size)
51+ // --- Windows Global / Local legacy allocation
4552 "LocalAlloc" , // LocalAlloc(flags, size)
4653 "GlobalAlloc" , // GlobalAlloc(flags, size)
54+ // --- Windows System Services allocation
4755 "VirtualAlloc" // VirtualAlloc(address, size, type, flag)
4856 ] ) and
4957 sizeArg = 1
@@ -52,6 +60,7 @@ private class MallocAllocationFunction extends AllocationFunction {
5260 sizeArg = 2
5361 or
5462 hasGlobalName ( [
63+ // --- Windows Memory Management for Windows Drivers
5564 "MmAllocatePagesForMdl" , // MmAllocatePagesForMdl(minaddress, maxaddress, skip, size)
5665 "MmAllocatePagesForMdlEx" , // MmAllocatePagesForMdlEx(minaddress, maxaddress, skip, size, type, flags)
5766 "MmAllocateNodePagesForMdlEx" // MmAllocateNodePagesForMdlEx(minaddress, maxaddress, skip, size, type, prefer, flags)
@@ -71,6 +80,7 @@ private class AllocaAllocationFunction extends AllocationFunction {
7180
7281 AllocaAllocationFunction ( ) {
7382 hasGlobalName ( [
83+ // --- stack allocation
7484 "alloca" , // // alloca(size)
7585 "__builtin_alloca" // __builtin_alloca(size)
7686 ] ) and
@@ -91,6 +101,7 @@ private class CallocAllocationFunction extends AllocationFunction {
91101 int multArg ;
92102
93103 CallocAllocationFunction ( ) {
104+ // --- C library allocation
94105 hasGlobalOrStdName ( "calloc" ) and // calloc(num, size)
95106 sizeArg = 1 and
96107 multArg = 0
@@ -110,14 +121,18 @@ private class ReallocAllocationFunction extends AllocationFunction {
110121 int reallocArg ;
111122
112123 ReallocAllocationFunction ( ) {
124+ // --- C library allocation
113125 hasGlobalOrStdName ( "realloc" ) and // realloc(ptr, size)
114126 sizeArg = 1 and
115127 reallocArg = 0
116128 or
117129 hasGlobalName ( [
130+ // --- Windows Global / Local legacy allocation
118131 "LocalReAlloc" , // LocalReAlloc(ptr, size, flags)
119132 "GlobalReAlloc" , // GlobalReAlloc(ptr, size, flags)
133+ // --- Windows COM allocation
120134 "CoTaskMemRealloc" , // CoTaskMemRealloc(ptr, size)
135+ // --- OpenSSL memory allocation
121136 "CRYPTO_realloc" // CRYPTO_realloc(void *addr, size_t num, const char *file, int line)
122137 ] ) and
123138 sizeArg = 1 and
@@ -140,6 +155,7 @@ private class ReallocAllocationFunction extends AllocationFunction {
140155private class SizelessAllocationFunction extends AllocationFunction {
141156 SizelessAllocationFunction ( ) {
142157 hasGlobalName ( [
158+ // --- Windows Memory Management for Windows Drivers
143159 "ExAllocateFromLookasideListEx" , // ExAllocateFromLookasideListEx(list)
144160 "ExAllocateFromPagedLookasideList" , // ExAllocateFromPagedLookasideList(list)
145161 "ExAllocateFromNPagedLookasideList" , // ExAllocateFromNPagedLookasideList(list)
@@ -148,6 +164,7 @@ private class SizelessAllocationFunction extends AllocationFunction {
148164 "MmMapLockedPagesWithReservedMapping" , // MmMapLockedPagesWithReservedMapping(address, tag, list, type)
149165 "MmMapLockedPages" , // MmMapLockedPages(list, mode)
150166 "MmMapLockedPagesSpecifyCache" , // MmMapLockedPagesSpecifyCache(list, mode, type, address, flag, flag)
167+ // --- NetBSD pool manager
151168 "pool_get" , // pool_get(pool, flags)
152169 "pool_cache_get" // pool_cache_get(pool, flags)
153170 ] )
0 commit comments