adjusting protections of ptes for cow pages

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

 



Hi.  In mm/mprotect.c, there's a function, change_pte_range, that
adjusts the protection settings in a range of ptes.  

I know that when a page is set up for copy on write, the pte is set
such that a write will result in a page fault.  A cow page pte is set
for write protection, and the vma is marked as writable, so
vma->vm_flags & VM_WRITE would be true.

That's why I expected to see some sort of special case for this
situation in change_pte_range.  I thought there would be something
like the code below:

   pte_t new_pte = pte_modify(entry, newprot);

   if (vma->vm_flags & VM_WRITE && !pte_write(*pte))
      new_pte = pte_wrprotect(new_pte);  /* for cow */

... otherwise it seems like you could ruin the cow settings when
adjusting page protections.  Why isn't that needed?

Thanks.

-- 
--Ed L Cashin            |   PGP public key:
  ecashin@uga.edu        |   http://noserose.net/e/pgp/

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux