mlock in libc
Neal H. Walfield
neal@cs.uml.edu
Sun Nov 3 08:53:00 GMT 2002
> What does work is using VM_PROT_DEFAULT, because memory allocated
> with malloc seems to use VM_PROT_DEFAULT. However, I think the best
> solution is to call vm_region and actually get the proper
> permissions for the pages.
We certainly want to avoid making any assumptions.
> The second does not because perhaps something could write to a
> read-only part of memory between the calls to vm_protect.
It is not only that, but also that you lose any COW savings. Thus,
doing a read loop would be better.
Your patches only cover a single memory region: there may be more than
one region or the region may be larger than the area that the user is
wiring. Both of these cases should be handled by your code and are
handled by hurd/libshouldbeinlibc/wire.c:wire_segment_internal.
Thanks.
More information about the Libc-alpha
mailing list