mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-01 06:33:07 +00:00
powerpc/book3s64/kuap: Use Key 3 to implement KUAP with hash translation.
Radix use AMR Key 0 and hash translation use AMR key 3. Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com> Reviewed-by: Sandipan Das <sandipan@linux.ibm.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://lore.kernel.org/r/20201127044424.40686-18-aneesh.kumar@linux.ibm.com
This commit is contained in:
parent
eb232b1624
commit
fa46c2fa6f
1 changed files with 4 additions and 5 deletions
|
@ -5,11 +5,10 @@
|
||||||
#include <linux/const.h>
|
#include <linux/const.h>
|
||||||
#include <asm/reg.h>
|
#include <asm/reg.h>
|
||||||
|
|
||||||
#define AMR_KUAP_BLOCK_READ UL(0x4000000000000000)
|
#define AMR_KUAP_BLOCK_READ UL(0x5455555555555555)
|
||||||
#define AMR_KUAP_BLOCK_WRITE UL(0x8000000000000000)
|
#define AMR_KUAP_BLOCK_WRITE UL(0xa8aaaaaaaaaaaaaa)
|
||||||
#define AMR_KUEP_BLOCKED (1UL << 62)
|
#define AMR_KUEP_BLOCKED (1UL << 62)
|
||||||
#define AMR_KUAP_BLOCKED (AMR_KUAP_BLOCK_READ | AMR_KUAP_BLOCK_WRITE)
|
#define AMR_KUAP_BLOCKED (AMR_KUAP_BLOCK_READ | AMR_KUAP_BLOCK_WRITE)
|
||||||
#define AMR_KUAP_SHIFT 62
|
|
||||||
|
|
||||||
#ifdef __ASSEMBLY__
|
#ifdef __ASSEMBLY__
|
||||||
|
|
||||||
|
@ -62,8 +61,8 @@
|
||||||
#ifdef CONFIG_PPC_KUAP_DEBUG
|
#ifdef CONFIG_PPC_KUAP_DEBUG
|
||||||
BEGIN_MMU_FTR_SECTION_NESTED(67)
|
BEGIN_MMU_FTR_SECTION_NESTED(67)
|
||||||
mfspr \gpr1, SPRN_AMR
|
mfspr \gpr1, SPRN_AMR
|
||||||
li \gpr2, (AMR_KUAP_BLOCKED >> AMR_KUAP_SHIFT)
|
/* Prevent access to userspace using any key values */
|
||||||
sldi \gpr2, \gpr2, AMR_KUAP_SHIFT
|
LOAD_REG_IMMEDIATE(\gpr2, AMR_KUAP_BLOCKED)
|
||||||
999: tdne \gpr1, \gpr2
|
999: tdne \gpr1, \gpr2
|
||||||
EMIT_BUG_ENTRY 999b, __FILE__, __LINE__, (BUGFLAG_WARNING | BUGFLAG_ONCE)
|
EMIT_BUG_ENTRY 999b, __FILE__, __LINE__, (BUGFLAG_WARNING | BUGFLAG_ONCE)
|
||||||
END_MMU_FTR_SECTION_NESTED_IFSET(MMU_FTR_BOOK3S_KUAP, 67)
|
END_MMU_FTR_SECTION_NESTED_IFSET(MMU_FTR_BOOK3S_KUAP, 67)
|
||||||
|
|
Loading…
Reference in a new issue