[PATCH 4.1 63/65] kpti: Disable when running under Xen PV

From: Pavel Tatashin
Date: Mon Mar 05 2018 - 19:27:34 EST


From: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>

Very very partial backport from aa8c6248f8c75 where
there is a check to see if this is an Xen PV guest - and
if so disable it.

The reason is that the PV ABI would require a major
overhaul to be Meltdown resistent.

Instead there are mitigations (PV in HVM) which are far more
suitable.

Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>
---
arch/x86/mm/kaiser.c | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/arch/x86/mm/kaiser.c b/arch/x86/mm/kaiser.c
index 50783ad4861d..05fb616c9e2a 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>

#include <asm/kaiser.h>
#include <asm/tlbflush.h> /* to verify its kaiser declarations */
@@ -264,6 +265,9 @@ void __init kaiser_check_boottime_disable(void)
char arg[5];
int ret;

+ if (xen_pv_domain())
+ goto disable;
+
ret = cmdline_find_option(boot_command_line, "pti", arg, sizeof(arg));
if (ret > 0) {
if (!strncmp(arg, "on", 2))
--
2.16.2