For CPU with I/D separate cache, flush_cache_range/flush_tlb_range
checks vma->vm_flags if it is instruction related or not.

I think that change_protection should be called with old vma->vm_flags
so that it can flush instruction cache/TLB correctly.

Here is a patch.

Signed-off-by: NIIBE Yutaka <[EMAIL PROTECTED]>

diff --git a/mm/mprotect.c b/mm/mprotect.c
index 4de5468..661c818 100644
--- a/mm/mprotect.c
+++ b/mm/mprotect.c
@@ -191,7 +191,6 @@ success:
         * vm_flags and vm_page_prot are protected by the mmap_sem
         * held in write mode.
         */
-       vma->vm_flags = newflags;
        vma->vm_page_prot = vm_get_page_prot(newflags);
        if (vma_wants_writenotify(vma)) {
                vma->vm_page_prot = vm_get_page_prot(newflags & ~VM_SHARED);
@@ -202,6 +201,7 @@ success:
                hugetlb_change_protection(vma, start, end, vma->vm_page_prot);
        else
                change_protection(vma, start, end, vma->vm_page_prot, 
dirty_accountable);
+       vma->vm_flags = newflags;
        vm_stat_account(mm, oldflags, vma->vm_file, -nrpages);
        vm_stat_account(mm, newflags, vma->vm_file, nrpages);
        return 0;

-
To unsubscribe from this list: send the line "unsubscribe linux-arch" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to