]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
4.4-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 15 Jan 2018 13:34:45 +0000 (14:34 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 15 Jan 2018 13:34:45 +0000 (14:34 +0100)
added patches:
x86-cpu-factor-out-application-of-forced-cpu-caps.patch
x86-cpu-merge-bugs.c-and-bugs_64.c.patch
x86-cpufeatures-add-x86_bug_cpu_insecure.patch
x86-cpufeatures-add-x86_bug_spectre_v.patch
x86-cpufeatures-make-cpu-bugs-sticky.patch
x86-pti-rename-bug_cpu_insecure-to-bug_cpu_meltdown.patch

queue-4.4/series
queue-4.4/x86-cpu-factor-out-application-of-forced-cpu-caps.patch [new file with mode: 0644]
queue-4.4/x86-cpu-implement-cpu-vulnerabilites-sysfs-functions.patch
queue-4.4/x86-cpu-merge-bugs.c-and-bugs_64.c.patch [new file with mode: 0644]
queue-4.4/x86-cpufeatures-add-x86_bug_cpu_insecure.patch [new file with mode: 0644]
queue-4.4/x86-cpufeatures-add-x86_bug_spectre_v.patch [new file with mode: 0644]
queue-4.4/x86-cpufeatures-make-cpu-bugs-sticky.patch [new file with mode: 0644]
queue-4.4/x86-pti-rename-bug_cpu_insecure-to-bug_cpu_meltdown.patch [new file with mode: 0644]

index 1d0899d3451a0d6a4bd3b9b8f732c2e65bc031e8..08713270540204e471dab27ea7d743ce5d8660a6 100644 (file)
@@ -79,6 +79,12 @@ bluetooth-prevent-stack-info-leak-from-the-efs-element.patch
 uas-ignore-uas-for-norelsys-ns1068-x-chips.patch
 e1000e-fix-e1000_check_for_copper_link_ich8lan-return-value.patch
 x86-documentation-add-pti-description.patch
+x86-cpu-factor-out-application-of-forced-cpu-caps.patch
+x86-cpufeatures-make-cpu-bugs-sticky.patch
+x86-cpufeatures-add-x86_bug_cpu_insecure.patch
+x86-pti-rename-bug_cpu_insecure-to-bug_cpu_meltdown.patch
+x86-cpufeatures-add-x86_bug_spectre_v.patch
+x86-cpu-merge-bugs.c-and-bugs_64.c.patch
 sysfs-cpu-add-vulnerability-folder.patch
 x86-cpu-implement-cpu-vulnerabilites-sysfs-functions.patch
 sysfs-cpu-fix-typos-in-vulnerability-documentation.patch
diff --git a/queue-4.4/x86-cpu-factor-out-application-of-forced-cpu-caps.patch b/queue-4.4/x86-cpu-factor-out-application-of-forced-cpu-caps.patch
new file mode 100644 (file)
index 0000000..96e2807
--- /dev/null
@@ -0,0 +1,81 @@
+From 8bf1ebca215c262e48c15a4a15f175991776f57f Mon Sep 17 00:00:00 2001
+From: Andy Lutomirski <luto@kernel.org>
+Date: Wed, 18 Jan 2017 11:15:38 -0800
+Subject: x86/cpu: Factor out application of forced CPU caps
+
+From: Andy Lutomirski <luto@kernel.org>
+
+commit 8bf1ebca215c262e48c15a4a15f175991776f57f upstream.
+
+There are multiple call sites that apply forced CPU caps.  Factor
+them into a helper.
+
+Signed-off-by: Andy Lutomirski <luto@kernel.org>
+Reviewed-by: Borislav Petkov <bp@suse.de>
+Cc: Borislav Petkov <bp@alien8.de>
+Cc: Brian Gerst <brgerst@gmail.com>
+Cc: Dave Hansen <dave.hansen@linux.intel.com>
+Cc: Fenghua Yu <fenghua.yu@intel.com>
+Cc: H. Peter Anvin <hpa@zytor.com>
+Cc: Linus Torvalds <torvalds@linux-foundation.org>
+Cc: Matthew Whitehead <tedheadster@gmail.com>
+Cc: Oleg Nesterov <oleg@redhat.com>
+Cc: One Thousand Gnomes <gnomes@lxorguk.ukuu.org.uk>
+Cc: Peter Zijlstra <peterz@infradead.org>
+Cc: Rik van Riel <riel@redhat.com>
+Cc: Thomas Gleixner <tglx@linutronix.de>
+Cc: Yu-cheng Yu <yu-cheng.yu@intel.com>
+Link: http://lkml.kernel.org/r/623ff7555488122143e4417de09b18be2085ad06.1484705016.git.luto@kernel.org
+Signed-off-by: Ingo Molnar <mingo@kernel.org>
+Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/x86/kernel/cpu/common.c |   22 +++++++++++++---------
+ 1 file changed, 13 insertions(+), 9 deletions(-)
+
+--- a/arch/x86/kernel/cpu/common.c
++++ b/arch/x86/kernel/cpu/common.c
+@@ -664,6 +664,16 @@ void cpu_detect(struct cpuinfo_x86 *c)
+       }
+ }
++static void apply_forced_caps(struct cpuinfo_x86 *c)
++{
++      int i;
++
++      for (i = 0; i < NCAPINTS; i++) {
++              c->x86_capability[i] &= ~cpu_caps_cleared[i];
++              c->x86_capability[i] |= cpu_caps_set[i];
++      }
++}
++
+ void get_cpu_cap(struct cpuinfo_x86 *c)
+ {
+       u32 tfms, xlvl;
+@@ -955,11 +965,8 @@ static void identify_cpu(struct cpuinfo_
+       if (this_cpu->c_identify)
+               this_cpu->c_identify(c);
+-      /* Clear/Set all flags overriden by options, after probe */
+-      for (i = 0; i < NCAPINTS; i++) {
+-              c->x86_capability[i] &= ~cpu_caps_cleared[i];
+-              c->x86_capability[i] |= cpu_caps_set[i];
+-      }
++      /* Clear/Set all flags overridden by options, after probe */
++      apply_forced_caps(c);
+ #ifdef CONFIG_X86_64
+       c->apicid = apic->phys_pkg_id(c->initial_apicid, 0);
+@@ -1020,10 +1027,7 @@ static void identify_cpu(struct cpuinfo_
+        * Clear/Set all flags overriden by options, need do it
+        * before following smp all cpus cap AND.
+        */
+-      for (i = 0; i < NCAPINTS; i++) {
+-              c->x86_capability[i] &= ~cpu_caps_cleared[i];
+-              c->x86_capability[i] |= cpu_caps_set[i];
+-      }
++      apply_forced_caps(c);
+       /*
+        * On SMP, boot_cpu_data holds the common feature set between
index 2d788e03c2aae8e4f1a67e22ef161db3d3050d14..253346b59436b77dd332bdab439e0531f850b18f 100644 (file)
@@ -47,9 +47,9 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  #include <asm/bugs.h>
  #include <asm/processor.h>
  #include <asm/processor-flags.h>
-@@ -49,3 +50,31 @@ void __init check_bugs(void)
-       fpu__init_check_bugs();
+@@ -67,3 +68,31 @@ void __init check_bugs(void)
+               set_memory_4k((unsigned long)__va(0), 1);
+ #endif
  }
 +
 +#ifdef CONFIG_SYSFS
@@ -58,7 +58,7 @@ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
 +{
 +      if (!boot_cpu_has_bug(X86_BUG_CPU_MELTDOWN))
 +              return sprintf(buf, "Not affected\n");
-+      if (boot_cpu_has(X86_FEATURE_PTI))
++      if (boot_cpu_has(X86_FEATURE_KAISER))
 +              return sprintf(buf, "Mitigation: PTI\n");
 +      return sprintf(buf, "Vulnerable\n");
 +}
diff --git a/queue-4.4/x86-cpu-merge-bugs.c-and-bugs_64.c.patch b/queue-4.4/x86-cpu-merge-bugs.c-and-bugs_64.c.patch
new file mode 100644 (file)
index 0000000..16f8eae
--- /dev/null
@@ -0,0 +1,136 @@
+From 62a67e123e058a67db58bc6a14354dd037bafd0a Mon Sep 17 00:00:00 2001
+From: Borislav Petkov <bp@suse.de>
+Date: Mon, 24 Oct 2016 19:38:43 +0200
+Subject: x86/cpu: Merge bugs.c and bugs_64.c
+
+From: Borislav Petkov <bp@suse.de>
+
+commit 62a67e123e058a67db58bc6a14354dd037bafd0a upstream.
+
+Should be easier when following boot paths. It probably is a left over
+from the x86 unification eons ago.
+
+No functionality change.
+
+Signed-off-by: Borislav Petkov <bp@suse.de>
+Cc: Andy Lutomirski <luto@kernel.org>
+Cc: Borislav Petkov <bp@alien8.de>
+Cc: Brian Gerst <brgerst@gmail.com>
+Cc: Denys Vlasenko <dvlasenk@redhat.com>
+Cc: H. Peter Anvin <hpa@zytor.com>
+Cc: Josh Poimboeuf <jpoimboe@redhat.com>
+Cc: Linus Torvalds <torvalds@linux-foundation.org>
+Cc: Peter Zijlstra <peterz@infradead.org>
+Cc: Thomas Gleixner <tglx@linutronix.de>
+Link: http://lkml.kernel.org/r/20161024173844.23038-3-bp@alien8.de
+Signed-off-by: Ingo Molnar <mingo@kernel.org>
+Signed-off-by: Razvan Ghitulete <rga@amazon.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ arch/x86/kernel/cpu/Makefile  |    4 +---
+ arch/x86/kernel/cpu/bugs.c    |   26 ++++++++++++++++++++++----
+ arch/x86/kernel/cpu/bugs_64.c |   33 ---------------------------------
+ 3 files changed, 23 insertions(+), 40 deletions(-)
+ delete mode 100644 arch/x86/kernel/cpu/bugs_64.c
+
+--- a/arch/x86/kernel/cpu/Makefile
++++ b/arch/x86/kernel/cpu/Makefile
+@@ -16,13 +16,11 @@ obj-y                      := intel_cacheinfo.o scattered.o
+ obj-y                 += common.o
+ obj-y                 += rdrand.o
+ obj-y                 += match.o
++obj-y                 += bugs.o
+ obj-$(CONFIG_PROC_FS) += proc.o
+ obj-$(CONFIG_X86_FEATURE_NAMES) += capflags.o powerflags.o
+-obj-$(CONFIG_X86_32)  += bugs.o
+-obj-$(CONFIG_X86_64)  += bugs_64.o
+-
+ obj-$(CONFIG_CPU_SUP_INTEL)           += intel.o
+ obj-$(CONFIG_CPU_SUP_AMD)             += amd.o
+ obj-$(CONFIG_CPU_SUP_CYRIX_32)                += cyrix.o
+--- a/arch/x86/kernel/cpu/bugs.c
++++ b/arch/x86/kernel/cpu/bugs.c
+@@ -16,6 +16,8 @@
+ #include <asm/msr.h>
+ #include <asm/paravirt.h>
+ #include <asm/alternative.h>
++#include <asm/pgtable.h>
++#include <asm/cacheflush.h>
+ void __init check_bugs(void)
+ {
+@@ -28,11 +30,13 @@ void __init check_bugs(void)
+ #endif
+       identify_boot_cpu();
+-#ifndef CONFIG_SMP
+-      pr_info("CPU: ");
+-      print_cpu_info(&boot_cpu_data);
+-#endif
++      if (!IS_ENABLED(CONFIG_SMP)) {
++              pr_info("CPU: ");
++              print_cpu_info(&boot_cpu_data);
++      }
++
++#ifdef CONFIG_X86_32
+       /*
+        * Check whether we are able to run this kernel safely on SMP.
+        *
+@@ -48,4 +52,18 @@ void __init check_bugs(void)
+       alternative_instructions();
+       fpu__init_check_bugs();
++#else /* CONFIG_X86_64 */
++      alternative_instructions();
++
++      /*
++       * Make sure the first 2MB area is not mapped by huge pages
++       * There are typically fixed size MTRRs in there and overlapping
++       * MTRRs into large pages causes slow downs.
++       *
++       * Right now we don't do that with gbpages because there seems
++       * very little benefit for that case.
++       */
++      if (!direct_gbpages)
++              set_memory_4k((unsigned long)__va(0), 1);
++#endif
+ }
+--- a/arch/x86/kernel/cpu/bugs_64.c
++++ /dev/null
+@@ -1,33 +0,0 @@
+-/*
+- *  Copyright (C) 1994  Linus Torvalds
+- *  Copyright (C) 2000  SuSE
+- */
+-
+-#include <linux/kernel.h>
+-#include <linux/init.h>
+-#include <asm/alternative.h>
+-#include <asm/bugs.h>
+-#include <asm/processor.h>
+-#include <asm/mtrr.h>
+-#include <asm/cacheflush.h>
+-
+-void __init check_bugs(void)
+-{
+-      identify_boot_cpu();
+-#if !defined(CONFIG_SMP)
+-      printk(KERN_INFO "CPU: ");
+-      print_cpu_info(&boot_cpu_data);
+-#endif
+-      alternative_instructions();
+-
+-      /*
+-       * Make sure the first 2MB area is not mapped by huge pages
+-       * There are typically fixed size MTRRs in there and overlapping
+-       * MTRRs into large pages causes slow downs.
+-       *
+-       * Right now we don't do that with gbpages because there seems
+-       * very little benefit for that case.
+-       */
+-      if (!direct_gbpages)
+-              set_memory_4k((unsigned long)__va(0), 1);
+-}
diff --git a/queue-4.4/x86-cpufeatures-add-x86_bug_cpu_insecure.patch b/queue-4.4/x86-cpufeatures-add-x86_bug_cpu_insecure.patch
new file mode 100644 (file)
index 0000000..c34088f
--- /dev/null
@@ -0,0 +1,74 @@
+From a89f040fa34ec9cd682aed98b8f04e3c47d998bd Mon Sep 17 00:00:00 2001
+From: Thomas Gleixner <tglx@linutronix.de>
+Date: Mon, 4 Dec 2017 15:07:33 +0100
+Subject: x86/cpufeatures: Add X86_BUG_CPU_INSECURE
+
+From: Thomas Gleixner <tglx@linutronix.de>
+
+commit a89f040fa34ec9cd682aed98b8f04e3c47d998bd upstream.
+
+Many x86 CPUs leak information to user space due to missing isolation of
+user space and kernel space page tables. There are many well documented
+ways to exploit that.
+
+The upcoming software migitation of isolating the user and kernel space
+page tables needs a misfeature flag so code can be made runtime
+conditional.
+
+Add the BUG bits which indicates that the CPU is affected and add a feature
+bit which indicates that the software migitation is enabled.
+
+Assume for now that _ALL_ x86 CPUs are affected by this. Exceptions can be
+made later.
+
+Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
+Cc: Andy Lutomirski <luto@kernel.org>
+Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
+Cc: Borislav Petkov <bp@alien8.de>
+Cc: Brian Gerst <brgerst@gmail.com>
+Cc: Dave Hansen <dave.hansen@linux.intel.com>
+Cc: David Laight <David.Laight@aculab.com>
+Cc: Denys Vlasenko <dvlasenk@redhat.com>
+Cc: Eduardo Valentin <eduval@amazon.com>
+Cc: Greg KH <gregkh@linuxfoundation.org>
+Cc: H. Peter Anvin <hpa@zytor.com>
+Cc: Josh Poimboeuf <jpoimboe@redhat.com>
+Cc: Juergen Gross <jgross@suse.com>
+Cc: Linus Torvalds <torvalds@linux-foundation.org>
+Cc: Peter Zijlstra <peterz@infradead.org>
+Cc: Will Deacon <will.deacon@arm.com>
+Cc: aliguori@amazon.com
+Cc: daniel.gruss@iaik.tugraz.at
+Cc: hughd@google.com
+Cc: keescook@google.com
+Signed-off-by: Ingo Molnar <mingo@kernel.org>
+Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ arch/x86/include/asm/cpufeature.h |    1 +
+ arch/x86/kernel/cpu/common.c      |    4 ++++
+ 2 files changed, 5 insertions(+)
+
+--- a/arch/x86/include/asm/cpufeature.h
++++ b/arch/x86/include/asm/cpufeature.h
+@@ -277,6 +277,7 @@
+ #define X86_BUG_FXSAVE_LEAK   X86_BUG(6) /* FXSAVE leaks FOP/FIP/FOP */
+ #define X86_BUG_CLFLUSH_MONITOR       X86_BUG(7) /* AAI65, CLFLUSH required before MONITOR */
+ #define X86_BUG_SYSRET_SS_ATTRS       X86_BUG(8) /* SYSRET doesn't fix up SS attrs */
++#define X86_BUG_CPU_INSECURE  X86_BUG(14) /* CPU is insecure and needs kernel page table isolation */
+ #if defined(__KERNEL__) && !defined(__ASSEMBLY__)
+--- a/arch/x86/kernel/cpu/common.c
++++ b/arch/x86/kernel/cpu/common.c
+@@ -830,6 +830,10 @@ static void __init early_identify_cpu(st
+       }
+       setup_force_cpu_cap(X86_FEATURE_ALWAYS);
++
++      /* Assume for now that ALL x86 CPUs are insecure */
++      setup_force_cpu_bug(X86_BUG_CPU_INSECURE);
++
+       fpu__init_system(c);
+ }
diff --git a/queue-4.4/x86-cpufeatures-add-x86_bug_spectre_v.patch b/queue-4.4/x86-cpufeatures-add-x86_bug_spectre_v.patch
new file mode 100644 (file)
index 0000000..84486e4
--- /dev/null
@@ -0,0 +1,59 @@
+From 99c6fa2511d8a683e61468be91b83f85452115fa Mon Sep 17 00:00:00 2001
+From: David Woodhouse <dwmw@amazon.co.uk>
+Date: Sat, 6 Jan 2018 11:49:23 +0000
+Subject: x86/cpufeatures: Add X86_BUG_SPECTRE_V[12]
+
+From: David Woodhouse <dwmw@amazon.co.uk>
+
+commit 99c6fa2511d8a683e61468be91b83f85452115fa upstream.
+
+Add the bug bits for spectre v1/2 and force them unconditionally for all
+cpus.
+
+Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
+Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
+Cc: gnomes@lxorguk.ukuu.org.uk
+Cc: Rik van Riel <riel@redhat.com>
+Cc: Andi Kleen <ak@linux.intel.com>
+Cc: Peter Zijlstra <peterz@infradead.org>
+Cc: Linus Torvalds <torvalds@linux-foundation.org>
+Cc: Jiri Kosina <jikos@kernel.org>
+Cc: Andy Lutomirski <luto@amacapital.net>
+Cc: Dave Hansen <dave.hansen@intel.com>
+Cc: Kees Cook <keescook@google.com>
+Cc: Tim Chen <tim.c.chen@linux.intel.com>
+Cc: Greg Kroah-Hartman <gregkh@linux-foundation.org>
+Cc: Paul Turner <pjt@google.com>
+Cc: stable@vger.kernel.org
+Link: https://lkml.kernel.org/r/1515239374-23361-2-git-send-email-dwmw@amazon.co.uk
+Signed-off-by: Razvan Ghitulete <rga@amazon.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/x86/include/asm/cpufeature.h |    2 ++
+ arch/x86/kernel/cpu/common.c      |    3 +++
+ 2 files changed, 5 insertions(+)
+
+--- a/arch/x86/include/asm/cpufeature.h
++++ b/arch/x86/include/asm/cpufeature.h
+@@ -278,6 +278,8 @@
+ #define X86_BUG_CLFLUSH_MONITOR       X86_BUG(7) /* AAI65, CLFLUSH required before MONITOR */
+ #define X86_BUG_SYSRET_SS_ATTRS       X86_BUG(8) /* SYSRET doesn't fix up SS attrs */
+ #define X86_BUG_CPU_MELTDOWN  X86_BUG(14) /* CPU is affected by meltdown attack and needs kernel page table isolation */
++#define X86_BUG_SPECTRE_V1    X86_BUG(15) /* CPU is affected by Spectre variant 1 attack with conditional branches */
++#define X86_BUG_SPECTRE_V2    X86_BUG(16) /* CPU is affected by Spectre variant 2 attack with indirect branches */
+ #if defined(__KERNEL__) && !defined(__ASSEMBLY__)
+--- a/arch/x86/kernel/cpu/common.c
++++ b/arch/x86/kernel/cpu/common.c
+@@ -834,6 +834,9 @@ static void __init early_identify_cpu(st
+       /* Assume for now that ALL x86 CPUs are insecure */
+       setup_force_cpu_bug(X86_BUG_CPU_MELTDOWN);
++      setup_force_cpu_bug(X86_BUG_SPECTRE_V1);
++      setup_force_cpu_bug(X86_BUG_SPECTRE_V2);
++
+       fpu__init_system(c);
+ }
diff --git a/queue-4.4/x86-cpufeatures-make-cpu-bugs-sticky.patch b/queue-4.4/x86-cpufeatures-make-cpu-bugs-sticky.patch
new file mode 100644 (file)
index 0000000..633660d
--- /dev/null
@@ -0,0 +1,96 @@
+From 6cbd2171e89b13377261d15e64384df60ecb530e Mon Sep 17 00:00:00 2001
+From: Thomas Gleixner <tglx@linutronix.de>
+Date: Mon, 4 Dec 2017 15:07:32 +0100
+Subject: x86/cpufeatures: Make CPU bugs sticky
+
+From: Thomas Gleixner <tglx@linutronix.de>
+
+commit 6cbd2171e89b13377261d15e64384df60ecb530e upstream.
+
+There is currently no way to force CPU bug bits like CPU feature bits. That
+makes it impossible to set a bug bit once at boot and have it stick for all
+upcoming CPUs.
+
+Extend the force set/clear arrays to handle bug bits as well.
+
+Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
+Reviewed-by: Borislav Petkov <bp@suse.de>
+Cc: Andy Lutomirski <luto@kernel.org>
+Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
+Cc: Borislav Petkov <bp@alien8.de>
+Cc: Borislav Petkov <bpetkov@suse.de>
+Cc: Brian Gerst <brgerst@gmail.com>
+Cc: Dave Hansen <dave.hansen@intel.com>
+Cc: Dave Hansen <dave.hansen@linux.intel.com>
+Cc: David Laight <David.Laight@aculab.com>
+Cc: Denys Vlasenko <dvlasenk@redhat.com>
+Cc: Eduardo Valentin <eduval@amazon.com>
+Cc: Greg KH <gregkh@linuxfoundation.org>
+Cc: H. Peter Anvin <hpa@zytor.com>
+Cc: Josh Poimboeuf <jpoimboe@redhat.com>
+Cc: Juergen Gross <jgross@suse.com>
+Cc: Linus Torvalds <torvalds@linux-foundation.org>
+Cc: Peter Zijlstra <peterz@infradead.org>
+Cc: Rik van Riel <riel@redhat.com>
+Cc: Will Deacon <will.deacon@arm.com>
+Cc: aliguori@amazon.com
+Cc: daniel.gruss@iaik.tugraz.at
+Cc: hughd@google.com
+Cc: keescook@google.com
+Link: https://lkml.kernel.org/r/20171204150606.992156574@linutronix.de
+Signed-off-by: Ingo Molnar <mingo@kernel.org>
+Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/x86/include/asm/cpufeature.h |    2 ++
+ arch/x86/include/asm/processor.h  |    4 ++--
+ arch/x86/kernel/cpu/common.c      |    6 +++---
+ 3 files changed, 7 insertions(+), 5 deletions(-)
+
+--- a/arch/x86/include/asm/cpufeature.h
++++ b/arch/x86/include/asm/cpufeature.h
+@@ -359,6 +359,8 @@ extern const char * const x86_bug_flags[
+       set_bit(bit, (unsigned long *)cpu_caps_set);    \
+ } while (0)
++#define setup_force_cpu_bug(bit) setup_force_cpu_cap(bit)
++
+ #define cpu_has_fpu           boot_cpu_has(X86_FEATURE_FPU)
+ #define cpu_has_de            boot_cpu_has(X86_FEATURE_DE)
+ #define cpu_has_pse           boot_cpu_has(X86_FEATURE_PSE)
+--- a/arch/x86/include/asm/processor.h
++++ b/arch/x86/include/asm/processor.h
+@@ -156,8 +156,8 @@ extern struct cpuinfo_x86  boot_cpu_data;
+ extern struct cpuinfo_x86     new_cpu_data;
+ extern struct tss_struct      doublefault_tss;
+-extern __u32                  cpu_caps_cleared[NCAPINTS];
+-extern __u32                  cpu_caps_set[NCAPINTS];
++extern __u32                  cpu_caps_cleared[NCAPINTS + NBUGINTS];
++extern __u32                  cpu_caps_set[NCAPINTS + NBUGINTS];
+ #ifdef CONFIG_SMP
+ DECLARE_PER_CPU_READ_MOSTLY(struct cpuinfo_x86, cpu_info);
+--- a/arch/x86/kernel/cpu/common.c
++++ b/arch/x86/kernel/cpu/common.c
+@@ -432,8 +432,8 @@ static const char *table_lookup_model(st
+       return NULL;            /* Not found */
+ }
+-__u32 cpu_caps_cleared[NCAPINTS];
+-__u32 cpu_caps_set[NCAPINTS];
++__u32 cpu_caps_cleared[NCAPINTS + NBUGINTS];
++__u32 cpu_caps_set[NCAPINTS + NBUGINTS];
+ void load_percpu_segment(int cpu)
+ {
+@@ -668,7 +668,7 @@ static void apply_forced_caps(struct cpu
+ {
+       int i;
+-      for (i = 0; i < NCAPINTS; i++) {
++      for (i = 0; i < NCAPINTS + NBUGINTS; i++) {
+               c->x86_capability[i] &= ~cpu_caps_cleared[i];
+               c->x86_capability[i] |= cpu_caps_set[i];
+       }
diff --git a/queue-4.4/x86-pti-rename-bug_cpu_insecure-to-bug_cpu_meltdown.patch b/queue-4.4/x86-pti-rename-bug_cpu_insecure-to-bug_cpu_meltdown.patch
new file mode 100644 (file)
index 0000000..6895a01
--- /dev/null
@@ -0,0 +1,57 @@
+From de791821c295cc61419a06fe5562288417d1bc58 Mon Sep 17 00:00:00 2001
+From: Thomas Gleixner <tglx@linutronix.de>
+Date: Fri, 5 Jan 2018 15:27:34 +0100
+Subject: x86/pti: Rename BUG_CPU_INSECURE to BUG_CPU_MELTDOWN
+
+From: Thomas Gleixner <tglx@linutronix.de>
+
+commit de791821c295cc61419a06fe5562288417d1bc58 upstream.
+
+Use the name associated with the particular attack which needs page table
+isolation for mitigation.
+
+Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
+Acked-by: David Woodhouse <dwmw@amazon.co.uk>
+Cc: Alan Cox <gnomes@lxorguk.ukuu.org.uk>
+Cc: Jiri Koshina <jikos@kernel.org>
+Cc: Linus Torvalds <torvalds@linux-foundation.org>
+Cc: Tim Chen <tim.c.chen@linux.intel.com>
+Cc: Andi Lutomirski  <luto@amacapital.net>
+Cc: Andi Kleen <ak@linux.intel.com>
+Cc: Peter Zijlstra <peterz@infradead.org>
+Cc: Paul Turner <pjt@google.com>
+Cc: Tom Lendacky <thomas.lendacky@amd.com>
+Cc: Greg KH <gregkh@linux-foundation.org>
+Cc: Dave Hansen <dave.hansen@intel.com>
+Cc: Kees Cook <keescook@google.com>
+Cc: stable@vger.kernel.org
+Link: https://lkml.kernel.org/r/alpine.DEB.2.20.1801051525300.1724@nanos
+Signed-off-by: Razvan Ghitulete <rga@amazon.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ arch/x86/include/asm/cpufeature.h |    2 +-
+ arch/x86/kernel/cpu/common.c      |    2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+--- a/arch/x86/include/asm/cpufeature.h
++++ b/arch/x86/include/asm/cpufeature.h
+@@ -277,7 +277,7 @@
+ #define X86_BUG_FXSAVE_LEAK   X86_BUG(6) /* FXSAVE leaks FOP/FIP/FOP */
+ #define X86_BUG_CLFLUSH_MONITOR       X86_BUG(7) /* AAI65, CLFLUSH required before MONITOR */
+ #define X86_BUG_SYSRET_SS_ATTRS       X86_BUG(8) /* SYSRET doesn't fix up SS attrs */
+-#define X86_BUG_CPU_INSECURE  X86_BUG(14) /* CPU is insecure and needs kernel page table isolation */
++#define X86_BUG_CPU_MELTDOWN  X86_BUG(14) /* CPU is affected by meltdown attack and needs kernel page table isolation */
+ #if defined(__KERNEL__) && !defined(__ASSEMBLY__)
+--- a/arch/x86/kernel/cpu/common.c
++++ b/arch/x86/kernel/cpu/common.c
+@@ -832,7 +832,7 @@ static void __init early_identify_cpu(st
+       setup_force_cpu_cap(X86_FEATURE_ALWAYS);
+       /* Assume for now that ALL x86 CPUs are insecure */
+-      setup_force_cpu_bug(X86_BUG_CPU_INSECURE);
++      setup_force_cpu_bug(X86_BUG_CPU_MELTDOWN);
+       fpu__init_system(c);
+ }