Gentoo Archives: gentoo-commits

From: "Anthony G. Basile" <blueness@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/hardened-patchset:master commit in: 3.2.66/, 3.18.5/, 3.14.31/
Date: Fri, 06 Feb 2015 19:09:14
Message-Id: 1423249867.91c14d8887230c9d559af666df26ecebed71c9d1.blueness@gentoo
1 commit: 91c14d8887230c9d559af666df26ecebed71c9d1
2 Author: Anthony G. Basile <blueness <AT> gentoo <DOT> org>
3 AuthorDate: Fri Feb 6 19:11:07 2015 +0000
4 Commit: Anthony G. Basile <blueness <AT> gentoo <DOT> org>
5 CommitDate: Fri Feb 6 19:11:07 2015 +0000
6 URL: http://sources.gentoo.org/gitweb/?p=proj/hardened-patchset.git;a=commit;h=91c14d88
7
8 Grsec/PaX: 3.0-{3.14.31,3.18.5}-201502052352
9
10 ---
11 3.14.31/0000_README | 2 +-
12 ...4420_grsecurity-3.0-3.14.31-201502052352.patch} | 420 ++++++++++++--
13 3.18.5/0000_README | 2 +-
14 ... 4420_grsecurity-3.0-3.18.5-201502052352.patch} | 617 +++++++++++++++++++--
15 3.2.66/0000_README | 2 +-
16 ... 4420_grsecurity-3.0-3.2.66-201502052350.patch} | 356 ++++++++----
17 6 files changed, 1218 insertions(+), 181 deletions(-)
18
19 diff --git a/3.14.31/0000_README b/3.14.31/0000_README
20 index c3d5e32..cd1e617 100644
21 --- a/3.14.31/0000_README
22 +++ b/3.14.31/0000_README
23 @@ -2,7 +2,7 @@ README
24 -----------------------------------------------------------------------------
25 Individual Patch Descriptions:
26 -----------------------------------------------------------------------------
27 -Patch: 4420_grsecurity-3.0-3.14.31-201501310705.patch
28 +Patch: 4420_grsecurity-3.0-3.14.31-201502052352.patch
29 From: http://www.grsecurity.net
30 Desc: hardened-sources base patch from upstream grsecurity
31
32
33 diff --git a/3.14.31/4420_grsecurity-3.0-3.14.31-201501310705.patch b/3.14.31/4420_grsecurity-3.0-3.14.31-201502052352.patch
34 similarity index 99%
35 rename from 3.14.31/4420_grsecurity-3.0-3.14.31-201501310705.patch
36 rename to 3.14.31/4420_grsecurity-3.0-3.14.31-201502052352.patch
37 index a9df68f..62bdff1 100644
38 --- a/3.14.31/4420_grsecurity-3.0-3.14.31-201501310705.patch
39 +++ b/3.14.31/4420_grsecurity-3.0-3.14.31-201502052352.patch
40 @@ -3896,7 +3896,7 @@ index 7abde2c..9df495f 100644
41 static bool of_init = false;
42
43 diff --git a/arch/arm/mm/context.c b/arch/arm/mm/context.c
44 -index 6eb97b3..ac509f6 100644
45 +index 6eb97b3..e77848e 100644
46 --- a/arch/arm/mm/context.c
47 +++ b/arch/arm/mm/context.c
48 @@ -43,7 +43,7 @@
49 @@ -3908,7 +3908,40 @@ index 6eb97b3..ac509f6 100644
50 static DECLARE_BITMAP(asid_map, NUM_USER_ASIDS);
51
52 static DEFINE_PER_CPU(atomic64_t, active_asids);
53 -@@ -182,7 +182,7 @@ static u64 new_context(struct mm_struct *mm, unsigned int cpu)
54 +@@ -144,21 +144,17 @@ static void flush_context(unsigned int cpu)
55 + /* Update the list of reserved ASIDs and the ASID bitmap. */
56 + bitmap_clear(asid_map, 0, NUM_USER_ASIDS);
57 + for_each_possible_cpu(i) {
58 +- if (i == cpu) {
59 +- asid = 0;
60 +- } else {
61 +- asid = atomic64_xchg(&per_cpu(active_asids, i), 0);
62 +- /*
63 +- * If this CPU has already been through a
64 +- * rollover, but hasn't run another task in
65 +- * the meantime, we must preserve its reserved
66 +- * ASID, as this is the only trace we have of
67 +- * the process it is still running.
68 +- */
69 +- if (asid == 0)
70 +- asid = per_cpu(reserved_asids, i);
71 +- __set_bit(asid & ~ASID_MASK, asid_map);
72 +- }
73 ++ asid = atomic64_xchg(&per_cpu(active_asids, i), 0);
74 ++ /*
75 ++ * If this CPU has already been through a
76 ++ * rollover, but hasn't run another task in
77 ++ * the meantime, we must preserve its reserved
78 ++ * ASID, as this is the only trace we have of
79 ++ * the process it is still running.
80 ++ */
81 ++ if (asid == 0)
82 ++ asid = per_cpu(reserved_asids, i);
83 ++ __set_bit(asid & ~ASID_MASK, asid_map);
84 + per_cpu(reserved_asids, i) = asid;
85 + }
86 +
87 +@@ -182,7 +178,7 @@ static u64 new_context(struct mm_struct *mm, unsigned int cpu)
88 {
89 static u32 cur_idx = 1;
90 u64 asid = atomic64_read(&mm->context.id);
91 @@ -3917,7 +3950,7 @@ index 6eb97b3..ac509f6 100644
92
93 if (asid != 0 && is_reserved_asid(asid)) {
94 /*
95 -@@ -203,7 +203,7 @@ static u64 new_context(struct mm_struct *mm, unsigned int cpu)
96 +@@ -203,7 +199,7 @@ static u64 new_context(struct mm_struct *mm, unsigned int cpu)
97 */
98 asid = find_next_zero_bit(asid_map, NUM_USER_ASIDS, cur_idx);
99 if (asid == NUM_USER_ASIDS) {
100 @@ -3926,7 +3959,7 @@ index 6eb97b3..ac509f6 100644
101 &asid_generation);
102 flush_context(cpu);
103 asid = find_next_zero_bit(asid_map, NUM_USER_ASIDS, 1);
104 -@@ -234,14 +234,14 @@ void check_and_switch_context(struct mm_struct *mm, struct task_struct *tsk)
105 +@@ -234,14 +230,14 @@ void check_and_switch_context(struct mm_struct *mm, struct task_struct *tsk)
106 cpu_set_reserved_ttbr0();
107
108 asid = atomic64_read(&mm->context.id);
109 @@ -22121,7 +22154,7 @@ index f2a1770..10fa52d 100644
110 +EXPORT_SYMBOL(pax_check_alloca);
111 +#endif
112 diff --git a/arch/x86/kernel/dumpstack_64.c b/arch/x86/kernel/dumpstack_64.c
113 -index 66e274a..99080e6 100644
114 +index 66e274a..81f4ebf 100644
115 --- a/arch/x86/kernel/dumpstack_64.c
116 +++ b/arch/x86/kernel/dumpstack_64.c
117 @@ -118,9 +118,9 @@ void dump_trace(struct task_struct *task, struct pt_regs *regs,
118 @@ -22185,7 +22218,13 @@ index 66e274a..99080e6 100644
119 put_cpu();
120 }
121 EXPORT_SYMBOL(dump_trace);
122 -@@ -299,3 +303,50 @@ int is_valid_bugaddr(unsigned long ip)
123 +@@ -294,8 +298,55 @@ int is_valid_bugaddr(unsigned long ip)
124 + {
125 + unsigned short ud2;
126 +
127 +- if (__copy_from_user(&ud2, (const void __user *) ip, sizeof(ud2)))
128 ++ if (probe_kernel_address((unsigned short *)ip, ud2))
129 + return 0;
130
131 return ud2 == 0x0b0f;
132 }
133 @@ -36116,7 +36155,7 @@ index 01b9026..1e476df 100644
134 This is the Linux Xen port. Enabling this will allow the
135 kernel to boot in a paravirtualized environment under the
136 diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
137 -index 201d09a..be93768 100644
138 +index 201d09a..2302db1 100644
139 --- a/arch/x86/xen/enlighten.c
140 +++ b/arch/x86/xen/enlighten.c
141 @@ -123,8 +123,6 @@ EXPORT_SYMBOL_GPL(xen_start_info);
142 @@ -36204,19 +36243,21 @@ index 201d09a..be93768 100644
143 {
144 if (pm_power_off)
145 pm_power_off();
146 -@@ -1455,8 +1451,9 @@ static void __ref xen_setup_gdt(int cpu)
147 +@@ -1455,8 +1451,11 @@ static void __ref xen_setup_gdt(int cpu)
148 pv_cpu_ops.write_gdt_entry = xen_write_gdt_entry_boot;
149 pv_cpu_ops.load_gdt = xen_load_gdt_boot;
150
151 - setup_stack_canary_segment(0);
152 - switch_to_new_gdt(0);
153 + setup_stack_canary_segment(cpu);
154 ++#ifdef CONFIG_X86_64
155 + load_percpu_segment(cpu);
156 ++#endif
157 + switch_to_new_gdt(cpu);
158
159 pv_cpu_ops.write_gdt_entry = xen_write_gdt_entry;
160 pv_cpu_ops.load_gdt = xen_load_gdt;
161 -@@ -1564,7 +1561,17 @@ asmlinkage void __init xen_start_kernel(void)
162 +@@ -1564,7 +1563,17 @@ asmlinkage void __init xen_start_kernel(void)
163 __userpte_alloc_gfp &= ~__GFP_HIGHMEM;
164
165 /* Work out if we support NX */
166 @@ -36235,7 +36276,7 @@ index 201d09a..be93768 100644
167
168 /* Get mfn list */
169 xen_build_dynamic_phys_to_machine();
170 -@@ -1592,13 +1599,6 @@ asmlinkage void __init xen_start_kernel(void)
171 +@@ -1592,13 +1601,6 @@ asmlinkage void __init xen_start_kernel(void)
172
173 machine_ops = xen_machine_ops;
174
175 @@ -44540,6 +44581,19 @@ index 4d9b195..455075c 100644
176 return -EFAULT;
177 } else {
178 memcpy(buf, dp, left);
179 +diff --git a/drivers/isdn/hardware/eicon/message.c b/drivers/isdn/hardware/eicon/message.c
180 +index a82e542..f766a79 100644
181 +--- a/drivers/isdn/hardware/eicon/message.c
182 ++++ b/drivers/isdn/hardware/eicon/message.c
183 +@@ -1474,7 +1474,7 @@ static byte connect_res(dword Id, word Number, DIVA_CAPI_ADAPTER *a,
184 + add_ai(plci, &parms[5]);
185 + sig_req(plci, REJECT, 0);
186 + }
187 +- else if (Reject == 1 || Reject > 9)
188 ++ else if (Reject == 1 || Reject >= 9)
189 + {
190 + add_ai(plci, &parms[5]);
191 + sig_req(plci, HANGUP, 0);
192 diff --git a/drivers/isdn/i4l/isdn_common.c b/drivers/isdn/i4l/isdn_common.c
193 index 9bb12ba..d4262f7 100644
194 --- a/drivers/isdn/i4l/isdn_common.c
195 @@ -47955,6 +48009,19 @@ index 8be5b40..081bc1b 100644
196
197 #include "ftmac100.h"
198
199 +diff --git a/drivers/net/ethernet/freescale/gianfar_ethtool.c b/drivers/net/ethernet/freescale/gianfar_ethtool.c
200 +index 63d2344..65b62c47 100644
201 +--- a/drivers/net/ethernet/freescale/gianfar_ethtool.c
202 ++++ b/drivers/net/ethernet/freescale/gianfar_ethtool.c
203 +@@ -1614,7 +1614,7 @@ static int gfar_write_filer_table(struct gfar_private *priv,
204 + lock_rx_qs(priv);
205 +
206 + /* Fill regular entries */
207 +- for (; i < MAX_FILER_IDX - 1 && (tab->fe[i].ctrl | tab->fe[i].ctrl);
208 ++ for (; i < MAX_FILER_IDX - 1 && (tab->fe[i].ctrl | tab->fe[i].prop);
209 + i++)
210 + gfar_write_filer(priv, i, tab->fe[i].ctrl, tab->fe[i].prop);
211 + /* Fill the rest with fall-troughs */
212 diff --git a/drivers/net/ethernet/intel/i40e/i40e_ptp.c b/drivers/net/ethernet/intel/i40e/i40e_ptp.c
213 index e33ec6c..f54cfe7 100644
214 --- a/drivers/net/ethernet/intel/i40e/i40e_ptp.c
215 @@ -48329,6 +48396,19 @@ index d2bb12b..d6c921e 100644
216 .kind = "nlmon",
217 .priv_size = sizeof(struct nlmon),
218 .setup = nlmon_setup,
219 +diff --git a/drivers/net/ppp/ppp_deflate.c b/drivers/net/ppp/ppp_deflate.c
220 +index 602c625..b5edc7f 100644
221 +--- a/drivers/net/ppp/ppp_deflate.c
222 ++++ b/drivers/net/ppp/ppp_deflate.c
223 +@@ -246,7 +246,7 @@ static int z_compress(void *arg, unsigned char *rptr, unsigned char *obuf,
224 + /*
225 + * See if we managed to reduce the size of the packet.
226 + */
227 +- if (olen < isize) {
228 ++ if (olen < isize && olen <= osize) {
229 + state->stats.comp_bytes += olen;
230 + state->stats.comp_packets++;
231 + } else {
232 diff --git a/drivers/net/ppp/ppp_generic.c b/drivers/net/ppp/ppp_generic.c
233 index 5a1897d..e860630 100644
234 --- a/drivers/net/ppp/ppp_generic.c
235 @@ -59776,7 +59856,7 @@ index 10a4ccb..92dbc5e 100644
236 sb->s_bdi = &fsc->backing_dev_info;
237 return err;
238 diff --git a/fs/cifs/cifs_debug.c b/fs/cifs/cifs_debug.c
239 -index f3ac415..3d2420c 100644
240 +index f3ac415..e26bd76 100644
241 --- a/fs/cifs/cifs_debug.c
242 +++ b/fs/cifs/cifs_debug.c
243 @@ -286,8 +286,8 @@ static ssize_t cifs_stats_proc_write(struct file *file,
244 @@ -59819,6 +59899,20 @@ index f3ac415..3d2420c 100644
245 if (server->ops->print_stats)
246 server->ops->print_stats(m, tcon);
247 }
248 +@@ -615,9 +615,11 @@ cifs_security_flags_handle_must_flags(unsigned int *flags)
249 + *flags = CIFSSEC_MUST_NTLMV2;
250 + else if ((*flags & CIFSSEC_MUST_NTLM) == CIFSSEC_MUST_NTLM)
251 + *flags = CIFSSEC_MUST_NTLM;
252 +- else if ((*flags & CIFSSEC_MUST_LANMAN) == CIFSSEC_MUST_LANMAN)
253 ++ else if (CIFSSEC_MUST_LANMAN &&
254 ++ (*flags & CIFSSEC_MUST_LANMAN) == CIFSSEC_MUST_LANMAN)
255 + *flags = CIFSSEC_MUST_LANMAN;
256 +- else if ((*flags & CIFSSEC_MUST_PLNTXT) == CIFSSEC_MUST_PLNTXT)
257 ++ else if (CIFSSEC_MUST_PLNTXT &&
258 ++ (*flags & CIFSSEC_MUST_PLNTXT) == CIFSSEC_MUST_PLNTXT)
259 + *flags = CIFSSEC_MUST_PLNTXT;
260 +
261 + *flags |= signflags;
262 diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c
263 index 7c6b73c..a8f0db2 100644
264 --- a/fs/cifs/cifsfs.c
265 @@ -59937,10 +60031,37 @@ index 5d12d69..161d0ce 100644
266 GLOBAL_EXTERN atomic_t smBufAllocCount;
267 GLOBAL_EXTERN atomic_t midCount;
268 diff --git a/fs/cifs/file.c b/fs/cifs/file.c
269 -index d375322..88c3ead 100644
270 +index d375322..2f1ac75 100644
271 --- a/fs/cifs/file.c
272 +++ b/fs/cifs/file.c
273 -@@ -1900,10 +1900,14 @@ static int cifs_writepages(struct address_space *mapping,
274 +@@ -366,6 +366,7 @@ void cifsFileInfo_put(struct cifsFileInfo *cifs_file)
275 + struct cifsLockInfo *li, *tmp;
276 + struct cifs_fid fid;
277 + struct cifs_pending_open open;
278 ++ bool oplock_break_cancelled;
279 +
280 + spin_lock(&cifs_file_list_lock);
281 + if (--cifs_file->count > 0) {
282 +@@ -397,7 +398,7 @@ void cifsFileInfo_put(struct cifsFileInfo *cifs_file)
283 + }
284 + spin_unlock(&cifs_file_list_lock);
285 +
286 +- cancel_work_sync(&cifs_file->oplock_break);
287 ++ oplock_break_cancelled = cancel_work_sync(&cifs_file->oplock_break);
288 +
289 + if (!tcon->need_reconnect && !cifs_file->invalidHandle) {
290 + struct TCP_Server_Info *server = tcon->ses->server;
291 +@@ -409,6 +410,9 @@ void cifsFileInfo_put(struct cifsFileInfo *cifs_file)
292 + _free_xid(xid);
293 + }
294 +
295 ++ if (oplock_break_cancelled)
296 ++ cifs_done_oplock_break(cifsi);
297 ++
298 + cifs_del_pending_open(&open);
299 +
300 + /*
301 +@@ -1900,10 +1904,14 @@ static int cifs_writepages(struct address_space *mapping,
302 index = mapping->writeback_index; /* Start from prev offset */
303 end = -1;
304 } else {
305 @@ -60224,6 +60345,19 @@ index 3487929..47a6ebf2 100644
306 }
307
308 req->FileIndex = cpu_to_le32(index);
309 +diff --git a/fs/cifs/smbencrypt.c b/fs/cifs/smbencrypt.c
310 +index 43eb136..f17e718 100644
311 +--- a/fs/cifs/smbencrypt.c
312 ++++ b/fs/cifs/smbencrypt.c
313 +@@ -220,7 +220,7 @@ E_md4hash(const unsigned char *passwd, unsigned char *p16,
314 + }
315 +
316 + rc = mdfour(p16, (unsigned char *) wpwd, len * sizeof(__le16));
317 +- memset(wpwd, 0, 129 * sizeof(__le16));
318 ++ memzero_explicit(wpwd, sizeof(wpwd));
319 +
320 + return rc;
321 + }
322 diff --git a/fs/coda/cache.c b/fs/coda/cache.c
323 index 1da168c..8bc7ff6 100644
324 --- a/fs/coda/cache.c
325 @@ -62062,7 +62196,7 @@ index ef68665..5deacdc 100644
326 return 0;
327 }
328 diff --git a/fs/fhandle.c b/fs/fhandle.c
329 -index 999ff5c..ac037c9 100644
330 +index 999ff5c..2281df9 100644
331 --- a/fs/fhandle.c
332 +++ b/fs/fhandle.c
333 @@ -8,6 +8,7 @@
334 @@ -62092,6 +62226,18 @@ index 999ff5c..ac037c9 100644
335 retval = -EPERM;
336 goto out_err;
337 }
338 +@@ -195,8 +195,9 @@ static int handle_to_path(int mountdirfd, struct file_handle __user *ufh,
339 + goto out_err;
340 + }
341 + /* copy the full handle */
342 +- if (copy_from_user(handle, ufh,
343 +- sizeof(struct file_handle) +
344 ++ *handle = f_handle;
345 ++ if (copy_from_user(&handle->f_handle,
346 ++ &ufh->f_handle,
347 + f_handle.handle_bytes)) {
348 + retval = -EFAULT;
349 + goto out_handle;
350 diff --git a/fs/file.c b/fs/file.c
351 index eb56a13..ccee850 100644
352 --- a/fs/file.c
353 @@ -86953,10 +87099,28 @@ index 823ec7b..44c938c 100644
354 struct rcu_head rcu;
355 struct inet_peer *gc_next;
356 diff --git a/include/net/ip.h b/include/net/ip.h
357 -index 937f196..7251808 100644
358 +index 937f196..310a44f 100644
359 --- a/include/net/ip.h
360 +++ b/include/net/ip.h
361 -@@ -214,7 +214,7 @@ static inline void snmp_mib_free(void __percpu *ptr[SNMP_ARRAY_SZ])
362 +@@ -38,11 +38,12 @@ struct inet_skb_parm {
363 + struct ip_options opt; /* Compiled IP options */
364 + unsigned char flags;
365 +
366 +-#define IPSKB_FORWARDED 1
367 +-#define IPSKB_XFRM_TUNNEL_SIZE 2
368 +-#define IPSKB_XFRM_TRANSFORMED 4
369 +-#define IPSKB_FRAG_COMPLETE 8
370 +-#define IPSKB_REROUTED 16
371 ++#define IPSKB_FORWARDED BIT(0)
372 ++#define IPSKB_XFRM_TUNNEL_SIZE BIT(1)
373 ++#define IPSKB_XFRM_TRANSFORMED BIT(2)
374 ++#define IPSKB_FRAG_COMPLETE BIT(3)
375 ++#define IPSKB_REROUTED BIT(4)
376 ++#define IPSKB_DOREDIRECT BIT(5)
377 +
378 + u16 frag_max_size;
379 + };
380 +@@ -214,7 +215,7 @@ static inline void snmp_mib_free(void __percpu *ptr[SNMP_ARRAY_SZ])
381
382 void inet_get_local_port_range(struct net *net, int *low, int *high);
383
384 @@ -86965,7 +87129,7 @@ index 937f196..7251808 100644
385 static inline int inet_is_reserved_local_port(int port)
386 {
387 return test_bit(port, sysctl_local_reserved_ports);
388 -@@ -297,7 +297,7 @@ static inline unsigned int ip_skb_dst_mtu(const struct sk_buff *skb)
389 +@@ -297,7 +298,7 @@ static inline unsigned int ip_skb_dst_mtu(const struct sk_buff *skb)
390 }
391 }
392
393 @@ -101987,7 +102151,7 @@ index a16ed7b..eb44d17 100644
394
395 return err;
396 diff --git a/net/core/dev.c b/net/core/dev.c
397 -index 86bb9cc..8814d50 100644
398 +index 86bb9cc..a4f25f3 100644
399 --- a/net/core/dev.c
400 +++ b/net/core/dev.c
401 @@ -1695,14 +1695,14 @@ int dev_forward_skb(struct net_device *dev, struct sk_buff *skb)
402 @@ -102052,6 +102216,24 @@ index 86bb9cc..8814d50 100644
403 {
404 struct softnet_data *sd = &__get_cpu_var(softnet_data);
405 unsigned long time_limit = jiffies + 2;
406 +@@ -5066,7 +5066,7 @@ void netdev_upper_dev_unlink(struct net_device *dev,
407 + }
408 + EXPORT_SYMBOL(netdev_upper_dev_unlink);
409 +
410 +-void netdev_adjacent_add_links(struct net_device *dev)
411 ++static void netdev_adjacent_add_links(struct net_device *dev)
412 + {
413 + struct netdev_adjacent *iter;
414 +
415 +@@ -5091,7 +5091,7 @@ void netdev_adjacent_add_links(struct net_device *dev)
416 + }
417 + }
418 +
419 +-void netdev_adjacent_del_links(struct net_device *dev)
420 ++static void netdev_adjacent_del_links(struct net_device *dev)
421 + {
422 + struct netdev_adjacent *iter;
423 +
424 @@ -6376,7 +6376,7 @@ struct rtnl_link_stats64 *dev_get_stats(struct net_device *dev,
425 } else {
426 netdev_stats_to_stats64(storage, &dev->stats);
427 @@ -102061,6 +102243,15 @@ index 86bb9cc..8814d50 100644
428 return storage;
429 }
430 EXPORT_SYMBOL(dev_get_stats);
431 +@@ -6392,7 +6392,7 @@ struct netdev_queue *dev_ingress_queue_create(struct net_device *dev)
432 + if (!queue)
433 + return NULL;
434 + netdev_init_one_queue(dev, queue, NULL);
435 +- queue->qdisc = &noop_qdisc;
436 ++ RCU_INIT_POINTER(queue->qdisc, &noop_qdisc);
437 + queue->qdisc_sleeping = &noop_qdisc;
438 + rcu_assign_pointer(dev->ingress_queue, queue);
439 + #endif
440 diff --git a/net/core/dev_ioctl.c b/net/core/dev_ioctl.c
441 index cf999e0..c59a9754 100644
442 --- a/net/core/dev_ioctl.c
443 @@ -103107,6 +103298,20 @@ index bf2cb4a..d83ba8a 100644
444 p->metrics[RTAX_LOCK-1] = INETPEER_METRICS_NEW;
445 p->rate_tokens = 0;
446 /* 60*HZ is arbitrary, but chosen enough high so that the first
447 +diff --git a/net/ipv4/ip_forward.c b/net/ipv4/ip_forward.c
448 +index 1c6bd43..ecb34b5 100644
449 +--- a/net/ipv4/ip_forward.c
450 ++++ b/net/ipv4/ip_forward.c
451 +@@ -178,7 +178,8 @@ int ip_forward(struct sk_buff *skb)
452 + * We now generate an ICMP HOST REDIRECT giving the route
453 + * we calculated.
454 + */
455 +- if (rt->rt_flags&RTCF_DOREDIRECT && !opt->srr && !skb_sec_path(skb))
456 ++ if (IPCB(skb)->flags & IPSKB_DOREDIRECT && !opt->srr &&
457 ++ !skb_sec_path(skb))
458 + ip_rt_send_redirect(skb);
459 +
460 + skb->priority = rt_tos2priority(iph->tos);
461 diff --git a/net/ipv4/ip_fragment.c b/net/ipv4/ip_fragment.c
462 index c10a3ce..dd71f84 100644
463 --- a/net/ipv4/ip_fragment.c
464 @@ -103214,6 +103419,18 @@ index 3d4da2c..40f9c29 100644
465 icmp_send(skb, ICMP_DEST_UNREACH,
466 ICMP_PROT_UNREACH, 0);
467 }
468 +diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c
469 +index 844323b..7c1b9ac 100644
470 +--- a/net/ipv4/ip_output.c
471 ++++ b/net/ipv4/ip_output.c
472 +@@ -1471,6 +1471,7 @@ static DEFINE_PER_CPU(struct inet_sock, unicast_sock) = {
473 + .sk_wmem_alloc = ATOMIC_INIT(1),
474 + .sk_allocation = GFP_ATOMIC,
475 + .sk_flags = (1UL << SOCK_USE_WRITE_QUEUE),
476 ++ .sk_pacing_rate = ~0U,
477 + },
478 + .pmtudisc = IP_PMTUDISC_WANT,
479 + .uc_ttl = -1,
480 diff --git a/net/ipv4/ip_sockglue.c b/net/ipv4/ip_sockglue.c
481 index 580dd96..41e9720 100644
482 --- a/net/ipv4/ip_sockglue.c
483 @@ -103582,7 +103799,7 @@ index 11c8d81..d67116b 100644
484
485 static int raw_seq_show(struct seq_file *seq, void *v)
486 diff --git a/net/ipv4/route.c b/net/ipv4/route.c
487 -index 487bb62..bc101aa 100644
488 +index 487bb62..31268ca 100644
489 --- a/net/ipv4/route.c
490 +++ b/net/ipv4/route.c
491 @@ -234,7 +234,7 @@ static const struct seq_operations rt_cache_seq_ops = {
492 @@ -103635,7 +103852,31 @@ index 487bb62..bc101aa 100644
493 }
494 EXPORT_SYMBOL(ip_idents_reserve);
495
496 -@@ -2631,34 +2631,34 @@ static struct ctl_table ipv4_route_flush_table[] = {
497 +@@ -1554,11 +1554,10 @@ static int __mkroute_input(struct sk_buff *skb,
498 +
499 + do_cache = res->fi && !itag;
500 + if (out_dev == in_dev && err && IN_DEV_TX_REDIRECTS(out_dev) &&
501 ++ skb->protocol == htons(ETH_P_IP) &&
502 + (IN_DEV_SHARED_MEDIA(out_dev) ||
503 +- inet_addr_onlink(out_dev, saddr, FIB_RES_GW(*res)))) {
504 +- flags |= RTCF_DOREDIRECT;
505 +- do_cache = false;
506 +- }
507 ++ inet_addr_onlink(out_dev, saddr, FIB_RES_GW(*res))))
508 ++ IPCB(skb)->flags |= IPSKB_DOREDIRECT;
509 +
510 + if (skb->protocol != htons(ETH_P_IP)) {
511 + /* Not IP (i.e. ARP). Do not create route, if it is
512 +@@ -2305,6 +2304,8 @@ static int rt_fill_info(struct net *net, __be32 dst, __be32 src,
513 + r->rtm_flags = (rt->rt_flags & ~0xFFFF) | RTM_F_CLONED;
514 + if (rt->rt_flags & RTCF_NOTIFY)
515 + r->rtm_flags |= RTM_F_NOTIFY;
516 ++ if (IPCB(skb)->flags & IPSKB_DOREDIRECT)
517 ++ r->rtm_flags |= RTCF_DOREDIRECT;
518 +
519 + if (nla_put_be32(skb, RTA_DST, dst))
520 + goto nla_put_failure;
521 +@@ -2631,34 +2632,34 @@ static struct ctl_table ipv4_route_flush_table[] = {
522 .maxlen = sizeof(int),
523 .mode = 0200,
524 .proc_handler = ipv4_sysctl_rtcache_flush,
525 @@ -103678,7 +103919,7 @@ index 487bb62..bc101aa 100644
526 err_dup:
527 return -ENOMEM;
528 }
529 -@@ -2681,8 +2681,8 @@ static __net_initdata struct pernet_operations sysctl_route_ops = {
530 +@@ -2681,8 +2682,8 @@ static __net_initdata struct pernet_operations sysctl_route_ops = {
531
532 static __net_init int rt_genid_init(struct net *net)
533 {
534 @@ -103689,7 +103930,7 @@ index 487bb62..bc101aa 100644
535 get_random_bytes(&net->ipv4.dev_addr_genid,
536 sizeof(net->ipv4.dev_addr_genid));
537 return 0;
538 -@@ -2725,11 +2725,7 @@ int __init ip_rt_init(void)
539 +@@ -2725,11 +2726,7 @@ int __init ip_rt_init(void)
540 {
541 int rc = 0;
542
543 @@ -104350,7 +104591,7 @@ index 7b32652..0bc348b 100644
544 table = kmemdup(ipv6_icmp_table_template,
545 sizeof(ipv6_icmp_table_template),
546 diff --git a/net/ipv6/ip6_gre.c b/net/ipv6/ip6_gre.c
547 -index 4a230b1..a1d47b8 100644
548 +index 4a230b1..42d6ab42 100644
549 --- a/net/ipv6/ip6_gre.c
550 +++ b/net/ipv6/ip6_gre.c
551 @@ -71,7 +71,7 @@ struct ip6gre_net {
552 @@ -104362,6 +104603,24 @@ index 4a230b1..a1d47b8 100644
553 static int ip6gre_tunnel_init(struct net_device *dev);
554 static void ip6gre_tunnel_setup(struct net_device *dev);
555 static void ip6gre_tunnel_link(struct ip6gre_net *ign, struct ip6_tnl *t);
556 +@@ -413,7 +413,7 @@ static void ip6gre_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
557 + if (code == ICMPV6_HDR_FIELD)
558 + teli = ip6_tnl_parse_tlv_enc_lim(skb, skb->data);
559 +
560 +- if (teli && teli == info - 2) {
561 ++ if (teli && teli == be32_to_cpu(info) - 2) {
562 + tel = (struct ipv6_tlv_tnl_enc_lim *) &skb->data[teli];
563 + if (tel->encap_limit == 0) {
564 + net_warn_ratelimited("%s: Too small encapsulation limit or routing loop in tunnel!\n",
565 +@@ -425,7 +425,7 @@ static void ip6gre_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
566 + }
567 + break;
568 + case ICMPV6_PKT_TOOBIG:
569 +- mtu = info - offset;
570 ++ mtu = be32_to_cpu(info) - offset;
571 + if (mtu < IPV6_MIN_MTU)
572 + mtu = IPV6_MIN_MTU;
573 + t->dev->mtu = mtu;
574 @@ -1290,7 +1290,7 @@ static void ip6gre_fb_tunnel_init(struct net_device *dev)
575 }
576
577 @@ -105843,7 +106102,7 @@ index f042ae5..30ea486 100644
578 }
579 EXPORT_SYMBOL(nf_unregister_sockopt);
580 diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c
581 -index c68e5e0..8d52d50 100644
582 +index c68e5e0..3bed3f0 100644
583 --- a/net/netfilter/nf_tables_api.c
584 +++ b/net/netfilter/nf_tables_api.c
585 @@ -152,8 +152,8 @@ nf_tables_chain_type_lookup(const struct nft_af_info *afi,
586 @@ -105857,6 +106116,18 @@ index c68e5e0..8d52d50 100644
587 nfnl_lock(NFNL_SUBSYS_NFTABLES);
588 type = __nf_tables_chain_type_lookup(afi->family, nla);
589 if (type != NULL)
590 +@@ -789,9 +789,11 @@ nf_tables_counters(struct nft_base_chain *chain, const struct nlattr *attr)
591 + /* Restore old counters on this cpu, no problem. Per-cpu statistics
592 + * are not exposed to userspace.
593 + */
594 ++ preempt_disable();
595 + stats = this_cpu_ptr(newstats);
596 + stats->bytes = be64_to_cpu(nla_get_be64(tb[NFTA_COUNTER_BYTES]));
597 + stats->pkts = be64_to_cpu(nla_get_be64(tb[NFTA_COUNTER_PACKETS]));
598 ++ preempt_enable();
599 +
600 + if (chain->stats) {
601 + /* nfnl_lock is held, add some nfnl function for this, later */
602 diff --git a/net/netfilter/nfnetlink_log.c b/net/netfilter/nfnetlink_log.c
603 index 6ff12a1..d1815b6 100644
604 --- a/net/netfilter/nfnetlink_log.c
605 @@ -106367,6 +106638,27 @@ index a82fb66..1ea9251 100644
606 continue;
607 }
608 list_del_init(&rm->m_conn_item);
609 +diff --git a/net/rds/sysctl.c b/net/rds/sysctl.c
610 +index b5cb2aa..35773ad 100644
611 +--- a/net/rds/sysctl.c
612 ++++ b/net/rds/sysctl.c
613 +@@ -71,14 +71,14 @@ static struct ctl_table rds_sysctl_rds_table[] = {
614 + {
615 + .procname = "max_unacked_packets",
616 + .data = &rds_sysctl_max_unacked_packets,
617 +- .maxlen = sizeof(unsigned long),
618 ++ .maxlen = sizeof(int),
619 + .mode = 0644,
620 + .proc_handler = proc_dointvec,
621 + },
622 + {
623 + .procname = "max_unacked_bytes",
624 + .data = &rds_sysctl_max_unacked_bytes,
625 +- .maxlen = sizeof(unsigned long),
626 ++ .maxlen = sizeof(int),
627 + .mode = 0644,
628 + .proc_handler = proc_dointvec,
629 + },
630 diff --git a/net/rds/tcp.c b/net/rds/tcp.c
631 index edac9ef..16bcb98 100644
632 --- a/net/rds/tcp.c
633 @@ -106653,6 +106945,31 @@ index f226709..0e735a8 100644
634 _proto("Tx RESPONSE %%%u", ntohl(hdr->serial));
635
636 ret = kernel_sendmsg(conn->trans->local->socket, &msg, iov, 3, len);
637 +diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c
638 +index bdbdb1a..1afc85f 100644
639 +--- a/net/sched/cls_api.c
640 ++++ b/net/sched/cls_api.c
641 +@@ -555,8 +555,9 @@ void tcf_exts_change(struct tcf_proto *tp, struct tcf_exts *dst,
642 + }
643 + EXPORT_SYMBOL(tcf_exts_change);
644 +
645 +-#define tcf_exts_first_act(ext) \
646 +- list_first_entry(&(exts)->actions, struct tc_action, list)
647 ++#define tcf_exts_first_act(ext) \
648 ++ list_first_entry_or_null(&(exts)->actions, \
649 ++ struct tc_action, list)
650 +
651 + int tcf_exts_dump(struct sk_buff *skb, struct tcf_exts *exts)
652 + {
653 +@@ -597,7 +598,7 @@ int tcf_exts_dump_stats(struct sk_buff *skb, struct tcf_exts *exts)
654 + {
655 + #ifdef CONFIG_NET_CLS_ACT
656 + struct tc_action *a = tcf_exts_first_act(exts);
657 +- if (tcf_action_copy_stats(skb, a, 1) < 0)
658 ++ if (a != NULL && tcf_action_copy_stats(skb, a, 1) < 0)
659 + return -1;
660 + #endif
661 + return 0;
662 diff --git a/net/sched/cls_bpf.c b/net/sched/cls_bpf.c
663 index 8e3cf49..4a8e322 100644
664 --- a/net/sched/cls_bpf.c
665 @@ -106793,10 +107110,38 @@ index fef2acd..c705c4f 100644
666 sctp_generate_t1_cookie_event,
667 sctp_generate_t1_init_event,
668 diff --git a/net/sctp/socket.c b/net/sctp/socket.c
669 -index 604a6ac..f87f0a3 100644
670 +index 604a6ac..990354d 100644
671 --- a/net/sctp/socket.c
672 +++ b/net/sctp/socket.c
673 -@@ -2175,11 +2175,13 @@ static int sctp_setsockopt_events(struct sock *sk, char __user *optval,
674 +@@ -1605,6 +1605,7 @@ static int sctp_sendmsg(struct kiocb *iocb, struct sock *sk,
675 + sctp_scope_t scope;
676 + long timeo;
677 + __u16 sinfo_flags = 0;
678 ++ bool wait_connect = false;
679 + struct sctp_datamsg *datamsg;
680 + int msg_flags = msg->msg_flags;
681 +
682 +@@ -1924,6 +1925,7 @@ static int sctp_sendmsg(struct kiocb *iocb, struct sock *sk,
683 + if (err < 0)
684 + goto out_free;
685 +
686 ++ wait_connect = true;
687 + pr_debug("%s: we associated primitively\n", __func__);
688 + }
689 +
690 +@@ -1961,6 +1963,11 @@ static int sctp_sendmsg(struct kiocb *iocb, struct sock *sk,
691 + sctp_datamsg_put(datamsg);
692 + err = msg_len;
693 +
694 ++ if (unlikely(wait_connect)) {
695 ++ timeo = sock_sndtimeo(sk, msg_flags & MSG_DONTWAIT);
696 ++ sctp_wait_for_connect(asoc, &timeo);
697 ++ }
698 ++
699 + /* If we are already past ASSOCIATE, the lower
700 + * layers are responsible for association cleanup.
701 + */
702 +@@ -2175,11 +2182,13 @@ static int sctp_setsockopt_events(struct sock *sk, char __user *optval,
703 {
704 struct sctp_association *asoc;
705 struct sctp_ulpevent *event;
706 @@ -106811,7 +107156,7 @@ index 604a6ac..f87f0a3 100644
707
708 /*
709 * At the time when a user app subscribes to SCTP_SENDER_DRY_EVENT,
710 -@@ -4259,13 +4261,16 @@ static int sctp_getsockopt_disable_fragments(struct sock *sk, int len,
711 +@@ -4259,13 +4268,16 @@ static int sctp_getsockopt_disable_fragments(struct sock *sk, int len,
712 static int sctp_getsockopt_events(struct sock *sk, int len, char __user *optval,
713 int __user *optlen)
714 {
715 @@ -106829,7 +107174,7 @@ index 604a6ac..f87f0a3 100644
716 return -EFAULT;
717 return 0;
718 }
719 -@@ -4283,6 +4288,8 @@ static int sctp_getsockopt_events(struct sock *sk, int len, char __user *optval,
720 +@@ -4283,6 +4295,8 @@ static int sctp_getsockopt_events(struct sock *sk, int len, char __user *optval,
721 */
722 static int sctp_getsockopt_autoclose(struct sock *sk, int len, char __user *optval, int __user *optlen)
723 {
724 @@ -106838,7 +107183,7 @@ index 604a6ac..f87f0a3 100644
725 /* Applicable to UDP-style socket only */
726 if (sctp_style(sk, TCP))
727 return -EOPNOTSUPP;
728 -@@ -4291,7 +4298,8 @@ static int sctp_getsockopt_autoclose(struct sock *sk, int len, char __user *optv
729 +@@ -4291,7 +4305,8 @@ static int sctp_getsockopt_autoclose(struct sock *sk, int len, char __user *optv
730 len = sizeof(int);
731 if (put_user(len, optlen))
732 return -EFAULT;
733 @@ -106848,7 +107193,7 @@ index 604a6ac..f87f0a3 100644
734 return -EFAULT;
735 return 0;
736 }
737 -@@ -4666,12 +4674,15 @@ static int sctp_getsockopt_delayed_ack(struct sock *sk, int len,
738 +@@ -4666,12 +4681,15 @@ static int sctp_getsockopt_delayed_ack(struct sock *sk, int len,
739 */
740 static int sctp_getsockopt_initmsg(struct sock *sk, int len, char __user *optval, int __user *optlen)
741 {
742 @@ -106865,7 +107210,7 @@ index 604a6ac..f87f0a3 100644
743 return -EFAULT;
744 return 0;
745 }
746 -@@ -4712,6 +4723,8 @@ static int sctp_getsockopt_peer_addrs(struct sock *sk, int len,
747 +@@ -4712,6 +4730,8 @@ static int sctp_getsockopt_peer_addrs(struct sock *sk, int len,
748 addrlen = sctp_get_af_specific(temp.sa.sa_family)->sockaddr_len;
749 if (space_left < addrlen)
750 return -ENOMEM;
751 @@ -107992,6 +108337,19 @@ index 05a6e3d..6716ec9 100644
752
753 __xfrm_sysctl_init(net);
754
755 +diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include
756 +index 547e15d..e550fa6 100644
757 +--- a/scripts/Kbuild.include
758 ++++ b/scripts/Kbuild.include
759 +@@ -143,7 +143,7 @@ cc-ifversion = $(shell [ $(call cc-version, $(CC)) $(1) $(2) ] && echo $(3))
760 + # cc-ldoption
761 + # Usage: ldflags += $(call cc-ldoption, -Wl$(comma)--hash-style=both)
762 + cc-ldoption = $(call try-run,\
763 +- $(CC) $(1) -nostdlib -x c /dev/null -o "$$TMP",$(1),$(2))
764 ++ $(CC) $(1) -Wl,-r -nostdlib -x c /dev/null -o "$$TMP",$(1),$(2))
765 +
766 + # ld-option
767 + # Usage: LDFLAGS += $(call ld-option, -X)
768 diff --git a/scripts/Makefile b/scripts/Makefile
769 index 01e7adb..6176d5d 100644
770 --- a/scripts/Makefile
771
772 diff --git a/3.18.5/0000_README b/3.18.5/0000_README
773 index 634a195..b1f502a 100644
774 --- a/3.18.5/0000_README
775 +++ b/3.18.5/0000_README
776 @@ -2,7 +2,7 @@ README
777 -----------------------------------------------------------------------------
778 Individual Patch Descriptions:
779 -----------------------------------------------------------------------------
780 -Patch: 4420_grsecurity-3.0-3.18.5-201501310706.patch
781 +Patch: 4420_grsecurity-3.0-3.18.5-201502052352.patch
782 From: http://www.grsecurity.net
783 Desc: hardened-sources base patch from upstream grsecurity
784
785
786 diff --git a/3.18.5/4420_grsecurity-3.0-3.18.5-201501310706.patch b/3.18.5/4420_grsecurity-3.0-3.18.5-201502052352.patch
787 similarity index 99%
788 rename from 3.18.5/4420_grsecurity-3.0-3.18.5-201501310706.patch
789 rename to 3.18.5/4420_grsecurity-3.0-3.18.5-201502052352.patch
790 index 06b5a6e..ad22521 100644
791 --- a/3.18.5/4420_grsecurity-3.0-3.18.5-201501310706.patch
792 +++ b/3.18.5/4420_grsecurity-3.0-3.18.5-201502052352.patch
793 @@ -3894,7 +3894,7 @@ index 5e65ca8..879e7b3 100644
794 #define CACHE_LINE_SIZE 32
795
796 diff --git a/arch/arm/mm/context.c b/arch/arm/mm/context.c
797 -index 6eb97b3..ac509f6 100644
798 +index 6eb97b3..e77848e 100644
799 --- a/arch/arm/mm/context.c
800 +++ b/arch/arm/mm/context.c
801 @@ -43,7 +43,7 @@
802 @@ -3906,7 +3906,40 @@ index 6eb97b3..ac509f6 100644
803 static DECLARE_BITMAP(asid_map, NUM_USER_ASIDS);
804
805 static DEFINE_PER_CPU(atomic64_t, active_asids);
806 -@@ -182,7 +182,7 @@ static u64 new_context(struct mm_struct *mm, unsigned int cpu)
807 +@@ -144,21 +144,17 @@ static void flush_context(unsigned int cpu)
808 + /* Update the list of reserved ASIDs and the ASID bitmap. */
809 + bitmap_clear(asid_map, 0, NUM_USER_ASIDS);
810 + for_each_possible_cpu(i) {
811 +- if (i == cpu) {
812 +- asid = 0;
813 +- } else {
814 +- asid = atomic64_xchg(&per_cpu(active_asids, i), 0);
815 +- /*
816 +- * If this CPU has already been through a
817 +- * rollover, but hasn't run another task in
818 +- * the meantime, we must preserve its reserved
819 +- * ASID, as this is the only trace we have of
820 +- * the process it is still running.
821 +- */
822 +- if (asid == 0)
823 +- asid = per_cpu(reserved_asids, i);
824 +- __set_bit(asid & ~ASID_MASK, asid_map);
825 +- }
826 ++ asid = atomic64_xchg(&per_cpu(active_asids, i), 0);
827 ++ /*
828 ++ * If this CPU has already been through a
829 ++ * rollover, but hasn't run another task in
830 ++ * the meantime, we must preserve its reserved
831 ++ * ASID, as this is the only trace we have of
832 ++ * the process it is still running.
833 ++ */
834 ++ if (asid == 0)
835 ++ asid = per_cpu(reserved_asids, i);
836 ++ __set_bit(asid & ~ASID_MASK, asid_map);
837 + per_cpu(reserved_asids, i) = asid;
838 + }
839 +
840 +@@ -182,7 +178,7 @@ static u64 new_context(struct mm_struct *mm, unsigned int cpu)
841 {
842 static u32 cur_idx = 1;
843 u64 asid = atomic64_read(&mm->context.id);
844 @@ -3915,7 +3948,7 @@ index 6eb97b3..ac509f6 100644
845
846 if (asid != 0 && is_reserved_asid(asid)) {
847 /*
848 -@@ -203,7 +203,7 @@ static u64 new_context(struct mm_struct *mm, unsigned int cpu)
849 +@@ -203,7 +199,7 @@ static u64 new_context(struct mm_struct *mm, unsigned int cpu)
850 */
851 asid = find_next_zero_bit(asid_map, NUM_USER_ASIDS, cur_idx);
852 if (asid == NUM_USER_ASIDS) {
853 @@ -3924,7 +3957,7 @@ index 6eb97b3..ac509f6 100644
854 &asid_generation);
855 flush_context(cpu);
856 asid = find_next_zero_bit(asid_map, NUM_USER_ASIDS, 1);
857 -@@ -234,14 +234,14 @@ void check_and_switch_context(struct mm_struct *mm, struct task_struct *tsk)
858 +@@ -234,14 +230,14 @@ void check_and_switch_context(struct mm_struct *mm, struct task_struct *tsk)
859 cpu_set_reserved_ttbr0();
860
861 asid = atomic64_read(&mm->context.id);
862 @@ -22126,7 +22159,7 @@ index 5abd4cd..c65733b 100644
863 +EXPORT_SYMBOL(pax_check_alloca);
864 +#endif
865 diff --git a/arch/x86/kernel/dumpstack_64.c b/arch/x86/kernel/dumpstack_64.c
866 -index ff86f19..a20c62c 100644
867 +index ff86f19..73eabf4 100644
868 --- a/arch/x86/kernel/dumpstack_64.c
869 +++ b/arch/x86/kernel/dumpstack_64.c
870 @@ -153,12 +153,12 @@ void dump_trace(struct task_struct *task, struct pt_regs *regs,
871 @@ -22189,7 +22222,13 @@ index ff86f19..a20c62c 100644
872 put_cpu();
873 }
874 EXPORT_SYMBOL(dump_trace);
875 -@@ -349,3 +352,50 @@ int is_valid_bugaddr(unsigned long ip)
876 +@@ -344,8 +347,55 @@ int is_valid_bugaddr(unsigned long ip)
877 + {
878 + unsigned short ud2;
879 +
880 +- if (__copy_from_user(&ud2, (const void __user *) ip, sizeof(ud2)))
881 ++ if (probe_kernel_address((unsigned short *)ip, ud2))
882 + return 0;
883
884 return ud2 == 0x0b0f;
885 }
886 @@ -35590,7 +35629,7 @@ index e88fda8..76ce7ce 100644
887 This is the Linux Xen port. Enabling this will allow the
888 kernel to boot in a paravirtualized environment under the
889 diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
890 -index fac5e4f..e421c18 100644
891 +index fac5e4f..89c3525 100644
892 --- a/arch/x86/xen/enlighten.c
893 +++ b/arch/x86/xen/enlighten.c
894 @@ -123,8 +123,6 @@ EXPORT_SYMBOL_GPL(xen_start_info);
895 @@ -35678,19 +35717,21 @@ index fac5e4f..e421c18 100644
896 {
897 if (pm_power_off)
898 pm_power_off();
899 -@@ -1456,8 +1452,9 @@ static void __ref xen_setup_gdt(int cpu)
900 +@@ -1456,8 +1452,11 @@ static void __ref xen_setup_gdt(int cpu)
901 pv_cpu_ops.write_gdt_entry = xen_write_gdt_entry_boot;
902 pv_cpu_ops.load_gdt = xen_load_gdt_boot;
903
904 - setup_stack_canary_segment(0);
905 - switch_to_new_gdt(0);
906 + setup_stack_canary_segment(cpu);
907 ++#ifdef CONFIG_X86_64
908 + load_percpu_segment(cpu);
909 ++#endif
910 + switch_to_new_gdt(cpu);
911
912 pv_cpu_ops.write_gdt_entry = xen_write_gdt_entry;
913 pv_cpu_ops.load_gdt = xen_load_gdt;
914 -@@ -1573,7 +1570,17 @@ asmlinkage __visible void __init xen_start_kernel(void)
915 +@@ -1573,7 +1572,17 @@ asmlinkage __visible void __init xen_start_kernel(void)
916 __userpte_alloc_gfp &= ~__GFP_HIGHMEM;
917
918 /* Work out if we support NX */
919 @@ -35709,7 +35750,7 @@ index fac5e4f..e421c18 100644
920
921 /* Get mfn list */
922 xen_build_dynamic_phys_to_machine();
923 -@@ -1601,13 +1608,6 @@ asmlinkage __visible void __init xen_start_kernel(void)
924 +@@ -1601,13 +1610,6 @@ asmlinkage __visible void __init xen_start_kernel(void)
925
926 machine_ops = xen_machine_ops;
927
928 @@ -44014,6 +44055,19 @@ index 4d9b195..455075c 100644
929 return -EFAULT;
930 } else {
931 memcpy(buf, dp, left);
932 +diff --git a/drivers/isdn/hardware/eicon/message.c b/drivers/isdn/hardware/eicon/message.c
933 +index a82e542..f766a79 100644
934 +--- a/drivers/isdn/hardware/eicon/message.c
935 ++++ b/drivers/isdn/hardware/eicon/message.c
936 +@@ -1474,7 +1474,7 @@ static byte connect_res(dword Id, word Number, DIVA_CAPI_ADAPTER *a,
937 + add_ai(plci, &parms[5]);
938 + sig_req(plci, REJECT, 0);
939 + }
940 +- else if (Reject == 1 || Reject > 9)
941 ++ else if (Reject == 1 || Reject >= 9)
942 + {
943 + add_ai(plci, &parms[5]);
944 + sig_req(plci, HANGUP, 0);
945 diff --git a/drivers/isdn/i4l/isdn_common.c b/drivers/isdn/i4l/isdn_common.c
946 index 9b856e1..fa03c92 100644
947 --- a/drivers/isdn/i4l/isdn_common.c
948 @@ -48093,6 +48147,19 @@ index 4ff1adc..0ea6bf4 100644
949
950 #include "ftmac100.h"
951
952 +diff --git a/drivers/net/ethernet/freescale/gianfar_ethtool.c b/drivers/net/ethernet/freescale/gianfar_ethtool.c
953 +index 76d7070..f6971182 100644
954 +--- a/drivers/net/ethernet/freescale/gianfar_ethtool.c
955 ++++ b/drivers/net/ethernet/freescale/gianfar_ethtool.c
956 +@@ -1581,7 +1581,7 @@ static int gfar_write_filer_table(struct gfar_private *priv,
957 + return -EBUSY;
958 +
959 + /* Fill regular entries */
960 +- for (; i < MAX_FILER_IDX - 1 && (tab->fe[i].ctrl | tab->fe[i].ctrl);
961 ++ for (; i < MAX_FILER_IDX - 1 && (tab->fe[i].ctrl | tab->fe[i].prop);
962 + i++)
963 + gfar_write_filer(priv, i, tab->fe[i].ctrl, tab->fe[i].prop);
964 + /* Fill the rest with fall-troughs */
965 diff --git a/drivers/net/ethernet/intel/i40e/i40e_ptp.c b/drivers/net/ethernet/intel/i40e/i40e_ptp.c
966 index 537b621..07f87ce 100644
967 --- a/drivers/net/ethernet/intel/i40e/i40e_ptp.c
968 @@ -48134,6 +48201,20 @@ index 11ff28b..375d659 100644
969
970 netdev_tx_completed_queue(ring->tx_queue, packets, bytes);
971
972 +diff --git a/drivers/net/ethernet/mellanox/mlx4/mlx4.h b/drivers/net/ethernet/mellanox/mlx4/mlx4.h
973 +index de10dbb..8b54f29 100644
974 +--- a/drivers/net/ethernet/mellanox/mlx4/mlx4.h
975 ++++ b/drivers/net/ethernet/mellanox/mlx4/mlx4.h
976 +@@ -233,7 +233,8 @@ do { \
977 + extern int mlx4_log_num_mgm_entry_size;
978 + extern int log_mtts_per_seg;
979 +
980 +-#define MLX4_MAX_NUM_SLAVES (MLX4_MAX_NUM_PF + MLX4_MAX_NUM_VF)
981 ++#define MLX4_MAX_NUM_SLAVES (min(MLX4_MAX_NUM_PF + MLX4_MAX_NUM_VF, \
982 ++ MLX4_MFUNC_MAX))
983 + #define ALL_SLAVES 0xff
984 +
985 + struct mlx4_bitmap {
986 diff --git a/drivers/net/ethernet/neterion/s2io.c b/drivers/net/ethernet/neterion/s2io.c
987 index f5e4b82..db0c7a9 100644
988 --- a/drivers/net/ethernet/neterion/s2io.c
989 @@ -48326,6 +48407,42 @@ index 2f48f79..8ae1a1a 100644
990
991 spinlock_t request_lock;
992 struct list_head req_list;
993 +diff --git a/drivers/net/hyperv/netvsc.c b/drivers/net/hyperv/netvsc.c
994 +index 7d76c95..63d7a64 100644
995 +--- a/drivers/net/hyperv/netvsc.c
996 ++++ b/drivers/net/hyperv/netvsc.c
997 +@@ -716,7 +716,7 @@ int netvsc_send(struct hv_device *device,
998 + u64 req_id;
999 + unsigned int section_index = NETVSC_INVALID_INDEX;
1000 + u32 msg_size = 0;
1001 +- struct sk_buff *skb;
1002 ++ struct sk_buff *skb = NULL;
1003 + u16 q_idx = packet->q_idx;
1004 +
1005 +
1006 +@@ -743,8 +743,6 @@ int netvsc_send(struct hv_device *device,
1007 + packet);
1008 + skb = (struct sk_buff *)
1009 + (unsigned long)packet->send_completion_tid;
1010 +- if (skb)
1011 +- dev_kfree_skb_any(skb);
1012 + packet->page_buf_cnt = 0;
1013 + }
1014 + }
1015 +@@ -807,6 +805,13 @@ int netvsc_send(struct hv_device *device,
1016 + packet, ret);
1017 + }
1018 +
1019 ++ if (ret != 0) {
1020 ++ if (section_index != NETVSC_INVALID_INDEX)
1021 ++ netvsc_free_send_slot(net_device, section_index);
1022 ++ } else if (skb) {
1023 ++ dev_kfree_skb_any(skb);
1024 ++ }
1025 ++
1026 + return ret;
1027 + }
1028 +
1029 diff --git a/drivers/net/hyperv/rndis_filter.c b/drivers/net/hyperv/rndis_filter.c
1030 index 2b86f0b..ecc996f 100644
1031 --- a/drivers/net/hyperv/rndis_filter.c
1032 @@ -48463,6 +48580,19 @@ index 34924df..a747360 100644
1033 .kind = "nlmon",
1034 .priv_size = sizeof(struct nlmon),
1035 .setup = nlmon_setup,
1036 +diff --git a/drivers/net/ppp/ppp_deflate.c b/drivers/net/ppp/ppp_deflate.c
1037 +index 602c625..b5edc7f 100644
1038 +--- a/drivers/net/ppp/ppp_deflate.c
1039 ++++ b/drivers/net/ppp/ppp_deflate.c
1040 +@@ -246,7 +246,7 @@ static int z_compress(void *arg, unsigned char *rptr, unsigned char *obuf,
1041 + /*
1042 + * See if we managed to reduce the size of the packet.
1043 + */
1044 +- if (olen < isize) {
1045 ++ if (olen < isize && olen <= osize) {
1046 + state->stats.comp_bytes += olen;
1047 + state->stats.comp_packets++;
1048 + } else {
1049 diff --git a/drivers/net/ppp/ppp_generic.c b/drivers/net/ppp/ppp_generic.c
1050 index 794a473..9fd437b 100644
1051 --- a/drivers/net/ppp/ppp_generic.c
1052 @@ -49592,6 +49722,40 @@ index a912dc0..a8225ba 100644
1053 u16 int_num;
1054
1055 ZD_ASSERT(in_interrupt());
1056 +diff --git a/drivers/net/xen-netback/interface.c b/drivers/net/xen-netback/interface.c
1057 +index d752d1c..23e3203 100644
1058 +--- a/drivers/net/xen-netback/interface.c
1059 ++++ b/drivers/net/xen-netback/interface.c
1060 +@@ -578,6 +578,7 @@ int xenvif_connect(struct xenvif_queue *queue, unsigned long tx_ring_ref,
1061 + goto err_rx_unbind;
1062 + }
1063 + queue->task = task;
1064 ++ get_task_struct(task);
1065 +
1066 + task = kthread_create(xenvif_dealloc_kthread,
1067 + (void *)queue, "%s-dealloc", queue->name);
1068 +@@ -634,6 +635,7 @@ void xenvif_disconnect(struct xenvif *vif)
1069 +
1070 + if (queue->task) {
1071 + kthread_stop(queue->task);
1072 ++ put_task_struct(queue->task);
1073 + queue->task = NULL;
1074 + }
1075 +
1076 +diff --git a/drivers/net/xen-netback/netback.c b/drivers/net/xen-netback/netback.c
1077 +index c39aace..e18728d 100644
1078 +--- a/drivers/net/xen-netback/netback.c
1079 ++++ b/drivers/net/xen-netback/netback.c
1080 +@@ -2111,8 +2111,7 @@ int xenvif_kthread_guest_rx(void *data)
1081 + */
1082 + if (unlikely(vif->disabled && queue->id == 0)) {
1083 + xenvif_carrier_off(vif);
1084 +- xenvif_rx_queue_purge(queue);
1085 +- continue;
1086 ++ break;
1087 + }
1088 +
1089 + if (!skb_queue_empty(&queue->rx_queue))
1090 diff --git a/drivers/nfc/nfcwilink.c b/drivers/nfc/nfcwilink.c
1091 index 683671a..4519fc2 100644
1092 --- a/drivers/nfc/nfcwilink.c
1093 @@ -51894,10 +52058,24 @@ index ae45bd9..c32a586 100644
1094
1095 transport_setup_device(&rport->dev);
1096 diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
1097 -index cfba74c..415f09b 100644
1098 +index cfba74c..4cdf6a1 100644
1099 --- a/drivers/scsi/sd.c
1100 +++ b/drivers/scsi/sd.c
1101 -@@ -3022,7 +3022,7 @@ static int sd_probe(struct device *dev)
1102 +@@ -2818,9 +2818,11 @@ static int sd_revalidate_disk(struct gendisk *disk)
1103 + */
1104 + sd_set_flush_flag(sdkp);
1105 +
1106 +- max_xfer = min_not_zero(queue_max_hw_sectors(sdkp->disk->queue),
1107 +- sdkp->max_xfer_blocks);
1108 ++ max_xfer = sdkp->max_xfer_blocks;
1109 + max_xfer <<= ilog2(sdp->sector_size) - 9;
1110 ++
1111 ++ max_xfer = min_not_zero(queue_max_hw_sectors(sdkp->disk->queue),
1112 ++ max_xfer);
1113 + blk_queue_max_hw_sectors(sdkp->disk->queue, max_xfer);
1114 + set_capacity(disk, sdkp->capacity);
1115 + sd_config_write_same(sdkp);
1116 +@@ -3022,7 +3024,7 @@ static int sd_probe(struct device *dev)
1117 sdkp->disk = gd;
1118 sdkp->index = index;
1119 atomic_set(&sdkp->openers, 0);
1120 @@ -59720,7 +59898,7 @@ index f6e1237..796ffd1 100644
1121 sb->s_bdi = &fsc->backing_dev_info;
1122 return err;
1123 diff --git a/fs/cifs/cifs_debug.c b/fs/cifs/cifs_debug.c
1124 -index 44ec726..bcb06a3 100644
1125 +index 44ec726..11a056f 100644
1126 --- a/fs/cifs/cifs_debug.c
1127 +++ b/fs/cifs/cifs_debug.c
1128 @@ -286,8 +286,8 @@ static ssize_t cifs_stats_proc_write(struct file *file,
1129 @@ -59763,6 +59941,20 @@ index 44ec726..bcb06a3 100644
1130 if (server->ops->print_stats)
1131 server->ops->print_stats(m, tcon);
1132 }
1133 +@@ -615,9 +615,11 @@ cifs_security_flags_handle_must_flags(unsigned int *flags)
1134 + *flags = CIFSSEC_MUST_NTLMV2;
1135 + else if ((*flags & CIFSSEC_MUST_NTLM) == CIFSSEC_MUST_NTLM)
1136 + *flags = CIFSSEC_MUST_NTLM;
1137 +- else if ((*flags & CIFSSEC_MUST_LANMAN) == CIFSSEC_MUST_LANMAN)
1138 ++ else if (CIFSSEC_MUST_LANMAN &&
1139 ++ (*flags & CIFSSEC_MUST_LANMAN) == CIFSSEC_MUST_LANMAN)
1140 + *flags = CIFSSEC_MUST_LANMAN;
1141 +- else if ((*flags & CIFSSEC_MUST_PLNTXT) == CIFSSEC_MUST_PLNTXT)
1142 ++ else if (CIFSSEC_MUST_PLNTXT &&
1143 ++ (*flags & CIFSSEC_MUST_PLNTXT) == CIFSSEC_MUST_PLNTXT)
1144 + *flags = CIFSSEC_MUST_PLNTXT;
1145 +
1146 + *flags |= signflags;
1147 diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c
1148 index 9d7996e..35ad5cf4 100644
1149 --- a/fs/cifs/cifsfs.c
1150 @@ -59881,10 +60073,37 @@ index 02a33e5..3a28b5a 100644
1151 GLOBAL_EXTERN atomic_t smBufAllocCount;
1152 GLOBAL_EXTERN atomic_t midCount;
1153 diff --git a/fs/cifs/file.c b/fs/cifs/file.c
1154 -index 3e4d00a..38a122d 100644
1155 +index 3e4d00a..4132187 100644
1156 --- a/fs/cifs/file.c
1157 +++ b/fs/cifs/file.c
1158 -@@ -2056,10 +2056,14 @@ static int cifs_writepages(struct address_space *mapping,
1159 +@@ -366,6 +366,7 @@ void cifsFileInfo_put(struct cifsFileInfo *cifs_file)
1160 + struct cifsLockInfo *li, *tmp;
1161 + struct cifs_fid fid;
1162 + struct cifs_pending_open open;
1163 ++ bool oplock_break_cancelled;
1164 +
1165 + spin_lock(&cifs_file_list_lock);
1166 + if (--cifs_file->count > 0) {
1167 +@@ -397,7 +398,7 @@ void cifsFileInfo_put(struct cifsFileInfo *cifs_file)
1168 + }
1169 + spin_unlock(&cifs_file_list_lock);
1170 +
1171 +- cancel_work_sync(&cifs_file->oplock_break);
1172 ++ oplock_break_cancelled = cancel_work_sync(&cifs_file->oplock_break);
1173 +
1174 + if (!tcon->need_reconnect && !cifs_file->invalidHandle) {
1175 + struct TCP_Server_Info *server = tcon->ses->server;
1176 +@@ -409,6 +410,9 @@ void cifsFileInfo_put(struct cifsFileInfo *cifs_file)
1177 + _free_xid(xid);
1178 + }
1179 +
1180 ++ if (oplock_break_cancelled)
1181 ++ cifs_done_oplock_break(cifsi);
1182 ++
1183 + cifs_del_pending_open(&open);
1184 +
1185 + /*
1186 +@@ -2056,10 +2060,14 @@ static int cifs_writepages(struct address_space *mapping,
1187 index = mapping->writeback_index; /* Start from prev offset */
1188 end = -1;
1189 } else {
1190 @@ -60168,6 +60387,19 @@ index 8f1672b..af339c07 100644
1191 }
1192
1193 req->FileIndex = cpu_to_le32(index);
1194 +diff --git a/fs/cifs/smbencrypt.c b/fs/cifs/smbencrypt.c
1195 +index 6c15663..a4232ec 100644
1196 +--- a/fs/cifs/smbencrypt.c
1197 ++++ b/fs/cifs/smbencrypt.c
1198 +@@ -221,7 +221,7 @@ E_md4hash(const unsigned char *passwd, unsigned char *p16,
1199 + }
1200 +
1201 + rc = mdfour(p16, (unsigned char *) wpwd, len * sizeof(__le16));
1202 +- memset(wpwd, 0, 129 * sizeof(__le16));
1203 ++ memzero_explicit(wpwd, sizeof(wpwd));
1204 +
1205 + return rc;
1206 + }
1207 diff --git a/fs/coda/cache.c b/fs/coda/cache.c
1208 index 46ee6f2..89a9e7f 100644
1209 --- a/fs/coda/cache.c
1210 @@ -61935,7 +62167,7 @@ index 99d440a..eb979d1 100644
1211 }
1212 EXPORT_SYMBOL(__f_setown);
1213 diff --git a/fs/fhandle.c b/fs/fhandle.c
1214 -index 999ff5c..ac037c9 100644
1215 +index 999ff5c..2281df9 100644
1216 --- a/fs/fhandle.c
1217 +++ b/fs/fhandle.c
1218 @@ -8,6 +8,7 @@
1219 @@ -61965,6 +62197,18 @@ index 999ff5c..ac037c9 100644
1220 retval = -EPERM;
1221 goto out_err;
1222 }
1223 +@@ -195,8 +195,9 @@ static int handle_to_path(int mountdirfd, struct file_handle __user *ufh,
1224 + goto out_err;
1225 + }
1226 + /* copy the full handle */
1227 +- if (copy_from_user(handle, ufh,
1228 +- sizeof(struct file_handle) +
1229 ++ *handle = f_handle;
1230 ++ if (copy_from_user(&handle->f_handle,
1231 ++ &ufh->f_handle,
1232 + f_handle.handle_bytes)) {
1233 + retval = -EFAULT;
1234 + goto out_handle;
1235 diff --git a/fs/file.c b/fs/file.c
1236 index ab3eb6a..8de2392 100644
1237 --- a/fs/file.c
1238 @@ -83097,6 +83341,19 @@ index 3d385c8..deacb6a 100644
1239
1240 static inline int
1241 vma_dup_policy(struct vm_area_struct *src, struct vm_area_struct *dst)
1242 +diff --git a/include/linux/mlx4/device.h b/include/linux/mlx4/device.h
1243 +index 37e4404..26ebbd0 100644
1244 +--- a/include/linux/mlx4/device.h
1245 ++++ b/include/linux/mlx4/device.h
1246 +@@ -97,7 +97,7 @@ enum {
1247 + MLX4_MAX_NUM_PF = 16,
1248 + MLX4_MAX_NUM_VF = 64,
1249 + MLX4_MAX_NUM_VF_P_PORT = 64,
1250 +- MLX4_MFUNC_MAX = 80,
1251 ++ MLX4_MFUNC_MAX = 128,
1252 + MLX4_MAX_EQ_NUM = 1024,
1253 + MLX4_MFUNC_EQ_NUM = 4,
1254 + MLX4_MFUNC_MAX_EQES = 8,
1255 diff --git a/include/linux/mm.h b/include/linux/mm.h
1256 index 5ab2da9..5f0b3df 100644
1257 --- a/include/linux/mm.h
1258 @@ -86073,6 +86330,23 @@ index 8109a15..504466d 100644
1259 +extern atomic_unchecked_t flow_cache_genid;
1260
1261 #endif
1262 +diff --git a/include/net/flow_keys.h b/include/net/flow_keys.h
1263 +index 7ee2df0..dc8fd81 100644
1264 +--- a/include/net/flow_keys.h
1265 ++++ b/include/net/flow_keys.h
1266 +@@ -22,9 +22,9 @@ struct flow_keys {
1267 + __be32 ports;
1268 + __be16 port16[2];
1269 + };
1270 +- u16 thoff;
1271 +- u16 n_proto;
1272 +- u8 ip_proto;
1273 ++ u16 thoff;
1274 ++ __be16 n_proto;
1275 ++ u8 ip_proto;
1276 + };
1277 +
1278 + bool __skb_flow_dissect(const struct sk_buff *skb, struct flow_keys *flow,
1279 diff --git a/include/net/genetlink.h b/include/net/genetlink.h
1280 index af10c2c..a431cc5 100644
1281 --- a/include/net/genetlink.h
1282 @@ -86126,10 +86400,28 @@ index 80479ab..0c3f647 100644
1283 struct rcu_head rcu;
1284 struct inet_peer *gc_next;
1285 diff --git a/include/net/ip.h b/include/net/ip.h
1286 -index 0bb6207..a8878af 100644
1287 +index 0bb6207..1f38247 100644
1288 --- a/include/net/ip.h
1289 +++ b/include/net/ip.h
1290 -@@ -316,7 +316,7 @@ static inline unsigned int ip_skb_dst_mtu(const struct sk_buff *skb)
1291 +@@ -39,11 +39,12 @@ struct inet_skb_parm {
1292 + struct ip_options opt; /* Compiled IP options */
1293 + unsigned char flags;
1294 +
1295 +-#define IPSKB_FORWARDED 1
1296 +-#define IPSKB_XFRM_TUNNEL_SIZE 2
1297 +-#define IPSKB_XFRM_TRANSFORMED 4
1298 +-#define IPSKB_FRAG_COMPLETE 8
1299 +-#define IPSKB_REROUTED 16
1300 ++#define IPSKB_FORWARDED BIT(0)
1301 ++#define IPSKB_XFRM_TUNNEL_SIZE BIT(1)
1302 ++#define IPSKB_XFRM_TRANSFORMED BIT(2)
1303 ++#define IPSKB_FRAG_COMPLETE BIT(3)
1304 ++#define IPSKB_REROUTED BIT(4)
1305 ++#define IPSKB_DOREDIRECT BIT(5)
1306 +
1307 + u16 frag_max_size;
1308 + };
1309 +@@ -316,7 +317,7 @@ static inline unsigned int ip_skb_dst_mtu(const struct sk_buff *skb)
1310 }
1311 }
1312
1313 @@ -86187,6 +86479,28 @@ index 615b20b..fd4cbd8 100644
1314 /* ip_vs_est */
1315 struct list_head est_list; /* estimator list */
1316 spinlock_t est_lock;
1317 +diff --git a/include/net/ipv6.h b/include/net/ipv6.h
1318 +index 4292929..7e21d2e 100644
1319 +--- a/include/net/ipv6.h
1320 ++++ b/include/net/ipv6.h
1321 +@@ -708,7 +708,7 @@ static inline __be32 ip6_make_flowlabel(struct net *net, struct sk_buff *skb,
1322 + __be32 flowlabel, bool autolabel)
1323 + {
1324 + if (!flowlabel && (autolabel || net->ipv6.sysctl.auto_flowlabels)) {
1325 +- __be32 hash;
1326 ++ u32 hash;
1327 +
1328 + hash = skb_get_hash(skb);
1329 +
1330 +@@ -718,7 +718,7 @@ static inline __be32 ip6_make_flowlabel(struct net *net, struct sk_buff *skb,
1331 + */
1332 + hash ^= hash >> 12;
1333 +
1334 +- flowlabel = hash & IPV6_FLOWLABEL_MASK;
1335 ++ flowlabel = (__force __be32)hash & IPV6_FLOWLABEL_MASK;
1336 + }
1337 +
1338 + return flowlabel;
1339 diff --git a/include/net/irda/ircomm_tty.h b/include/net/irda/ircomm_tty.h
1340 index 8d4f588..2e37ad2 100644
1341 --- a/include/net/irda/ircomm_tty.h
1342 @@ -98084,7 +98398,7 @@ index ace9345..63320dc 100644
1343
1344 if (nstart < prev->vm_end)
1345 diff --git a/mm/mremap.c b/mm/mremap.c
1346 -index b147f66..98a695a 100644
1347 +index b147f66..98a695ab 100644
1348 --- a/mm/mremap.c
1349 +++ b/mm/mremap.c
1350 @@ -144,6 +144,12 @@ static void move_ptes(struct vm_area_struct *vma, pmd_t *old_pmd,
1351 @@ -101187,7 +101501,7 @@ index fdbc9a8..cd6972c 100644
1352
1353 return err;
1354 diff --git a/net/core/dev.c b/net/core/dev.c
1355 -index 8440968..d1d6bea 100644
1356 +index 8440968..e14d2b7 100644
1357 --- a/net/core/dev.c
1358 +++ b/net/core/dev.c
1359 @@ -1683,14 +1683,14 @@ int __dev_forward_skb(struct net_device *dev, struct sk_buff *skb)
1360 @@ -101252,6 +101566,24 @@ index 8440968..d1d6bea 100644
1361 {
1362 struct softnet_data *sd = this_cpu_ptr(&softnet_data);
1363 unsigned long time_limit = jiffies + 2;
1364 +@@ -5247,7 +5247,7 @@ void netdev_upper_dev_unlink(struct net_device *dev,
1365 + }
1366 + EXPORT_SYMBOL(netdev_upper_dev_unlink);
1367 +
1368 +-void netdev_adjacent_add_links(struct net_device *dev)
1369 ++static void netdev_adjacent_add_links(struct net_device *dev)
1370 + {
1371 + struct netdev_adjacent *iter;
1372 +
1373 +@@ -5272,7 +5272,7 @@ void netdev_adjacent_add_links(struct net_device *dev)
1374 + }
1375 + }
1376 +
1377 +-void netdev_adjacent_del_links(struct net_device *dev)
1378 ++static void netdev_adjacent_del_links(struct net_device *dev)
1379 + {
1380 + struct netdev_adjacent *iter;
1381 +
1382 @@ -6557,8 +6557,8 @@ struct rtnl_link_stats64 *dev_get_stats(struct net_device *dev,
1383 } else {
1384 netdev_stats_to_stats64(storage, &dev->stats);
1385 @@ -101263,6 +101595,15 @@ index 8440968..d1d6bea 100644
1386 return storage;
1387 }
1388 EXPORT_SYMBOL(dev_get_stats);
1389 +@@ -6574,7 +6574,7 @@ struct netdev_queue *dev_ingress_queue_create(struct net_device *dev)
1390 + if (!queue)
1391 + return NULL;
1392 + netdev_init_one_queue(dev, queue, NULL);
1393 +- queue->qdisc = &noop_qdisc;
1394 ++ RCU_INIT_POINTER(queue->qdisc, &noop_qdisc);
1395 + queue->qdisc_sleeping = &noop_qdisc;
1396 + rcu_assign_pointer(dev->ingress_queue, queue);
1397 + #endif
1398 diff --git a/net/core/dev_ioctl.c b/net/core/dev_ioctl.c
1399 index 72e899a..79a9409 100644
1400 --- a/net/core/dev_ioctl.c
1401 @@ -101318,7 +101659,7 @@ index 647b122..18a7ff6 100644
1402 fp->len = fprog->len;
1403 /* Since unattached filters are not copied back to user
1404 diff --git a/net/core/flow.c b/net/core/flow.c
1405 -index a0348fd..6951c76 100644
1406 +index a0348fd..340f65d 100644
1407 --- a/net/core/flow.c
1408 +++ b/net/core/flow.c
1409 @@ -65,7 +65,7 @@ static void flow_cache_new_hashrnd(unsigned long arg)
1410 @@ -101348,6 +101689,15 @@ index a0348fd..6951c76 100644
1411 if (!IS_ERR(flo))
1412 fle->object = flo;
1413 else
1414 +@@ -379,7 +379,7 @@ done:
1415 + static void flow_cache_flush_task(struct work_struct *work)
1416 + {
1417 + struct netns_xfrm *xfrm = container_of(work, struct netns_xfrm,
1418 +- flow_cache_gc_work);
1419 ++ flow_cache_flush_work);
1420 + struct net *net = container_of(xfrm, struct net, xfrm);
1421 +
1422 + flow_cache_flush(net);
1423 diff --git a/net/core/iovec.c b/net/core/iovec.c
1424 index e1ec45a..e5c6f16 100644
1425 --- a/net/core/iovec.c
1426 @@ -102209,6 +102559,20 @@ index 241afd7..31b95d5 100644
1427 p->metrics[RTAX_LOCK-1] = INETPEER_METRICS_NEW;
1428 p->rate_tokens = 0;
1429 /* 60*HZ is arbitrary, but chosen enough high so that the first
1430 +diff --git a/net/ipv4/ip_forward.c b/net/ipv4/ip_forward.c
1431 +index 3a83ce5..787b3c2 100644
1432 +--- a/net/ipv4/ip_forward.c
1433 ++++ b/net/ipv4/ip_forward.c
1434 +@@ -129,7 +129,8 @@ int ip_forward(struct sk_buff *skb)
1435 + * We now generate an ICMP HOST REDIRECT giving the route
1436 + * we calculated.
1437 + */
1438 +- if (rt->rt_flags&RTCF_DOREDIRECT && !opt->srr && !skb_sec_path(skb))
1439 ++ if (IPCB(skb)->flags & IPSKB_DOREDIRECT && !opt->srr &&
1440 ++ !skb_sec_path(skb))
1441 + ip_rt_send_redirect(skb);
1442 +
1443 + skb->priority = rt_tos2priority(iph->tos);
1444 diff --git a/net/ipv4/ip_fragment.c b/net/ipv4/ip_fragment.c
1445 index 2811cc1..ad5a534 100644
1446 --- a/net/ipv4/ip_fragment.c
1447 @@ -102316,6 +102680,18 @@ index 3d4da2c..40f9c29 100644
1448 icmp_send(skb, ICMP_DEST_UNREACH,
1449 ICMP_PROT_UNREACH, 0);
1450 }
1451 +diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c
1452 +index bc6471d..c5e8a0c 100644
1453 +--- a/net/ipv4/ip_output.c
1454 ++++ b/net/ipv4/ip_output.c
1455 +@@ -1517,6 +1517,7 @@ static DEFINE_PER_CPU(struct inet_sock, unicast_sock) = {
1456 + .sk_wmem_alloc = ATOMIC_INIT(1),
1457 + .sk_allocation = GFP_ATOMIC,
1458 + .sk_flags = (1UL << SOCK_USE_WRITE_QUEUE),
1459 ++ .sk_pacing_rate = ~0U,
1460 + },
1461 + .pmtudisc = IP_PMTUDISC_WANT,
1462 + .uc_ttl = -1,
1463 diff --git a/net/ipv4/ip_sockglue.c b/net/ipv4/ip_sockglue.c
1464 index 9daf217..373d454 100644
1465 --- a/net/ipv4/ip_sockglue.c
1466 @@ -102675,7 +103051,7 @@ index 739db31..74f0210 100644
1467
1468 static int raw_seq_show(struct seq_file *seq, void *v)
1469 diff --git a/net/ipv4/route.c b/net/ipv4/route.c
1470 -index 6a2155b..d426880 100644
1471 +index 6a2155b..47de388 100644
1472 --- a/net/ipv4/route.c
1473 +++ b/net/ipv4/route.c
1474 @@ -228,7 +228,7 @@ static const struct seq_operations rt_cache_seq_ops = {
1475 @@ -102728,7 +103104,31 @@ index 6a2155b..d426880 100644
1476 }
1477 EXPORT_SYMBOL(ip_idents_reserve);
1478
1479 -@@ -2624,34 +2624,34 @@ static struct ctl_table ipv4_route_flush_table[] = {
1480 +@@ -1554,11 +1554,10 @@ static int __mkroute_input(struct sk_buff *skb,
1481 +
1482 + do_cache = res->fi && !itag;
1483 + if (out_dev == in_dev && err && IN_DEV_TX_REDIRECTS(out_dev) &&
1484 ++ skb->protocol == htons(ETH_P_IP) &&
1485 + (IN_DEV_SHARED_MEDIA(out_dev) ||
1486 +- inet_addr_onlink(out_dev, saddr, FIB_RES_GW(*res)))) {
1487 +- flags |= RTCF_DOREDIRECT;
1488 +- do_cache = false;
1489 +- }
1490 ++ inet_addr_onlink(out_dev, saddr, FIB_RES_GW(*res))))
1491 ++ IPCB(skb)->flags |= IPSKB_DOREDIRECT;
1492 +
1493 + if (skb->protocol != htons(ETH_P_IP)) {
1494 + /* Not IP (i.e. ARP). Do not create route, if it is
1495 +@@ -2303,6 +2302,8 @@ static int rt_fill_info(struct net *net, __be32 dst, __be32 src,
1496 + r->rtm_flags = (rt->rt_flags & ~0xFFFF) | RTM_F_CLONED;
1497 + if (rt->rt_flags & RTCF_NOTIFY)
1498 + r->rtm_flags |= RTM_F_NOTIFY;
1499 ++ if (IPCB(skb)->flags & IPSKB_DOREDIRECT)
1500 ++ r->rtm_flags |= RTCF_DOREDIRECT;
1501 +
1502 + if (nla_put_be32(skb, RTA_DST, dst))
1503 + goto nla_put_failure;
1504 +@@ -2624,34 +2625,34 @@ static struct ctl_table ipv4_route_flush_table[] = {
1505 .maxlen = sizeof(int),
1506 .mode = 0200,
1507 .proc_handler = ipv4_sysctl_rtcache_flush,
1508 @@ -102771,7 +103171,7 @@ index 6a2155b..d426880 100644
1509 err_dup:
1510 return -ENOMEM;
1511 }
1512 -@@ -2674,8 +2674,8 @@ static __net_initdata struct pernet_operations sysctl_route_ops = {
1513 +@@ -2674,8 +2675,8 @@ static __net_initdata struct pernet_operations sysctl_route_ops = {
1514
1515 static __net_init int rt_genid_init(struct net *net)
1516 {
1517 @@ -102782,7 +103182,7 @@ index 6a2155b..d426880 100644
1518 get_random_bytes(&net->ipv4.dev_addr_genid,
1519 sizeof(net->ipv4.dev_addr_genid));
1520 return 0;
1521 -@@ -2718,11 +2718,7 @@ int __init ip_rt_init(void)
1522 +@@ -2718,11 +2719,7 @@ int __init ip_rt_init(void)
1523 {
1524 int rc = 0;
1525
1526 @@ -103410,7 +103810,7 @@ index b2d1838..0194c04 100644
1527 return new;
1528 }
1529 diff --git a/net/ipv6/ip6_gre.c b/net/ipv6/ip6_gre.c
1530 -index 0e32d2e..98cbe65 100644
1531 +index 0e32d2e..dd45cdc 100644
1532 --- a/net/ipv6/ip6_gre.c
1533 +++ b/net/ipv6/ip6_gre.c
1534 @@ -71,8 +71,8 @@ struct ip6gre_net {
1535 @@ -103424,6 +103824,24 @@ index 0e32d2e..98cbe65 100644
1536 static int ip6gre_tunnel_init(struct net_device *dev);
1537 static void ip6gre_tunnel_setup(struct net_device *dev);
1538 static void ip6gre_tunnel_link(struct ip6gre_net *ign, struct ip6_tnl *t);
1539 +@@ -417,7 +417,7 @@ static void ip6gre_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
1540 + if (code == ICMPV6_HDR_FIELD)
1541 + teli = ip6_tnl_parse_tlv_enc_lim(skb, skb->data);
1542 +
1543 +- if (teli && teli == info - 2) {
1544 ++ if (teli && teli == be32_to_cpu(info) - 2) {
1545 + tel = (struct ipv6_tlv_tnl_enc_lim *) &skb->data[teli];
1546 + if (tel->encap_limit == 0) {
1547 + net_warn_ratelimited("%s: Too small encapsulation limit or routing loop in tunnel!\n",
1548 +@@ -429,7 +429,7 @@ static void ip6gre_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
1549 + }
1550 + break;
1551 + case ICMPV6_PKT_TOOBIG:
1552 +- mtu = info - offset;
1553 ++ mtu = be32_to_cpu(info) - offset;
1554 + if (mtu < IPV6_MIN_MTU)
1555 + mtu = IPV6_MIN_MTU;
1556 + t->dev->mtu = mtu;
1557 @@ -1289,7 +1289,7 @@ static void ip6gre_fb_tunnel_init(struct net_device *dev)
1558 }
1559
1560 @@ -103818,7 +104236,7 @@ index a318dd89..42a612c 100644
1561 table = kmemdup(ipv6_route_table_template,
1562 sizeof(ipv6_route_table_template),
1563 diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c
1564 -index a24557a..00a9ed1 100644
1565 +index a24557a..ade77d3 100644
1566 --- a/net/ipv6/sit.c
1567 +++ b/net/ipv6/sit.c
1568 @@ -74,7 +74,7 @@ static void ipip6_tunnel_setup(struct net_device *dev);
1569 @@ -103830,6 +104248,33 @@ index a24557a..00a9ed1 100644
1570
1571 static int sit_net_id __read_mostly;
1572 struct sit_net {
1573 +@@ -1505,12 +1505,12 @@ static bool ipip6_netlink_encap_parms(struct nlattr *data[],
1574 +
1575 + if (data[IFLA_IPTUN_ENCAP_SPORT]) {
1576 + ret = true;
1577 +- ipencap->sport = nla_get_u16(data[IFLA_IPTUN_ENCAP_SPORT]);
1578 ++ ipencap->sport = nla_get_be16(data[IFLA_IPTUN_ENCAP_SPORT]);
1579 + }
1580 +
1581 + if (data[IFLA_IPTUN_ENCAP_DPORT]) {
1582 + ret = true;
1583 +- ipencap->dport = nla_get_u16(data[IFLA_IPTUN_ENCAP_DPORT]);
1584 ++ ipencap->dport = nla_get_be16(data[IFLA_IPTUN_ENCAP_DPORT]);
1585 + }
1586 +
1587 + return ret;
1588 +@@ -1706,9 +1706,9 @@ static int ipip6_fill_info(struct sk_buff *skb, const struct net_device *dev)
1589 +
1590 + if (nla_put_u16(skb, IFLA_IPTUN_ENCAP_TYPE,
1591 + tunnel->encap.type) ||
1592 +- nla_put_u16(skb, IFLA_IPTUN_ENCAP_SPORT,
1593 ++ nla_put_be16(skb, IFLA_IPTUN_ENCAP_SPORT,
1594 + tunnel->encap.sport) ||
1595 +- nla_put_u16(skb, IFLA_IPTUN_ENCAP_DPORT,
1596 ++ nla_put_be16(skb, IFLA_IPTUN_ENCAP_DPORT,
1597 + tunnel->encap.dport) ||
1598 + nla_put_u16(skb, IFLA_IPTUN_ENCAP_FLAGS,
1599 + tunnel->encap.dport))
1600 @@ -1750,7 +1750,7 @@ static void ipip6_dellink(struct net_device *dev, struct list_head *head)
1601 unregister_netdevice_queue(dev, head);
1602 }
1603 @@ -104887,6 +105332,22 @@ index c68c1e5..8b5d670 100644
1604 mutex_unlock(&nf_sockopt_mutex);
1605 }
1606 EXPORT_SYMBOL(nf_unregister_sockopt);
1607 +diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c
1608 +index 71b574c..d319e8b 100644
1609 +--- a/net/netfilter/nf_tables_api.c
1610 ++++ b/net/netfilter/nf_tables_api.c
1611 +@@ -1134,9 +1134,11 @@ static struct nft_stats __percpu *nft_stats_alloc(const struct nlattr *attr)
1612 + /* Restore old counters on this cpu, no problem. Per-cpu statistics
1613 + * are not exposed to userspace.
1614 + */
1615 ++ preempt_disable();
1616 + stats = this_cpu_ptr(newstats);
1617 + stats->bytes = be64_to_cpu(nla_get_be64(tb[NFTA_COUNTER_BYTES]));
1618 + stats->pkts = be64_to_cpu(nla_get_be64(tb[NFTA_COUNTER_PACKETS]));
1619 ++ preempt_enable();
1620 +
1621 + return newstats;
1622 + }
1623 diff --git a/net/netfilter/nfnetlink_log.c b/net/netfilter/nfnetlink_log.c
1624 index 5f1be5b..2cba8cd 100644
1625 --- a/net/netfilter/nfnetlink_log.c
1626 @@ -105374,6 +105835,27 @@ index 48f8ffc..0ef3eec 100644
1627
1628 struct rds_sock {
1629 struct sock rs_sk;
1630 +diff --git a/net/rds/sysctl.c b/net/rds/sysctl.c
1631 +index c3b0cd4..c173f69 100644
1632 +--- a/net/rds/sysctl.c
1633 ++++ b/net/rds/sysctl.c
1634 +@@ -71,14 +71,14 @@ static struct ctl_table rds_sysctl_rds_table[] = {
1635 + {
1636 + .procname = "max_unacked_packets",
1637 + .data = &rds_sysctl_max_unacked_packets,
1638 +- .maxlen = sizeof(unsigned long),
1639 ++ .maxlen = sizeof(int),
1640 + .mode = 0644,
1641 + .proc_handler = proc_dointvec,
1642 + },
1643 + {
1644 + .procname = "max_unacked_bytes",
1645 + .data = &rds_sysctl_max_unacked_bytes,
1646 +- .maxlen = sizeof(unsigned long),
1647 ++ .maxlen = sizeof(int),
1648 + .mode = 0644,
1649 + .proc_handler = proc_dointvec,
1650 + },
1651 diff --git a/net/rds/tcp.c b/net/rds/tcp.c
1652 index edac9ef..16bcb98 100644
1653 --- a/net/rds/tcp.c
1654 @@ -105665,6 +106147,31 @@ index f226709..0e735a8 100644
1655 _proto("Tx RESPONSE %%%u", ntohl(hdr->serial));
1656
1657 ret = kernel_sendmsg(conn->trans->local->socket, &msg, iov, 3, len);
1658 +diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c
1659 +index aad6a67..baef987 100644
1660 +--- a/net/sched/cls_api.c
1661 ++++ b/net/sched/cls_api.c
1662 +@@ -556,8 +556,9 @@ void tcf_exts_change(struct tcf_proto *tp, struct tcf_exts *dst,
1663 + }
1664 + EXPORT_SYMBOL(tcf_exts_change);
1665 +
1666 +-#define tcf_exts_first_act(ext) \
1667 +- list_first_entry(&(exts)->actions, struct tc_action, list)
1668 ++#define tcf_exts_first_act(ext) \
1669 ++ list_first_entry_or_null(&(exts)->actions, \
1670 ++ struct tc_action, list)
1671 +
1672 + int tcf_exts_dump(struct sk_buff *skb, struct tcf_exts *exts)
1673 + {
1674 +@@ -603,7 +604,7 @@ int tcf_exts_dump_stats(struct sk_buff *skb, struct tcf_exts *exts)
1675 + {
1676 + #ifdef CONFIG_NET_CLS_ACT
1677 + struct tc_action *a = tcf_exts_first_act(exts);
1678 +- if (tcf_action_copy_stats(skb, a, 1) < 0)
1679 ++ if (a != NULL && tcf_action_copy_stats(skb, a, 1) < 0)
1680 + return -1;
1681 + #endif
1682 + return 0;
1683 diff --git a/net/sched/cls_bpf.c b/net/sched/cls_bpf.c
1684 index eed49d1..ce22514 100644
1685 --- a/net/sched/cls_bpf.c
1686 @@ -105827,10 +106334,39 @@ index fef2acd..c705c4f 100644
1687 sctp_generate_t1_cookie_event,
1688 sctp_generate_t1_init_event,
1689 diff --git a/net/sctp/socket.c b/net/sctp/socket.c
1690 -index 634a2ab..8e93929 100644
1691 +index 634a2ab..dfdaf9b 100644
1692 --- a/net/sctp/socket.c
1693 +++ b/net/sctp/socket.c
1694 -@@ -2199,11 +2199,13 @@ static int sctp_setsockopt_events(struct sock *sk, char __user *optval,
1695 +@@ -1603,7 +1603,7 @@ static int sctp_sendmsg(struct kiocb *iocb, struct sock *sk,
1696 + sctp_assoc_t associd = 0;
1697 + sctp_cmsgs_t cmsgs = { NULL };
1698 + sctp_scope_t scope;
1699 +- bool fill_sinfo_ttl = false;
1700 ++ bool fill_sinfo_ttl = false, wait_connect = false;
1701 + struct sctp_datamsg *datamsg;
1702 + int msg_flags = msg->msg_flags;
1703 + __u16 sinfo_flags = 0;
1704 +@@ -1943,6 +1943,7 @@ static int sctp_sendmsg(struct kiocb *iocb, struct sock *sk,
1705 + if (err < 0)
1706 + goto out_free;
1707 +
1708 ++ wait_connect = true;
1709 + pr_debug("%s: we associated primitively\n", __func__);
1710 + }
1711 +
1712 +@@ -1980,6 +1981,11 @@ static int sctp_sendmsg(struct kiocb *iocb, struct sock *sk,
1713 + sctp_datamsg_put(datamsg);
1714 + err = msg_len;
1715 +
1716 ++ if (unlikely(wait_connect)) {
1717 ++ timeo = sock_sndtimeo(sk, msg_flags & MSG_DONTWAIT);
1718 ++ sctp_wait_for_connect(asoc, &timeo);
1719 ++ }
1720 ++
1721 + /* If we are already past ASSOCIATE, the lower
1722 + * layers are responsible for association cleanup.
1723 + */
1724 +@@ -2199,11 +2205,13 @@ static int sctp_setsockopt_events(struct sock *sk, char __user *optval,
1725 {
1726 struct sctp_association *asoc;
1727 struct sctp_ulpevent *event;
1728 @@ -105845,7 +106381,7 @@ index 634a2ab..8e93929 100644
1729
1730 if (sctp_sk(sk)->subscribe.sctp_data_io_event)
1731 pr_warn_ratelimited(DEPRECATED "%s (pid %d) "
1732 -@@ -4372,13 +4374,16 @@ static int sctp_getsockopt_disable_fragments(struct sock *sk, int len,
1733 +@@ -4372,13 +4380,16 @@ static int sctp_getsockopt_disable_fragments(struct sock *sk, int len,
1734 static int sctp_getsockopt_events(struct sock *sk, int len, char __user *optval,
1735 int __user *optlen)
1736 {
1737 @@ -105863,7 +106399,7 @@ index 634a2ab..8e93929 100644
1738 return -EFAULT;
1739 return 0;
1740 }
1741 -@@ -4396,6 +4401,8 @@ static int sctp_getsockopt_events(struct sock *sk, int len, char __user *optval,
1742 +@@ -4396,6 +4407,8 @@ static int sctp_getsockopt_events(struct sock *sk, int len, char __user *optval,
1743 */
1744 static int sctp_getsockopt_autoclose(struct sock *sk, int len, char __user *optval, int __user *optlen)
1745 {
1746 @@ -105872,7 +106408,7 @@ index 634a2ab..8e93929 100644
1747 /* Applicable to UDP-style socket only */
1748 if (sctp_style(sk, TCP))
1749 return -EOPNOTSUPP;
1750 -@@ -4404,7 +4411,8 @@ static int sctp_getsockopt_autoclose(struct sock *sk, int len, char __user *optv
1751 +@@ -4404,7 +4417,8 @@ static int sctp_getsockopt_autoclose(struct sock *sk, int len, char __user *optv
1752 len = sizeof(int);
1753 if (put_user(len, optlen))
1754 return -EFAULT;
1755 @@ -105882,7 +106418,7 @@ index 634a2ab..8e93929 100644
1756 return -EFAULT;
1757 return 0;
1758 }
1759 -@@ -4778,12 +4786,15 @@ static int sctp_getsockopt_delayed_ack(struct sock *sk, int len,
1760 +@@ -4778,12 +4792,15 @@ static int sctp_getsockopt_delayed_ack(struct sock *sk, int len,
1761 */
1762 static int sctp_getsockopt_initmsg(struct sock *sk, int len, char __user *optval, int __user *optlen)
1763 {
1764 @@ -105899,7 +106435,7 @@ index 634a2ab..8e93929 100644
1765 return -EFAULT;
1766 return 0;
1767 }
1768 -@@ -4824,6 +4835,8 @@ static int sctp_getsockopt_peer_addrs(struct sock *sk, int len,
1769 +@@ -4824,6 +4841,8 @@ static int sctp_getsockopt_peer_addrs(struct sock *sk, int len,
1770 ->addr_to_user(sp, &temp);
1771 if (space_left < addrlen)
1772 return -ENOMEM;
1773 @@ -107012,6 +107548,19 @@ index 05a6e3d..6716ec9 100644
1774
1775 __xfrm_sysctl_init(net);
1776
1777 +diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include
1778 +index 65e7b08..1b868d5 100644
1779 +--- a/scripts/Kbuild.include
1780 ++++ b/scripts/Kbuild.include
1781 +@@ -144,7 +144,7 @@ cc-ifversion = $(shell [ $(call cc-version, $(CC)) $(1) $(2) ] && echo $(3))
1782 + # cc-ldoption
1783 + # Usage: ldflags += $(call cc-ldoption, -Wl$(comma)--hash-style=both)
1784 + cc-ldoption = $(call try-run,\
1785 +- $(CC) $(1) -nostdlib -x c /dev/null -o "$$TMP",$(1),$(2))
1786 ++ $(CC) $(1) -Wl,-r -nostdlib -x c /dev/null -o "$$TMP",$(1),$(2))
1787 +
1788 + # ld-option
1789 + # Usage: LDFLAGS += $(call ld-option, -X)
1790 diff --git a/scripts/Makefile.build b/scripts/Makefile.build
1791 index 649ce68..f6bc05c 100644
1792 --- a/scripts/Makefile.build
1793
1794 diff --git a/3.2.66/0000_README b/3.2.66/0000_README
1795 index 2b43bf6..3806e75 100644
1796 --- a/3.2.66/0000_README
1797 +++ b/3.2.66/0000_README
1798 @@ -182,7 +182,7 @@ Patch: 1065_linux-3.2.66.patch
1799 From: http://www.kernel.org
1800 Desc: Linux 3.2.66
1801
1802 -Patch: 4420_grsecurity-3.0-3.2.66-201501272306.patch
1803 +Patch: 4420_grsecurity-3.0-3.2.66-201502052350.patch
1804 From: http://www.grsecurity.net
1805 Desc: hardened-sources base patch from upstream grsecurity
1806
1807
1808 diff --git a/3.2.66/4420_grsecurity-3.0-3.2.66-201501272306.patch b/3.2.66/4420_grsecurity-3.0-3.2.66-201502052350.patch
1809 similarity index 99%
1810 rename from 3.2.66/4420_grsecurity-3.0-3.2.66-201501272306.patch
1811 rename to 3.2.66/4420_grsecurity-3.0-3.2.66-201502052350.patch
1812 index 082c246..520ed1e 100644
1813 --- a/3.2.66/4420_grsecurity-3.0-3.2.66-201501272306.patch
1814 +++ b/3.2.66/4420_grsecurity-3.0-3.2.66-201502052350.patch
1815 @@ -18748,7 +18748,7 @@ index c99f9ed..76cf602 100644
1816 +EXPORT_SYMBOL(pax_check_alloca);
1817 +#endif
1818 diff --git a/arch/x86/kernel/dumpstack_64.c b/arch/x86/kernel/dumpstack_64.c
1819 -index 5e890cc..048f251 100644
1820 +index 5e890cc..66ec71b 100644
1821 --- a/arch/x86/kernel/dumpstack_64.c
1822 +++ b/arch/x86/kernel/dumpstack_64.c
1823 @@ -118,9 +118,9 @@ void dump_trace(struct task_struct *task, struct pt_regs *regs,
1824 @@ -18821,7 +18821,13 @@ index 5e890cc..048f251 100644
1825 struct task_struct *cur = current;
1826
1827 sp = regs->sp;
1828 -@@ -304,3 +308,50 @@ int is_valid_bugaddr(unsigned long ip)
1829 +@@ -299,8 +303,55 @@ int is_valid_bugaddr(unsigned long ip)
1830 + {
1831 + unsigned short ud2;
1832 +
1833 +- if (__copy_from_user(&ud2, (const void __user *) ip, sizeof(ud2)))
1834 ++ if (probe_kernel_address((unsigned short *)ip, ud2))
1835 + return 0;
1836
1837 return ud2 == 0x0b0f;
1838 }
1839 @@ -18900,10 +18906,10 @@ index cd28a35..c72ed9a 100644
1840 #include <asm/processor.h>
1841 #include <asm/fcntl.h>
1842 diff --git a/arch/x86/kernel/entry_32.S b/arch/x86/kernel/entry_32.S
1843 -index 0fa4f89..40ff646 100644
1844 +index 0fa4f89..dbbfa58 100644
1845 --- a/arch/x86/kernel/entry_32.S
1846 +++ b/arch/x86/kernel/entry_32.S
1847 -@@ -180,13 +180,153 @@
1848 +@@ -180,13 +180,154 @@
1849 /*CFI_REL_OFFSET gs, PT_GS*/
1850 .endm
1851 .macro SET_KERNEL_GS reg
1852 @@ -19032,6 +19038,7 @@ index 0fa4f89..40ff646 100644
1853 + jne 1b
1854 +
1855 +2: cld
1856 ++ or $2*4, %edi
1857 + mov %esp, %ecx
1858 + sub %edi, %ecx
1859 +
1860 @@ -19058,7 +19065,7 @@ index 0fa4f89..40ff646 100644
1861 cld
1862 PUSH_GS
1863 pushl_cfi %fs
1864 -@@ -209,7 +349,7 @@
1865 +@@ -209,7 +350,7 @@
1866 CFI_REL_OFFSET ecx, 0
1867 pushl_cfi %ebx
1868 CFI_REL_OFFSET ebx, 0
1869 @@ -19067,7 +19074,7 @@ index 0fa4f89..40ff646 100644
1870 movl %edx, %ds
1871 movl %edx, %es
1872 movl $(__KERNEL_PERCPU), %edx
1873 -@@ -217,6 +357,15 @@
1874 +@@ -217,6 +358,15 @@
1875 SET_KERNEL_GS %edx
1876 .endm
1877
1878 @@ -19083,7 +19090,7 @@ index 0fa4f89..40ff646 100644
1879 .macro RESTORE_INT_REGS
1880 popl_cfi %ebx
1881 CFI_RESTORE ebx
1882 -@@ -302,7 +451,7 @@ ENTRY(ret_from_fork)
1883 +@@ -302,7 +452,7 @@ ENTRY(ret_from_fork)
1884 popfl_cfi
1885 jmp syscall_exit
1886 CFI_ENDPROC
1887 @@ -19092,7 +19099,7 @@ index 0fa4f89..40ff646 100644
1888
1889 /*
1890 * Interrupt exit functions should be protected against kprobes
1891 -@@ -336,7 +485,15 @@ resume_userspace_sig:
1892 +@@ -336,7 +486,15 @@ resume_userspace_sig:
1893 andl $SEGMENT_RPL_MASK, %eax
1894 #endif
1895 cmpl $USER_RPL, %eax
1896 @@ -19108,7 +19115,7 @@ index 0fa4f89..40ff646 100644
1897
1898 ENTRY(resume_userspace)
1899 LOCKDEP_SYS_EXIT
1900 -@@ -348,8 +505,8 @@ ENTRY(resume_userspace)
1901 +@@ -348,8 +506,8 @@ ENTRY(resume_userspace)
1902 andl $_TIF_WORK_MASK, %ecx # is there any work to be done on
1903 # int/exception return?
1904 jne work_pending
1905 @@ -19119,7 +19126,7 @@ index 0fa4f89..40ff646 100644
1906
1907 #ifdef CONFIG_PREEMPT
1908 ENTRY(resume_kernel)
1909 -@@ -364,7 +521,7 @@ need_resched:
1910 +@@ -364,7 +522,7 @@ need_resched:
1911 jz restore_all
1912 call preempt_schedule_irq
1913 jmp need_resched
1914 @@ -19128,7 +19135,7 @@ index 0fa4f89..40ff646 100644
1915 #endif
1916 CFI_ENDPROC
1917 /*
1918 -@@ -398,23 +555,34 @@ sysenter_past_esp:
1919 +@@ -398,23 +556,34 @@ sysenter_past_esp:
1920 /*CFI_REL_OFFSET cs, 0*/
1921 /*
1922 * Push current_thread_info()->sysenter_return to the stack.
1923 @@ -19166,7 +19173,7 @@ index 0fa4f89..40ff646 100644
1924 movl %ebp,PT_EBP(%esp)
1925 .section __ex_table,"a"
1926 .align 4
1927 -@@ -423,6 +591,10 @@ sysenter_past_esp:
1928 +@@ -423,6 +592,10 @@ sysenter_past_esp:
1929
1930 GET_THREAD_INFO(%ebp)
1931
1932 @@ -19177,7 +19184,7 @@ index 0fa4f89..40ff646 100644
1933 testl $_TIF_WORK_SYSCALL_ENTRY,TI_flags(%ebp)
1934 jnz sysenter_audit
1935 sysenter_do_call:
1936 -@@ -438,12 +610,24 @@ sysenter_after_call:
1937 +@@ -438,12 +611,24 @@ sysenter_after_call:
1938 testl $_TIF_ALLWORK_MASK, %ecx
1939 jne sysexit_audit
1940 sysenter_exit:
1941 @@ -19202,7 +19209,7 @@ index 0fa4f89..40ff646 100644
1942 PTGS_TO_GS
1943 ENABLE_INTERRUPTS_SYSEXIT
1944
1945 -@@ -460,6 +644,9 @@ sysenter_audit:
1946 +@@ -460,6 +645,9 @@ sysenter_audit:
1947 movl %eax,%edx /* 2nd arg: syscall number */
1948 movl $AUDIT_ARCH_I386,%eax /* 1st arg: audit arch */
1949 call audit_syscall_entry
1950 @@ -19212,7 +19219,7 @@ index 0fa4f89..40ff646 100644
1951 pushl_cfi %ebx
1952 movl PT_EAX(%esp),%eax /* reload syscall number */
1953 jmp sysenter_do_call
1954 -@@ -486,11 +673,17 @@ sysexit_audit:
1955 +@@ -486,11 +674,17 @@ sysexit_audit:
1956
1957 CFI_ENDPROC
1958 .pushsection .fixup,"ax"
1959 @@ -19232,7 +19239,7 @@ index 0fa4f89..40ff646 100644
1960 .popsection
1961 PTGS_TO_GS_EX
1962 ENDPROC(ia32_sysenter_target)
1963 -@@ -505,6 +698,11 @@ ENTRY(system_call)
1964 +@@ -505,6 +699,11 @@ ENTRY(system_call)
1965 pushl_cfi %eax # save orig_eax
1966 SAVE_ALL
1967 GET_THREAD_INFO(%ebp)
1968 @@ -19244,7 +19251,7 @@ index 0fa4f89..40ff646 100644
1969 # system call tracing in operation / emulation
1970 testl $_TIF_WORK_SYSCALL_ENTRY,TI_flags(%ebp)
1971 jnz syscall_trace_entry
1972 -@@ -524,6 +722,15 @@ syscall_exit:
1973 +@@ -524,6 +723,15 @@ syscall_exit:
1974 testl $_TIF_ALLWORK_MASK, %ecx # current->work
1975 jne syscall_exit_work
1976
1977 @@ -19260,7 +19267,7 @@ index 0fa4f89..40ff646 100644
1978 restore_all:
1979 TRACE_IRQS_IRET
1980 restore_all_notrace:
1981 -@@ -581,14 +788,34 @@ ldt_ss:
1982 +@@ -581,14 +789,34 @@ ldt_ss:
1983 * compensating for the offset by changing to the ESPFIX segment with
1984 * a base address that matches for the difference.
1985 */
1986 @@ -19298,7 +19305,7 @@ index 0fa4f89..40ff646 100644
1987 pushl_cfi $__ESPFIX_SS
1988 pushl_cfi %eax /* new kernel esp */
1989 /* Disable interrupts, but do not irqtrace this section: we
1990 -@@ -618,34 +845,28 @@ work_resched:
1991 +@@ -618,34 +846,28 @@ work_resched:
1992 movl TI_flags(%ebp), %ecx
1993 andl $_TIF_WORK_MASK, %ecx # is there any work to be done other
1994 # than syscall tracing?
1995 @@ -19338,7 +19345,7 @@ index 0fa4f89..40ff646 100644
1996
1997 # perform syscall exit tracing
1998 ALIGN
1999 -@@ -653,11 +874,14 @@ syscall_trace_entry:
2000 +@@ -653,11 +875,14 @@ syscall_trace_entry:
2001 movl $-ENOSYS,PT_EAX(%esp)
2002 movl %esp, %eax
2003 call syscall_trace_enter
2004 @@ -19354,7 +19361,7 @@ index 0fa4f89..40ff646 100644
2005
2006 # perform syscall exit tracing
2007 ALIGN
2008 -@@ -670,25 +894,29 @@ syscall_exit_work:
2009 +@@ -670,25 +895,29 @@ syscall_exit_work:
2010 movl %esp, %eax
2011 call syscall_trace_leave
2012 jmp resume_userspace
2013 @@ -19388,7 +19395,7 @@ index 0fa4f89..40ff646 100644
2014 CFI_ENDPROC
2015 /*
2016 * End of kprobes section
2017 -@@ -762,6 +990,36 @@ ptregs_clone:
2018 +@@ -762,6 +991,36 @@ ptregs_clone:
2019 CFI_ENDPROC
2020 ENDPROC(ptregs_clone)
2021
2022 @@ -19425,7 +19432,7 @@ index 0fa4f89..40ff646 100644
2023 .macro FIXUP_ESPFIX_STACK
2024 /*
2025 * Switch back for ESPFIX stack to the normal zerobased stack
2026 -@@ -772,8 +1030,15 @@ ENDPROC(ptregs_clone)
2027 +@@ -772,8 +1031,15 @@ ENDPROC(ptregs_clone)
2028 */
2029 #ifdef CONFIG_X86_ESPFIX32
2030 /* fixup the stack */
2031 @@ -19443,7 +19450,7 @@ index 0fa4f89..40ff646 100644
2032 shl $16, %eax
2033 addl %esp, %eax /* the adjusted stack pointer */
2034 pushl_cfi $__KERNEL_DS
2035 -@@ -829,7 +1094,7 @@ vector=vector+1
2036 +@@ -829,7 +1095,7 @@ vector=vector+1
2037 .endr
2038 2: jmp common_interrupt
2039 .endr
2040 @@ -19452,7 +19459,7 @@ index 0fa4f89..40ff646 100644
2041
2042 .previous
2043 END(interrupt)
2044 -@@ -877,7 +1142,7 @@ ENTRY(coprocessor_error)
2045 +@@ -877,7 +1143,7 @@ ENTRY(coprocessor_error)
2046 pushl_cfi $do_coprocessor_error
2047 jmp error_code
2048 CFI_ENDPROC
2049 @@ -19461,7 +19468,7 @@ index 0fa4f89..40ff646 100644
2050
2051 ENTRY(simd_coprocessor_error)
2052 RING0_INT_FRAME
2053 -@@ -898,7 +1163,7 @@ ENTRY(simd_coprocessor_error)
2054 +@@ -898,7 +1164,7 @@ ENTRY(simd_coprocessor_error)
2055 #endif
2056 jmp error_code
2057 CFI_ENDPROC
2058 @@ -19470,7 +19477,7 @@ index 0fa4f89..40ff646 100644
2059
2060 ENTRY(device_not_available)
2061 RING0_INT_FRAME
2062 -@@ -906,7 +1171,7 @@ ENTRY(device_not_available)
2063 +@@ -906,7 +1172,7 @@ ENTRY(device_not_available)
2064 pushl_cfi $do_device_not_available
2065 jmp error_code
2066 CFI_ENDPROC
2067 @@ -19479,7 +19486,7 @@ index 0fa4f89..40ff646 100644
2068
2069 #ifdef CONFIG_PARAVIRT
2070 ENTRY(native_iret)
2071 -@@ -915,12 +1180,12 @@ ENTRY(native_iret)
2072 +@@ -915,12 +1181,12 @@ ENTRY(native_iret)
2073 .align 4
2074 .long native_iret, iret_exc
2075 .previous
2076 @@ -19494,7 +19501,7 @@ index 0fa4f89..40ff646 100644
2077 #endif
2078
2079 ENTRY(overflow)
2080 -@@ -929,7 +1194,7 @@ ENTRY(overflow)
2081 +@@ -929,7 +1195,7 @@ ENTRY(overflow)
2082 pushl_cfi $do_overflow
2083 jmp error_code
2084 CFI_ENDPROC
2085 @@ -19503,7 +19510,7 @@ index 0fa4f89..40ff646 100644
2086
2087 ENTRY(bounds)
2088 RING0_INT_FRAME
2089 -@@ -937,7 +1202,7 @@ ENTRY(bounds)
2090 +@@ -937,7 +1203,7 @@ ENTRY(bounds)
2091 pushl_cfi $do_bounds
2092 jmp error_code
2093 CFI_ENDPROC
2094 @@ -19512,7 +19519,7 @@ index 0fa4f89..40ff646 100644
2095
2096 ENTRY(invalid_op)
2097 RING0_INT_FRAME
2098 -@@ -945,7 +1210,7 @@ ENTRY(invalid_op)
2099 +@@ -945,7 +1211,7 @@ ENTRY(invalid_op)
2100 pushl_cfi $do_invalid_op
2101 jmp error_code
2102 CFI_ENDPROC
2103 @@ -19521,7 +19528,7 @@ index 0fa4f89..40ff646 100644
2104
2105 ENTRY(coprocessor_segment_overrun)
2106 RING0_INT_FRAME
2107 -@@ -953,35 +1218,35 @@ ENTRY(coprocessor_segment_overrun)
2108 +@@ -953,35 +1219,35 @@ ENTRY(coprocessor_segment_overrun)
2109 pushl_cfi $do_coprocessor_segment_overrun
2110 jmp error_code
2111 CFI_ENDPROC
2112 @@ -19562,7 +19569,7 @@ index 0fa4f89..40ff646 100644
2113
2114 ENTRY(divide_error)
2115 RING0_INT_FRAME
2116 -@@ -989,7 +1254,7 @@ ENTRY(divide_error)
2117 +@@ -989,7 +1255,7 @@ ENTRY(divide_error)
2118 pushl_cfi $do_divide_error
2119 jmp error_code
2120 CFI_ENDPROC
2121 @@ -19571,7 +19578,7 @@ index 0fa4f89..40ff646 100644
2122
2123 #ifdef CONFIG_X86_MCE
2124 ENTRY(machine_check)
2125 -@@ -998,7 +1263,7 @@ ENTRY(machine_check)
2126 +@@ -998,7 +1264,7 @@ ENTRY(machine_check)
2127 pushl_cfi machine_check_vector
2128 jmp error_code
2129 CFI_ENDPROC
2130 @@ -19580,7 +19587,7 @@ index 0fa4f89..40ff646 100644
2131 #endif
2132
2133 ENTRY(spurious_interrupt_bug)
2134 -@@ -1007,7 +1272,7 @@ ENTRY(spurious_interrupt_bug)
2135 +@@ -1007,7 +1273,7 @@ ENTRY(spurious_interrupt_bug)
2136 pushl_cfi $do_spurious_interrupt_bug
2137 jmp error_code
2138 CFI_ENDPROC
2139 @@ -19589,7 +19596,7 @@ index 0fa4f89..40ff646 100644
2140 /*
2141 * End of kprobes section
2142 */
2143 -@@ -1123,7 +1388,7 @@ BUILD_INTERRUPT3(xen_hvm_callback_vector, XEN_HVM_EVTCHN_CALLBACK,
2144 +@@ -1123,7 +1389,7 @@ BUILD_INTERRUPT3(xen_hvm_callback_vector, XEN_HVM_EVTCHN_CALLBACK,
2145
2146 ENTRY(mcount)
2147 ret
2148 @@ -19598,7 +19605,7 @@ index 0fa4f89..40ff646 100644
2149
2150 ENTRY(ftrace_caller)
2151 cmpl $0, function_trace_stop
2152 -@@ -1152,7 +1417,7 @@ ftrace_graph_call:
2153 +@@ -1152,7 +1418,7 @@ ftrace_graph_call:
2154 .globl ftrace_stub
2155 ftrace_stub:
2156 ret
2157 @@ -19607,7 +19614,7 @@ index 0fa4f89..40ff646 100644
2158
2159 #else /* ! CONFIG_DYNAMIC_FTRACE */
2160
2161 -@@ -1188,7 +1453,7 @@ trace:
2162 +@@ -1188,7 +1454,7 @@ trace:
2163 popl %ecx
2164 popl %eax
2165 jmp ftrace_stub
2166 @@ -19616,7 +19623,7 @@ index 0fa4f89..40ff646 100644
2167 #endif /* CONFIG_DYNAMIC_FTRACE */
2168 #endif /* CONFIG_FUNCTION_TRACER */
2169
2170 -@@ -1209,7 +1474,7 @@ ENTRY(ftrace_graph_caller)
2171 +@@ -1209,7 +1475,7 @@ ENTRY(ftrace_graph_caller)
2172 popl %ecx
2173 popl %eax
2174 ret
2175 @@ -19625,7 +19632,7 @@ index 0fa4f89..40ff646 100644
2176
2177 .globl return_to_handler
2178 return_to_handler:
2179 -@@ -1223,7 +1488,6 @@ return_to_handler:
2180 +@@ -1223,7 +1489,6 @@ return_to_handler:
2181 jmp *%ecx
2182 #endif
2183
2184 @@ -19633,7 +19640,7 @@ index 0fa4f89..40ff646 100644
2185 #include "syscall_table_32.S"
2186
2187 syscall_table_size=(.-sys_call_table)
2188 -@@ -1269,15 +1533,18 @@ error_code:
2189 +@@ -1269,15 +1534,18 @@ error_code:
2190 movl $-1, PT_ORIG_EAX(%esp) # no syscall to restart
2191 REG_TO_PTGS %ecx
2192 SET_KERNEL_GS %ecx
2193 @@ -19654,7 +19661,7 @@ index 0fa4f89..40ff646 100644
2194
2195 /*
2196 * Debug traps and NMI can happen at the one SYSENTER instruction
2197 -@@ -1319,7 +1586,7 @@ debug_stack_correct:
2198 +@@ -1319,7 +1587,7 @@ debug_stack_correct:
2199 call do_debug
2200 jmp ret_from_exception
2201 CFI_ENDPROC
2202 @@ -19663,7 +19670,7 @@ index 0fa4f89..40ff646 100644
2203
2204 /*
2205 * NMI is doubly nasty. It can happen _while_ we're handling
2206 -@@ -1358,6 +1625,9 @@ nmi_stack_correct:
2207 +@@ -1358,6 +1626,9 @@ nmi_stack_correct:
2208 xorl %edx,%edx # zero error code
2209 movl %esp,%eax # pt_regs pointer
2210 call do_nmi
2211 @@ -19673,7 +19680,7 @@ index 0fa4f89..40ff646 100644
2212 jmp restore_all_notrace
2213 CFI_ENDPROC
2214
2215 -@@ -1395,13 +1665,16 @@ nmi_espfix_stack:
2216 +@@ -1395,13 +1666,16 @@ nmi_espfix_stack:
2217 FIXUP_ESPFIX_STACK # %eax == %esp
2218 xorl %edx,%edx # zero error code
2219 call do_nmi
2220 @@ -19691,7 +19698,7 @@ index 0fa4f89..40ff646 100644
2221
2222 ENTRY(int3)
2223 RING0_INT_FRAME
2224 -@@ -1413,14 +1686,14 @@ ENTRY(int3)
2225 +@@ -1413,14 +1687,14 @@ ENTRY(int3)
2226 call do_int3
2227 jmp ret_from_exception
2228 CFI_ENDPROC
2229 @@ -19708,7 +19715,7 @@ index 0fa4f89..40ff646 100644
2230
2231 #ifdef CONFIG_KVM_GUEST
2232 ENTRY(async_page_fault)
2233 -@@ -1428,7 +1701,7 @@ ENTRY(async_page_fault)
2234 +@@ -1428,7 +1702,7 @@ ENTRY(async_page_fault)
2235 pushl_cfi $do_async_page_fault
2236 jmp error_code
2237 CFI_ENDPROC
2238 @@ -19718,7 +19725,7 @@ index 0fa4f89..40ff646 100644
2239
2240 /*
2241 diff --git a/arch/x86/kernel/entry_64.S b/arch/x86/kernel/entry_64.S
2242 -index 9d28dbac..43bde59 100644
2243 +index 9d28dbac..d5f7d1d 100644
2244 --- a/arch/x86/kernel/entry_64.S
2245 +++ b/arch/x86/kernel/entry_64.S
2246 @@ -56,6 +56,8 @@
2247 @@ -19794,7 +19801,7 @@ index 9d28dbac..43bde59 100644
2248 jmp *%rdi
2249 #endif
2250
2251 -@@ -179,6 +187,285 @@ ENTRY(native_usergs_sysret64)
2252 +@@ -179,6 +187,286 @@ ENTRY(native_usergs_sysret64)
2253 ENDPROC(native_usergs_sysret64)
2254 #endif /* CONFIG_PARAVIRT */
2255
2256 @@ -20054,6 +20061,7 @@ index 9d28dbac..43bde59 100644
2257 + jne 1b
2258 +
2259 +2: cld
2260 ++ or $2*8, %rdi
2261 + mov %esp, %ecx
2262 + sub %edi, %ecx
2263 +
2264 @@ -20080,7 +20088,7 @@ index 9d28dbac..43bde59 100644
2265
2266 .macro TRACE_IRQS_IRETQ offset=ARGOFFSET
2267 #ifdef CONFIG_TRACE_IRQFLAGS
2268 -@@ -232,8 +519,8 @@ ENDPROC(native_usergs_sysret64)
2269 +@@ -232,8 +520,8 @@ ENDPROC(native_usergs_sysret64)
2270 .endm
2271
2272 .macro UNFAKE_STACK_FRAME
2273 @@ -20091,7 +20099,7 @@ index 9d28dbac..43bde59 100644
2274 .endm
2275
2276 /*
2277 -@@ -302,25 +589,26 @@ ENDPROC(native_usergs_sysret64)
2278 +@@ -302,25 +590,26 @@ ENDPROC(native_usergs_sysret64)
2279 /* save partial stack frame */
2280 .macro SAVE_ARGS_IRQ
2281 cld
2282 @@ -20131,7 +20139,7 @@ index 9d28dbac..43bde59 100644
2283 je 1f
2284 SWAPGS
2285 /*
2286 -@@ -341,24 +629,39 @@ ENDPROC(native_usergs_sysret64)
2287 +@@ -341,24 +630,39 @@ ENDPROC(native_usergs_sysret64)
2288 0x06 /* DW_OP_deref */, \
2289 0x08 /* DW_OP_const1u */, SS+8-RBP, \
2290 0x22 /* DW_OP_plus */
2291 @@ -20175,7 +20183,7 @@ index 9d28dbac..43bde59 100644
2292
2293 /* save complete stack frame */
2294 .pushsection .kprobes.text, "ax"
2295 -@@ -387,10 +690,21 @@ ENTRY(save_paranoid)
2296 +@@ -387,10 +691,21 @@ ENTRY(save_paranoid)
2297 js 1f /* negative -> in kernel */
2298 SWAPGS
2299 xorl %ebx,%ebx
2300 @@ -20200,7 +20208,7 @@ index 9d28dbac..43bde59 100644
2301
2302 /*
2303 * A newly forked process directly context switches into this address.
2304 -@@ -411,7 +725,7 @@ ENTRY(ret_from_fork)
2305 +@@ -411,7 +726,7 @@ ENTRY(ret_from_fork)
2306
2307 RESTORE_REST
2308
2309 @@ -20209,7 +20217,7 @@ index 9d28dbac..43bde59 100644
2310 je int_ret_from_sys_call
2311
2312 testl $_TIF_IA32, TI_flags(%rcx) # 32-bit compat task needs IRET
2313 -@@ -421,7 +735,7 @@ ENTRY(ret_from_fork)
2314 +@@ -421,7 +736,7 @@ ENTRY(ret_from_fork)
2315 jmp ret_from_sys_call # go to the SYSRET fastpath
2316
2317 CFI_ENDPROC
2318 @@ -20218,7 +20226,7 @@ index 9d28dbac..43bde59 100644
2319
2320 /*
2321 * System call entry. Up to 6 arguments in registers are supported.
2322 -@@ -457,7 +771,7 @@ END(ret_from_fork)
2323 +@@ -457,7 +772,7 @@ END(ret_from_fork)
2324 ENTRY(system_call)
2325 CFI_STARTPROC simple
2326 CFI_SIGNAL_FRAME
2327 @@ -20227,7 +20235,7 @@ index 9d28dbac..43bde59 100644
2328 CFI_REGISTER rip,rcx
2329 /*CFI_REGISTER rflags,r11*/
2330 SWAPGS_UNSAFE_STACK
2331 -@@ -470,12 +784,18 @@ ENTRY(system_call_after_swapgs)
2332 +@@ -470,12 +785,18 @@ ENTRY(system_call_after_swapgs)
2333
2334 movq %rsp,PER_CPU_VAR(old_rsp)
2335 movq PER_CPU_VAR(kernel_stack),%rsp
2336 @@ -20247,7 +20255,7 @@ index 9d28dbac..43bde59 100644
2337 movq %rax,ORIG_RAX-ARGOFFSET(%rsp)
2338 movq %rcx,RIP-ARGOFFSET(%rsp)
2339 CFI_REL_OFFSET rip,RIP-ARGOFFSET
2340 -@@ -504,6 +824,8 @@ sysret_check:
2341 +@@ -504,6 +825,8 @@ sysret_check:
2342 andl %edi,%edx
2343 jnz sysret_careful
2344 CFI_REMEMBER_STATE
2345 @@ -20256,7 +20264,7 @@ index 9d28dbac..43bde59 100644
2346 /*
2347 * sysretq will re-enable interrupts:
2348 */
2349 -@@ -562,6 +884,9 @@ auditsys:
2350 +@@ -562,6 +885,9 @@ auditsys:
2351 movq %rax,%rsi /* 2nd arg: syscall number */
2352 movl $AUDIT_ARCH_X86_64,%edi /* 1st arg: audit arch */
2353 call audit_syscall_entry
2354 @@ -20266,7 +20274,7 @@ index 9d28dbac..43bde59 100644
2355 LOAD_ARGS 0 /* reload call-clobbered registers */
2356 jmp system_call_fastpath
2357
2358 -@@ -592,12 +917,15 @@ tracesys:
2359 +@@ -592,12 +918,15 @@ tracesys:
2360 FIXUP_TOP_OF_STACK %rdi
2361 movq %rsp,%rdi
2362 call syscall_trace_enter
2363 @@ -20283,7 +20291,7 @@ index 9d28dbac..43bde59 100644
2364 RESTORE_REST
2365 cmpq $__NR_syscall_max,%rax
2366 ja int_ret_from_sys_call /* RAX(%rsp) set to -ENOSYS above */
2367 -@@ -613,7 +941,7 @@ tracesys:
2368 +@@ -613,7 +942,7 @@ tracesys:
2369 GLOBAL(int_ret_from_sys_call)
2370 DISABLE_INTERRUPTS(CLBR_NONE)
2371 TRACE_IRQS_OFF
2372 @@ -20292,7 +20300,7 @@ index 9d28dbac..43bde59 100644
2373 je retint_restore_args
2374 movl $_TIF_ALLWORK_MASK,%edi
2375 /* edi: mask to check */
2376 -@@ -624,7 +952,9 @@ GLOBAL(int_with_check)
2377 +@@ -624,7 +953,9 @@ GLOBAL(int_with_check)
2378 andl %edi,%edx
2379 jnz int_careful
2380 andl $~TS_COMPAT,TI_status(%rcx)
2381 @@ -20303,7 +20311,7 @@ index 9d28dbac..43bde59 100644
2382
2383 /* Either reschedule or signal or syscall exit tracking needed. */
2384 /* First do a reschedule test. */
2385 -@@ -670,7 +1000,7 @@ int_restore_rest:
2386 +@@ -670,7 +1001,7 @@ int_restore_rest:
2387 TRACE_IRQS_OFF
2388 jmp int_with_check
2389 CFI_ENDPROC
2390 @@ -20312,7 +20320,7 @@ index 9d28dbac..43bde59 100644
2391
2392 /*
2393 * Certain special system calls that need to save a complete full stack frame.
2394 -@@ -678,15 +1008,13 @@ END(system_call)
2395 +@@ -678,15 +1009,13 @@ END(system_call)
2396 .macro PTREGSCALL label,func,arg
2397 ENTRY(\label)
2398 PARTIAL_FRAME 1 8 /* offset 8: return address */
2399 @@ -20329,7 +20337,7 @@ index 9d28dbac..43bde59 100644
2400 .endm
2401
2402 PTREGSCALL stub_clone, sys_clone, %r8
2403 -@@ -701,12 +1029,17 @@ ENTRY(ptregscall_common)
2404 +@@ -701,12 +1030,17 @@ ENTRY(ptregscall_common)
2405 movq_cfi_restore R15+8, r15
2406 movq_cfi_restore R14+8, r14
2407 movq_cfi_restore R13+8, r13
2408 @@ -20349,7 +20357,7 @@ index 9d28dbac..43bde59 100644
2409
2410 ENTRY(stub_execve)
2411 CFI_STARTPROC
2412 -@@ -721,7 +1054,7 @@ ENTRY(stub_execve)
2413 +@@ -721,7 +1055,7 @@ ENTRY(stub_execve)
2414 RESTORE_REST
2415 jmp int_ret_from_sys_call
2416 CFI_ENDPROC
2417 @@ -20358,7 +20366,7 @@ index 9d28dbac..43bde59 100644
2418
2419 /*
2420 * sigreturn is special because it needs to restore all registers on return.
2421 -@@ -739,7 +1072,7 @@ ENTRY(stub_rt_sigreturn)
2422 +@@ -739,7 +1073,7 @@ ENTRY(stub_rt_sigreturn)
2423 RESTORE_REST
2424 jmp int_ret_from_sys_call
2425 CFI_ENDPROC
2426 @@ -20367,7 +20375,7 @@ index 9d28dbac..43bde59 100644
2427
2428 /*
2429 * Build the entry stubs and pointer table with some assembler magic.
2430 -@@ -774,7 +1107,7 @@ vector=vector+1
2431 +@@ -774,7 +1108,7 @@ vector=vector+1
2432 2: jmp common_interrupt
2433 .endr
2434 CFI_ENDPROC
2435 @@ -20376,7 +20384,7 @@ index 9d28dbac..43bde59 100644
2436
2437 .previous
2438 END(interrupt)
2439 -@@ -791,8 +1124,8 @@ END(interrupt)
2440 +@@ -791,8 +1125,8 @@ END(interrupt)
2441 /* 0(%rsp): ~(interrupt number) */
2442 .macro interrupt func
2443 /* reserve pt_regs for scratch regs and rbp */
2444 @@ -20387,7 +20395,7 @@ index 9d28dbac..43bde59 100644
2445 SAVE_ARGS_IRQ
2446 call \func
2447 .endm
2448 -@@ -819,13 +1152,13 @@ ret_from_intr:
2449 +@@ -819,13 +1153,13 @@ ret_from_intr:
2450 /* Restore saved previous stack */
2451 popq %rsi
2452 CFI_DEF_CFA_REGISTER rsi
2453 @@ -20404,7 +20412,7 @@ index 9d28dbac..43bde59 100644
2454 je retint_kernel
2455
2456 /* Interrupt came from user space */
2457 -@@ -847,12 +1180,16 @@ retint_swapgs: /* return to user-space */
2458 +@@ -847,12 +1181,16 @@ retint_swapgs: /* return to user-space */
2459 * The iretq could re-enable interrupts:
2460 */
2461 DISABLE_INTERRUPTS(CLBR_ANY)
2462 @@ -20421,7 +20429,7 @@ index 9d28dbac..43bde59 100644
2463 /*
2464 * The iretq could re-enable interrupts:
2465 */
2466 -@@ -890,15 +1227,15 @@ native_irq_return_ldt:
2467 +@@ -890,15 +1228,15 @@ native_irq_return_ldt:
2468 SWAPGS
2469 movq PER_CPU_VAR(espfix_waddr),%rdi
2470 movq %rax,(0*8)(%rdi) /* RAX */
2471 @@ -20442,7 +20450,7 @@ index 9d28dbac..43bde59 100644
2472 movq %rax,(4*8)(%rdi)
2473 andl $0xffff0000,%eax
2474 popq_cfi %rdi
2475 -@@ -954,7 +1291,7 @@ ENTRY(retint_kernel)
2476 +@@ -954,7 +1292,7 @@ ENTRY(retint_kernel)
2477 jmp exit_intr
2478 #endif
2479 CFI_ENDPROC
2480 @@ -20451,7 +20459,7 @@ index 9d28dbac..43bde59 100644
2481
2482 /*
2483 * End of kprobes section
2484 -@@ -971,7 +1308,7 @@ ENTRY(\sym)
2485 +@@ -971,7 +1309,7 @@ ENTRY(\sym)
2486 interrupt \do_sym
2487 jmp ret_from_intr
2488 CFI_ENDPROC
2489 @@ -20460,7 +20468,7 @@ index 9d28dbac..43bde59 100644
2490 .endm
2491
2492 #ifdef CONFIG_SMP
2493 -@@ -1041,7 +1378,7 @@ ENTRY(\sym)
2494 +@@ -1041,7 +1379,7 @@ ENTRY(\sym)
2495 call \do_sym
2496 jmp error_exit /* %ebx: no swapgs flag */
2497 CFI_ENDPROC
2498 @@ -20469,7 +20477,7 @@ index 9d28dbac..43bde59 100644
2499 .endm
2500
2501 .macro paranoidzeroentry sym do_sym
2502 -@@ -1058,10 +1395,10 @@ ENTRY(\sym)
2503 +@@ -1058,10 +1396,10 @@ ENTRY(\sym)
2504 call \do_sym
2505 jmp paranoid_exit /* %ebx: no swapgs flag */
2506 CFI_ENDPROC
2507 @@ -20482,7 +20490,7 @@ index 9d28dbac..43bde59 100644
2508 .macro paranoidzeroentry_ist sym do_sym ist
2509 ENTRY(\sym)
2510 INTR_FRAME
2511 -@@ -1073,12 +1410,18 @@ ENTRY(\sym)
2512 +@@ -1073,12 +1411,18 @@ ENTRY(\sym)
2513 TRACE_IRQS_OFF
2514 movq %rsp,%rdi /* pt_regs pointer */
2515 xorl %esi,%esi /* no error code */
2516 @@ -20502,7 +20510,7 @@ index 9d28dbac..43bde59 100644
2517 .endm
2518
2519 .macro errorentry sym do_sym
2520 -@@ -1095,7 +1438,7 @@ ENTRY(\sym)
2521 +@@ -1095,7 +1439,7 @@ ENTRY(\sym)
2522 call \do_sym
2523 jmp error_exit /* %ebx: no swapgs flag */
2524 CFI_ENDPROC
2525 @@ -20511,7 +20519,7 @@ index 9d28dbac..43bde59 100644
2526 .endm
2527
2528 /* error code is on the stack already */
2529 -@@ -1114,7 +1457,7 @@ ENTRY(\sym)
2530 +@@ -1114,7 +1458,7 @@ ENTRY(\sym)
2531 call \do_sym
2532 jmp paranoid_exit /* %ebx: no swapgs flag */
2533 CFI_ENDPROC
2534 @@ -20520,7 +20528,7 @@ index 9d28dbac..43bde59 100644
2535 .endm
2536
2537 zeroentry divide_error do_divide_error
2538 -@@ -1144,9 +1487,10 @@ gs_change:
2539 +@@ -1144,9 +1488,10 @@ gs_change:
2540 2: mfence /* workaround */
2541 SWAPGS
2542 popfq_cfi
2543 @@ -20532,7 +20540,7 @@ index 9d28dbac..43bde59 100644
2544
2545 .section __ex_table,"a"
2546 .align 8
2547 -@@ -1168,13 +1512,14 @@ ENTRY(kernel_thread_helper)
2548 +@@ -1168,13 +1513,14 @@ ENTRY(kernel_thread_helper)
2549 * Here we are in the child and the registers are set as they were
2550 * at kernel_thread() invocation in the parent.
2551 */
2552 @@ -20548,7 +20556,7 @@ index 9d28dbac..43bde59 100644
2553
2554 /*
2555 * execve(). This function needs to use IRET, not SYSRET, to set up all state properly.
2556 -@@ -1201,11 +1546,11 @@ ENTRY(kernel_execve)
2557 +@@ -1201,11 +1547,11 @@ ENTRY(kernel_execve)
2558 RESTORE_REST
2559 testq %rax,%rax
2560 je int_ret_from_sys_call
2561 @@ -20562,7 +20570,7 @@ index 9d28dbac..43bde59 100644
2562
2563 /* Call softirq on interrupt stack. Interrupts are off. */
2564 ENTRY(call_softirq)
2565 -@@ -1223,9 +1568,10 @@ ENTRY(call_softirq)
2566 +@@ -1223,9 +1569,10 @@ ENTRY(call_softirq)
2567 CFI_DEF_CFA_REGISTER rsp
2568 CFI_ADJUST_CFA_OFFSET -8
2569 decl PER_CPU_VAR(irq_count)
2570 @@ -20574,7 +20582,7 @@ index 9d28dbac..43bde59 100644
2571
2572 #ifdef CONFIG_XEN
2573 zeroentry xen_hypervisor_callback xen_do_hypervisor_callback
2574 -@@ -1263,7 +1609,7 @@ ENTRY(xen_do_hypervisor_callback) # do_hypervisor_callback(struct *pt_regs)
2575 +@@ -1263,7 +1610,7 @@ ENTRY(xen_do_hypervisor_callback) # do_hypervisor_callback(struct *pt_regs)
2576 decl PER_CPU_VAR(irq_count)
2577 jmp error_exit
2578 CFI_ENDPROC
2579 @@ -20583,7 +20591,7 @@ index 9d28dbac..43bde59 100644
2580
2581 /*
2582 * Hypervisor uses this for application faults while it executes.
2583 -@@ -1322,7 +1668,7 @@ ENTRY(xen_failsafe_callback)
2584 +@@ -1322,7 +1669,7 @@ ENTRY(xen_failsafe_callback)
2585 SAVE_ALL
2586 jmp error_exit
2587 CFI_ENDPROC
2588 @@ -20592,7 +20600,7 @@ index 9d28dbac..43bde59 100644
2589
2590 apicinterrupt XEN_HVM_EVTCHN_CALLBACK \
2591 xen_hvm_callback_vector xen_evtchn_do_upcall
2592 -@@ -1371,16 +1717,31 @@ ENTRY(paranoid_exit)
2593 +@@ -1371,16 +1718,31 @@ ENTRY(paranoid_exit)
2594 TRACE_IRQS_OFF
2595 testl %ebx,%ebx /* swapgs needed? */
2596 jnz paranoid_restore
2597 @@ -20625,7 +20633,7 @@ index 9d28dbac..43bde59 100644
2598 jmp irq_return
2599 paranoid_userspace:
2600 GET_THREAD_INFO(%rcx)
2601 -@@ -1409,7 +1770,7 @@ paranoid_schedule:
2602 +@@ -1409,7 +1771,7 @@ paranoid_schedule:
2603 TRACE_IRQS_OFF
2604 jmp paranoid_userspace
2605 CFI_ENDPROC
2606 @@ -20634,7 +20642,7 @@ index 9d28dbac..43bde59 100644
2607
2608 /*
2609 * Exception entry point. This expects an error code/orig_rax on the stack.
2610 -@@ -1436,12 +1797,23 @@ ENTRY(error_entry)
2611 +@@ -1436,12 +1798,23 @@ ENTRY(error_entry)
2612 movq_cfi r14, R14+8
2613 movq_cfi r15, R15+8
2614 xorl %ebx,%ebx
2615 @@ -20659,7 +20667,7 @@ index 9d28dbac..43bde59 100644
2616 ret
2617
2618 /*
2619 -@@ -1475,7 +1847,7 @@ error_bad_iret:
2620 +@@ -1475,7 +1848,7 @@ error_bad_iret:
2621 decl %ebx /* Return to usergs */
2622 jmp error_sti
2623 CFI_ENDPROC
2624 @@ -20668,7 +20676,7 @@ index 9d28dbac..43bde59 100644
2625
2626
2627 /* ebx: no swapgs flag (1: don't need swapgs, 0: need it) */
2628 -@@ -1495,7 +1867,7 @@ ENTRY(error_exit)
2629 +@@ -1495,7 +1868,7 @@ ENTRY(error_exit)
2630 jnz retint_careful
2631 jmp retint_swapgs
2632 CFI_ENDPROC
2633 @@ -20677,7 +20685,7 @@ index 9d28dbac..43bde59 100644
2634
2635
2636 /* runs on exception stack */
2637 -@@ -1507,6 +1879,7 @@ ENTRY(nmi)
2638 +@@ -1507,6 +1880,7 @@ ENTRY(nmi)
2639 CFI_ADJUST_CFA_OFFSET ORIG_RAX-R15
2640 call save_paranoid
2641 DEFAULT_FRAME 0
2642 @@ -20685,7 +20693,7 @@ index 9d28dbac..43bde59 100644
2643 /* paranoidentry do_nmi, 0; without TRACE_IRQS_OFF */
2644 movq %rsp,%rdi
2645 movq $-1,%rsi
2646 -@@ -1517,12 +1890,28 @@ ENTRY(nmi)
2647 +@@ -1517,12 +1891,28 @@ ENTRY(nmi)
2648 DISABLE_INTERRUPTS(CLBR_NONE)
2649 testl %ebx,%ebx /* swapgs needed? */
2650 jnz nmi_restore
2651 @@ -20715,7 +20723,7 @@ index 9d28dbac..43bde59 100644
2652 jmp irq_return
2653 nmi_userspace:
2654 GET_THREAD_INFO(%rcx)
2655 -@@ -1551,14 +1940,14 @@ nmi_schedule:
2656 +@@ -1551,14 +1941,14 @@ nmi_schedule:
2657 jmp paranoid_exit
2658 CFI_ENDPROC
2659 #endif
2660 @@ -23015,7 +23023,7 @@ index 59b9b37..f02ee42 100644
2661 +}
2662 +#endif
2663 diff --git a/arch/x86/kernel/process_32.c b/arch/x86/kernel/process_32.c
2664 -index 8598296..7c1af45 100644
2665 +index 8598296..3fd3443 100644
2666 --- a/arch/x86/kernel/process_32.c
2667 +++ b/arch/x86/kernel/process_32.c
2668 @@ -67,6 +67,7 @@ asmlinkage void ret_from_fork(void) __asm__("ret_from_fork");
2669 @@ -23063,7 +23071,7 @@ index 8598296..7c1af45 100644
2670
2671 p->thread.sp = (unsigned long) childregs;
2672 p->thread.sp0 = (unsigned long) (childregs+1);
2673 -+ p->tinfo.lowest_stack = (unsigned long)task_stack_page(p);
2674 ++ p->tinfo.lowest_stack = (unsigned long)task_stack_page(p) + 2 * sizeof(unsigned long);
2675
2676 p->thread.ip = (unsigned long) ret_from_fork;
2677
2678 @@ -23112,7 +23120,7 @@ index 8598296..7c1af45 100644
2679 }
2680 -
2681 diff --git a/arch/x86/kernel/process_64.c b/arch/x86/kernel/process_64.c
2682 -index 6a364a6..b147d11 100644
2683 +index 6a364a6..030f5d6 100644
2684 --- a/arch/x86/kernel/process_64.c
2685 +++ b/arch/x86/kernel/process_64.c
2686 @@ -89,7 +89,7 @@ static void __exit_idle(void)
2687 @@ -23138,7 +23146,7 @@ index 6a364a6..b147d11 100644
2688 p->thread.sp = (unsigned long) childregs;
2689 p->thread.sp0 = (unsigned long) (childregs+1);
2690 p->thread.usersp = me->thread.usersp;
2691 -+ p->tinfo.lowest_stack = (unsigned long)task_stack_page(p);
2692 ++ p->tinfo.lowest_stack = (unsigned long)task_stack_page(p) + 2 * sizeof(unsigned long);
2693
2694 set_tsk_thread_flag(p, TIF_FORK);
2695
2696 @@ -32470,7 +32478,7 @@ index 26c731a..fb510c7 100644
2697 This is the Linux Xen port. Enabling this will allow the
2698 kernel to boot in a paravirtualized environment under the
2699 diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
2700 -index 5189fe8..d937469 100644
2701 +index 5189fe8..1bf8944 100644
2702 --- a/arch/x86/xen/enlighten.c
2703 +++ b/arch/x86/xen/enlighten.c
2704 @@ -86,8 +86,6 @@ EXPORT_SYMBOL_GPL(xen_start_info);
2705 @@ -32549,7 +32557,17 @@ index 5189fe8..d937469 100644
2706 {
2707 if (pm_power_off)
2708 pm_power_off();
2709 -@@ -1196,7 +1192,17 @@ asmlinkage void __init xen_start_kernel(void)
2710 +@@ -1144,6 +1140,9 @@ static void __init xen_setup_stackprotector(void)
2711 + pv_cpu_ops.load_gdt = xen_load_gdt_boot;
2712 +
2713 + setup_stack_canary_segment(0);
2714 ++#ifdef CONFIG_X86_64
2715 ++ load_percpu_segment(0);
2716 ++#endif
2717 + switch_to_new_gdt(0);
2718 +
2719 + pv_cpu_ops.write_gdt_entry = xen_write_gdt_entry;
2720 +@@ -1196,7 +1195,17 @@ asmlinkage void __init xen_start_kernel(void)
2721 __userpte_alloc_gfp &= ~__GFP_HIGHMEM;
2722
2723 /* Work out if we support NX */
2724 @@ -32568,7 +32586,7 @@ index 5189fe8..d937469 100644
2725
2726 xen_setup_features();
2727
2728 -@@ -1227,13 +1233,6 @@ asmlinkage void __init xen_start_kernel(void)
2729 +@@ -1227,13 +1236,6 @@ asmlinkage void __init xen_start_kernel(void)
2730
2731 machine_ops = xen_machine_ops;
2732
2733 @@ -32582,7 +32600,7 @@ index 5189fe8..d937469 100644
2734 xen_smp_init();
2735
2736 #ifdef CONFIG_ACPI_NUMA
2737 -@@ -1418,7 +1417,7 @@ static int __cpuinit xen_hvm_cpu_notify(struct notifier_block *self,
2738 +@@ -1418,7 +1420,7 @@ static int __cpuinit xen_hvm_cpu_notify(struct notifier_block *self,
2739 return NOTIFY_OK;
2740 }
2741
2742 @@ -45942,6 +45960,19 @@ index 0e6e57e..060e208 100644
2743 .notifier_call = macvtap_device_event,
2744 };
2745
2746 +diff --git a/drivers/net/ppp/ppp_deflate.c b/drivers/net/ppp/ppp_deflate.c
2747 +index 1dbdf82..43764cc 100644
2748 +--- a/drivers/net/ppp/ppp_deflate.c
2749 ++++ b/drivers/net/ppp/ppp_deflate.c
2750 +@@ -268,7 +268,7 @@ static int z_compress(void *arg, unsigned char *rptr, unsigned char *obuf,
2751 + /*
2752 + * See if we managed to reduce the size of the packet.
2753 + */
2754 +- if (olen < isize) {
2755 ++ if (olen < isize && olen <= osize) {
2756 + state->stats.comp_bytes += olen;
2757 + state->stats.comp_packets++;
2758 + } else {
2759 diff --git a/drivers/net/ppp/ppp_generic.c b/drivers/net/ppp/ppp_generic.c
2760 index 4782d79..359f1b9 100644
2761 --- a/drivers/net/ppp/ppp_generic.c
2762 @@ -58075,6 +58106,19 @@ index 52a820a..1d8ab03 100644
2763 }
2764
2765 /*
2766 +diff --git a/fs/cifs/smbencrypt.c b/fs/cifs/smbencrypt.c
2767 +index 80d8508..6de30aa 100644
2768 +--- a/fs/cifs/smbencrypt.c
2769 ++++ b/fs/cifs/smbencrypt.c
2770 +@@ -220,7 +220,7 @@ E_md4hash(const unsigned char *passwd, unsigned char *p16,
2771 + }
2772 +
2773 + rc = mdfour(p16, (unsigned char *) wpwd, len * sizeof(__le16));
2774 +- memset(wpwd, 0, 129 * sizeof(__le16));
2775 ++ memzero_explicit(wpwd, sizeof(wpwd));
2776 +
2777 + return rc;
2778 + }
2779 diff --git a/fs/coda/cache.c b/fs/coda/cache.c
2780 index 4b2e5cb..67b96bb 100644
2781 --- a/fs/coda/cache.c
2782 @@ -58384,7 +58428,7 @@ index 739fb59..5385976 100644
2783 static int __init init_cramfs_fs(void)
2784 {
2785 diff --git a/fs/dcache.c b/fs/dcache.c
2786 -index 3f65742..9a9eeb5 100644
2787 +index 3f65742..0972e8b 100644
2788 --- a/fs/dcache.c
2789 +++ b/fs/dcache.c
2790 @@ -103,11 +103,11 @@ static unsigned int d_hash_shift __read_mostly;
2791 @@ -58403,7 +58447,19 @@ index 3f65742..9a9eeb5 100644
2792 return dentry_hashtable + (hash & D_HASHMASK);
2793 }
2794
2795 -@@ -3080,7 +3080,8 @@ void __init vfs_caches_init(unsigned long mempages)
2796 +@@ -1034,8 +1034,10 @@ ascend:
2797 + write_sequnlock(&rename_lock);
2798 + return 0; /* No mount points found in tree */
2799 + positive:
2800 +- if (!locked && read_seqretry(&rename_lock, seq))
2801 ++ if (!locked && read_seqretry(&rename_lock, seq)) {
2802 ++ rcu_read_lock();
2803 + goto rename_retry;
2804 ++ }
2805 + if (locked)
2806 + write_sequnlock(&rename_lock);
2807 + return 1;
2808 +@@ -3080,7 +3082,8 @@ void __init vfs_caches_init(unsigned long mempages)
2809 mempages -= reserve;
2810
2811 names_cachep = kmem_cache_create("names_cache", PATH_MAX, 0,
2812 @@ -58565,7 +58621,7 @@ index 451b9b8..12e5a03 100644
2813
2814 out_free_fd:
2815 diff --git a/fs/exec.c b/fs/exec.c
2816 -index 78199eb..8958766 100644
2817 +index 78199eb..a1fb382 100644
2818 --- a/fs/exec.c
2819 +++ b/fs/exec.c
2820 @@ -55,12 +55,35 @@
2821 @@ -59475,7 +59531,7 @@ index 78199eb..8958766 100644
2822 +{
2823 + unsigned long sp = (unsigned long)&sp;
2824 + if (sp < current_thread_info()->lowest_stack &&
2825 -+ sp > (unsigned long)task_stack_page(current))
2826 ++ sp >= (unsigned long)task_stack_page(current) + 2 * sizeof(unsigned long))
2827 + current_thread_info()->lowest_stack = sp;
2828 + if (unlikely((sp & ~(THREAD_SIZE - 1)) < (THREAD_SIZE/16)))
2829 + BUG();
2830 @@ -60142,7 +60198,7 @@ index 22764c7..86372c9 100644
2831 break;
2832 err = alloc_fd(arg, cmd == F_DUPFD_CLOEXEC ? O_CLOEXEC : 0);
2833 diff --git a/fs/fhandle.c b/fs/fhandle.c
2834 -index 6b08864..4b42b2d 100644
2835 +index 6b08864..030db71 100644
2836 --- a/fs/fhandle.c
2837 +++ b/fs/fhandle.c
2838 @@ -8,6 +8,7 @@
2839 @@ -60162,6 +60218,18 @@ index 6b08864..4b42b2d 100644
2840 retval = -EPERM;
2841 goto out_err;
2842 }
2843 +@@ -196,8 +197,9 @@ static int handle_to_path(int mountdirfd, struct file_handle __user *ufh,
2844 + goto out_err;
2845 + }
2846 + /* copy the full handle */
2847 +- if (copy_from_user(handle, ufh,
2848 +- sizeof(struct file_handle) +
2849 ++ *handle = f_handle;
2850 ++ if (copy_from_user(&handle->f_handle,
2851 ++ &ufh->f_handle,
2852 + f_handle.handle_bytes)) {
2853 + retval = -EFAULT;
2854 + goto out_handle;
2855 diff --git a/fs/fifo.c b/fs/fifo.c
2856 index cf6f434..3d7942c 100644
2857 --- a/fs/fifo.c
2858 @@ -85491,7 +85559,7 @@ index ea0c02f..0eed39d 100644
2859 #ifdef __arch_swab64
2860 return __arch_swab64(val);
2861 diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
2862 -index 86a24b1..e6974f1 100644
2863 +index 86a24b11..e6974f1 100644
2864 --- a/include/linux/syscalls.h
2865 +++ b/include/linux/syscalls.h
2866 @@ -83,12 +83,20 @@ struct file_handle;
2867 @@ -108089,6 +108157,27 @@ index 88eace5..b5947e7 100644
2868 continue;
2869 }
2870 list_del_init(&rm->m_conn_item);
2871 +diff --git a/net/rds/sysctl.c b/net/rds/sysctl.c
2872 +index 25ad0c7..065026f 100644
2873 +--- a/net/rds/sysctl.c
2874 ++++ b/net/rds/sysctl.c
2875 +@@ -71,14 +71,14 @@ static ctl_table rds_sysctl_rds_table[] = {
2876 + {
2877 + .procname = "max_unacked_packets",
2878 + .data = &rds_sysctl_max_unacked_packets,
2879 +- .maxlen = sizeof(unsigned long),
2880 ++ .maxlen = sizeof(int),
2881 + .mode = 0644,
2882 + .proc_handler = proc_dointvec,
2883 + },
2884 + {
2885 + .procname = "max_unacked_bytes",
2886 + .data = &rds_sysctl_max_unacked_bytes,
2887 +- .maxlen = sizeof(unsigned long),
2888 ++ .maxlen = sizeof(int),
2889 + .mode = 0644,
2890 + .proc_handler = proc_dointvec,
2891 + },
2892 diff --git a/net/rds/tcp.c b/net/rds/tcp.c
2893 index edac9ef..16bcb98 100644
2894 --- a/net/rds/tcp.c
2895 @@ -108533,10 +108622,38 @@ index 76388b0..a967f68 100644
2896 sctp_generate_t1_cookie_event,
2897 sctp_generate_t1_init_event,
2898 diff --git a/net/sctp/socket.c b/net/sctp/socket.c
2899 -index c28eb7b..7afe73d 100644
2900 +index c28eb7b..832978a 100644
2901 --- a/net/sctp/socket.c
2902 +++ b/net/sctp/socket.c
2903 -@@ -2183,11 +2183,13 @@ static int sctp_setsockopt_events(struct sock *sk, char __user *optval,
2904 +@@ -1611,6 +1611,7 @@ SCTP_STATIC int sctp_sendmsg(struct kiocb *iocb, struct sock *sk,
2905 + sctp_scope_t scope;
2906 + long timeo;
2907 + __u16 sinfo_flags = 0;
2908 ++ bool wait_connect = false;
2909 + struct sctp_datamsg *datamsg;
2910 + int msg_flags = msg->msg_flags;
2911 +
2912 +@@ -1929,6 +1930,7 @@ SCTP_STATIC int sctp_sendmsg(struct kiocb *iocb, struct sock *sk,
2913 + err = sctp_primitive_ASSOCIATE(asoc, NULL);
2914 + if (err < 0)
2915 + goto out_free;
2916 ++ wait_connect = true;
2917 + SCTP_DEBUG_PRINTK("We associated primitively.\n");
2918 + }
2919 +
2920 +@@ -1968,6 +1970,11 @@ SCTP_STATIC int sctp_sendmsg(struct kiocb *iocb, struct sock *sk,
2921 + else
2922 + err = msg_len;
2923 +
2924 ++ if (unlikely(wait_connect)) {
2925 ++ timeo = sock_sndtimeo(sk, msg_flags & MSG_DONTWAIT);
2926 ++ sctp_wait_for_connect(asoc, &timeo);
2927 ++ }
2928 ++
2929 + /* If we are already past ASSOCIATE, the lower
2930 + * layers are responsible for association cleanup.
2931 + */
2932 +@@ -2183,11 +2190,13 @@ static int sctp_setsockopt_events(struct sock *sk, char __user *optval,
2933 {
2934 struct sctp_association *asoc;
2935 struct sctp_ulpevent *event;
2936 @@ -108551,7 +108668,7 @@ index c28eb7b..7afe73d 100644
2937
2938 /*
2939 * At the time when a user app subscribes to SCTP_SENDER_DRY_EVENT,
2940 -@@ -4173,13 +4175,16 @@ static int sctp_getsockopt_disable_fragments(struct sock *sk, int len,
2941 +@@ -4173,13 +4182,16 @@ static int sctp_getsockopt_disable_fragments(struct sock *sk, int len,
2942 static int sctp_getsockopt_events(struct sock *sk, int len, char __user *optval,
2943 int __user *optlen)
2944 {
2945 @@ -108569,7 +108686,7 @@ index c28eb7b..7afe73d 100644
2946 return -EFAULT;
2947 return 0;
2948 }
2949 -@@ -4197,6 +4202,8 @@ static int sctp_getsockopt_events(struct sock *sk, int len, char __user *optval,
2950 +@@ -4197,6 +4209,8 @@ static int sctp_getsockopt_events(struct sock *sk, int len, char __user *optval,
2951 */
2952 static int sctp_getsockopt_autoclose(struct sock *sk, int len, char __user *optval, int __user *optlen)
2953 {
2954 @@ -108578,7 +108695,7 @@ index c28eb7b..7afe73d 100644
2955 /* Applicable to UDP-style socket only */
2956 if (sctp_style(sk, TCP))
2957 return -EOPNOTSUPP;
2958 -@@ -4205,7 +4212,8 @@ static int sctp_getsockopt_autoclose(struct sock *sk, int len, char __user *optv
2959 +@@ -4205,7 +4219,8 @@ static int sctp_getsockopt_autoclose(struct sock *sk, int len, char __user *optv
2960 len = sizeof(int);
2961 if (put_user(len, optlen))
2962 return -EFAULT;
2963 @@ -108588,7 +108705,7 @@ index c28eb7b..7afe73d 100644
2964 return -EFAULT;
2965 return 0;
2966 }
2967 -@@ -4569,12 +4577,15 @@ static int sctp_getsockopt_delayed_ack(struct sock *sk, int len,
2968 +@@ -4569,12 +4584,15 @@ static int sctp_getsockopt_delayed_ack(struct sock *sk, int len,
2969 */
2970 static int sctp_getsockopt_initmsg(struct sock *sk, int len, char __user *optval, int __user *optlen)
2971 {
2972 @@ -108605,7 +108722,7 @@ index c28eb7b..7afe73d 100644
2973 return -EFAULT;
2974 return 0;
2975 }
2976 -@@ -4615,6 +4626,8 @@ static int sctp_getsockopt_peer_addrs(struct sock *sk, int len,
2977 +@@ -4615,6 +4633,8 @@ static int sctp_getsockopt_peer_addrs(struct sock *sk, int len,
2978 addrlen = sctp_get_af_specific(temp.sa.sa_family)->sockaddr_len;
2979 if (space_left < addrlen)
2980 return -ENOMEM;
2981 @@ -110272,6 +110389,19 @@ index ede01a8..756e6bd 100644
2982 if (err)
2983 goto out;
2984
2985 +diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include
2986 +index 978416d..a1c341e 100644
2987 +--- a/scripts/Kbuild.include
2988 ++++ b/scripts/Kbuild.include
2989 +@@ -143,7 +143,7 @@ cc-ifversion = $(shell [ $(call cc-version, $(CC)) $(1) $(2) ] && echo $(3))
2990 + # cc-ldoption
2991 + # Usage: ldflags += $(call cc-ldoption, -Wl$(comma)--hash-style=both)
2992 + cc-ldoption = $(call try-run,\
2993 +- $(CC) $(1) -nostdlib -x c /dev/null -o "$$TMP",$(1),$(2))
2994 ++ $(CC) $(1) -Wl,-r -nostdlib -x c /dev/null -o "$$TMP",$(1),$(2))
2995 +
2996 + # ld-option
2997 + # Usage: LDFLAGS += $(call ld-option, -X)
2998 diff --git a/scripts/Makefile.build b/scripts/Makefile.build
2999 index d2b366c1..2d5a6f8 100644
3000 --- a/scripts/Makefile.build