Query regarding page access protection flags linux kernel

Pranay Srivastava pranjas at gmail.com
Mon Aug 18 03:52:32 EDT 2014


On Tue, Aug 5, 2014 at 4:49 PM, ravali pullela <rpravali069 at gmail.com> wrote:
> Hello,
>
> I am trying to understand the page fault handling and MMU. These are my
> queries
>
> 1) What is the exact difference between the protection flags in
> vm_area_struct and pte's protection flags of the page.

vm_area_struct flags aren't seen by MMU but PTE's protection flags
would be seen by MMU for granting access. If there's any mismatch at
the PTE's  protection flags like write requested but PTE is set to
read-only then it'll fault.

> Does the field "pgprot_t vm_page_prot" in vm_area_struct contain the
> protection flags of all the pages in that vm_area? If so how to set these
> for individual pages?

see handle_pte_fault and

/arch/x86/include/asm/pgtable.h for the defs
>
> I have come across this http://marc.info/?l=linux-mm&m=109422600806490
> But could not find any answer to this post.
>
> 2) Does MMU (x86 arch) check the vm_area prot flags or the page's pte flags
> to cause the page fault?

MMU will look at PTE's not vm_area_struct. vm_area_struct gets checked
later on if there's a fault. See __do_fault or do_page_fault.

>
> Please help !!
>
> Thanks,
> Ravali
>
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies at kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>



-- 
        ---P.K.S



More information about the Kernelnewbies mailing list