Thread (48 messages) 48 messages, 3 authors, 2021-10-11

Re: [PATCH v6 03/22] powerpc/book3s64/kuap/kuep: Make KUAP and KUEP a subfeature of PPC_MEM_KEYS

From: Aneesh Kumar K.V <hidden>
Date: 2020-11-25 15:01:25

Christophe Leroy [off-list ref] writes:
Le 25/11/2020 à 06:16, Aneesh Kumar K.V a écrit :
....
quoted hunk ↗ jump to hunk
diff --git a/arch/powerpc/mm/book3s64/pkeys.c b/arch/powerpc/mm/book3s64/pkeys.c
quoted
index b1d091a97611..7dc71f85683d 100644
--- a/arch/powerpc/mm/book3s64/pkeys.c
+++ b/arch/powerpc/mm/book3s64/pkeys.c
@@ -89,12 +89,14 @@ static int scan_pkey_feature(void)
  		}
  	}
  
+#ifdef CONFIG_PPC_MEM_KEYS
  	/*
  	 * Adjust the upper limit, based on the number of bits supported by
  	 * arch-neutral code.
  	 */
  	pkeys_total = min_t(int, pkeys_total,
  			    ((ARCH_VM_PKEY_FLAGS >> VM_PKEY_SHIFT) + 1));
I don't think we need an #ifdef here. I thing an 'if (IS_ENABLED(CONFIG_PPC_MEM_KEYS))' should make it.
ppc64/arch/powerpc/mm/book3s64/pkeys.c: In function ‘scan_pkey_feature’:                                                                                     
ppc64/arch/powerpc/mm/book3s64/pkeys.c:98:33: error: ‘VM_PKEY_SHIFT’ undeclared (first use in this function)                                                 
   98 |         ((ARCH_VM_PKEY_FLAGS >> VM_PKEY_SHIFT) + 1));                                
      |                                 ^~~~~~~~~~~~~                                          
pkey headers only include arch headers if PPC_MEM_KEYS is enabled. ie, 

#ifdef CONFIG_ARCH_HAS_PKEYS
#include <asm/pkeys.h>
#else /* ! CONFIG_ARCH_HAS_PKEYS */
#define arch_max_pkey() (1)
#define execute_only_pkey(mm) (0)
#define arch_override_mprotect_pkey(vma, prot, pkey) (0)
#define PKEY_DEDICATED_EXECUTE_ONLY 0
#define ARCH_VM_PKEY_FLAGS 0
..

Sorting that out should be another patch series. 


quoted
+#endif
  	return pkeys_total;
  }
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help