summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJiri Kosina <jkosina@suse.cz>2018-01-02 14:19:49 +0100
committerBen Hutchings <ben@decadent.org.uk>2018-01-09 00:35:19 +0000
commite36d606e53a8d4cac574cbb22b006f9129b88f5f (patch)
treea7c63ba6a99b453869b3246b112ba644196adc32
parent1f30b9849d6a59834d7f9f11e232e52958a1fbb7 (diff)
kaiser: disabled on Xen PV
Kaiser cannot be used on paravirtualized MMUs (namely reading and writing CR3). This does not work with KAISER as the CR3 switch from and to user space PGD would require to map the whole XEN_PV machinery into both. More importantly, enabling KAISER on Xen PV doesn't make too much sense, as PV guests use distinct %cr3 values for kernel and user already. Signed-off-by: Jiri Kosina <jkosina@suse.cz> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: Hugh Dickins <hughd@google.com> [bwh: Backported to 3.16: use xen_pv_domain()] Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
-rw-r--r--arch/x86/mm/kaiser.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/arch/x86/mm/kaiser.c b/arch/x86/mm/kaiser.c
index 1781da23e86a..4a0dcd03505b 100644
--- a/arch/x86/mm/kaiser.c
+++ b/arch/x86/mm/kaiser.c
@@ -10,6 +10,7 @@
#include <linux/mm.h>
#include <linux/uaccess.h>
#include <linux/ftrace.h>
+#include <xen/xen.h>
extern struct mm_struct init_mm;
@@ -273,6 +274,9 @@ void __init kaiser_check_boottime_disable(void)
char arg[5];
int ret;
+ if (xen_pv_domain())
+ goto silent_disable;
+
ret = cmdline_find_option(boot_command_line, "pti", arg, sizeof(arg));
if (ret > 0) {
if (!strncmp(arg, "on", 2))
@@ -300,6 +304,8 @@ enable:
disable:
pr_info("Kernel/User page tables isolation: disabled\n");
+
+silent_disable:
kaiser_enabled = 0;
setup_clear_cpu_cap(X86_FEATURE_KAISER);
}