Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

powerpc/kuap: Remove __kuap_assert_locked()

__kuap_assert_locked() is redundant with
__kuap_get_and_assert_locked().

Move the verification of CONFIG_PPC_KUAP_DEBUG in kuap_assert_locked()
and make it call __kuap_get_and_assert_locked() directly.

Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/1a60198a25d2ba38a37f1b92bc7d096435df4224.1634627931.git.christophe.leroy@csgroup.eu

authored by

Christophe Leroy and committed by
Michael Ellerman
2341964e c252f384

+2 -18
-5
arch/powerpc/include/asm/book3s/32/kup.h
··· 117 117 return kuap; 118 118 } 119 119 120 - static inline void __kuap_assert_locked(void) 121 - { 122 - __kuap_get_and_assert_locked(); 123 - } 124 - 125 120 static __always_inline void __allow_user_access(void __user *to, const void __user *from, 126 121 u32 size, unsigned long dir) 127 122 {
-6
arch/powerpc/include/asm/book3s/64/kup.h
··· 298 298 return amr; 299 299 } 300 300 301 - static inline void __kuap_assert_locked(void) 302 - { 303 - if (IS_ENABLED(CONFIG_PPC_KUAP_DEBUG)) 304 - WARN_ON_ONCE(mfspr(SPRN_AMR) != AMR_KUAP_BLOCKED); 305 - } 306 - 307 301 /* 308 302 * We support individually allowing read or write, but we don't support nesting 309 303 * because that would require an expensive read/modify write of the AMR.
+2 -1
arch/powerpc/include/asm/kup.h
··· 86 86 if (kuap_is_disabled()) 87 87 return; 88 88 89 - __kuap_assert_locked(); 89 + if (IS_ENABLED(CONFIG_PPC_KUAP_DEBUG)) 90 + __kuap_get_and_assert_locked(); 90 91 } 91 92 92 93 #ifdef CONFIG_PPC32
-6
arch/powerpc/include/asm/nohash/32/kup-8xx.h
··· 47 47 return kuap; 48 48 } 49 49 50 - static inline void __kuap_assert_locked(void) 51 - { 52 - if (IS_ENABLED(CONFIG_PPC_KUAP_DEBUG)) 53 - __kuap_get_and_assert_locked(); 54 - } 55 - 56 50 static inline void __allow_user_access(void __user *to, const void __user *from, 57 51 unsigned long size, unsigned long dir) 58 52 {