aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGordon Tetlow <gordon@FreeBSD.org>2018-06-21 05:18:08 +0000
committerGordon Tetlow <gordon@FreeBSD.org>2018-06-21 05:18:08 +0000
commit3cf76440d26778ad6a0a9bd4273bb4da01e8e491 (patch)
tree3901b5161318239592fd248511fdb2fc0f3b2471
parent701e21017f7ad962eb7f319460b5d37f047bb9e8 (diff)
downloadsrc-3cf76440d26778ad6a0a9bd4273bb4da01e8e491.tar.gz
src-3cf76440d26778ad6a0a9bd4273bb4da01e8e491.zip
Fix TLB shootdown for Xen based guests. [EN-18:07.pmap]
Approved by: so Security: FreeBSD-EN-18:07.pmap
Notes
Notes: svn path=/releng/11.1/; revision=335466
-rw-r--r--sys/x86/xen/xen_apic.c55
1 files changed, 53 insertions, 2 deletions
diff --git a/sys/x86/xen/xen_apic.c b/sys/x86/xen/xen_apic.c
index a7fa255d7568..09ba28f9e46b 100644
--- a/sys/x86/xen/xen_apic.c
+++ b/sys/x86/xen/xen_apic.c
@@ -41,6 +41,7 @@ __FBSDID("$FreeBSD$");
#include <machine/cpufunc.h>
#include <machine/cpu.h>
#include <machine/intr_machdep.h>
+#include <machine/md_var.h>
#include <machine/smp.h>
#include <x86/apicreg.h>
@@ -439,6 +440,46 @@ xen_invltlb_pcid(void *arg)
invltlb_pcid_handler();
return (FILTER_HANDLED);
}
+
+static int
+xen_invltlb_invpcid_pti(void *arg)
+{
+
+ invltlb_invpcid_pti_handler();
+ return (FILTER_HANDLED);
+}
+
+static int
+xen_invlpg_invpcid_handler(void *arg)
+{
+
+ invlpg_invpcid_handler();
+ return (FILTER_HANDLED);
+}
+
+static int
+xen_invlpg_pcid_handler(void *arg)
+{
+
+ invlpg_pcid_handler();
+ return (FILTER_HANDLED);
+}
+
+static int
+xen_invlrng_invpcid_handler(void *arg)
+{
+
+ invlrng_invpcid_handler();
+ return (FILTER_HANDLED);
+}
+
+static int
+xen_invlrng_pcid_handler(void *arg)
+{
+
+ invlrng_pcid_handler();
+ return (FILTER_HANDLED);
+}
#endif
static int
@@ -529,8 +570,18 @@ xen_setup_cpus(void)
#ifdef __amd64__
if (pmap_pcid_enabled) {
- xen_ipis[IPI_TO_IDX(IPI_INVLTLB)].filter = invpcid_works ?
- xen_invltlb_invpcid : xen_invltlb_pcid;
+ if (pti)
+ xen_ipis[IPI_TO_IDX(IPI_INVLTLB)].filter =
+ invpcid_works ? xen_invltlb_invpcid_pti :
+ xen_invltlb_pcid;
+ else
+ xen_ipis[IPI_TO_IDX(IPI_INVLTLB)].filter =
+ invpcid_works ? xen_invltlb_invpcid :
+ xen_invltlb_pcid;
+ xen_ipis[IPI_TO_IDX(IPI_INVLPG)].filter = invpcid_works ?
+ xen_invlpg_invpcid_handler : xen_invlpg_pcid_handler;
+ xen_ipis[IPI_TO_IDX(IPI_INVLRNG)].filter = invpcid_works ?
+ xen_invlrng_invpcid_handler : xen_invlrng_pcid_handler;
}
#endif
CPU_FOREACH(i)