Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e71fac01 authored by Kees Cook's avatar Kees Cook Committed by Greg Kroah-Hartman
Browse files

KPTI: Rename to PAGE_TABLE_ISOLATION



This renames CONFIG_KAISER to CONFIG_PAGE_TABLE_ISOLATION.

Signed-off-by: default avatarKees Cook <keescook@chromium.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 59094faf
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -9,7 +9,7 @@
 */
#undef CONFIG_PARAVIRT
#undef CONFIG_PARAVIRT_SPINLOCKS
#undef CONFIG_KAISER
#undef CONFIG_PAGE_TABLE_ISOLATION
#undef CONFIG_KASAN

#include <linux/linkage.h>
+6 −6
Original line number Diff line number Diff line
@@ -1071,7 +1071,7 @@ ENTRY(paranoid_entry)
	SWAPGS
	xorl	%ebx, %ebx
1:
#ifdef CONFIG_KAISER
#ifdef CONFIG_PAGE_TABLE_ISOLATION
	/*
	 * We might have come in between a swapgs and a SWITCH_KERNEL_CR3
	 * on entry, or between a SWITCH_USER_CR3 and a swapgs on exit.
@@ -1111,7 +1111,7 @@ ENTRY(paranoid_exit)
	DISABLE_INTERRUPTS(CLBR_NONE)
	TRACE_IRQS_OFF_DEBUG
	TRACE_IRQS_IRETQ_DEBUG
#ifdef CONFIG_KAISER
#ifdef CONFIG_PAGE_TABLE_ISOLATION
	/* No ALTERNATIVE for X86_FEATURE_KAISER: paranoid_entry sets %ebx */
	testl	$2, %ebx			/* SWITCH_USER_CR3 needed? */
	jz	paranoid_exit_no_switch
@@ -1340,7 +1340,7 @@ ENTRY(nmi)

	movq	%rsp, %rdi
	movq	$-1, %rsi
#ifdef CONFIG_KAISER
#ifdef CONFIG_PAGE_TABLE_ISOLATION
	/* Unconditionally use kernel CR3 for do_nmi() */
	/* %rax is saved above, so OK to clobber here */
	ALTERNATIVE "jmp 2f", "movq %cr3, %rax", X86_FEATURE_KAISER
@@ -1354,7 +1354,7 @@ ENTRY(nmi)
#endif
	call	do_nmi

#ifdef CONFIG_KAISER
#ifdef CONFIG_PAGE_TABLE_ISOLATION
	/*
	 * Unconditionally restore CR3.  I know we return to
	 * kernel code that needs user CR3, but do we ever return
@@ -1584,7 +1584,7 @@ end_repeat_nmi:
1:
	movq	%rsp, %rdi
	movq	$-1, %rsi
#ifdef CONFIG_KAISER
#ifdef CONFIG_PAGE_TABLE_ISOLATION
	/* Unconditionally use kernel CR3 for do_nmi() */
	/* %rax is saved above, so OK to clobber here */
	ALTERNATIVE "jmp 2f", "movq %cr3, %rax", X86_FEATURE_KAISER
@@ -1600,7 +1600,7 @@ end_repeat_nmi:
	/* paranoidentry do_nmi, 0; without TRACE_IRQS_OFF */
	call	do_nmi

#ifdef CONFIG_KAISER
#ifdef CONFIG_PAGE_TABLE_ISOLATION
	/*
	 * Unconditionally restore CR3.  We might be returning to
	 * kernel code that needs user CR3, like just just before
+2 −2
Original line number Diff line number Diff line
@@ -274,7 +274,7 @@ static DEFINE_PER_CPU(void *, insn_buffer);

static void *dsalloc(size_t size, gfp_t flags, int node)
{
#ifdef CONFIG_KAISER
#ifdef CONFIG_PAGE_TABLE_ISOLATION
	unsigned int order = get_order(size);
	struct page *page;
	unsigned long addr;
@@ -295,7 +295,7 @@ static void *dsalloc(size_t size, gfp_t flags, int node)

static void dsfree(const void *buffer, size_t size)
{
#ifdef CONFIG_KAISER
#ifdef CONFIG_PAGE_TABLE_ISOLATION
	if (!buffer)
		return;
	kaiser_remove_mapping((unsigned long)buffer, size);
+1 −1
Original line number Diff line number Diff line
@@ -199,7 +199,7 @@
#define X86_FEATURE_AVX512_4FMAPS (7*32+17) /* AVX-512 Multiply Accumulation Single precision */

/* Because the ALTERNATIVE scheme is for members of the X86_FEATURE club... */
#define X86_FEATURE_KAISER	( 7*32+31) /* CONFIG_KAISER w/o nokaiser */
#define X86_FEATURE_KAISER	( 7*32+31) /* CONFIG_PAGE_TABLE_ISOLATION w/o nokaiser */

/* Virtualization flags: Linux defined, word 8 */
#define X86_FEATURE_TPR_SHADOW  ( 8*32+ 0) /* Intel TPR Shadow */
+6 −6
Original line number Diff line number Diff line
@@ -20,7 +20,7 @@
#define KAISER_SHADOW_PGD_OFFSET 0x1000

#ifdef __ASSEMBLY__
#ifdef CONFIG_KAISER
#ifdef CONFIG_PAGE_TABLE_ISOLATION

.macro _SWITCH_TO_KERNEL_CR3 reg
movq %cr3, \reg
@@ -69,7 +69,7 @@ movq PER_CPU_VAR(unsafe_stack_register_backup), %rax
8:
.endm

#else /* CONFIG_KAISER */
#else /* CONFIG_PAGE_TABLE_ISOLATION */

.macro SWITCH_KERNEL_CR3
.endm
@@ -78,11 +78,11 @@ movq PER_CPU_VAR(unsafe_stack_register_backup), %rax
.macro SWITCH_KERNEL_CR3_NO_STACK
.endm

#endif /* CONFIG_KAISER */
#endif /* CONFIG_PAGE_TABLE_ISOLATION */

#else /* __ASSEMBLY__ */

#ifdef CONFIG_KAISER
#ifdef CONFIG_PAGE_TABLE_ISOLATION
/*
 * Upon kernel/user mode switch, it may happen that the address
 * space has to be switched before the registers have been
@@ -100,10 +100,10 @@ extern void __init kaiser_check_boottime_disable(void);
#else
#define kaiser_enabled	0
static inline void __init kaiser_check_boottime_disable(void) {}
#endif /* CONFIG_KAISER */
#endif /* CONFIG_PAGE_TABLE_ISOLATION */

/*
 * Kaiser function prototypes are needed even when CONFIG_KAISER is not set,
 * Kaiser function prototypes are needed even when CONFIG_PAGE_TABLE_ISOLATION is not set,
 * so as to build with tests on kaiser_enabled instead of #ifdefs.
 */

Loading