Re: a question about protection_map
From: Kirill A. Shutemov
Date: Mon Jul 11 2016 - 09:30:23 EST
On Mon, Jul 11, 2016 at 06:12:30PM +0800, Xishi Qiu wrote:
> We can use mprotect to set read only or read/write.
> protection_map[vm_flags & (VM_READ|VM_WRITE|VM_EXEC|VM_SHARED)]
> The following code shows that prots from __P001(PROT_READ) and __P010(PROT_WRITE)
> are the same, so how does it distinguish read only or read/write from mprotect?
Write protection will be removed by fault handler on next write access to
the page. Somewhat suboptiomal, but zero page implemenation relies on this
to work properly.
Kirill A. Shutemov