On Tue, Dec 31, 2024 at 1:30 AM Diego Nieto Cid <dnie...@gmail.com> wrote: > On Mon, Dec 30, 2024 at 07:08:55PM +0100, Samuel Thibault wrote: > > 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.
Huh? That's my understanding as well. max_protection can never be raised; if max_protection was VM_PROT_NONE and the one we're attempting to set isn't, we'll fail with KERN_PROTECTION_FAILURE here, no? if ((new_prot & (VM_PROT_NOTIFY | current->max_protection)) != new_prot) { vm_map_unlock(map); return(KERN_PROTECTION_FAILURE); } Sergey