From: Greg Kroah-Hartman Date: Tue, 13 Oct 2015 22:16:42 +0000 (-0700) Subject: 3.10-stable patches X-Git-Tag: v3.10.91~71 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f3d5861b853493088a9bc8656941c23c420f754f;p=thirdparty%2Fkernel%2Fstable-queue.git 3.10-stable patches added patches: use-warn_on_once-for-missing-x86_feature_nrips.patch x86-mm-set-nx-on-gap-between-__ex_table-and-rodata.patch x86-xen-support-kexec-kdump-in-hvm-guests-by-doing-a-soft-reset.patch --- diff --git a/queue-3.10/series b/queue-3.10/series index 27e35f4a095..216183c06ff 100644 --- a/queue-3.10/series +++ b/queue-3.10/series @@ -4,3 +4,6 @@ arm-8429-1-disable-gcc-sra-optimization.patch windfarm-decrement-client-count-when-unregistering.patch x86-apic-serialize-lvtt-and-tsc_deadline-writes.patch x86-platform-fix-geode-lx-timekeeping-in-the-generic-x86-build.patch +use-warn_on_once-for-missing-x86_feature_nrips.patch +x86-mm-set-nx-on-gap-between-__ex_table-and-rodata.patch +x86-xen-support-kexec-kdump-in-hvm-guests-by-doing-a-soft-reset.patch diff --git a/queue-3.10/use-warn_on_once-for-missing-x86_feature_nrips.patch b/queue-3.10/use-warn_on_once-for-missing-x86_feature_nrips.patch new file mode 100644 index 00000000000..279a60f31e6 --- /dev/null +++ b/queue-3.10/use-warn_on_once-for-missing-x86_feature_nrips.patch @@ -0,0 +1,37 @@ +From d2922422c48df93f3edff7d872ee4f3191fefb08 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Dirk=20M=C3=BCller?= +Date: Thu, 1 Oct 2015 13:43:42 +0200 +Subject: Use WARN_ON_ONCE for missing X86_FEATURE_NRIPS + +From: =?UTF-8?q?Dirk=20M=C3=BCller?= + +commit d2922422c48df93f3edff7d872ee4f3191fefb08 upstream. + +The cpu feature flags are not ever going to change, so warning +everytime can cause a lot of kernel log spam +(in our case more than 10GB/hour). + +The warning seems to only occur when nested virtualization is +enabled, so it's probably triggered by a KVM bug. This is a +sensible and safe change anyway, and the KVM bug fix might not +be suitable for stable releases anyway. + +Signed-off-by: Dirk Mueller +Signed-off-by: Paolo Bonzini +Signed-off-by: Greg Kroah-Hartman + +--- + arch/x86/kvm/svm.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/arch/x86/kvm/svm.c ++++ b/arch/x86/kvm/svm.c +@@ -496,7 +496,7 @@ static void skip_emulated_instruction(st + struct vcpu_svm *svm = to_svm(vcpu); + + if (svm->vmcb->control.next_rip != 0) { +- WARN_ON(!static_cpu_has(X86_FEATURE_NRIPS)); ++ WARN_ON_ONCE(!static_cpu_has(X86_FEATURE_NRIPS)); + svm->next_rip = svm->vmcb->control.next_rip; + } + diff --git a/queue-3.10/x86-mm-set-nx-on-gap-between-__ex_table-and-rodata.patch b/queue-3.10/x86-mm-set-nx-on-gap-between-__ex_table-and-rodata.patch new file mode 100644 index 00000000000..5503ee85bce --- /dev/null +++ b/queue-3.10/x86-mm-set-nx-on-gap-between-__ex_table-and-rodata.patch @@ -0,0 +1,64 @@ +From ab76f7b4ab2397ffdd2f1eb07c55697d19991d10 Mon Sep 17 00:00:00 2001 +From: Stephen Smalley +Date: Thu, 1 Oct 2015 09:04:22 -0400 +Subject: x86/mm: Set NX on gap between __ex_table and rodata + +From: Stephen Smalley + +commit ab76f7b4ab2397ffdd2f1eb07c55697d19991d10 upstream. + +Unused space between the end of __ex_table and the start of +rodata can be left W+x in the kernel page tables. Extend the +setting of the NX bit to cover this gap by starting from +text_end rather than rodata_start. + + Before: + ---[ High Kernel Mapping ]--- + 0xffffffff80000000-0xffffffff81000000 16M pmd + 0xffffffff81000000-0xffffffff81600000 6M ro PSE GLB x pmd + 0xffffffff81600000-0xffffffff81754000 1360K ro GLB x pte + 0xffffffff81754000-0xffffffff81800000 688K RW GLB x pte + 0xffffffff81800000-0xffffffff81a00000 2M ro PSE GLB NX pmd + 0xffffffff81a00000-0xffffffff81b3b000 1260K ro GLB NX pte + 0xffffffff81b3b000-0xffffffff82000000 4884K RW GLB NX pte + 0xffffffff82000000-0xffffffff82200000 2M RW PSE GLB NX pmd + 0xffffffff82200000-0xffffffffa0000000 478M pmd + + After: + ---[ High Kernel Mapping ]--- + 0xffffffff80000000-0xffffffff81000000 16M pmd + 0xffffffff81000000-0xffffffff81600000 6M ro PSE GLB x pmd + 0xffffffff81600000-0xffffffff81754000 1360K ro GLB x pte + 0xffffffff81754000-0xffffffff81800000 688K RW GLB NX pte + 0xffffffff81800000-0xffffffff81a00000 2M ro PSE GLB NX pmd + 0xffffffff81a00000-0xffffffff81b3b000 1260K ro GLB NX pte + 0xffffffff81b3b000-0xffffffff82000000 4884K RW GLB NX pte + 0xffffffff82000000-0xffffffff82200000 2M RW PSE GLB NX pmd + 0xffffffff82200000-0xffffffffa0000000 478M pmd + +Signed-off-by: Stephen Smalley +Acked-by: Kees Cook +Cc: Linus Torvalds +Cc: Mike Galbraith +Cc: Peter Zijlstra +Cc: Thomas Gleixner +Cc: linux-kernel@vger.kernel.org +Link: http://lkml.kernel.org/r/1443704662-3138-1-git-send-email-sds@tycho.nsa.gov +Signed-off-by: Ingo Molnar +Signed-off-by: Greg Kroah-Hartman + +--- + arch/x86/mm/init_64.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/arch/x86/mm/init_64.c ++++ b/arch/x86/mm/init_64.c +@@ -1163,7 +1163,7 @@ void mark_rodata_ro(void) + * has been zapped already via cleanup_highmem(). + */ + all_end = roundup((unsigned long)_brk_end, PMD_SIZE); +- set_memory_nx(rodata_start, (all_end - rodata_start) >> PAGE_SHIFT); ++ set_memory_nx(text_end, (all_end - text_end) >> PAGE_SHIFT); + + rodata_test(); + diff --git a/queue-3.10/x86-xen-support-kexec-kdump-in-hvm-guests-by-doing-a-soft-reset.patch b/queue-3.10/x86-xen-support-kexec-kdump-in-hvm-guests-by-doing-a-soft-reset.patch new file mode 100644 index 00000000000..a90710534d8 --- /dev/null +++ b/queue-3.10/x86-xen-support-kexec-kdump-in-hvm-guests-by-doing-a-soft-reset.patch @@ -0,0 +1,105 @@ +From 0b34a166f291d255755be46e43ed5497cdd194f2 Mon Sep 17 00:00:00 2001 +From: Vitaly Kuznetsov +Date: Fri, 25 Sep 2015 11:59:52 +0200 +Subject: x86/xen: Support kexec/kdump in HVM guests by doing a soft reset + +From: Vitaly Kuznetsov + +commit 0b34a166f291d255755be46e43ed5497cdd194f2 upstream. + +Currently there is a number of issues preventing PVHVM Xen guests from +doing successful kexec/kdump: + + - Bound event channels. + - Registered vcpu_info. + - PIRQ/emuirq mappings. + - shared_info frame after XENMAPSPACE_shared_info operation. + - Active grant mappings. + +Basically, newly booted kernel stumbles upon already set up Xen +interfaces and there is no way to reestablish them. In Xen-4.7 a new +feature called 'soft reset' is coming. A guest performing kexec/kdump +operation is supposed to call SCHEDOP_shutdown hypercall with +SHUTDOWN_soft_reset reason before jumping to new kernel. Hypervisor +(with some help from toolstack) will do full domain cleanup (but +keeping its memory and vCPU contexts intact) returning the guest to +the state it had when it was first booted and thus allowing it to +start over. + +Doing SHUTDOWN_soft_reset on Xen hypervisors which don't support it is +probably OK as by default all unknown shutdown reasons cause domain +destroy with a message in toolstack log: 'Unknown shutdown reason code +5. Destroying domain.' which gives a clue to what the problem is and +eliminates false expectations. + +Signed-off-by: Vitaly Kuznetsov +Signed-off-by: David Vrabel +Signed-off-by: Greg Kroah-Hartman + +--- + arch/x86/xen/enlighten.c | 23 +++++++++++++++++++++++ + include/xen/interface/sched.h | 8 ++++++++ + 2 files changed, 31 insertions(+) + +--- a/arch/x86/xen/enlighten.c ++++ b/arch/x86/xen/enlighten.c +@@ -33,6 +33,10 @@ + #include + #include + ++#ifdef CONFIG_KEXEC_CORE ++#include ++#endif ++ + #include + #include + #include +@@ -1744,6 +1748,21 @@ static struct notifier_block xen_hvm_cpu + .notifier_call = xen_hvm_cpu_notify, + }; + ++#ifdef CONFIG_KEXEC_CORE ++static void xen_hvm_shutdown(void) ++{ ++ native_machine_shutdown(); ++ if (kexec_in_progress) ++ xen_reboot(SHUTDOWN_soft_reset); ++} ++ ++static void xen_hvm_crash_shutdown(struct pt_regs *regs) ++{ ++ native_machine_crash_shutdown(regs); ++ xen_reboot(SHUTDOWN_soft_reset); ++} ++#endif ++ + static void __init xen_hvm_guest_init(void) + { + init_hvm_pv_info(); +@@ -1758,6 +1777,10 @@ static void __init xen_hvm_guest_init(vo + x86_init.irqs.intr_init = xen_init_IRQ; + xen_hvm_init_time_ops(); + xen_hvm_init_mmu_ops(); ++#ifdef CONFIG_KEXEC_CORE ++ machine_ops.shutdown = xen_hvm_shutdown; ++ machine_ops.crash_shutdown = xen_hvm_crash_shutdown; ++#endif + } + + static bool __init xen_hvm_platform(void) +--- a/include/xen/interface/sched.h ++++ b/include/xen/interface/sched.h +@@ -107,5 +107,13 @@ struct sched_watchdog { + #define SHUTDOWN_suspend 2 /* Clean up, save suspend info, kill. */ + #define SHUTDOWN_crash 3 /* Tell controller we've crashed. */ + #define SHUTDOWN_watchdog 4 /* Restart because watchdog time expired. */ ++/* ++ * Domain asked to perform 'soft reset' for it. The expected behavior is to ++ * reset internal Xen state for the domain returning it to the point where it ++ * was created but leaving the domain's memory contents and vCPU contexts ++ * intact. This will allow the domain to start over and set up all Xen specific ++ * interfaces again. ++ */ ++#define SHUTDOWN_soft_reset 5 + + #endif /* __XEN_PUBLIC_SCHED_H__ */