Hi, On Mon, Dec 30, 2024 at 07:08:55PM +0100, Samuel Thibault wrote: > > Please also add printing size_null in vm_map_print. >
Ok > dnie...@gmail.com, le mer. 25 déc. 2024 16:16:06 -0300, a ecrit: > > > @@ -1679,11 +1747,13 @@ kern_return_t vm_map_protect( > > vm_map_clip_end(map, current, end); > > > > old_prot = current->protection; > > - if (set_max) > > + if (set_max) { > > + if (current->max_protection != new_prot && new_prot == > > VM_PROT_NONE) > > + map->size_none += current->vme_end - > > current->vme_start; > > You also need to take into account the case where > current->max_protection was NONE and new_prot is not NONE, you then have > to decrease size_none. > Ah right, the & in the expression tricked me into believing that max_protection could not be raised. > > It seems there is also an occurrence of changing max_protection in > projected_buffer_allocate and projected_buffer_map > This is tricky, the allocation is made by vm_map_find_entry which does not have access to the max_protection projected buffers will use later. I'll add the accounting, which will "release" the allocated memory and made it available for future allocations, but will drop a note that the required size must be within the limit.