Skip to content
Snippets Groups Projects
Commit 51d0ebd5 authored by Nadav Har'El's avatar Nadav Har'El
Browse files

Implement mprotect(). There's still one missing feature though - PROT_NONE

is not currently supported, and PROT_READ is used instead (i.e., instead of
inaccessible memory, one gets read-only memory). Inaccessible memory
complicates the code because it means using the non-present bit on
still-allocated pages, and then unpopulate() can't use the present bit to
decide which pages are allocated and need to be freed.
To fix this, I'll need to:
1. unpopulate_page() and unpopulate_huge_page() should assume it is only
ever called on allocated pages (evacute() actually ensures that!), and not
return on non-present ptes.
2. change_perm() should use the read_perm to set the present bit.
3. protect() shouldn't rely on present bit to know when to return 0 or 1,
   rather it must be wrapped in something like evacute() which knows to
   find mapped ranges, and only call protect() for actually mapped ranges.
I'll try this tomorrow.
parent cb1f611a
No related branches found
No related tags found
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment