From d922e28b0b7d782ad42cbd7c45cb1d4244850de1 Mon Sep 17 00:00:00 2001 From: Simon Gaiser Date: Tue, 6 Feb 2018 06:09:11 +0100 Subject: [PATCH] Add upstream fix for 4.15 This is from xen-devel and isn't yet in master. Without it PV is broken. --- ...very-early-to-avoid-page-faults-with.patch | 56 +++++++++++++++++++ series.conf | 3 + 2 files changed, 59 insertions(+) create mode 100644 patches.xen/x86-xen-init-gs-very-early-to-avoid-page-faults-with.patch diff --git a/patches.xen/x86-xen-init-gs-very-early-to-avoid-page-faults-with.patch b/patches.xen/x86-xen-init-gs-very-early-to-avoid-page-faults-with.patch new file mode 100644 index 0000000..f742e5b --- /dev/null +++ b/patches.xen/x86-xen-init-gs-very-early-to-avoid-page-faults-with.patch @@ -0,0 +1,56 @@ +From d3c8038919ffb95553ff2b6878f6eae46579abe7 Mon Sep 17 00:00:00 2001 +From: Juergen Gross +Date: Thu, 1 Feb 2018 13:40:19 +0100 +Subject: [PATCH] x86/xen: init %gs very early to avoid page faults with stack + protector + +When running as Xen pv guest %gs is initialized some time after +C code is started. Depending on stack protector usage this might be +too late, resulting in page faults. + +So setup %gs and MSR_GS_BASE in assembly code already. + +Cc: stable@vger.kernel.org +Signed-off-by: Juergen Gross +--- + arch/x86/xen/xen-head.S | 16 ++++++++++++++++ + 1 file changed, 16 insertions(+) + +diff --git a/arch/x86/xen/xen-head.S b/arch/x86/xen/xen-head.S +index 497cc55a0c16..96f26e026783 100644 +--- a/arch/x86/xen/xen-head.S ++++ b/arch/x86/xen/xen-head.S +@@ -9,7 +9,9 @@ + + #include + #include ++#include + #include ++#include + #include + + #include +@@ -35,6 +37,20 @@ ENTRY(startup_xen) + mov %_ASM_SI, xen_start_info + mov $init_thread_union+THREAD_SIZE, %_ASM_SP + ++#ifdef CONFIG_X86_64 ++ /* Set up %gs. ++ * ++ * The base of %gs always points to the bottom of the irqstack ++ * union. If the stack protector canary is enabled, it is ++ * located at %gs:40. Note that, on SMP, the boot cpu uses ++ * init data section till per cpu areas are set up. ++ */ ++ movl $MSR_GS_BASE,%ecx ++ movq $INIT_PER_CPU_VAR(irq_stack_union),%rax ++ cdq ++ wrmsr ++#endif ++ + jmp xen_start_kernel + END(startup_xen) + __FINIT +-- +2.15.1 + diff --git a/series.conf b/series.conf index 71e79c6..e504ec6 100644 --- a/series.conf +++ b/series.conf @@ -34,6 +34,9 @@ patches.xen/Revert-xen-avoid-deadlock-in-xenbus-driver.patch patches.xen/Revert-xenbus-remove-transaction-holder-from-list-be.patch patches.xen/Revert-xen-optimize-xenbus-driver-for-multiple-concu.patch +# Upstream patch for 4.15 +patches.xen/x86-xen-init-gs-very-early-to-avoid-page-faults-with.patch + # Hardware-specific fixes, backported from newer kernel and/or developers branches patches.backports/v2-2-2-Input-synaptics---Lenovo-X1-Carbon-5-should-use-SMBUS-RMI.patch patches.backports/Input-synaptics---add-Intertouch-support-on-X1-Carbon-6th-and-X280.patch