Get dirty_accountable before the vm flags are
changed by vma_set_page_prot. Otherwise, the dirty_accountable
always remains 0 even if mprotect() changes permissions from VM_NONE
to vm_flags containing VM_SHARED | VM_WRITE. This leads to page
faults although pte is marked writable because dirty bit won't be set.
JIRA TMM-40
Change-Id: I68c41b3fa7beec151614a1882d7be30feab3bf21
Signed-off-by: Sri Krishna chowdary <schowdary@nvidia.com>
Reviewed-on: http://git-master/r/
1150587
GVS: Gerrit_Virtual_Submit
#ifdef CONFIG_MMU
pgprot_t vm_get_page_prot(unsigned long vm_flags);
-void vma_set_page_prot(struct vm_area_struct *vma);
+bool vma_set_page_prot(struct vm_area_struct *vma);
#else
static inline pgprot_t vm_get_page_prot(unsigned long vm_flags)
{
return __pgprot(0);
}
-static inline void vma_set_page_prot(struct vm_area_struct *vma)
+static inline bool vma_set_page_prot(struct vm_area_struct *vma)
{
vma->vm_page_prot = vm_get_page_prot(vma->vm_flags);
+ return 0;
}
#endif
}
/* Update vma->vm_page_prot to reflect vma->vm_flags. */
-void vma_set_page_prot(struct vm_area_struct *vma)
+bool vma_set_page_prot(struct vm_area_struct *vma)
{
unsigned long vm_flags = vma->vm_flags;
vm_flags &= ~VM_SHARED;
vma->vm_page_prot = vm_pgprot_modify(vma->vm_page_prot,
vm_flags);
+ return 1;
}
+ return 0;
}
*/
vma->vm_flags |= VM_SOFTDIRTY;
- vma_set_page_prot(vma);
+ (void)vma_set_page_prot(vma);
return addr;
* held in write mode.
*/
vma->vm_flags = newflags;
- dirty_accountable = vma_wants_writenotify(vma);
- vma_set_page_prot(vma);
+ dirty_accountable = vma_set_page_prot(vma);
change_protection(vma, start, end, vma->vm_page_prot,
dirty_accountable, 0);