powerpc: Add framework for Kernel Userspace Protection
authorChristophe Leroy <christophe.leroy@c-s.fr>
Thu, 18 Apr 2019 06:51:18 +0000 (16:51 +1000)
committerMichael Ellerman <mpe@ellerman.id.au>
Sun, 21 Apr 2019 13:05:54 +0000 (23:05 +1000)
commit69795cabe4cfe5122438d50010ad5310c113a013
tree1a6f463d544b6ce25276c05558123d3614a7b6db
parent53a712bae5dd919521a58d7bad773b949358add0
powerpc: Add framework for Kernel Userspace Protection

This patch adds a skeleton for Kernel Userspace Protection
functionnalities like Kernel Userspace Access Protection and Kernel
Userspace Execution Prevention

The subsequent implementation of KUAP for radix makes use of a MMU
feature in order to patch out assembly when KUAP is disabled or
unsupported. This won't work unless there's an entry point for KUP
support before the feature magic happens, so for PPC64 setup_kup() is
called early in setup.

On PPC32, feature_fixup() is done too early to allow the same.

Suggested-by: Russell Currey <ruscur@russell.cc>
Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
arch/powerpc/include/asm/kup.h [new file with mode: 0644]
arch/powerpc/kernel/setup_64.c
arch/powerpc/mm/init-common.c
arch/powerpc/mm/init_32.c