mm/core, x86/mm/pkeys: Differentiate instruction fetches
[cascardo/linux.git] / mm / gup.c
index d276760..7f1c4fb 100644 (file)
--- a/mm/gup.c
+++ b/mm/gup.c
@@ -449,7 +449,11 @@ static int check_vma_flags(struct vm_area_struct *vma, unsigned long gup_flags)
                if (!(vm_flags & VM_MAYREAD))
                        return -EFAULT;
        }
-       if (!arch_vma_access_permitted(vma, write, foreign))
+       /*
+        * gups are always data accesses, not instruction
+        * fetches, so execute=false here
+        */
+       if (!arch_vma_access_permitted(vma, write, false, foreign))
                return -EFAULT;
        return 0;
 }
@@ -629,8 +633,11 @@ bool vma_permits_fault(struct vm_area_struct *vma, unsigned int fault_flags)
        /*
         * The architecture might have a hardware protection
         * mechanism other than read/write that can deny access.
+        *
+        * gup always represents data access, not instruction
+        * fetches, so execute=false here:
         */
-       if (!arch_vma_access_permitted(vma, write, foreign))
+       if (!arch_vma_access_permitted(vma, write, false, foreign))
                return false;
 
        return true;