vm_map_protect / pmap_protect Can't lower protection

Andrey Simonenko simon at comsys.ntu-kpi.kiev.ua
Tue Jul 28 16:33:00 UTC 2009


Hello Andrew,

On Mon, Jul 20, 2009 at 04:14:02PM +0100, Andrew Brampton wrote:

> However, memguard_unguard doesn't work correctly. It first calls
> vm_map_protect with a read-write flag.
> vm_map_protect correctly updates the vm_map_entry, and then calls
> pmap_protect to set the actual pte.
> pmap_protect is lazy and notices that we are reducing the protection
> on the page and therefore does nothing. It assumes that later that a
> page fault will occur, call vm_fault, and then fix up the pte then.

As I remember, pmap_protect() is used for removing permissions, it
cannot be used (even in initial versions of pmap code) for lowering
permissions.  pmap_enter() can be used to lower permissions, this
is even written in its comments.


More information about the freebsd-hackers mailing list