]> git.kernelconcepts.de Git - karo-tx-linux.git/blobdiff - arch/powerpc/include/asm/page.h
Merge 4.12-rc2 into usb-next
[karo-tx-linux.git] / arch / powerpc / include / asm / page.h
index 47120bf2670c49f224744445c5dc154f0de60b31..8da5d4c1cab2b6d52a297117c6e6b27221d941c6 100644 (file)
@@ -132,7 +132,19 @@ extern long long virt_phys_offset;
 #define virt_to_pfn(kaddr)     (__pa(kaddr) >> PAGE_SHIFT)
 #define virt_to_page(kaddr)    pfn_to_page(virt_to_pfn(kaddr))
 #define pfn_to_kaddr(pfn)      __va((pfn) << PAGE_SHIFT)
+
+#ifdef CONFIG_PPC_BOOK3S_64
+/*
+ * On hash the vmalloc and other regions alias to the kernel region when passed
+ * through __pa(), which virt_to_pfn() uses. That means virt_addr_valid() can
+ * return true for some vmalloc addresses, which is incorrect. So explicitly
+ * check that the address is in the kernel region.
+ */
+#define virt_addr_valid(kaddr) (REGION_ID(kaddr) == KERNEL_REGION_ID && \
+                               pfn_valid(virt_to_pfn(kaddr)))
+#else
 #define virt_addr_valid(kaddr) pfn_valid(virt_to_pfn(kaddr))
+#endif
 
 /*
  * On Book-E parts we need __va to parse the device tree and we can't
@@ -230,7 +242,9 @@ extern long long virt_phys_offset;
  * and needs to be executable.  This means the whole heap ends
  * up being executable.
  */
-#define VM_DATA_DEFAULT_FLAGS32        (VM_READ | VM_WRITE | VM_EXEC | \
+#define VM_DATA_DEFAULT_FLAGS32 \
+       (((current->personality & READ_IMPLIES_EXEC) ? VM_EXEC : 0) | \
+                                VM_READ | VM_WRITE | \
                                 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
 
 #define VM_DATA_DEFAULT_FLAGS64        (VM_READ | VM_WRITE | \