Hello, On Wed, Dec 25, 2024 at 04:16:06PM -0300, dnie...@gmail.com wrote: > > +/* > + * Enforces the VM limit of a target map. > + */ > +static kern_return_t > +vm_map_enforce_limit( > + vm_map_t map, > + vm_size_t size, > + const char *fn_name) > +{ > + /* Limit is ignored for the kernel map */ > + if (vm_map_pmap(map) == kernel_pmap) { > + return KERN_SUCCESS; > + } > + > + /* Avoid taking into account the total VM_PROT_NONE virtual memory */ > + vm_size_t usable_size = map->size - map->size_none; > + vm_size_t new_size = size + usable_size; > + /* Check for integer overflow */ > + if (new_size < size) { > + return KERN_INVALID_ARGUMENT; > + } > + > + if (new_size > map->size_cur_limit) { > + task_t task = current_task(); > + printf("[%s] [task %s] map size: %lu, none: %lu, requested: > %lu, limit: %lu\n", > + fn_name, task->name, map->size, map->size_none, size, > map->size_cur_limit);
Should I drop the printf here now that vm_map_print also prints this information? -- Diego