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

Configure Feed

Select the types of activity you want to include in your feed.

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

authored by

Aneesh Kumar K.V and committed by
Michael Ellerman
fa46c2fa eb232b16

+4 -5
+4 -5
arch/powerpc/include/asm/book3s/64/kup.h
··· 5 5 #include <linux/const.h> 6 6 #include <asm/reg.h> 7 7 8 - #define AMR_KUAP_BLOCK_READ UL(0x4000000000000000) 9 - #define AMR_KUAP_BLOCK_WRITE UL(0x8000000000000000) 8 + #define AMR_KUAP_BLOCK_READ UL(0x5455555555555555) 9 + #define AMR_KUAP_BLOCK_WRITE UL(0xa8aaaaaaaaaaaaaa) 10 10 #define AMR_KUEP_BLOCKED (1UL << 62) 11 11 #define AMR_KUAP_BLOCKED (AMR_KUAP_BLOCK_READ | AMR_KUAP_BLOCK_WRITE) 12 - #define AMR_KUAP_SHIFT 62 13 12 14 13 #ifdef __ASSEMBLY__ 15 14 ··· 61 62 #ifdef CONFIG_PPC_KUAP_DEBUG 62 63 BEGIN_MMU_FTR_SECTION_NESTED(67) 63 64 mfspr \gpr1, SPRN_AMR 64 - li \gpr2, (AMR_KUAP_BLOCKED >> AMR_KUAP_SHIFT) 65 - sldi \gpr2, \gpr2, AMR_KUAP_SHIFT 65 + /* Prevent access to userspace using any key values */ 66 + LOAD_REG_IMMEDIATE(\gpr2, AMR_KUAP_BLOCKED) 66 67 999: tdne \gpr1, \gpr2 67 68 EMIT_BUG_ENTRY 999b, __FILE__, __LINE__, (BUGFLAG_WARNING | BUGFLAG_ONCE) 68 69 END_MMU_FTR_SECTION_NESTED_IFSET(MMU_FTR_BOOK3S_KUAP, 67)