diff options
author | Christophe Leroy <christophe.leroy@csgroup.eu> | 2021-06-04 04:49:25 +0000 |
---|---|---|
committer | Michael Ellerman <mpe@ellerman.id.au> | 2021-06-17 00:09:07 +1000 |
commit | f6025a140ba8dcabdfb8a1e27ddaf44821700dce (patch) | |
tree | 11f90bdc86e96de4b1b14b687535a76f45eb71ef /arch/powerpc/mm | |
parent | 10248dcba1205042a3a0ea65eb441030702d97cd (diff) | |
download | linux-f6025a140ba8dcabdfb8a1e27ddaf44821700dce.tar.gz linux-f6025a140ba8dcabdfb8a1e27ddaf44821700dce.tar.bz2 linux-f6025a140ba8dcabdfb8a1e27ddaf44821700dce.zip |
powerpc/8xx: Allow disabling KUAP at boot time
PPC64 uses MMU features to enable/disable KUAP at boot time.
But feature fixups are applied way too early on PPC32.
But since commit c16728835eec ("powerpc/32: Manage KUAP in C"),
all KUAP is in C so it is now possible to use static branches.
Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/3dca510ce555335261a47c4799167da698f569c0.1622782111.git.christophe.leroy@csgroup.eu
Diffstat (limited to 'arch/powerpc/mm')
-rw-r--r-- | arch/powerpc/mm/nohash/8xx.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/arch/powerpc/mm/nohash/8xx.c b/arch/powerpc/mm/nohash/8xx.c index 71bfdbedacee..fc663322ba58 100644 --- a/arch/powerpc/mm/nohash/8xx.c +++ b/arch/powerpc/mm/nohash/8xx.c @@ -256,12 +256,17 @@ void __init setup_kuep(bool disabled) #endif #ifdef CONFIG_PPC_KUAP +struct static_key_false disable_kuap_key; +EXPORT_SYMBOL(disable_kuap_key); + void __init setup_kuap(bool disabled) { - pr_info("Activating Kernel Userspace Access Protection\n"); + if (disabled) { + static_branch_enable(&disable_kuap_key); + return; + } - if (disabled) - pr_warn("KUAP cannot be disabled yet on 8xx when compiled in\n"); + pr_info("Activating Kernel Userspace Access Protection\n"); mtspr(SPRN_MD_AP, MD_APG_KUAP); } |