commit:     b1527d2ab69f961e9d3ddd25f7374ddc16162bcd
Author:     Mike Pagano <mpagano <AT> gentoo <DOT> org>
AuthorDate: Fri Nov 23 12:47:52 2018 +0000
Commit:     Mike Pagano <mpagano <AT> gentoo <DOT> org>
CommitDate: Fri Nov 23 12:47:52 2018 +0000
URL:        https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=b1527d2a

proj/linux-patches: Linux patch 4.9.140

Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org>

 0000_README              |   4 +
 1139_linux-4.9.140.patch | 192 +++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 196 insertions(+)

diff --git a/0000_README b/0000_README
index 56d5a98..316dfbb 100644
--- a/0000_README
+++ b/0000_README
@@ -599,6 +599,10 @@ Patch:  1138_linux-4.9.139.patch
 From:   http://www.kernel.org
 Desc:   Linux 4.9.139
 
+Patch:  1139_linux-4.9.140.patch
+From:   http://www.kernel.org
+Desc:   Linux 4.9.140
+
 Patch:  1500_XATTR_USER_PREFIX.patch
 From:   https://bugs.gentoo.org/show_bug.cgi?id=470644
 Desc:   Support for namespace user.pax.* on tmpfs.

diff --git a/1139_linux-4.9.140.patch b/1139_linux-4.9.140.patch
new file mode 100644
index 0000000..623b8ab
--- /dev/null
+++ b/1139_linux-4.9.140.patch
@@ -0,0 +1,192 @@
+diff --git a/Makefile b/Makefile
+index a6959d96316d..a9aed2326233 100644
+--- a/Makefile
++++ b/Makefile
+@@ -1,6 +1,6 @@
+ VERSION = 4
+ PATCHLEVEL = 9
+-SUBLEVEL = 139
++SUBLEVEL = 140
+ EXTRAVERSION =
+ NAME = Roaring Lionus
+ 
+diff --git a/arch/x86/kernel/cpu/bugs.c b/arch/x86/kernel/cpu/bugs.c
+index 647a702c29dc..6221166e3fca 100644
+--- a/arch/x86/kernel/cpu/bugs.c
++++ b/arch/x86/kernel/cpu/bugs.c
+@@ -33,10 +33,12 @@ static void __init spectre_v2_select_mitigation(void);
+ static void __init ssb_select_mitigation(void);
+ static void __init l1tf_select_mitigation(void);
+ 
+-/* The base value of the SPEC_CTRL MSR that always has to be preserved. */
+-u64 x86_spec_ctrl_base;
++/*
++ * Our boot-time value of the SPEC_CTRL MSR. We read it once so that any
++ * writes to SPEC_CTRL contain whatever reserved bits have been set.
++ */
++u64 __ro_after_init x86_spec_ctrl_base;
+ EXPORT_SYMBOL_GPL(x86_spec_ctrl_base);
+-static DEFINE_MUTEX(spec_ctrl_mutex);
+ 
+ /*
+  * The vendor and possibly platform specific bits which can be modified in
+@@ -320,46 +322,6 @@ static enum spectre_v2_mitigation_cmd __init 
spectre_v2_parse_cmdline(void)
+       return cmd;
+ }
+ 
+-static bool stibp_needed(void)
+-{
+-      if (spectre_v2_enabled == SPECTRE_V2_NONE)
+-              return false;
+-
+-      if (!boot_cpu_has(X86_FEATURE_STIBP))
+-              return false;
+-
+-      return true;
+-}
+-
+-static void update_stibp_msr(void *info)
+-{
+-      wrmsrl(MSR_IA32_SPEC_CTRL, x86_spec_ctrl_base);
+-}
+-
+-void arch_smt_update(void)
+-{
+-      u64 mask;
+-
+-      if (!stibp_needed())
+-              return;
+-
+-      mutex_lock(&spec_ctrl_mutex);
+-      mask = x86_spec_ctrl_base;
+-      if (cpu_smt_control == CPU_SMT_ENABLED)
+-              mask |= SPEC_CTRL_STIBP;
+-      else
+-              mask &= ~SPEC_CTRL_STIBP;
+-
+-      if (mask != x86_spec_ctrl_base) {
+-              pr_info("Spectre v2 cross-process SMT mitigation: %s STIBP\n",
+-                              cpu_smt_control == CPU_SMT_ENABLED ?
+-                              "Enabling" : "Disabling");
+-              x86_spec_ctrl_base = mask;
+-              on_each_cpu(update_stibp_msr, NULL, 1);
+-      }
+-      mutex_unlock(&spec_ctrl_mutex);
+-}
+-
+ static void __init spectre_v2_select_mitigation(void)
+ {
+       enum spectre_v2_mitigation_cmd cmd = spectre_v2_parse_cmdline();
+@@ -459,9 +421,6 @@ specv2_set_mode:
+               setup_force_cpu_cap(X86_FEATURE_USE_IBRS_FW);
+               pr_info("Enabling Restricted Speculation for firmware calls\n");
+       }
+-
+-      /* Enable STIBP if appropriate */
+-      arch_smt_update();
+ }
+ 
+ #undef pr_fmt
+@@ -854,8 +813,6 @@ static ssize_t l1tf_show_state(char *buf)
+ static ssize_t cpu_show_common(struct device *dev, struct device_attribute 
*attr,
+                              char *buf, unsigned int bug)
+ {
+-      int ret;
+-
+       if (!boot_cpu_has_bug(bug))
+               return sprintf(buf, "Not affected\n");
+ 
+@@ -870,12 +827,10 @@ static ssize_t cpu_show_common(struct device *dev, 
struct device_attribute *attr
+               return sprintf(buf, "Mitigation: __user pointer 
sanitization\n");
+ 
+       case X86_BUG_SPECTRE_V2:
+-              ret = sprintf(buf, "%s%s%s%s%s\n", 
spectre_v2_strings[spectre_v2_enabled],
++              return sprintf(buf, "%s%s%s%s\n", 
spectre_v2_strings[spectre_v2_enabled],
+                              boot_cpu_has(X86_FEATURE_USE_IBPB) ? ", IBPB" : 
"",
+                              boot_cpu_has(X86_FEATURE_USE_IBRS_FW) ? ", 
IBRS_FW" : "",
+-                             (x86_spec_ctrl_base & SPEC_CTRL_STIBP) ? ", 
STIBP" : "",
+                              spectre_v2_module_string());
+-              return ret;
+ 
+       case X86_BUG_SPEC_STORE_BYPASS:
+               return sprintf(buf, "%s\n", ssb_strings[ssb_mode]);
+diff --git a/kernel/cpu.c b/kernel/cpu.c
+index 8d7bace9a7b2..b5a0165b7300 100644
+--- a/kernel/cpu.c
++++ b/kernel/cpu.c
+@@ -1970,12 +1970,6 @@ static void cpuhp_online_cpu_device(unsigned int cpu)
+       kobject_uevent(&dev->kobj, KOBJ_ONLINE);
+ }
+ 
+-/*
+- * Architectures that need SMT-specific errata handling during SMT hotplug
+- * should override this.
+- */
+-void __weak arch_smt_update(void) { };
+-
+ static int cpuhp_smt_disable(enum cpuhp_smt_control ctrlval)
+ {
+       int cpu, ret = 0;
+@@ -2002,10 +1996,8 @@ static int cpuhp_smt_disable(enum cpuhp_smt_control 
ctrlval)
+                */
+               cpuhp_offline_cpu_device(cpu);
+       }
+-      if (!ret) {
++      if (!ret)
+               cpu_smt_control = ctrlval;
+-              arch_smt_update();
+-      }
+       cpu_maps_update_done();
+       return ret;
+ }
+@@ -2016,7 +2008,6 @@ static int cpuhp_smt_enable(void)
+ 
+       cpu_maps_update_begin();
+       cpu_smt_control = CPU_SMT_ENABLED;
+-      arch_smt_update();
+       for_each_present_cpu(cpu) {
+               /* Skip online CPUs and CPUs on offline nodes */
+               if (cpu_online(cpu) || !node_online(cpu_to_node(cpu)))
+diff --git a/net/ipv6/route.c b/net/ipv6/route.c
+index 0db120d2a4fe..b0a72677b7e5 100644
+--- a/net/ipv6/route.c
++++ b/net/ipv6/route.c
+@@ -2292,7 +2292,6 @@ static void rt6_do_redirect(struct dst_entry *dst, 
struct sock *sk, struct sk_bu
+       if (on_link)
+               nrt->rt6i_flags &= ~RTF_GATEWAY;
+ 
+-      nrt->rt6i_protocol = RTPROT_REDIRECT;
+       nrt->rt6i_gateway = *(struct in6_addr *)neigh->primary_key;
+ 
+       if (ip6_ins_rt(nrt))
+@@ -2397,7 +2396,6 @@ static struct rt6_info *rt6_add_route_info(struct net 
*net,
+               .fc_dst_len     = prefixlen,
+               .fc_flags       = RTF_GATEWAY | RTF_ADDRCONF | RTF_ROUTEINFO |
+                                 RTF_UP | RTF_PREF(pref),
+-              .fc_protocol = RTPROT_RA,
+               .fc_nlinfo.portid = 0,
+               .fc_nlinfo.nlh = NULL,
+               .fc_nlinfo.nl_net = net,
+@@ -2450,7 +2448,6 @@ struct rt6_info *rt6_add_dflt_router(const struct 
in6_addr *gwaddr,
+               .fc_ifindex     = dev->ifindex,
+               .fc_flags       = RTF_GATEWAY | RTF_ADDRCONF | RTF_DEFAULT |
+                                 RTF_UP | RTF_EXPIRES | RTF_PREF(pref),
+-              .fc_protocol = RTPROT_RA,
+               .fc_nlinfo.portid = 0,
+               .fc_nlinfo.nlh = NULL,
+               .fc_nlinfo.nl_net = dev_net(dev),
+@@ -3247,6 +3244,14 @@ static int rt6_fill_node(struct net *net,
+       }
+       rtm->rtm_scope = RT_SCOPE_UNIVERSE;
+       rtm->rtm_protocol = rt->rt6i_protocol;
++      if (rt->rt6i_flags & RTF_DYNAMIC)
++              rtm->rtm_protocol = RTPROT_REDIRECT;
++      else if (rt->rt6i_flags & RTF_ADDRCONF) {
++              if (rt->rt6i_flags & (RTF_DEFAULT | RTF_ROUTEINFO))
++                      rtm->rtm_protocol = RTPROT_RA;
++              else
++                      rtm->rtm_protocol = RTPROT_KERNEL;
++      }
+ 
+       if (rt->rt6i_flags & RTF_CACHE)
+               rtm->rtm_flags |= RTM_F_CLONED;

Reply via email to