Re: [PATCH 0/4] mm: permit guard regions for file-backed/shmem mappings

From: David Hildenbrand
Date: Tue Feb 18 2025 - 12:32:10 EST


See mlock2();

SYSCALL_DEFINE3(mlock2, unsigned long, start, size_t, len, int, flags)
{
vm_flags_t vm_flags = VM_LOCKED;

if (flags & ~MLOCK_ONFAULT)
return -EINVAL;

if (flags & MLOCK_ONFAULT)
vm_flags |= VM_LOCKONFAULT;

return do_mlock(start, len, vm_flags);
}


VM_LOCKONFAULT always as VM_LOCKED set as well.

OK cool, that makes sense.

As with much kernel stuff, I knew this in the past. Then I forgot. Then I knew
again, then... :P if only somebody would write it down in a book...

And if there would be such a book in the makings, I would consider hurrying up and preordering it ;)

--
Cheers,

David / dhildenb