Re: a question about protection_map[]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2016/7/11 21:30, Kirill A. Shutemov wrote:

> On Mon, Jul 11, 2016 at 06:12:30PM +0800, Xishi Qiu wrote:
>> Hi,
>>
>> We can use mprotect to set read only or read/write.
>>
>> mprotect_fixup()
>> 	vma_set_page_prot()
>> 		vm_pgprot_modify()
>> 			vm_get_page_prot()
>> 				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?
> 
> It doesn't.
> 
> 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.
> 

Hi Kirill,

I know, PAGE_READONLY and PAGE_COPY are both missed _PAGE_RW,
so it will cause page fault, then we will set new prot flag from
vma, right?

Thanks,
Xishi Qiu

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxx.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>



[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]