Commit 6c1fa60d authored by Christophe Leroy's avatar Christophe Leroy Committed by Michael Ellerman

Revert "powerpc: Inline setup_kup()"

This reverts commit 1791ebd1.

setup_kup() was inlined to manage conflict between PPC32 marking
setup_{kuap/kuep}() __init and PPC64 not marking them __init.

But in fact PPC32 has removed the __init mark for all but 8xx
in order to properly handle SMP.

In order to make setup_kup() grow a bit, revert the commit
mentioned above but remove __init for 8xx as well so that
we don't have to mark setup_kup() as __ref.

Also switch the order so that KUAP is initialised before KUEP
because on the 40x, KUEP will depend on the activation of KUAP.
Signed-off-by: default avatarChristophe Leroy <christophe.leroy@csgroup.eu>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/7691088fd0994ee3c8db6298dc8c00259e3f6a7f.1634627931.git.christophe.leroy@csgroup.eu
parent 06e7cbc2
...@@ -32,6 +32,8 @@ extern bool disable_kuap; ...@@ -32,6 +32,8 @@ extern bool disable_kuap;
#include <linux/pgtable.h> #include <linux/pgtable.h>
void setup_kup(void);
#ifdef CONFIG_PPC_KUEP #ifdef CONFIG_PPC_KUEP
void setup_kuep(bool disabled); void setup_kuep(bool disabled);
#else #else
...@@ -78,12 +80,6 @@ static inline void restore_user_access(unsigned long flags) { } ...@@ -78,12 +80,6 @@ static inline void restore_user_access(unsigned long flags) { }
#endif /* CONFIG_PPC_BOOK3S_64 */ #endif /* CONFIG_PPC_BOOK3S_64 */
#endif /* CONFIG_PPC_KUAP */ #endif /* CONFIG_PPC_KUAP */
static __always_inline void setup_kup(void)
{
setup_kuep(disable_kuep);
setup_kuap(disable_kuap);
}
static __always_inline void allow_read_from_user(const void __user *from, unsigned long size) static __always_inline void allow_read_from_user(const void __user *from, unsigned long size)
{ {
barrier_nospec(); barrier_nospec();
......
...@@ -47,6 +47,12 @@ static int __init parse_nosmap(char *p) ...@@ -47,6 +47,12 @@ static int __init parse_nosmap(char *p)
} }
early_param("nosmap", parse_nosmap); early_param("nosmap", parse_nosmap);
void setup_kup(void)
{
setup_kuap(disable_kuap);
setup_kuep(disable_kuep);
}
#define CTOR(shift) static void ctor_##shift(void *addr) \ #define CTOR(shift) static void ctor_##shift(void *addr) \
{ \ { \
memset(addr, 0, sizeof(void *) << (shift)); \ memset(addr, 0, sizeof(void *) << (shift)); \
......
...@@ -213,7 +213,7 @@ void __init setup_initial_memory_limit(phys_addr_t first_memblock_base, ...@@ -213,7 +213,7 @@ void __init setup_initial_memory_limit(phys_addr_t first_memblock_base,
} }
#ifdef CONFIG_PPC_KUEP #ifdef CONFIG_PPC_KUEP
void __init setup_kuep(bool disabled) void setup_kuep(bool disabled)
{ {
if (disabled) if (disabled)
return; return;
...@@ -228,7 +228,7 @@ void __init setup_kuep(bool disabled) ...@@ -228,7 +228,7 @@ void __init setup_kuep(bool disabled)
struct static_key_false disable_kuap_key; struct static_key_false disable_kuap_key;
EXPORT_SYMBOL(disable_kuap_key); EXPORT_SYMBOL(disable_kuap_key);
void __init setup_kuap(bool disabled) void setup_kuap(bool disabled)
{ {
if (disabled) { if (disabled) {
static_branch_enable(&disable_kuap_key); static_branch_enable(&disable_kuap_key);
......
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