quoted
Should you really be testing VM_READ|VM_WRITE, or should it just
be VM_READ?
We test VM_READ | VM_WRITE | VM_EXEC in the read case below, and that
is because we have no HPTE encoding to say "writable but not readable"
or "executable but not readable". Similarly we have no encoding to
say "writable but not executable" on classic processors, so if you
have just VM_WRITE set, you get a page that is readable, writable and
executable.
Ah yes. I thought "executable requires readable", but
that is with the CPU its flags, not the Linux flags.
Would it be a good idea to map Linux flags to CPU flags
somewhere early in this function? It might simplify some
code, and things certainly would become more readable.
Segher