Commit d175ee98 authored by Christophe Leroy's avatar Christophe Leroy Committed by Jason A. Donenfeld

mm: Define VM_DROPPABLE for powerpc/32

Commit 9651fced ("mm: add MAP_DROPPABLE for designating always
lazily freeable mappings") only adds VM_DROPPABLE for 64 bits
architectures.

In order to also use the getrandom vDSO implementation on powerpc/32,
use VM_ARCH_1 for VM_DROPPABLE on powerpc/32. This is possible because
VM_ARCH_1 is used for VM_SAO on powerpc and VM_SAO is only for
powerpc/64. It is used in combination with PROT_SAO in some parts of
code that are restricted to CONFIG_PPC64 through #ifdefs, it is
therefore possible to define VM_SAO for CONFIG_PPC64 only.
Signed-off-by: default avatarChristophe Leroy <christophe.leroy@csgroup.eu>
Acked-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
Signed-off-by: default avatarJason A. Donenfeld <Jason@zx2c4.com>
parent c7304938
...@@ -987,8 +987,10 @@ static void show_smap_vma_flags(struct seq_file *m, struct vm_area_struct *vma) ...@@ -987,8 +987,10 @@ static void show_smap_vma_flags(struct seq_file *m, struct vm_area_struct *vma)
#ifdef CONFIG_X86_USER_SHADOW_STACK #ifdef CONFIG_X86_USER_SHADOW_STACK
[ilog2(VM_SHADOW_STACK)] = "ss", [ilog2(VM_SHADOW_STACK)] = "ss",
#endif #endif
#ifdef CONFIG_64BIT #if defined(CONFIG_64BIT) || defined(CONFIG_PPC32)
[ilog2(VM_DROPPABLE)] = "dp", [ilog2(VM_DROPPABLE)] = "dp",
#endif
#ifdef CONFIG_64BIT
[ilog2(VM_SEALED)] = "sl", [ilog2(VM_SEALED)] = "sl",
#endif #endif
}; };
......
...@@ -359,7 +359,7 @@ extern unsigned int kobjsize(const void *objp); ...@@ -359,7 +359,7 @@ extern unsigned int kobjsize(const void *objp);
#if defined(CONFIG_X86) #if defined(CONFIG_X86)
# define VM_PAT VM_ARCH_1 /* PAT reserves whole VMA at once (x86) */ # define VM_PAT VM_ARCH_1 /* PAT reserves whole VMA at once (x86) */
#elif defined(CONFIG_PPC) #elif defined(CONFIG_PPC64)
# define VM_SAO VM_ARCH_1 /* Strong Access Ordering (powerpc) */ # define VM_SAO VM_ARCH_1 /* Strong Access Ordering (powerpc) */
#elif defined(CONFIG_PARISC) #elif defined(CONFIG_PARISC)
# define VM_GROWSUP VM_ARCH_1 # define VM_GROWSUP VM_ARCH_1
...@@ -409,6 +409,8 @@ extern unsigned int kobjsize(const void *objp); ...@@ -409,6 +409,8 @@ extern unsigned int kobjsize(const void *objp);
#ifdef CONFIG_64BIT #ifdef CONFIG_64BIT
#define VM_DROPPABLE_BIT 40 #define VM_DROPPABLE_BIT 40
#define VM_DROPPABLE BIT(VM_DROPPABLE_BIT) #define VM_DROPPABLE BIT(VM_DROPPABLE_BIT)
#elif defined(CONFIG_PPC32)
#define VM_DROPPABLE VM_ARCH_1
#else #else
#define VM_DROPPABLE VM_NONE #define VM_DROPPABLE VM_NONE
#endif #endif
......
...@@ -143,7 +143,7 @@ IF_HAVE_PG_ARCH_X(arch_3) ...@@ -143,7 +143,7 @@ IF_HAVE_PG_ARCH_X(arch_3)
#if defined(CONFIG_X86) #if defined(CONFIG_X86)
#define __VM_ARCH_SPECIFIC_1 {VM_PAT, "pat" } #define __VM_ARCH_SPECIFIC_1 {VM_PAT, "pat" }
#elif defined(CONFIG_PPC) #elif defined(CONFIG_PPC64)
#define __VM_ARCH_SPECIFIC_1 {VM_SAO, "sao" } #define __VM_ARCH_SPECIFIC_1 {VM_SAO, "sao" }
#elif defined(CONFIG_PARISC) #elif defined(CONFIG_PARISC)
#define __VM_ARCH_SPECIFIC_1 {VM_GROWSUP, "growsup" } #define __VM_ARCH_SPECIFIC_1 {VM_GROWSUP, "growsup" }
...@@ -165,7 +165,7 @@ IF_HAVE_PG_ARCH_X(arch_3) ...@@ -165,7 +165,7 @@ IF_HAVE_PG_ARCH_X(arch_3)
# define IF_HAVE_UFFD_MINOR(flag, name) # define IF_HAVE_UFFD_MINOR(flag, name)
#endif #endif
#ifdef CONFIG_64BIT #if defined(CONFIG_64BIT) || defined(CONFIG_PPC32)
# define IF_HAVE_VM_DROPPABLE(flag, name) {flag, name}, # define IF_HAVE_VM_DROPPABLE(flag, name) {flag, name},
#else #else
# define IF_HAVE_VM_DROPPABLE(flag, name) # define IF_HAVE_VM_DROPPABLE(flag, name)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment