Magellan Linux

Annotation of /trunk/kernel-alx/patches-4.9/0239-4.9.140-all-fixes.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3292 - (hide annotations) (download)
Tue Mar 12 10:43:03 2019 UTC (5 years, 3 months ago) by niro
File size: 5874 byte(s)
-linux-4.9.140
1 niro 3292 diff --git a/Makefile b/Makefile
2     index a6959d96316d..a9aed2326233 100644
3     --- a/Makefile
4     +++ b/Makefile
5     @@ -1,6 +1,6 @@
6     VERSION = 4
7     PATCHLEVEL = 9
8     -SUBLEVEL = 139
9     +SUBLEVEL = 140
10     EXTRAVERSION =
11     NAME = Roaring Lionus
12    
13     diff --git a/arch/x86/kernel/cpu/bugs.c b/arch/x86/kernel/cpu/bugs.c
14     index 647a702c29dc..6221166e3fca 100644
15     --- a/arch/x86/kernel/cpu/bugs.c
16     +++ b/arch/x86/kernel/cpu/bugs.c
17     @@ -33,10 +33,12 @@ static void __init spectre_v2_select_mitigation(void);
18     static void __init ssb_select_mitigation(void);
19     static void __init l1tf_select_mitigation(void);
20    
21     -/* The base value of the SPEC_CTRL MSR that always has to be preserved. */
22     -u64 x86_spec_ctrl_base;
23     +/*
24     + * Our boot-time value of the SPEC_CTRL MSR. We read it once so that any
25     + * writes to SPEC_CTRL contain whatever reserved bits have been set.
26     + */
27     +u64 __ro_after_init x86_spec_ctrl_base;
28     EXPORT_SYMBOL_GPL(x86_spec_ctrl_base);
29     -static DEFINE_MUTEX(spec_ctrl_mutex);
30    
31     /*
32     * The vendor and possibly platform specific bits which can be modified in
33     @@ -320,46 +322,6 @@ static enum spectre_v2_mitigation_cmd __init spectre_v2_parse_cmdline(void)
34     return cmd;
35     }
36    
37     -static bool stibp_needed(void)
38     -{
39     - if (spectre_v2_enabled == SPECTRE_V2_NONE)
40     - return false;
41     -
42     - if (!boot_cpu_has(X86_FEATURE_STIBP))
43     - return false;
44     -
45     - return true;
46     -}
47     -
48     -static void update_stibp_msr(void *info)
49     -{
50     - wrmsrl(MSR_IA32_SPEC_CTRL, x86_spec_ctrl_base);
51     -}
52     -
53     -void arch_smt_update(void)
54     -{
55     - u64 mask;
56     -
57     - if (!stibp_needed())
58     - return;
59     -
60     - mutex_lock(&spec_ctrl_mutex);
61     - mask = x86_spec_ctrl_base;
62     - if (cpu_smt_control == CPU_SMT_ENABLED)
63     - mask |= SPEC_CTRL_STIBP;
64     - else
65     - mask &= ~SPEC_CTRL_STIBP;
66     -
67     - if (mask != x86_spec_ctrl_base) {
68     - pr_info("Spectre v2 cross-process SMT mitigation: %s STIBP\n",
69     - cpu_smt_control == CPU_SMT_ENABLED ?
70     - "Enabling" : "Disabling");
71     - x86_spec_ctrl_base = mask;
72     - on_each_cpu(update_stibp_msr, NULL, 1);
73     - }
74     - mutex_unlock(&spec_ctrl_mutex);
75     -}
76     -
77     static void __init spectre_v2_select_mitigation(void)
78     {
79     enum spectre_v2_mitigation_cmd cmd = spectre_v2_parse_cmdline();
80     @@ -459,9 +421,6 @@ specv2_set_mode:
81     setup_force_cpu_cap(X86_FEATURE_USE_IBRS_FW);
82     pr_info("Enabling Restricted Speculation for firmware calls\n");
83     }
84     -
85     - /* Enable STIBP if appropriate */
86     - arch_smt_update();
87     }
88    
89     #undef pr_fmt
90     @@ -854,8 +813,6 @@ static ssize_t l1tf_show_state(char *buf)
91     static ssize_t cpu_show_common(struct device *dev, struct device_attribute *attr,
92     char *buf, unsigned int bug)
93     {
94     - int ret;
95     -
96     if (!boot_cpu_has_bug(bug))
97     return sprintf(buf, "Not affected\n");
98    
99     @@ -870,12 +827,10 @@ static ssize_t cpu_show_common(struct device *dev, struct device_attribute *attr
100     return sprintf(buf, "Mitigation: __user pointer sanitization\n");
101    
102     case X86_BUG_SPECTRE_V2:
103     - ret = sprintf(buf, "%s%s%s%s%s\n", spectre_v2_strings[spectre_v2_enabled],
104     + return sprintf(buf, "%s%s%s%s\n", spectre_v2_strings[spectre_v2_enabled],
105     boot_cpu_has(X86_FEATURE_USE_IBPB) ? ", IBPB" : "",
106     boot_cpu_has(X86_FEATURE_USE_IBRS_FW) ? ", IBRS_FW" : "",
107     - (x86_spec_ctrl_base & SPEC_CTRL_STIBP) ? ", STIBP" : "",
108     spectre_v2_module_string());
109     - return ret;
110    
111     case X86_BUG_SPEC_STORE_BYPASS:
112     return sprintf(buf, "%s\n", ssb_strings[ssb_mode]);
113     diff --git a/kernel/cpu.c b/kernel/cpu.c
114     index 8d7bace9a7b2..b5a0165b7300 100644
115     --- a/kernel/cpu.c
116     +++ b/kernel/cpu.c
117     @@ -1970,12 +1970,6 @@ static void cpuhp_online_cpu_device(unsigned int cpu)
118     kobject_uevent(&dev->kobj, KOBJ_ONLINE);
119     }
120    
121     -/*
122     - * Architectures that need SMT-specific errata handling during SMT hotplug
123     - * should override this.
124     - */
125     -void __weak arch_smt_update(void) { };
126     -
127     static int cpuhp_smt_disable(enum cpuhp_smt_control ctrlval)
128     {
129     int cpu, ret = 0;
130     @@ -2002,10 +1996,8 @@ static int cpuhp_smt_disable(enum cpuhp_smt_control ctrlval)
131     */
132     cpuhp_offline_cpu_device(cpu);
133     }
134     - if (!ret) {
135     + if (!ret)
136     cpu_smt_control = ctrlval;
137     - arch_smt_update();
138     - }
139     cpu_maps_update_done();
140     return ret;
141     }
142     @@ -2016,7 +2008,6 @@ static int cpuhp_smt_enable(void)
143    
144     cpu_maps_update_begin();
145     cpu_smt_control = CPU_SMT_ENABLED;
146     - arch_smt_update();
147     for_each_present_cpu(cpu) {
148     /* Skip online CPUs and CPUs on offline nodes */
149     if (cpu_online(cpu) || !node_online(cpu_to_node(cpu)))
150     diff --git a/net/ipv6/route.c b/net/ipv6/route.c
151     index 0db120d2a4fe..b0a72677b7e5 100644
152     --- a/net/ipv6/route.c
153     +++ b/net/ipv6/route.c
154     @@ -2292,7 +2292,6 @@ static void rt6_do_redirect(struct dst_entry *dst, struct sock *sk, struct sk_bu
155     if (on_link)
156     nrt->rt6i_flags &= ~RTF_GATEWAY;
157    
158     - nrt->rt6i_protocol = RTPROT_REDIRECT;
159     nrt->rt6i_gateway = *(struct in6_addr *)neigh->primary_key;
160    
161     if (ip6_ins_rt(nrt))
162     @@ -2397,7 +2396,6 @@ static struct rt6_info *rt6_add_route_info(struct net *net,
163     .fc_dst_len = prefixlen,
164     .fc_flags = RTF_GATEWAY | RTF_ADDRCONF | RTF_ROUTEINFO |
165     RTF_UP | RTF_PREF(pref),
166     - .fc_protocol = RTPROT_RA,
167     .fc_nlinfo.portid = 0,
168     .fc_nlinfo.nlh = NULL,
169     .fc_nlinfo.nl_net = net,
170     @@ -2450,7 +2448,6 @@ struct rt6_info *rt6_add_dflt_router(const struct in6_addr *gwaddr,
171     .fc_ifindex = dev->ifindex,
172     .fc_flags = RTF_GATEWAY | RTF_ADDRCONF | RTF_DEFAULT |
173     RTF_UP | RTF_EXPIRES | RTF_PREF(pref),
174     - .fc_protocol = RTPROT_RA,
175     .fc_nlinfo.portid = 0,
176     .fc_nlinfo.nlh = NULL,
177     .fc_nlinfo.nl_net = dev_net(dev),
178     @@ -3247,6 +3244,14 @@ static int rt6_fill_node(struct net *net,
179     }
180     rtm->rtm_scope = RT_SCOPE_UNIVERSE;
181     rtm->rtm_protocol = rt->rt6i_protocol;
182     + if (rt->rt6i_flags & RTF_DYNAMIC)
183     + rtm->rtm_protocol = RTPROT_REDIRECT;
184     + else if (rt->rt6i_flags & RTF_ADDRCONF) {
185     + if (rt->rt6i_flags & (RTF_DEFAULT | RTF_ROUTEINFO))
186     + rtm->rtm_protocol = RTPROT_RA;
187     + else
188     + rtm->rtm_protocol = RTPROT_KERNEL;
189     + }
190    
191     if (rt->rt6i_flags & RTF_CACHE)
192     rtm->rtm_flags |= RTM_F_CLONED;