diff options
-rw-r--r-- | 3.14.31/0000_README | 2 | ||||
-rw-r--r-- | 3.14.31/4420_grsecurity-3.0-3.14.31-201502052352.patch (renamed from 3.14.31/4420_grsecurity-3.0-3.14.31-201501310705.patch) | 420 | ||||
-rw-r--r-- | 3.18.5/0000_README | 2 | ||||
-rw-r--r-- | 3.18.5/4420_grsecurity-3.0-3.18.5-201502052352.patch (renamed from 3.18.5/4420_grsecurity-3.0-3.18.5-201501310706.patch) | 617 | ||||
-rw-r--r-- | 3.2.66/0000_README | 2 | ||||
-rw-r--r-- | 3.2.66/4420_grsecurity-3.0-3.2.66-201502052350.patch (renamed from 3.2.66/4420_grsecurity-3.0-3.2.66-201501272306.patch) | 356 |
6 files changed, 1218 insertions, 181 deletions
diff --git a/3.14.31/0000_README b/3.14.31/0000_README index c3d5e32..cd1e617 100644 --- a/3.14.31/0000_README +++ b/3.14.31/0000_README @@ -2,7 +2,7 @@ README ----------------------------------------------------------------------------- Individual Patch Descriptions: ----------------------------------------------------------------------------- -Patch: 4420_grsecurity-3.0-3.14.31-201501310705.patch +Patch: 4420_grsecurity-3.0-3.14.31-201502052352.patch From: http://www.grsecurity.net Desc: hardened-sources base patch from upstream grsecurity 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 index a9df68f..62bdff1 100644 --- 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 @@ -3896,7 +3896,7 @@ index 7abde2c..9df495f 100644 static bool of_init = false; diff --git a/arch/arm/mm/context.c b/arch/arm/mm/context.c -index 6eb97b3..ac509f6 100644 +index 6eb97b3..e77848e 100644 --- a/arch/arm/mm/context.c +++ b/arch/arm/mm/context.c @@ -43,7 +43,7 @@ @@ -3908,7 +3908,40 @@ index 6eb97b3..ac509f6 100644 static DECLARE_BITMAP(asid_map, NUM_USER_ASIDS); static DEFINE_PER_CPU(atomic64_t, active_asids); -@@ -182,7 +182,7 @@ static u64 new_context(struct mm_struct *mm, unsigned int cpu) +@@ -144,21 +144,17 @@ static void flush_context(unsigned int cpu) + /* Update the list of reserved ASIDs and the ASID bitmap. */ + bitmap_clear(asid_map, 0, NUM_USER_ASIDS); + for_each_possible_cpu(i) { +- if (i == cpu) { +- asid = 0; +- } else { +- asid = atomic64_xchg(&per_cpu(active_asids, i), 0); +- /* +- * If this CPU has already been through a +- * rollover, but hasn't run another task in +- * the meantime, we must preserve its reserved +- * ASID, as this is the only trace we have of +- * the process it is still running. +- */ +- if (asid == 0) +- asid = per_cpu(reserved_asids, i); +- __set_bit(asid & ~ASID_MASK, asid_map); +- } ++ asid = atomic64_xchg(&per_cpu(active_asids, i), 0); ++ /* ++ * If this CPU has already been through a ++ * rollover, but hasn't run another task in ++ * the meantime, we must preserve its reserved ++ * ASID, as this is the only trace we have of ++ * the process it is still running. ++ */ ++ if (asid == 0) ++ asid = per_cpu(reserved_asids, i); ++ __set_bit(asid & ~ASID_MASK, asid_map); + per_cpu(reserved_asids, i) = asid; + } + +@@ -182,7 +178,7 @@ static u64 new_context(struct mm_struct *mm, unsigned int cpu) { static u32 cur_idx = 1; u64 asid = atomic64_read(&mm->context.id); @@ -3917,7 +3950,7 @@ index 6eb97b3..ac509f6 100644 if (asid != 0 && is_reserved_asid(asid)) { /* -@@ -203,7 +203,7 @@ static u64 new_context(struct mm_struct *mm, unsigned int cpu) +@@ -203,7 +199,7 @@ static u64 new_context(struct mm_struct *mm, unsigned int cpu) */ asid = find_next_zero_bit(asid_map, NUM_USER_ASIDS, cur_idx); if (asid == NUM_USER_ASIDS) { @@ -3926,7 +3959,7 @@ index 6eb97b3..ac509f6 100644 &asid_generation); flush_context(cpu); asid = find_next_zero_bit(asid_map, NUM_USER_ASIDS, 1); -@@ -234,14 +234,14 @@ void check_and_switch_context(struct mm_struct *mm, struct task_struct *tsk) +@@ -234,14 +230,14 @@ void check_and_switch_context(struct mm_struct *mm, struct task_struct *tsk) cpu_set_reserved_ttbr0(); asid = atomic64_read(&mm->context.id); @@ -22121,7 +22154,7 @@ index f2a1770..10fa52d 100644 +EXPORT_SYMBOL(pax_check_alloca); +#endif diff --git a/arch/x86/kernel/dumpstack_64.c b/arch/x86/kernel/dumpstack_64.c -index 66e274a..99080e6 100644 +index 66e274a..81f4ebf 100644 --- a/arch/x86/kernel/dumpstack_64.c +++ b/arch/x86/kernel/dumpstack_64.c @@ -118,9 +118,9 @@ void dump_trace(struct task_struct *task, struct pt_regs *regs, @@ -22185,7 +22218,13 @@ index 66e274a..99080e6 100644 put_cpu(); } EXPORT_SYMBOL(dump_trace); -@@ -299,3 +303,50 @@ int is_valid_bugaddr(unsigned long ip) +@@ -294,8 +298,55 @@ int is_valid_bugaddr(unsigned long ip) + { + unsigned short ud2; + +- if (__copy_from_user(&ud2, (const void __user *) ip, sizeof(ud2))) ++ if (probe_kernel_address((unsigned short *)ip, ud2)) + return 0; return ud2 == 0x0b0f; } @@ -36116,7 +36155,7 @@ index 01b9026..1e476df 100644 This is the Linux Xen port. Enabling this will allow the kernel to boot in a paravirtualized environment under the diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c -index 201d09a..be93768 100644 +index 201d09a..2302db1 100644 --- a/arch/x86/xen/enlighten.c +++ b/arch/x86/xen/enlighten.c @@ -123,8 +123,6 @@ EXPORT_SYMBOL_GPL(xen_start_info); @@ -36204,19 +36243,21 @@ index 201d09a..be93768 100644 { if (pm_power_off) pm_power_off(); -@@ -1455,8 +1451,9 @@ static void __ref xen_setup_gdt(int cpu) +@@ -1455,8 +1451,11 @@ static void __ref xen_setup_gdt(int cpu) pv_cpu_ops.write_gdt_entry = xen_write_gdt_entry_boot; pv_cpu_ops.load_gdt = xen_load_gdt_boot; - setup_stack_canary_segment(0); - switch_to_new_gdt(0); + setup_stack_canary_segment(cpu); ++#ifdef CONFIG_X86_64 + load_percpu_segment(cpu); ++#endif + switch_to_new_gdt(cpu); pv_cpu_ops.write_gdt_entry = xen_write_gdt_entry; pv_cpu_ops.load_gdt = xen_load_gdt; -@@ -1564,7 +1561,17 @@ asmlinkage void __init xen_start_kernel(void) +@@ -1564,7 +1563,17 @@ asmlinkage void __init xen_start_kernel(void) __userpte_alloc_gfp &= ~__GFP_HIGHMEM; /* Work out if we support NX */ @@ -36235,7 +36276,7 @@ index 201d09a..be93768 100644 /* Get mfn list */ xen_build_dynamic_phys_to_machine(); -@@ -1592,13 +1599,6 @@ asmlinkage void __init xen_start_kernel(void) +@@ -1592,13 +1601,6 @@ asmlinkage void __init xen_start_kernel(void) machine_ops = xen_machine_ops; @@ -44540,6 +44581,19 @@ index 4d9b195..455075c 100644 return -EFAULT; } else { memcpy(buf, dp, left); +diff --git a/drivers/isdn/hardware/eicon/message.c b/drivers/isdn/hardware/eicon/message.c +index a82e542..f766a79 100644 +--- a/drivers/isdn/hardware/eicon/message.c ++++ b/drivers/isdn/hardware/eicon/message.c +@@ -1474,7 +1474,7 @@ static byte connect_res(dword Id, word Number, DIVA_CAPI_ADAPTER *a, + add_ai(plci, &parms[5]); + sig_req(plci, REJECT, 0); + } +- else if (Reject == 1 || Reject > 9) ++ else if (Reject == 1 || Reject >= 9) + { + add_ai(plci, &parms[5]); + sig_req(plci, HANGUP, 0); diff --git a/drivers/isdn/i4l/isdn_common.c b/drivers/isdn/i4l/isdn_common.c index 9bb12ba..d4262f7 100644 --- a/drivers/isdn/i4l/isdn_common.c @@ -47955,6 +48009,19 @@ index 8be5b40..081bc1b 100644 #include "ftmac100.h" +diff --git a/drivers/net/ethernet/freescale/gianfar_ethtool.c b/drivers/net/ethernet/freescale/gianfar_ethtool.c +index 63d2344..65b62c47 100644 +--- a/drivers/net/ethernet/freescale/gianfar_ethtool.c ++++ b/drivers/net/ethernet/freescale/gianfar_ethtool.c +@@ -1614,7 +1614,7 @@ static int gfar_write_filer_table(struct gfar_private *priv, + lock_rx_qs(priv); + + /* Fill regular entries */ +- for (; i < MAX_FILER_IDX - 1 && (tab->fe[i].ctrl | tab->fe[i].ctrl); ++ for (; i < MAX_FILER_IDX - 1 && (tab->fe[i].ctrl | tab->fe[i].prop); + i++) + gfar_write_filer(priv, i, tab->fe[i].ctrl, tab->fe[i].prop); + /* Fill the rest with fall-troughs */ diff --git a/drivers/net/ethernet/intel/i40e/i40e_ptp.c b/drivers/net/ethernet/intel/i40e/i40e_ptp.c index e33ec6c..f54cfe7 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_ptp.c @@ -48329,6 +48396,19 @@ index d2bb12b..d6c921e 100644 .kind = "nlmon", .priv_size = sizeof(struct nlmon), .setup = nlmon_setup, +diff --git a/drivers/net/ppp/ppp_deflate.c b/drivers/net/ppp/ppp_deflate.c +index 602c625..b5edc7f 100644 +--- a/drivers/net/ppp/ppp_deflate.c ++++ b/drivers/net/ppp/ppp_deflate.c +@@ -246,7 +246,7 @@ static int z_compress(void *arg, unsigned char *rptr, unsigned char *obuf, + /* + * See if we managed to reduce the size of the packet. + */ +- if (olen < isize) { ++ if (olen < isize && olen <= osize) { + state->stats.comp_bytes += olen; + state->stats.comp_packets++; + } else { diff --git a/drivers/net/ppp/ppp_generic.c b/drivers/net/ppp/ppp_generic.c index 5a1897d..e860630 100644 --- a/drivers/net/ppp/ppp_generic.c @@ -59776,7 +59856,7 @@ index 10a4ccb..92dbc5e 100644 sb->s_bdi = &fsc->backing_dev_info; return err; diff --git a/fs/cifs/cifs_debug.c b/fs/cifs/cifs_debug.c -index f3ac415..3d2420c 100644 +index f3ac415..e26bd76 100644 --- a/fs/cifs/cifs_debug.c +++ b/fs/cifs/cifs_debug.c @@ -286,8 +286,8 @@ static ssize_t cifs_stats_proc_write(struct file *file, @@ -59819,6 +59899,20 @@ index f3ac415..3d2420c 100644 if (server->ops->print_stats) server->ops->print_stats(m, tcon); } +@@ -615,9 +615,11 @@ cifs_security_flags_handle_must_flags(unsigned int *flags) + *flags = CIFSSEC_MUST_NTLMV2; + else if ((*flags & CIFSSEC_MUST_NTLM) == CIFSSEC_MUST_NTLM) + *flags = CIFSSEC_MUST_NTLM; +- else if ((*flags & CIFSSEC_MUST_LANMAN) == CIFSSEC_MUST_LANMAN) ++ else if (CIFSSEC_MUST_LANMAN && ++ (*flags & CIFSSEC_MUST_LANMAN) == CIFSSEC_MUST_LANMAN) + *flags = CIFSSEC_MUST_LANMAN; +- else if ((*flags & CIFSSEC_MUST_PLNTXT) == CIFSSEC_MUST_PLNTXT) ++ else if (CIFSSEC_MUST_PLNTXT && ++ (*flags & CIFSSEC_MUST_PLNTXT) == CIFSSEC_MUST_PLNTXT) + *flags = CIFSSEC_MUST_PLNTXT; + + *flags |= signflags; diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c index 7c6b73c..a8f0db2 100644 --- a/fs/cifs/cifsfs.c @@ -59937,10 +60031,37 @@ index 5d12d69..161d0ce 100644 GLOBAL_EXTERN atomic_t smBufAllocCount; GLOBAL_EXTERN atomic_t midCount; diff --git a/fs/cifs/file.c b/fs/cifs/file.c -index d375322..88c3ead 100644 +index d375322..2f1ac75 100644 --- a/fs/cifs/file.c +++ b/fs/cifs/file.c -@@ -1900,10 +1900,14 @@ static int cifs_writepages(struct address_space *mapping, +@@ -366,6 +366,7 @@ void cifsFileInfo_put(struct cifsFileInfo *cifs_file) + struct cifsLockInfo *li, *tmp; + struct cifs_fid fid; + struct cifs_pending_open open; ++ bool oplock_break_cancelled; + + spin_lock(&cifs_file_list_lock); + if (--cifs_file->count > 0) { +@@ -397,7 +398,7 @@ void cifsFileInfo_put(struct cifsFileInfo *cifs_file) + } + spin_unlock(&cifs_file_list_lock); + +- cancel_work_sync(&cifs_file->oplock_break); ++ oplock_break_cancelled = cancel_work_sync(&cifs_file->oplock_break); + + if (!tcon->need_reconnect && !cifs_file->invalidHandle) { + struct TCP_Server_Info *server = tcon->ses->server; +@@ -409,6 +410,9 @@ void cifsFileInfo_put(struct cifsFileInfo *cifs_file) + _free_xid(xid); + } + ++ if (oplock_break_cancelled) ++ cifs_done_oplock_break(cifsi); ++ + cifs_del_pending_open(&open); + + /* +@@ -1900,10 +1904,14 @@ static int cifs_writepages(struct address_space *mapping, index = mapping->writeback_index; /* Start from prev offset */ end = -1; } else { @@ -60224,6 +60345,19 @@ index 3487929..47a6ebf2 100644 } req->FileIndex = cpu_to_le32(index); +diff --git a/fs/cifs/smbencrypt.c b/fs/cifs/smbencrypt.c +index 43eb136..f17e718 100644 +--- a/fs/cifs/smbencrypt.c ++++ b/fs/cifs/smbencrypt.c +@@ -220,7 +220,7 @@ E_md4hash(const unsigned char *passwd, unsigned char *p16, + } + + rc = mdfour(p16, (unsigned char *) wpwd, len * sizeof(__le16)); +- memset(wpwd, 0, 129 * sizeof(__le16)); ++ memzero_explicit(wpwd, sizeof(wpwd)); + + return rc; + } diff --git a/fs/coda/cache.c b/fs/coda/cache.c index 1da168c..8bc7ff6 100644 --- a/fs/coda/cache.c @@ -62062,7 +62196,7 @@ index ef68665..5deacdc 100644 return 0; } diff --git a/fs/fhandle.c b/fs/fhandle.c -index 999ff5c..ac037c9 100644 +index 999ff5c..2281df9 100644 --- a/fs/fhandle.c +++ b/fs/fhandle.c @@ -8,6 +8,7 @@ @@ -62092,6 +62226,18 @@ index 999ff5c..ac037c9 100644 retval = -EPERM; goto out_err; } +@@ -195,8 +195,9 @@ static int handle_to_path(int mountdirfd, struct file_handle __user *ufh, + goto out_err; + } + /* copy the full handle */ +- if (copy_from_user(handle, ufh, +- sizeof(struct file_handle) + ++ *handle = f_handle; ++ if (copy_from_user(&handle->f_handle, ++ &ufh->f_handle, + f_handle.handle_bytes)) { + retval = -EFAULT; + goto out_handle; diff --git a/fs/file.c b/fs/file.c index eb56a13..ccee850 100644 --- a/fs/file.c @@ -86953,10 +87099,28 @@ index 823ec7b..44c938c 100644 struct rcu_head rcu; struct inet_peer *gc_next; diff --git a/include/net/ip.h b/include/net/ip.h -index 937f196..7251808 100644 +index 937f196..310a44f 100644 --- a/include/net/ip.h +++ b/include/net/ip.h -@@ -214,7 +214,7 @@ static inline void snmp_mib_free(void __percpu *ptr[SNMP_ARRAY_SZ]) +@@ -38,11 +38,12 @@ struct inet_skb_parm { + struct ip_options opt; /* Compiled IP options */ + unsigned char flags; + +-#define IPSKB_FORWARDED 1 +-#define IPSKB_XFRM_TUNNEL_SIZE 2 +-#define IPSKB_XFRM_TRANSFORMED 4 +-#define IPSKB_FRAG_COMPLETE 8 +-#define IPSKB_REROUTED 16 ++#define IPSKB_FORWARDED BIT(0) ++#define IPSKB_XFRM_TUNNEL_SIZE BIT(1) ++#define IPSKB_XFRM_TRANSFORMED BIT(2) ++#define IPSKB_FRAG_COMPLETE BIT(3) ++#define IPSKB_REROUTED BIT(4) ++#define IPSKB_DOREDIRECT BIT(5) + + u16 frag_max_size; + }; +@@ -214,7 +215,7 @@ static inline void snmp_mib_free(void __percpu *ptr[SNMP_ARRAY_SZ]) void inet_get_local_port_range(struct net *net, int *low, int *high); @@ -86965,7 +87129,7 @@ index 937f196..7251808 100644 static inline int inet_is_reserved_local_port(int port) { return test_bit(port, sysctl_local_reserved_ports); -@@ -297,7 +297,7 @@ static inline unsigned int ip_skb_dst_mtu(const struct sk_buff *skb) +@@ -297,7 +298,7 @@ static inline unsigned int ip_skb_dst_mtu(const struct sk_buff *skb) } } @@ -101987,7 +102151,7 @@ index a16ed7b..eb44d17 100644 return err; diff --git a/net/core/dev.c b/net/core/dev.c -index 86bb9cc..8814d50 100644 +index 86bb9cc..a4f25f3 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -1695,14 +1695,14 @@ int dev_forward_skb(struct net_device *dev, struct sk_buff *skb) @@ -102052,6 +102216,24 @@ index 86bb9cc..8814d50 100644 { struct softnet_data *sd = &__get_cpu_var(softnet_data); unsigned long time_limit = jiffies + 2; +@@ -5066,7 +5066,7 @@ void netdev_upper_dev_unlink(struct net_device *dev, + } + EXPORT_SYMBOL(netdev_upper_dev_unlink); + +-void netdev_adjacent_add_links(struct net_device *dev) ++static void netdev_adjacent_add_links(struct net_device *dev) + { + struct netdev_adjacent *iter; + +@@ -5091,7 +5091,7 @@ void netdev_adjacent_add_links(struct net_device *dev) + } + } + +-void netdev_adjacent_del_links(struct net_device *dev) ++static void netdev_adjacent_del_links(struct net_device *dev) + { + struct netdev_adjacent *iter; + @@ -6376,7 +6376,7 @@ struct rtnl_link_stats64 *dev_get_stats(struct net_device *dev, } else { netdev_stats_to_stats64(storage, &dev->stats); @@ -102061,6 +102243,15 @@ index 86bb9cc..8814d50 100644 return storage; } EXPORT_SYMBOL(dev_get_stats); +@@ -6392,7 +6392,7 @@ struct netdev_queue *dev_ingress_queue_create(struct net_device *dev) + if (!queue) + return NULL; + netdev_init_one_queue(dev, queue, NULL); +- queue->qdisc = &noop_qdisc; ++ RCU_INIT_POINTER(queue->qdisc, &noop_qdisc); + queue->qdisc_sleeping = &noop_qdisc; + rcu_assign_pointer(dev->ingress_queue, queue); + #endif diff --git a/net/core/dev_ioctl.c b/net/core/dev_ioctl.c index cf999e0..c59a9754 100644 --- a/net/core/dev_ioctl.c @@ -103107,6 +103298,20 @@ index bf2cb4a..d83ba8a 100644 p->metrics[RTAX_LOCK-1] = INETPEER_METRICS_NEW; p->rate_tokens = 0; /* 60*HZ is arbitrary, but chosen enough high so that the first +diff --git a/net/ipv4/ip_forward.c b/net/ipv4/ip_forward.c +index 1c6bd43..ecb34b5 100644 +--- a/net/ipv4/ip_forward.c ++++ b/net/ipv4/ip_forward.c +@@ -178,7 +178,8 @@ int ip_forward(struct sk_buff *skb) + * We now generate an ICMP HOST REDIRECT giving the route + * we calculated. + */ +- if (rt->rt_flags&RTCF_DOREDIRECT && !opt->srr && !skb_sec_path(skb)) ++ if (IPCB(skb)->flags & IPSKB_DOREDIRECT && !opt->srr && ++ !skb_sec_path(skb)) + ip_rt_send_redirect(skb); + + skb->priority = rt_tos2priority(iph->tos); diff --git a/net/ipv4/ip_fragment.c b/net/ipv4/ip_fragment.c index c10a3ce..dd71f84 100644 --- a/net/ipv4/ip_fragment.c @@ -103214,6 +103419,18 @@ index 3d4da2c..40f9c29 100644 icmp_send(skb, ICMP_DEST_UNREACH, ICMP_PROT_UNREACH, 0); } +diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c +index 844323b..7c1b9ac 100644 +--- a/net/ipv4/ip_output.c ++++ b/net/ipv4/ip_output.c +@@ -1471,6 +1471,7 @@ static DEFINE_PER_CPU(struct inet_sock, unicast_sock) = { + .sk_wmem_alloc = ATOMIC_INIT(1), + .sk_allocation = GFP_ATOMIC, + .sk_flags = (1UL << SOCK_USE_WRITE_QUEUE), ++ .sk_pacing_rate = ~0U, + }, + .pmtudisc = IP_PMTUDISC_WANT, + .uc_ttl = -1, diff --git a/net/ipv4/ip_sockglue.c b/net/ipv4/ip_sockglue.c index 580dd96..41e9720 100644 --- a/net/ipv4/ip_sockglue.c @@ -103582,7 +103799,7 @@ index 11c8d81..d67116b 100644 static int raw_seq_show(struct seq_file *seq, void *v) diff --git a/net/ipv4/route.c b/net/ipv4/route.c -index 487bb62..bc101aa 100644 +index 487bb62..31268ca 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c @@ -234,7 +234,7 @@ static const struct seq_operations rt_cache_seq_ops = { @@ -103635,7 +103852,31 @@ index 487bb62..bc101aa 100644 } EXPORT_SYMBOL(ip_idents_reserve); -@@ -2631,34 +2631,34 @@ static struct ctl_table ipv4_route_flush_table[] = { +@@ -1554,11 +1554,10 @@ static int __mkroute_input(struct sk_buff *skb, + + do_cache = res->fi && !itag; + if (out_dev == in_dev && err && IN_DEV_TX_REDIRECTS(out_dev) && ++ skb->protocol == htons(ETH_P_IP) && + (IN_DEV_SHARED_MEDIA(out_dev) || +- inet_addr_onlink(out_dev, saddr, FIB_RES_GW(*res)))) { +- flags |= RTCF_DOREDIRECT; +- do_cache = false; +- } ++ inet_addr_onlink(out_dev, saddr, FIB_RES_GW(*res)))) ++ IPCB(skb)->flags |= IPSKB_DOREDIRECT; + + if (skb->protocol != htons(ETH_P_IP)) { + /* Not IP (i.e. ARP). Do not create route, if it is +@@ -2305,6 +2304,8 @@ static int rt_fill_info(struct net *net, __be32 dst, __be32 src, + r->rtm_flags = (rt->rt_flags & ~0xFFFF) | RTM_F_CLONED; + if (rt->rt_flags & RTCF_NOTIFY) + r->rtm_flags |= RTM_F_NOTIFY; ++ if (IPCB(skb)->flags & IPSKB_DOREDIRECT) ++ r->rtm_flags |= RTCF_DOREDIRECT; + + if (nla_put_be32(skb, RTA_DST, dst)) + goto nla_put_failure; +@@ -2631,34 +2632,34 @@ static struct ctl_table ipv4_route_flush_table[] = { .maxlen = sizeof(int), .mode = 0200, .proc_handler = ipv4_sysctl_rtcache_flush, @@ -103678,7 +103919,7 @@ index 487bb62..bc101aa 100644 err_dup: return -ENOMEM; } -@@ -2681,8 +2681,8 @@ static __net_initdata struct pernet_operations sysctl_route_ops = { +@@ -2681,8 +2682,8 @@ static __net_initdata struct pernet_operations sysctl_route_ops = { static __net_init int rt_genid_init(struct net *net) { @@ -103689,7 +103930,7 @@ index 487bb62..bc101aa 100644 get_random_bytes(&net->ipv4.dev_addr_genid, sizeof(net->ipv4.dev_addr_genid)); return 0; -@@ -2725,11 +2725,7 @@ int __init ip_rt_init(void) +@@ -2725,11 +2726,7 @@ int __init ip_rt_init(void) { int rc = 0; @@ -104350,7 +104591,7 @@ index 7b32652..0bc348b 100644 table = kmemdup(ipv6_icmp_table_template, sizeof(ipv6_icmp_table_template), diff --git a/net/ipv6/ip6_gre.c b/net/ipv6/ip6_gre.c -index 4a230b1..a1d47b8 100644 +index 4a230b1..42d6ab42 100644 --- a/net/ipv6/ip6_gre.c +++ b/net/ipv6/ip6_gre.c @@ -71,7 +71,7 @@ struct ip6gre_net { @@ -104362,6 +104603,24 @@ index 4a230b1..a1d47b8 100644 static int ip6gre_tunnel_init(struct net_device *dev); static void ip6gre_tunnel_setup(struct net_device *dev); static void ip6gre_tunnel_link(struct ip6gre_net *ign, struct ip6_tnl *t); +@@ -413,7 +413,7 @@ static void ip6gre_err(struct sk_buff *skb, struct inet6_skb_parm *opt, + if (code == ICMPV6_HDR_FIELD) + teli = ip6_tnl_parse_tlv_enc_lim(skb, skb->data); + +- if (teli && teli == info - 2) { ++ if (teli && teli == be32_to_cpu(info) - 2) { + tel = (struct ipv6_tlv_tnl_enc_lim *) &skb->data[teli]; + if (tel->encap_limit == 0) { + net_warn_ratelimited("%s: Too small encapsulation limit or routing loop in tunnel!\n", +@@ -425,7 +425,7 @@ static void ip6gre_err(struct sk_buff *skb, struct inet6_skb_parm *opt, + } + break; + case ICMPV6_PKT_TOOBIG: +- mtu = info - offset; ++ mtu = be32_to_cpu(info) - offset; + if (mtu < IPV6_MIN_MTU) + mtu = IPV6_MIN_MTU; + t->dev->mtu = mtu; @@ -1290,7 +1290,7 @@ static void ip6gre_fb_tunnel_init(struct net_device *dev) } @@ -105843,7 +106102,7 @@ index f042ae5..30ea486 100644 } EXPORT_SYMBOL(nf_unregister_sockopt); diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c -index c68e5e0..8d52d50 100644 +index c68e5e0..3bed3f0 100644 --- a/net/netfilter/nf_tables_api.c +++ b/net/netfilter/nf_tables_api.c @@ -152,8 +152,8 @@ nf_tables_chain_type_lookup(const struct nft_af_info *afi, @@ -105857,6 +106116,18 @@ index c68e5e0..8d52d50 100644 nfnl_lock(NFNL_SUBSYS_NFTABLES); type = __nf_tables_chain_type_lookup(afi->family, nla); if (type != NULL) +@@ -789,9 +789,11 @@ nf_tables_counters(struct nft_base_chain *chain, const struct nlattr *attr) + /* Restore old counters on this cpu, no problem. Per-cpu statistics + * are not exposed to userspace. + */ ++ preempt_disable(); + stats = this_cpu_ptr(newstats); + stats->bytes = be64_to_cpu(nla_get_be64(tb[NFTA_COUNTER_BYTES])); + stats->pkts = be64_to_cpu(nla_get_be64(tb[NFTA_COUNTER_PACKETS])); ++ preempt_enable(); + + if (chain->stats) { + /* nfnl_lock is held, add some nfnl function for this, later */ diff --git a/net/netfilter/nfnetlink_log.c b/net/netfilter/nfnetlink_log.c index 6ff12a1..d1815b6 100644 --- a/net/netfilter/nfnetlink_log.c @@ -106367,6 +106638,27 @@ index a82fb66..1ea9251 100644 continue; } list_del_init(&rm->m_conn_item); +diff --git a/net/rds/sysctl.c b/net/rds/sysctl.c +index b5cb2aa..35773ad 100644 +--- a/net/rds/sysctl.c ++++ b/net/rds/sysctl.c +@@ -71,14 +71,14 @@ static struct ctl_table rds_sysctl_rds_table[] = { + { + .procname = "max_unacked_packets", + .data = &rds_sysctl_max_unacked_packets, +- .maxlen = sizeof(unsigned long), ++ .maxlen = sizeof(int), + .mode = 0644, + .proc_handler = proc_dointvec, + }, + { + .procname = "max_unacked_bytes", + .data = &rds_sysctl_max_unacked_bytes, +- .maxlen = sizeof(unsigned long), ++ .maxlen = sizeof(int), + .mode = 0644, + .proc_handler = proc_dointvec, + }, diff --git a/net/rds/tcp.c b/net/rds/tcp.c index edac9ef..16bcb98 100644 --- a/net/rds/tcp.c @@ -106653,6 +106945,31 @@ index f226709..0e735a8 100644 _proto("Tx RESPONSE %%%u", ntohl(hdr->serial)); ret = kernel_sendmsg(conn->trans->local->socket, &msg, iov, 3, len); +diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c +index bdbdb1a..1afc85f 100644 +--- a/net/sched/cls_api.c ++++ b/net/sched/cls_api.c +@@ -555,8 +555,9 @@ void tcf_exts_change(struct tcf_proto *tp, struct tcf_exts *dst, + } + EXPORT_SYMBOL(tcf_exts_change); + +-#define tcf_exts_first_act(ext) \ +- list_first_entry(&(exts)->actions, struct tc_action, list) ++#define tcf_exts_first_act(ext) \ ++ list_first_entry_or_null(&(exts)->actions, \ ++ struct tc_action, list) + + int tcf_exts_dump(struct sk_buff *skb, struct tcf_exts *exts) + { +@@ -597,7 +598,7 @@ int tcf_exts_dump_stats(struct sk_buff *skb, struct tcf_exts *exts) + { + #ifdef CONFIG_NET_CLS_ACT + struct tc_action *a = tcf_exts_first_act(exts); +- if (tcf_action_copy_stats(skb, a, 1) < 0) ++ if (a != NULL && tcf_action_copy_stats(skb, a, 1) < 0) + return -1; + #endif + return 0; diff --git a/net/sched/cls_bpf.c b/net/sched/cls_bpf.c index 8e3cf49..4a8e322 100644 --- a/net/sched/cls_bpf.c @@ -106793,10 +107110,38 @@ index fef2acd..c705c4f 100644 sctp_generate_t1_cookie_event, sctp_generate_t1_init_event, diff --git a/net/sctp/socket.c b/net/sctp/socket.c -index 604a6ac..f87f0a3 100644 +index 604a6ac..990354d 100644 --- a/net/sctp/socket.c +++ b/net/sctp/socket.c -@@ -2175,11 +2175,13 @@ static int sctp_setsockopt_events(struct sock *sk, char __user *optval, +@@ -1605,6 +1605,7 @@ static int sctp_sendmsg(struct kiocb *iocb, struct sock *sk, + sctp_scope_t scope; + long timeo; + __u16 sinfo_flags = 0; ++ bool wait_connect = false; + struct sctp_datamsg *datamsg; + int msg_flags = msg->msg_flags; + +@@ -1924,6 +1925,7 @@ static int sctp_sendmsg(struct kiocb *iocb, struct sock *sk, + if (err < 0) + goto out_free; + ++ wait_connect = true; + pr_debug("%s: we associated primitively\n", __func__); + } + +@@ -1961,6 +1963,11 @@ static int sctp_sendmsg(struct kiocb *iocb, struct sock *sk, + sctp_datamsg_put(datamsg); + err = msg_len; + ++ if (unlikely(wait_connect)) { ++ timeo = sock_sndtimeo(sk, msg_flags & MSG_DONTWAIT); ++ sctp_wait_for_connect(asoc, &timeo); ++ } ++ + /* If we are already past ASSOCIATE, the lower + * layers are responsible for association cleanup. + */ +@@ -2175,11 +2182,13 @@ static int sctp_setsockopt_events(struct sock *sk, char __user *optval, { struct sctp_association *asoc; struct sctp_ulpevent *event; @@ -106811,7 +107156,7 @@ index 604a6ac..f87f0a3 100644 /* * At the time when a user app subscribes to SCTP_SENDER_DRY_EVENT, -@@ -4259,13 +4261,16 @@ static int sctp_getsockopt_disable_fragments(struct sock *sk, int len, +@@ -4259,13 +4268,16 @@ static int sctp_getsockopt_disable_fragments(struct sock *sk, int len, static int sctp_getsockopt_events(struct sock *sk, int len, char __user *optval, int __user *optlen) { @@ -106829,7 +107174,7 @@ index 604a6ac..f87f0a3 100644 return -EFAULT; return 0; } -@@ -4283,6 +4288,8 @@ static int sctp_getsockopt_events(struct sock *sk, int len, char __user *optval, +@@ -4283,6 +4295,8 @@ static int sctp_getsockopt_events(struct sock *sk, int len, char __user *optval, */ static int sctp_getsockopt_autoclose(struct sock *sk, int len, char __user *optval, int __user *optlen) { @@ -106838,7 +107183,7 @@ index 604a6ac..f87f0a3 100644 /* Applicable to UDP-style socket only */ if (sctp_style(sk, TCP)) return -EOPNOTSUPP; -@@ -4291,7 +4298,8 @@ static int sctp_getsockopt_autoclose(struct sock *sk, int len, char __user *optv +@@ -4291,7 +4305,8 @@ static int sctp_getsockopt_autoclose(struct sock *sk, int len, char __user *optv len = sizeof(int); if (put_user(len, optlen)) return -EFAULT; @@ -106848,7 +107193,7 @@ index 604a6ac..f87f0a3 100644 return -EFAULT; return 0; } -@@ -4666,12 +4674,15 @@ static int sctp_getsockopt_delayed_ack(struct sock *sk, int len, +@@ -4666,12 +4681,15 @@ static int sctp_getsockopt_delayed_ack(struct sock *sk, int len, */ static int sctp_getsockopt_initmsg(struct sock *sk, int len, char __user *optval, int __user *optlen) { @@ -106865,7 +107210,7 @@ index 604a6ac..f87f0a3 100644 return -EFAULT; return 0; } -@@ -4712,6 +4723,8 @@ static int sctp_getsockopt_peer_addrs(struct sock *sk, int len, +@@ -4712,6 +4730,8 @@ static int sctp_getsockopt_peer_addrs(struct sock *sk, int len, addrlen = sctp_get_af_specific(temp.sa.sa_family)->sockaddr_len; if (space_left < addrlen) return -ENOMEM; @@ -107992,6 +108337,19 @@ index 05a6e3d..6716ec9 100644 __xfrm_sysctl_init(net); +diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include +index 547e15d..e550fa6 100644 +--- a/scripts/Kbuild.include ++++ b/scripts/Kbuild.include +@@ -143,7 +143,7 @@ cc-ifversion = $(shell [ $(call cc-version, $(CC)) $(1) $(2) ] && echo $(3)) + # cc-ldoption + # Usage: ldflags += $(call cc-ldoption, -Wl$(comma)--hash-style=both) + cc-ldoption = $(call try-run,\ +- $(CC) $(1) -nostdlib -x c /dev/null -o "$$TMP",$(1),$(2)) ++ $(CC) $(1) -Wl,-r -nostdlib -x c /dev/null -o "$$TMP",$(1),$(2)) + + # ld-option + # Usage: LDFLAGS += $(call ld-option, -X) diff --git a/scripts/Makefile b/scripts/Makefile index 01e7adb..6176d5d 100644 --- a/scripts/Makefile diff --git a/3.18.5/0000_README b/3.18.5/0000_README index 634a195..b1f502a 100644 --- a/3.18.5/0000_README +++ b/3.18.5/0000_README @@ -2,7 +2,7 @@ README ----------------------------------------------------------------------------- Individual Patch Descriptions: ----------------------------------------------------------------------------- -Patch: 4420_grsecurity-3.0-3.18.5-201501310706.patch +Patch: 4420_grsecurity-3.0-3.18.5-201502052352.patch From: http://www.grsecurity.net Desc: hardened-sources base patch from upstream grsecurity 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 index 06b5a6e..ad22521 100644 --- 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 @@ -3894,7 +3894,7 @@ index 5e65ca8..879e7b3 100644 #define CACHE_LINE_SIZE 32 diff --git a/arch/arm/mm/context.c b/arch/arm/mm/context.c -index 6eb97b3..ac509f6 100644 +index 6eb97b3..e77848e 100644 --- a/arch/arm/mm/context.c +++ b/arch/arm/mm/context.c @@ -43,7 +43,7 @@ @@ -3906,7 +3906,40 @@ index 6eb97b3..ac509f6 100644 static DECLARE_BITMAP(asid_map, NUM_USER_ASIDS); static DEFINE_PER_CPU(atomic64_t, active_asids); -@@ -182,7 +182,7 @@ static u64 new_context(struct mm_struct *mm, unsigned int cpu) +@@ -144,21 +144,17 @@ static void flush_context(unsigned int cpu) + /* Update the list of reserved ASIDs and the ASID bitmap. */ + bitmap_clear(asid_map, 0, NUM_USER_ASIDS); + for_each_possible_cpu(i) { +- if (i == cpu) { +- asid = 0; +- } else { +- asid = atomic64_xchg(&per_cpu(active_asids, i), 0); +- /* +- * If this CPU has already been through a +- * rollover, but hasn't run another task in +- * the meantime, we must preserve its reserved +- * ASID, as this is the only trace we have of +- * the process it is still running. +- */ +- if (asid == 0) +- asid = per_cpu(reserved_asids, i); +- __set_bit(asid & ~ASID_MASK, asid_map); +- } ++ asid = atomic64_xchg(&per_cpu(active_asids, i), 0); ++ /* ++ * If this CPU has already been through a ++ * rollover, but hasn't run another task in ++ * the meantime, we must preserve its reserved ++ * ASID, as this is the only trace we have of ++ * the process it is still running. ++ */ ++ if (asid == 0) ++ asid = per_cpu(reserved_asids, i); ++ __set_bit(asid & ~ASID_MASK, asid_map); + per_cpu(reserved_asids, i) = asid; + } + +@@ -182,7 +178,7 @@ static u64 new_context(struct mm_struct *mm, unsigned int cpu) { static u32 cur_idx = 1; u64 asid = atomic64_read(&mm->context.id); @@ -3915,7 +3948,7 @@ index 6eb97b3..ac509f6 100644 if (asid != 0 && is_reserved_asid(asid)) { /* -@@ -203,7 +203,7 @@ static u64 new_context(struct mm_struct *mm, unsigned int cpu) +@@ -203,7 +199,7 @@ static u64 new_context(struct mm_struct *mm, unsigned int cpu) */ asid = find_next_zero_bit(asid_map, NUM_USER_ASIDS, cur_idx); if (asid == NUM_USER_ASIDS) { @@ -3924,7 +3957,7 @@ index 6eb97b3..ac509f6 100644 &asid_generation); flush_context(cpu); asid = find_next_zero_bit(asid_map, NUM_USER_ASIDS, 1); -@@ -234,14 +234,14 @@ void check_and_switch_context(struct mm_struct *mm, struct task_struct *tsk) +@@ -234,14 +230,14 @@ void check_and_switch_context(struct mm_struct *mm, struct task_struct *tsk) cpu_set_reserved_ttbr0(); asid = atomic64_read(&mm->context.id); @@ -22126,7 +22159,7 @@ index 5abd4cd..c65733b 100644 +EXPORT_SYMBOL(pax_check_alloca); +#endif diff --git a/arch/x86/kernel/dumpstack_64.c b/arch/x86/kernel/dumpstack_64.c -index ff86f19..a20c62c 100644 +index ff86f19..73eabf4 100644 --- a/arch/x86/kernel/dumpstack_64.c +++ b/arch/x86/kernel/dumpstack_64.c @@ -153,12 +153,12 @@ void dump_trace(struct task_struct *task, struct pt_regs *regs, @@ -22189,7 +22222,13 @@ index ff86f19..a20c62c 100644 put_cpu(); } EXPORT_SYMBOL(dump_trace); -@@ -349,3 +352,50 @@ int is_valid_bugaddr(unsigned long ip) +@@ -344,8 +347,55 @@ int is_valid_bugaddr(unsigned long ip) + { + unsigned short ud2; + +- if (__copy_from_user(&ud2, (const void __user *) ip, sizeof(ud2))) ++ if (probe_kernel_address((unsigned short *)ip, ud2)) + return 0; return ud2 == 0x0b0f; } @@ -35590,7 +35629,7 @@ index e88fda8..76ce7ce 100644 This is the Linux Xen port. Enabling this will allow the kernel to boot in a paravirtualized environment under the diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c -index fac5e4f..e421c18 100644 +index fac5e4f..89c3525 100644 --- a/arch/x86/xen/enlighten.c +++ b/arch/x86/xen/enlighten.c @@ -123,8 +123,6 @@ EXPORT_SYMBOL_GPL(xen_start_info); @@ -35678,19 +35717,21 @@ index fac5e4f..e421c18 100644 { if (pm_power_off) pm_power_off(); -@@ -1456,8 +1452,9 @@ static void __ref xen_setup_gdt(int cpu) +@@ -1456,8 +1452,11 @@ static void __ref xen_setup_gdt(int cpu) pv_cpu_ops.write_gdt_entry = xen_write_gdt_entry_boot; pv_cpu_ops.load_gdt = xen_load_gdt_boot; - setup_stack_canary_segment(0); - switch_to_new_gdt(0); + setup_stack_canary_segment(cpu); ++#ifdef CONFIG_X86_64 + load_percpu_segment(cpu); ++#endif + switch_to_new_gdt(cpu); pv_cpu_ops.write_gdt_entry = xen_write_gdt_entry; pv_cpu_ops.load_gdt = xen_load_gdt; -@@ -1573,7 +1570,17 @@ asmlinkage __visible void __init xen_start_kernel(void) +@@ -1573,7 +1572,17 @@ asmlinkage __visible void __init xen_start_kernel(void) __userpte_alloc_gfp &= ~__GFP_HIGHMEM; /* Work out if we support NX */ @@ -35709,7 +35750,7 @@ index fac5e4f..e421c18 100644 /* Get mfn list */ xen_build_dynamic_phys_to_machine(); -@@ -1601,13 +1608,6 @@ asmlinkage __visible void __init xen_start_kernel(void) +@@ -1601,13 +1610,6 @@ asmlinkage __visible void __init xen_start_kernel(void) machine_ops = xen_machine_ops; @@ -44014,6 +44055,19 @@ index 4d9b195..455075c 100644 return -EFAULT; } else { memcpy(buf, dp, left); +diff --git a/drivers/isdn/hardware/eicon/message.c b/drivers/isdn/hardware/eicon/message.c +index a82e542..f766a79 100644 +--- a/drivers/isdn/hardware/eicon/message.c ++++ b/drivers/isdn/hardware/eicon/message.c +@@ -1474,7 +1474,7 @@ static byte connect_res(dword Id, word Number, DIVA_CAPI_ADAPTER *a, + add_ai(plci, &parms[5]); + sig_req(plci, REJECT, 0); + } +- else if (Reject == 1 || Reject > 9) ++ else if (Reject == 1 || Reject >= 9) + { + add_ai(plci, &parms[5]); + sig_req(plci, HANGUP, 0); diff --git a/drivers/isdn/i4l/isdn_common.c b/drivers/isdn/i4l/isdn_common.c index 9b856e1..fa03c92 100644 --- a/drivers/isdn/i4l/isdn_common.c @@ -48093,6 +48147,19 @@ index 4ff1adc..0ea6bf4 100644 #include "ftmac100.h" +diff --git a/drivers/net/ethernet/freescale/gianfar_ethtool.c b/drivers/net/ethernet/freescale/gianfar_ethtool.c +index 76d7070..f6971182 100644 +--- a/drivers/net/ethernet/freescale/gianfar_ethtool.c ++++ b/drivers/net/ethernet/freescale/gianfar_ethtool.c +@@ -1581,7 +1581,7 @@ static int gfar_write_filer_table(struct gfar_private *priv, + return -EBUSY; + + /* Fill regular entries */ +- for (; i < MAX_FILER_IDX - 1 && (tab->fe[i].ctrl | tab->fe[i].ctrl); ++ for (; i < MAX_FILER_IDX - 1 && (tab->fe[i].ctrl | tab->fe[i].prop); + i++) + gfar_write_filer(priv, i, tab->fe[i].ctrl, tab->fe[i].prop); + /* Fill the rest with fall-troughs */ diff --git a/drivers/net/ethernet/intel/i40e/i40e_ptp.c b/drivers/net/ethernet/intel/i40e/i40e_ptp.c index 537b621..07f87ce 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_ptp.c @@ -48134,6 +48201,20 @@ index 11ff28b..375d659 100644 netdev_tx_completed_queue(ring->tx_queue, packets, bytes); +diff --git a/drivers/net/ethernet/mellanox/mlx4/mlx4.h b/drivers/net/ethernet/mellanox/mlx4/mlx4.h +index de10dbb..8b54f29 100644 +--- a/drivers/net/ethernet/mellanox/mlx4/mlx4.h ++++ b/drivers/net/ethernet/mellanox/mlx4/mlx4.h +@@ -233,7 +233,8 @@ do { \ + extern int mlx4_log_num_mgm_entry_size; + extern int log_mtts_per_seg; + +-#define MLX4_MAX_NUM_SLAVES (MLX4_MAX_NUM_PF + MLX4_MAX_NUM_VF) ++#define MLX4_MAX_NUM_SLAVES (min(MLX4_MAX_NUM_PF + MLX4_MAX_NUM_VF, \ ++ MLX4_MFUNC_MAX)) + #define ALL_SLAVES 0xff + + struct mlx4_bitmap { diff --git a/drivers/net/ethernet/neterion/s2io.c b/drivers/net/ethernet/neterion/s2io.c index f5e4b82..db0c7a9 100644 --- a/drivers/net/ethernet/neterion/s2io.c @@ -48326,6 +48407,42 @@ index 2f48f79..8ae1a1a 100644 spinlock_t request_lock; struct list_head req_list; +diff --git a/drivers/net/hyperv/netvsc.c b/drivers/net/hyperv/netvsc.c +index 7d76c95..63d7a64 100644 +--- a/drivers/net/hyperv/netvsc.c ++++ b/drivers/net/hyperv/netvsc.c +@@ -716,7 +716,7 @@ int netvsc_send(struct hv_device *device, + u64 req_id; + unsigned int section_index = NETVSC_INVALID_INDEX; + u32 msg_size = 0; +- struct sk_buff *skb; ++ struct sk_buff *skb = NULL; + u16 q_idx = packet->q_idx; + + +@@ -743,8 +743,6 @@ int netvsc_send(struct hv_device *device, + packet); + skb = (struct sk_buff *) + (unsigned long)packet->send_completion_tid; +- if (skb) +- dev_kfree_skb_any(skb); + packet->page_buf_cnt = 0; + } + } +@@ -807,6 +805,13 @@ int netvsc_send(struct hv_device *device, + packet, ret); + } + ++ if (ret != 0) { ++ if (section_index != NETVSC_INVALID_INDEX) ++ netvsc_free_send_slot(net_device, section_index); ++ } else if (skb) { ++ dev_kfree_skb_any(skb); ++ } ++ + return ret; + } + diff --git a/drivers/net/hyperv/rndis_filter.c b/drivers/net/hyperv/rndis_filter.c index 2b86f0b..ecc996f 100644 --- a/drivers/net/hyperv/rndis_filter.c @@ -48463,6 +48580,19 @@ index 34924df..a747360 100644 .kind = "nlmon", .priv_size = sizeof(struct nlmon), .setup = nlmon_setup, +diff --git a/drivers/net/ppp/ppp_deflate.c b/drivers/net/ppp/ppp_deflate.c +index 602c625..b5edc7f 100644 +--- a/drivers/net/ppp/ppp_deflate.c ++++ b/drivers/net/ppp/ppp_deflate.c +@@ -246,7 +246,7 @@ static int z_compress(void *arg, unsigned char *rptr, unsigned char *obuf, + /* + * See if we managed to reduce the size of the packet. + */ +- if (olen < isize) { ++ if (olen < isize && olen <= osize) { + state->stats.comp_bytes += olen; + state->stats.comp_packets++; + } else { diff --git a/drivers/net/ppp/ppp_generic.c b/drivers/net/ppp/ppp_generic.c index 794a473..9fd437b 100644 --- a/drivers/net/ppp/ppp_generic.c @@ -49592,6 +49722,40 @@ index a912dc0..a8225ba 100644 u16 int_num; ZD_ASSERT(in_interrupt()); +diff --git a/drivers/net/xen-netback/interface.c b/drivers/net/xen-netback/interface.c +index d752d1c..23e3203 100644 +--- a/drivers/net/xen-netback/interface.c ++++ b/drivers/net/xen-netback/interface.c +@@ -578,6 +578,7 @@ int xenvif_connect(struct xenvif_queue *queue, unsigned long tx_ring_ref, + goto err_rx_unbind; + } + queue->task = task; ++ get_task_struct(task); + + task = kthread_create(xenvif_dealloc_kthread, + (void *)queue, "%s-dealloc", queue->name); +@@ -634,6 +635,7 @@ void xenvif_disconnect(struct xenvif *vif) + + if (queue->task) { + kthread_stop(queue->task); ++ put_task_struct(queue->task); + queue->task = NULL; + } + +diff --git a/drivers/net/xen-netback/netback.c b/drivers/net/xen-netback/netback.c +index c39aace..e18728d 100644 +--- a/drivers/net/xen-netback/netback.c ++++ b/drivers/net/xen-netback/netback.c +@@ -2111,8 +2111,7 @@ int xenvif_kthread_guest_rx(void *data) + */ + if (unlikely(vif->disabled && queue->id == 0)) { + xenvif_carrier_off(vif); +- xenvif_rx_queue_purge(queue); +- continue; ++ break; + } + + if (!skb_queue_empty(&queue->rx_queue)) diff --git a/drivers/nfc/nfcwilink.c b/drivers/nfc/nfcwilink.c index 683671a..4519fc2 100644 --- a/drivers/nfc/nfcwilink.c @@ -51894,10 +52058,24 @@ index ae45bd9..c32a586 100644 transport_setup_device(&rport->dev); diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c -index cfba74c..415f09b 100644 +index cfba74c..4cdf6a1 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c -@@ -3022,7 +3022,7 @@ static int sd_probe(struct device *dev) +@@ -2818,9 +2818,11 @@ static int sd_revalidate_disk(struct gendisk *disk) + */ + sd_set_flush_flag(sdkp); + +- max_xfer = min_not_zero(queue_max_hw_sectors(sdkp->disk->queue), +- sdkp->max_xfer_blocks); ++ max_xfer = sdkp->max_xfer_blocks; + max_xfer <<= ilog2(sdp->sector_size) - 9; ++ ++ max_xfer = min_not_zero(queue_max_hw_sectors(sdkp->disk->queue), ++ max_xfer); + blk_queue_max_hw_sectors(sdkp->disk->queue, max_xfer); + set_capacity(disk, sdkp->capacity); + sd_config_write_same(sdkp); +@@ -3022,7 +3024,7 @@ static int sd_probe(struct device *dev) sdkp->disk = gd; sdkp->index = index; atomic_set(&sdkp->openers, 0); @@ -59720,7 +59898,7 @@ index f6e1237..796ffd1 100644 sb->s_bdi = &fsc->backing_dev_info; return err; diff --git a/fs/cifs/cifs_debug.c b/fs/cifs/cifs_debug.c -index 44ec726..bcb06a3 100644 +index 44ec726..11a056f 100644 --- a/fs/cifs/cifs_debug.c +++ b/fs/cifs/cifs_debug.c @@ -286,8 +286,8 @@ static ssize_t cifs_stats_proc_write(struct file *file, @@ -59763,6 +59941,20 @@ index 44ec726..bcb06a3 100644 if (server->ops->print_stats) server->ops->print_stats(m, tcon); } +@@ -615,9 +615,11 @@ cifs_security_flags_handle_must_flags(unsigned int *flags) + *flags = CIFSSEC_MUST_NTLMV2; + else if ((*flags & CIFSSEC_MUST_NTLM) == CIFSSEC_MUST_NTLM) + *flags = CIFSSEC_MUST_NTLM; +- else if ((*flags & CIFSSEC_MUST_LANMAN) == CIFSSEC_MUST_LANMAN) ++ else if (CIFSSEC_MUST_LANMAN && ++ (*flags & CIFSSEC_MUST_LANMAN) == CIFSSEC_MUST_LANMAN) + *flags = CIFSSEC_MUST_LANMAN; +- else if ((*flags & CIFSSEC_MUST_PLNTXT) == CIFSSEC_MUST_PLNTXT) ++ else if (CIFSSEC_MUST_PLNTXT && ++ (*flags & CIFSSEC_MUST_PLNTXT) == CIFSSEC_MUST_PLNTXT) + *flags = CIFSSEC_MUST_PLNTXT; + + *flags |= signflags; diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c index 9d7996e..35ad5cf4 100644 --- a/fs/cifs/cifsfs.c @@ -59881,10 +60073,37 @@ index 02a33e5..3a28b5a 100644 GLOBAL_EXTERN atomic_t smBufAllocCount; GLOBAL_EXTERN atomic_t midCount; diff --git a/fs/cifs/file.c b/fs/cifs/file.c -index 3e4d00a..38a122d 100644 +index 3e4d00a..4132187 100644 --- a/fs/cifs/file.c +++ b/fs/cifs/file.c -@@ -2056,10 +2056,14 @@ static int cifs_writepages(struct address_space *mapping, +@@ -366,6 +366,7 @@ void cifsFileInfo_put(struct cifsFileInfo *cifs_file) + struct cifsLockInfo *li, *tmp; + struct cifs_fid fid; + struct cifs_pending_open open; ++ bool oplock_break_cancelled; + + spin_lock(&cifs_file_list_lock); + if (--cifs_file->count > 0) { +@@ -397,7 +398,7 @@ void cifsFileInfo_put(struct cifsFileInfo *cifs_file) + } + spin_unlock(&cifs_file_list_lock); + +- cancel_work_sync(&cifs_file->oplock_break); ++ oplock_break_cancelled = cancel_work_sync(&cifs_file->oplock_break); + + if (!tcon->need_reconnect && !cifs_file->invalidHandle) { + struct TCP_Server_Info *server = tcon->ses->server; +@@ -409,6 +410,9 @@ void cifsFileInfo_put(struct cifsFileInfo *cifs_file) + _free_xid(xid); + } + ++ if (oplock_break_cancelled) ++ cifs_done_oplock_break(cifsi); ++ + cifs_del_pending_open(&open); + + /* +@@ -2056,10 +2060,14 @@ static int cifs_writepages(struct address_space *mapping, index = mapping->writeback_index; /* Start from prev offset */ end = -1; } else { @@ -60168,6 +60387,19 @@ index 8f1672b..af339c07 100644 } req->FileIndex = cpu_to_le32(index); +diff --git a/fs/cifs/smbencrypt.c b/fs/cifs/smbencrypt.c +index 6c15663..a4232ec 100644 +--- a/fs/cifs/smbencrypt.c ++++ b/fs/cifs/smbencrypt.c +@@ -221,7 +221,7 @@ E_md4hash(const unsigned char *passwd, unsigned char *p16, + } + + rc = mdfour(p16, (unsigned char *) wpwd, len * sizeof(__le16)); +- memset(wpwd, 0, 129 * sizeof(__le16)); ++ memzero_explicit(wpwd, sizeof(wpwd)); + + return rc; + } diff --git a/fs/coda/cache.c b/fs/coda/cache.c index 46ee6f2..89a9e7f 100644 --- a/fs/coda/cache.c @@ -61935,7 +62167,7 @@ index 99d440a..eb979d1 100644 } EXPORT_SYMBOL(__f_setown); diff --git a/fs/fhandle.c b/fs/fhandle.c -index 999ff5c..ac037c9 100644 +index 999ff5c..2281df9 100644 --- a/fs/fhandle.c +++ b/fs/fhandle.c @@ -8,6 +8,7 @@ @@ -61965,6 +62197,18 @@ index 999ff5c..ac037c9 100644 retval = -EPERM; goto out_err; } +@@ -195,8 +195,9 @@ static int handle_to_path(int mountdirfd, struct file_handle __user *ufh, + goto out_err; + } + /* copy the full handle */ +- if (copy_from_user(handle, ufh, +- sizeof(struct file_handle) + ++ *handle = f_handle; ++ if (copy_from_user(&handle->f_handle, ++ &ufh->f_handle, + f_handle.handle_bytes)) { + retval = -EFAULT; + goto out_handle; diff --git a/fs/file.c b/fs/file.c index ab3eb6a..8de2392 100644 --- a/fs/file.c @@ -83097,6 +83341,19 @@ index 3d385c8..deacb6a 100644 static inline int vma_dup_policy(struct vm_area_struct *src, struct vm_area_struct *dst) +diff --git a/include/linux/mlx4/device.h b/include/linux/mlx4/device.h +index 37e4404..26ebbd0 100644 +--- a/include/linux/mlx4/device.h ++++ b/include/linux/mlx4/device.h +@@ -97,7 +97,7 @@ enum { + MLX4_MAX_NUM_PF = 16, + MLX4_MAX_NUM_VF = 64, + MLX4_MAX_NUM_VF_P_PORT = 64, +- MLX4_MFUNC_MAX = 80, ++ MLX4_MFUNC_MAX = 128, + MLX4_MAX_EQ_NUM = 1024, + MLX4_MFUNC_EQ_NUM = 4, + MLX4_MFUNC_MAX_EQES = 8, diff --git a/include/linux/mm.h b/include/linux/mm.h index 5ab2da9..5f0b3df 100644 --- a/include/linux/mm.h @@ -86073,6 +86330,23 @@ index 8109a15..504466d 100644 +extern atomic_unchecked_t flow_cache_genid; #endif +diff --git a/include/net/flow_keys.h b/include/net/flow_keys.h +index 7ee2df0..dc8fd81 100644 +--- a/include/net/flow_keys.h ++++ b/include/net/flow_keys.h +@@ -22,9 +22,9 @@ struct flow_keys { + __be32 ports; + __be16 port16[2]; + }; +- u16 thoff; +- u16 n_proto; +- u8 ip_proto; ++ u16 thoff; ++ __be16 n_proto; ++ u8 ip_proto; + }; + + bool __skb_flow_dissect(const struct sk_buff *skb, struct flow_keys *flow, diff --git a/include/net/genetlink.h b/include/net/genetlink.h index af10c2c..a431cc5 100644 --- a/include/net/genetlink.h @@ -86126,10 +86400,28 @@ index 80479ab..0c3f647 100644 struct rcu_head rcu; struct inet_peer *gc_next; diff --git a/include/net/ip.h b/include/net/ip.h -index 0bb6207..a8878af 100644 +index 0bb6207..1f38247 100644 --- a/include/net/ip.h +++ b/include/net/ip.h -@@ -316,7 +316,7 @@ static inline unsigned int ip_skb_dst_mtu(const struct sk_buff *skb) +@@ -39,11 +39,12 @@ struct inet_skb_parm { + struct ip_options opt; /* Compiled IP options */ + unsigned char flags; + +-#define IPSKB_FORWARDED 1 +-#define IPSKB_XFRM_TUNNEL_SIZE 2 +-#define IPSKB_XFRM_TRANSFORMED 4 +-#define IPSKB_FRAG_COMPLETE 8 +-#define IPSKB_REROUTED 16 ++#define IPSKB_FORWARDED BIT(0) ++#define IPSKB_XFRM_TUNNEL_SIZE BIT(1) ++#define IPSKB_XFRM_TRANSFORMED BIT(2) ++#define IPSKB_FRAG_COMPLETE BIT(3) ++#define IPSKB_REROUTED BIT(4) ++#define IPSKB_DOREDIRECT BIT(5) + + u16 frag_max_size; + }; +@@ -316,7 +317,7 @@ static inline unsigned int ip_skb_dst_mtu(const struct sk_buff *skb) } } @@ -86187,6 +86479,28 @@ index 615b20b..fd4cbd8 100644 /* ip_vs_est */ struct list_head est_list; /* estimator list */ spinlock_t est_lock; +diff --git a/include/net/ipv6.h b/include/net/ipv6.h +index 4292929..7e21d2e 100644 +--- a/include/net/ipv6.h ++++ b/include/net/ipv6.h +@@ -708,7 +708,7 @@ static inline __be32 ip6_make_flowlabel(struct net *net, struct sk_buff *skb, + __be32 flowlabel, bool autolabel) + { + if (!flowlabel && (autolabel || net->ipv6.sysctl.auto_flowlabels)) { +- __be32 hash; ++ u32 hash; + + hash = skb_get_hash(skb); + +@@ -718,7 +718,7 @@ static inline __be32 ip6_make_flowlabel(struct net *net, struct sk_buff *skb, + */ + hash ^= hash >> 12; + +- flowlabel = hash & IPV6_FLOWLABEL_MASK; ++ flowlabel = (__force __be32)hash & IPV6_FLOWLABEL_MASK; + } + + return flowlabel; diff --git a/include/net/irda/ircomm_tty.h b/include/net/irda/ircomm_tty.h index 8d4f588..2e37ad2 100644 --- a/include/net/irda/ircomm_tty.h @@ -98084,7 +98398,7 @@ index ace9345..63320dc 100644 if (nstart < prev->vm_end) diff --git a/mm/mremap.c b/mm/mremap.c -index b147f66..98a695a 100644 +index b147f66..98a695ab 100644 --- a/mm/mremap.c +++ b/mm/mremap.c @@ -144,6 +144,12 @@ static void move_ptes(struct vm_area_struct *vma, pmd_t *old_pmd, @@ -101187,7 +101501,7 @@ index fdbc9a8..cd6972c 100644 return err; diff --git a/net/core/dev.c b/net/core/dev.c -index 8440968..d1d6bea 100644 +index 8440968..e14d2b7 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -1683,14 +1683,14 @@ int __dev_forward_skb(struct net_device *dev, struct sk_buff *skb) @@ -101252,6 +101566,24 @@ index 8440968..d1d6bea 100644 { struct softnet_data *sd = this_cpu_ptr(&softnet_data); unsigned long time_limit = jiffies + 2; +@@ -5247,7 +5247,7 @@ void netdev_upper_dev_unlink(struct net_device *dev, + } + EXPORT_SYMBOL(netdev_upper_dev_unlink); + +-void netdev_adjacent_add_links(struct net_device *dev) ++static void netdev_adjacent_add_links(struct net_device *dev) + { + struct netdev_adjacent *iter; + +@@ -5272,7 +5272,7 @@ void netdev_adjacent_add_links(struct net_device *dev) + } + } + +-void netdev_adjacent_del_links(struct net_device *dev) ++static void netdev_adjacent_del_links(struct net_device *dev) + { + struct netdev_adjacent *iter; + @@ -6557,8 +6557,8 @@ struct rtnl_link_stats64 *dev_get_stats(struct net_device *dev, } else { netdev_stats_to_stats64(storage, &dev->stats); @@ -101263,6 +101595,15 @@ index 8440968..d1d6bea 100644 return storage; } EXPORT_SYMBOL(dev_get_stats); +@@ -6574,7 +6574,7 @@ struct netdev_queue *dev_ingress_queue_create(struct net_device *dev) + if (!queue) + return NULL; + netdev_init_one_queue(dev, queue, NULL); +- queue->qdisc = &noop_qdisc; ++ RCU_INIT_POINTER(queue->qdisc, &noop_qdisc); + queue->qdisc_sleeping = &noop_qdisc; + rcu_assign_pointer(dev->ingress_queue, queue); + #endif diff --git a/net/core/dev_ioctl.c b/net/core/dev_ioctl.c index 72e899a..79a9409 100644 --- a/net/core/dev_ioctl.c @@ -101318,7 +101659,7 @@ index 647b122..18a7ff6 100644 fp->len = fprog->len; /* Since unattached filters are not copied back to user diff --git a/net/core/flow.c b/net/core/flow.c -index a0348fd..6951c76 100644 +index a0348fd..340f65d 100644 --- a/net/core/flow.c +++ b/net/core/flow.c @@ -65,7 +65,7 @@ static void flow_cache_new_hashrnd(unsigned long arg) @@ -101348,6 +101689,15 @@ index a0348fd..6951c76 100644 if (!IS_ERR(flo)) fle->object = flo; else +@@ -379,7 +379,7 @@ done: + static void flow_cache_flush_task(struct work_struct *work) + { + struct netns_xfrm *xfrm = container_of(work, struct netns_xfrm, +- flow_cache_gc_work); ++ flow_cache_flush_work); + struct net *net = container_of(xfrm, struct net, xfrm); + + flow_cache_flush(net); diff --git a/net/core/iovec.c b/net/core/iovec.c index e1ec45a..e5c6f16 100644 --- a/net/core/iovec.c @@ -102209,6 +102559,20 @@ index 241afd7..31b95d5 100644 p->metrics[RTAX_LOCK-1] = INETPEER_METRICS_NEW; p->rate_tokens = 0; /* 60*HZ is arbitrary, but chosen enough high so that the first +diff --git a/net/ipv4/ip_forward.c b/net/ipv4/ip_forward.c +index 3a83ce5..787b3c2 100644 +--- a/net/ipv4/ip_forward.c ++++ b/net/ipv4/ip_forward.c +@@ -129,7 +129,8 @@ int ip_forward(struct sk_buff *skb) + * We now generate an ICMP HOST REDIRECT giving the route + * we calculated. + */ +- if (rt->rt_flags&RTCF_DOREDIRECT && !opt->srr && !skb_sec_path(skb)) ++ if (IPCB(skb)->flags & IPSKB_DOREDIRECT && !opt->srr && ++ !skb_sec_path(skb)) + ip_rt_send_redirect(skb); + + skb->priority = rt_tos2priority(iph->tos); diff --git a/net/ipv4/ip_fragment.c b/net/ipv4/ip_fragment.c index 2811cc1..ad5a534 100644 --- a/net/ipv4/ip_fragment.c @@ -102316,6 +102680,18 @@ index 3d4da2c..40f9c29 100644 icmp_send(skb, ICMP_DEST_UNREACH, ICMP_PROT_UNREACH, 0); } +diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c +index bc6471d..c5e8a0c 100644 +--- a/net/ipv4/ip_output.c ++++ b/net/ipv4/ip_output.c +@@ -1517,6 +1517,7 @@ static DEFINE_PER_CPU(struct inet_sock, unicast_sock) = { + .sk_wmem_alloc = ATOMIC_INIT(1), + .sk_allocation = GFP_ATOMIC, + .sk_flags = (1UL << SOCK_USE_WRITE_QUEUE), ++ .sk_pacing_rate = ~0U, + }, + .pmtudisc = IP_PMTUDISC_WANT, + .uc_ttl = -1, diff --git a/net/ipv4/ip_sockglue.c b/net/ipv4/ip_sockglue.c index 9daf217..373d454 100644 --- a/net/ipv4/ip_sockglue.c @@ -102675,7 +103051,7 @@ index 739db31..74f0210 100644 static int raw_seq_show(struct seq_file *seq, void *v) diff --git a/net/ipv4/route.c b/net/ipv4/route.c -index 6a2155b..d426880 100644 +index 6a2155b..47de388 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c @@ -228,7 +228,7 @@ static const struct seq_operations rt_cache_seq_ops = { @@ -102728,7 +103104,31 @@ index 6a2155b..d426880 100644 } EXPORT_SYMBOL(ip_idents_reserve); -@@ -2624,34 +2624,34 @@ static struct ctl_table ipv4_route_flush_table[] = { +@@ -1554,11 +1554,10 @@ static int __mkroute_input(struct sk_buff *skb, + + do_cache = res->fi && !itag; + if (out_dev == in_dev && err && IN_DEV_TX_REDIRECTS(out_dev) && ++ skb->protocol == htons(ETH_P_IP) && + (IN_DEV_SHARED_MEDIA(out_dev) || +- inet_addr_onlink(out_dev, saddr, FIB_RES_GW(*res)))) { +- flags |= RTCF_DOREDIRECT; +- do_cache = false; +- } ++ inet_addr_onlink(out_dev, saddr, FIB_RES_GW(*res)))) ++ IPCB(skb)->flags |= IPSKB_DOREDIRECT; + + if (skb->protocol != htons(ETH_P_IP)) { + /* Not IP (i.e. ARP). Do not create route, if it is +@@ -2303,6 +2302,8 @@ static int rt_fill_info(struct net *net, __be32 dst, __be32 src, + r->rtm_flags = (rt->rt_flags & ~0xFFFF) | RTM_F_CLONED; + if (rt->rt_flags & RTCF_NOTIFY) + r->rtm_flags |= RTM_F_NOTIFY; ++ if (IPCB(skb)->flags & IPSKB_DOREDIRECT) ++ r->rtm_flags |= RTCF_DOREDIRECT; + + if (nla_put_be32(skb, RTA_DST, dst)) + goto nla_put_failure; +@@ -2624,34 +2625,34 @@ static struct ctl_table ipv4_route_flush_table[] = { .maxlen = sizeof(int), .mode = 0200, .proc_handler = ipv4_sysctl_rtcache_flush, @@ -102771,7 +103171,7 @@ index 6a2155b..d426880 100644 err_dup: return -ENOMEM; } -@@ -2674,8 +2674,8 @@ static __net_initdata struct pernet_operations sysctl_route_ops = { +@@ -2674,8 +2675,8 @@ static __net_initdata struct pernet_operations sysctl_route_ops = { static __net_init int rt_genid_init(struct net *net) { @@ -102782,7 +103182,7 @@ index 6a2155b..d426880 100644 get_random_bytes(&net->ipv4.dev_addr_genid, sizeof(net->ipv4.dev_addr_genid)); return 0; -@@ -2718,11 +2718,7 @@ int __init ip_rt_init(void) +@@ -2718,11 +2719,7 @@ int __init ip_rt_init(void) { int rc = 0; @@ -103410,7 +103810,7 @@ index b2d1838..0194c04 100644 return new; } diff --git a/net/ipv6/ip6_gre.c b/net/ipv6/ip6_gre.c -index 0e32d2e..98cbe65 100644 +index 0e32d2e..dd45cdc 100644 --- a/net/ipv6/ip6_gre.c +++ b/net/ipv6/ip6_gre.c @@ -71,8 +71,8 @@ struct ip6gre_net { @@ -103424,6 +103824,24 @@ index 0e32d2e..98cbe65 100644 static int ip6gre_tunnel_init(struct net_device *dev); static void ip6gre_tunnel_setup(struct net_device *dev); static void ip6gre_tunnel_link(struct ip6gre_net *ign, struct ip6_tnl *t); +@@ -417,7 +417,7 @@ static void ip6gre_err(struct sk_buff *skb, struct inet6_skb_parm *opt, + if (code == ICMPV6_HDR_FIELD) + teli = ip6_tnl_parse_tlv_enc_lim(skb, skb->data); + +- if (teli && teli == info - 2) { ++ if (teli && teli == be32_to_cpu(info) - 2) { + tel = (struct ipv6_tlv_tnl_enc_lim *) &skb->data[teli]; + if (tel->encap_limit == 0) { + net_warn_ratelimited("%s: Too small encapsulation limit or routing loop in tunnel!\n", +@@ -429,7 +429,7 @@ static void ip6gre_err(struct sk_buff *skb, struct inet6_skb_parm *opt, + } + break; + case ICMPV6_PKT_TOOBIG: +- mtu = info - offset; ++ mtu = be32_to_cpu(info) - offset; + if (mtu < IPV6_MIN_MTU) + mtu = IPV6_MIN_MTU; + t->dev->mtu = mtu; @@ -1289,7 +1289,7 @@ static void ip6gre_fb_tunnel_init(struct net_device *dev) } @@ -103818,7 +104236,7 @@ index a318dd89..42a612c 100644 table = kmemdup(ipv6_route_table_template, sizeof(ipv6_route_table_template), diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c -index a24557a..00a9ed1 100644 +index a24557a..ade77d3 100644 --- a/net/ipv6/sit.c +++ b/net/ipv6/sit.c @@ -74,7 +74,7 @@ static void ipip6_tunnel_setup(struct net_device *dev); @@ -103830,6 +104248,33 @@ index a24557a..00a9ed1 100644 static int sit_net_id __read_mostly; struct sit_net { +@@ -1505,12 +1505,12 @@ static bool ipip6_netlink_encap_parms(struct nlattr *data[], + + if (data[IFLA_IPTUN_ENCAP_SPORT]) { + ret = true; +- ipencap->sport = nla_get_u16(data[IFLA_IPTUN_ENCAP_SPORT]); ++ ipencap->sport = nla_get_be16(data[IFLA_IPTUN_ENCAP_SPORT]); + } + + if (data[IFLA_IPTUN_ENCAP_DPORT]) { + ret = true; +- ipencap->dport = nla_get_u16(data[IFLA_IPTUN_ENCAP_DPORT]); ++ ipencap->dport = nla_get_be16(data[IFLA_IPTUN_ENCAP_DPORT]); + } + + return ret; +@@ -1706,9 +1706,9 @@ static int ipip6_fill_info(struct sk_buff *skb, const struct net_device *dev) + + if (nla_put_u16(skb, IFLA_IPTUN_ENCAP_TYPE, + tunnel->encap.type) || +- nla_put_u16(skb, IFLA_IPTUN_ENCAP_SPORT, ++ nla_put_be16(skb, IFLA_IPTUN_ENCAP_SPORT, + tunnel->encap.sport) || +- nla_put_u16(skb, IFLA_IPTUN_ENCAP_DPORT, ++ nla_put_be16(skb, IFLA_IPTUN_ENCAP_DPORT, + tunnel->encap.dport) || + nla_put_u16(skb, IFLA_IPTUN_ENCAP_FLAGS, + tunnel->encap.dport)) @@ -1750,7 +1750,7 @@ static void ipip6_dellink(struct net_device *dev, struct list_head *head) unregister_netdevice_queue(dev, head); } @@ -104887,6 +105332,22 @@ index c68c1e5..8b5d670 100644 mutex_unlock(&nf_sockopt_mutex); } EXPORT_SYMBOL(nf_unregister_sockopt); +diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c +index 71b574c..d319e8b 100644 +--- a/net/netfilter/nf_tables_api.c ++++ b/net/netfilter/nf_tables_api.c +@@ -1134,9 +1134,11 @@ static struct nft_stats __percpu *nft_stats_alloc(const struct nlattr *attr) + /* Restore old counters on this cpu, no problem. Per-cpu statistics + * are not exposed to userspace. + */ ++ preempt_disable(); + stats = this_cpu_ptr(newstats); + stats->bytes = be64_to_cpu(nla_get_be64(tb[NFTA_COUNTER_BYTES])); + stats->pkts = be64_to_cpu(nla_get_be64(tb[NFTA_COUNTER_PACKETS])); ++ preempt_enable(); + + return newstats; + } diff --git a/net/netfilter/nfnetlink_log.c b/net/netfilter/nfnetlink_log.c index 5f1be5b..2cba8cd 100644 --- a/net/netfilter/nfnetlink_log.c @@ -105374,6 +105835,27 @@ index 48f8ffc..0ef3eec 100644 struct rds_sock { struct sock rs_sk; +diff --git a/net/rds/sysctl.c b/net/rds/sysctl.c +index c3b0cd4..c173f69 100644 +--- a/net/rds/sysctl.c ++++ b/net/rds/sysctl.c +@@ -71,14 +71,14 @@ static struct ctl_table rds_sysctl_rds_table[] = { + { + .procname = "max_unacked_packets", + .data = &rds_sysctl_max_unacked_packets, +- .maxlen = sizeof(unsigned long), ++ .maxlen = sizeof(int), + .mode = 0644, + .proc_handler = proc_dointvec, + }, + { + .procname = "max_unacked_bytes", + .data = &rds_sysctl_max_unacked_bytes, +- .maxlen = sizeof(unsigned long), ++ .maxlen = sizeof(int), + .mode = 0644, + .proc_handler = proc_dointvec, + }, diff --git a/net/rds/tcp.c b/net/rds/tcp.c index edac9ef..16bcb98 100644 --- a/net/rds/tcp.c @@ -105665,6 +106147,31 @@ index f226709..0e735a8 100644 _proto("Tx RESPONSE %%%u", ntohl(hdr->serial)); ret = kernel_sendmsg(conn->trans->local->socket, &msg, iov, 3, len); +diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c +index aad6a67..baef987 100644 +--- a/net/sched/cls_api.c ++++ b/net/sched/cls_api.c +@@ -556,8 +556,9 @@ void tcf_exts_change(struct tcf_proto *tp, struct tcf_exts *dst, + } + EXPORT_SYMBOL(tcf_exts_change); + +-#define tcf_exts_first_act(ext) \ +- list_first_entry(&(exts)->actions, struct tc_action, list) ++#define tcf_exts_first_act(ext) \ ++ list_first_entry_or_null(&(exts)->actions, \ ++ struct tc_action, list) + + int tcf_exts_dump(struct sk_buff *skb, struct tcf_exts *exts) + { +@@ -603,7 +604,7 @@ int tcf_exts_dump_stats(struct sk_buff *skb, struct tcf_exts *exts) + { + #ifdef CONFIG_NET_CLS_ACT + struct tc_action *a = tcf_exts_first_act(exts); +- if (tcf_action_copy_stats(skb, a, 1) < 0) ++ if (a != NULL && tcf_action_copy_stats(skb, a, 1) < 0) + return -1; + #endif + return 0; diff --git a/net/sched/cls_bpf.c b/net/sched/cls_bpf.c index eed49d1..ce22514 100644 --- a/net/sched/cls_bpf.c @@ -105827,10 +106334,39 @@ index fef2acd..c705c4f 100644 sctp_generate_t1_cookie_event, sctp_generate_t1_init_event, diff --git a/net/sctp/socket.c b/net/sctp/socket.c -index 634a2ab..8e93929 100644 +index 634a2ab..dfdaf9b 100644 --- a/net/sctp/socket.c +++ b/net/sctp/socket.c -@@ -2199,11 +2199,13 @@ static int sctp_setsockopt_events(struct sock *sk, char __user *optval, +@@ -1603,7 +1603,7 @@ static int sctp_sendmsg(struct kiocb *iocb, struct sock *sk, + sctp_assoc_t associd = 0; + sctp_cmsgs_t cmsgs = { NULL }; + sctp_scope_t scope; +- bool fill_sinfo_ttl = false; ++ bool fill_sinfo_ttl = false, wait_connect = false; + struct sctp_datamsg *datamsg; + int msg_flags = msg->msg_flags; + __u16 sinfo_flags = 0; +@@ -1943,6 +1943,7 @@ static int sctp_sendmsg(struct kiocb *iocb, struct sock *sk, + if (err < 0) + goto out_free; + ++ wait_connect = true; + pr_debug("%s: we associated primitively\n", __func__); + } + +@@ -1980,6 +1981,11 @@ static int sctp_sendmsg(struct kiocb *iocb, struct sock *sk, + sctp_datamsg_put(datamsg); + err = msg_len; + ++ if (unlikely(wait_connect)) { ++ timeo = sock_sndtimeo(sk, msg_flags & MSG_DONTWAIT); ++ sctp_wait_for_connect(asoc, &timeo); ++ } ++ + /* If we are already past ASSOCIATE, the lower + * layers are responsible for association cleanup. + */ +@@ -2199,11 +2205,13 @@ static int sctp_setsockopt_events(struct sock *sk, char __user *optval, { struct sctp_association *asoc; struct sctp_ulpevent *event; @@ -105845,7 +106381,7 @@ index 634a2ab..8e93929 100644 if (sctp_sk(sk)->subscribe.sctp_data_io_event) pr_warn_ratelimited(DEPRECATED "%s (pid %d) " -@@ -4372,13 +4374,16 @@ static int sctp_getsockopt_disable_fragments(struct sock *sk, int len, +@@ -4372,13 +4380,16 @@ static int sctp_getsockopt_disable_fragments(struct sock *sk, int len, static int sctp_getsockopt_events(struct sock *sk, int len, char __user *optval, int __user *optlen) { @@ -105863,7 +106399,7 @@ index 634a2ab..8e93929 100644 return -EFAULT; return 0; } -@@ -4396,6 +4401,8 @@ static int sctp_getsockopt_events(struct sock *sk, int len, char __user *optval, +@@ -4396,6 +4407,8 @@ static int sctp_getsockopt_events(struct sock *sk, int len, char __user *optval, */ static int sctp_getsockopt_autoclose(struct sock *sk, int len, char __user *optval, int __user *optlen) { @@ -105872,7 +106408,7 @@ index 634a2ab..8e93929 100644 /* Applicable to UDP-style socket only */ if (sctp_style(sk, TCP)) return -EOPNOTSUPP; -@@ -4404,7 +4411,8 @@ static int sctp_getsockopt_autoclose(struct sock *sk, int len, char __user *optv +@@ -4404,7 +4417,8 @@ static int sctp_getsockopt_autoclose(struct sock *sk, int len, char __user *optv len = sizeof(int); if (put_user(len, optlen)) return -EFAULT; @@ -105882,7 +106418,7 @@ index 634a2ab..8e93929 100644 return -EFAULT; return 0; } -@@ -4778,12 +4786,15 @@ static int sctp_getsockopt_delayed_ack(struct sock *sk, int len, +@@ -4778,12 +4792,15 @@ static int sctp_getsockopt_delayed_ack(struct sock *sk, int len, */ static int sctp_getsockopt_initmsg(struct sock *sk, int len, char __user *optval, int __user *optlen) { @@ -105899,7 +106435,7 @@ index 634a2ab..8e93929 100644 return -EFAULT; return 0; } -@@ -4824,6 +4835,8 @@ static int sctp_getsockopt_peer_addrs(struct sock *sk, int len, +@@ -4824,6 +4841,8 @@ static int sctp_getsockopt_peer_addrs(struct sock *sk, int len, ->addr_to_user(sp, &temp); if (space_left < addrlen) return -ENOMEM; @@ -107012,6 +107548,19 @@ index 05a6e3d..6716ec9 100644 __xfrm_sysctl_init(net); +diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include +index 65e7b08..1b868d5 100644 +--- a/scripts/Kbuild.include ++++ b/scripts/Kbuild.include +@@ -144,7 +144,7 @@ cc-ifversion = $(shell [ $(call cc-version, $(CC)) $(1) $(2) ] && echo $(3)) + # cc-ldoption + # Usage: ldflags += $(call cc-ldoption, -Wl$(comma)--hash-style=both) + cc-ldoption = $(call try-run,\ +- $(CC) $(1) -nostdlib -x c /dev/null -o "$$TMP",$(1),$(2)) ++ $(CC) $(1) -Wl,-r -nostdlib -x c /dev/null -o "$$TMP",$(1),$(2)) + + # ld-option + # Usage: LDFLAGS += $(call ld-option, -X) diff --git a/scripts/Makefile.build b/scripts/Makefile.build index 649ce68..f6bc05c 100644 --- a/scripts/Makefile.build diff --git a/3.2.66/0000_README b/3.2.66/0000_README index 2b43bf6..3806e75 100644 --- a/3.2.66/0000_README +++ b/3.2.66/0000_README @@ -182,7 +182,7 @@ Patch: 1065_linux-3.2.66.patch From: http://www.kernel.org Desc: Linux 3.2.66 -Patch: 4420_grsecurity-3.0-3.2.66-201501272306.patch +Patch: 4420_grsecurity-3.0-3.2.66-201502052350.patch From: http://www.grsecurity.net Desc: hardened-sources base patch from upstream grsecurity 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 index 082c246..520ed1e 100644 --- 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 @@ -18748,7 +18748,7 @@ index c99f9ed..76cf602 100644 +EXPORT_SYMBOL(pax_check_alloca); +#endif diff --git a/arch/x86/kernel/dumpstack_64.c b/arch/x86/kernel/dumpstack_64.c -index 5e890cc..048f251 100644 +index 5e890cc..66ec71b 100644 --- a/arch/x86/kernel/dumpstack_64.c +++ b/arch/x86/kernel/dumpstack_64.c @@ -118,9 +118,9 @@ void dump_trace(struct task_struct *task, struct pt_regs *regs, @@ -18821,7 +18821,13 @@ index 5e890cc..048f251 100644 struct task_struct *cur = current; sp = regs->sp; -@@ -304,3 +308,50 @@ int is_valid_bugaddr(unsigned long ip) +@@ -299,8 +303,55 @@ int is_valid_bugaddr(unsigned long ip) + { + unsigned short ud2; + +- if (__copy_from_user(&ud2, (const void __user *) ip, sizeof(ud2))) ++ if (probe_kernel_address((unsigned short *)ip, ud2)) + return 0; return ud2 == 0x0b0f; } @@ -18900,10 +18906,10 @@ index cd28a35..c72ed9a 100644 #include <asm/processor.h> #include <asm/fcntl.h> diff --git a/arch/x86/kernel/entry_32.S b/arch/x86/kernel/entry_32.S -index 0fa4f89..40ff646 100644 +index 0fa4f89..dbbfa58 100644 --- a/arch/x86/kernel/entry_32.S +++ b/arch/x86/kernel/entry_32.S -@@ -180,13 +180,153 @@ +@@ -180,13 +180,154 @@ /*CFI_REL_OFFSET gs, PT_GS*/ .endm .macro SET_KERNEL_GS reg @@ -19032,6 +19038,7 @@ index 0fa4f89..40ff646 100644 + jne 1b + +2: cld ++ or $2*4, %edi + mov %esp, %ecx + sub %edi, %ecx + @@ -19058,7 +19065,7 @@ index 0fa4f89..40ff646 100644 cld PUSH_GS pushl_cfi %fs -@@ -209,7 +349,7 @@ +@@ -209,7 +350,7 @@ CFI_REL_OFFSET ecx, 0 pushl_cfi %ebx CFI_REL_OFFSET ebx, 0 @@ -19067,7 +19074,7 @@ index 0fa4f89..40ff646 100644 movl %edx, %ds movl %edx, %es movl $(__KERNEL_PERCPU), %edx -@@ -217,6 +357,15 @@ +@@ -217,6 +358,15 @@ SET_KERNEL_GS %edx .endm @@ -19083,7 +19090,7 @@ index 0fa4f89..40ff646 100644 .macro RESTORE_INT_REGS popl_cfi %ebx CFI_RESTORE ebx -@@ -302,7 +451,7 @@ ENTRY(ret_from_fork) +@@ -302,7 +452,7 @@ ENTRY(ret_from_fork) popfl_cfi jmp syscall_exit CFI_ENDPROC @@ -19092,7 +19099,7 @@ index 0fa4f89..40ff646 100644 /* * Interrupt exit functions should be protected against kprobes -@@ -336,7 +485,15 @@ resume_userspace_sig: +@@ -336,7 +486,15 @@ resume_userspace_sig: andl $SEGMENT_RPL_MASK, %eax #endif cmpl $USER_RPL, %eax @@ -19108,7 +19115,7 @@ index 0fa4f89..40ff646 100644 ENTRY(resume_userspace) LOCKDEP_SYS_EXIT -@@ -348,8 +505,8 @@ ENTRY(resume_userspace) +@@ -348,8 +506,8 @@ ENTRY(resume_userspace) andl $_TIF_WORK_MASK, %ecx # is there any work to be done on # int/exception return? jne work_pending @@ -19119,7 +19126,7 @@ index 0fa4f89..40ff646 100644 #ifdef CONFIG_PREEMPT ENTRY(resume_kernel) -@@ -364,7 +521,7 @@ need_resched: +@@ -364,7 +522,7 @@ need_resched: jz restore_all call preempt_schedule_irq jmp need_resched @@ -19128,7 +19135,7 @@ index 0fa4f89..40ff646 100644 #endif CFI_ENDPROC /* -@@ -398,23 +555,34 @@ sysenter_past_esp: +@@ -398,23 +556,34 @@ sysenter_past_esp: /*CFI_REL_OFFSET cs, 0*/ /* * Push current_thread_info()->sysenter_return to the stack. @@ -19166,7 +19173,7 @@ index 0fa4f89..40ff646 100644 movl %ebp,PT_EBP(%esp) .section __ex_table,"a" .align 4 -@@ -423,6 +591,10 @@ sysenter_past_esp: +@@ -423,6 +592,10 @@ sysenter_past_esp: GET_THREAD_INFO(%ebp) @@ -19177,7 +19184,7 @@ index 0fa4f89..40ff646 100644 testl $_TIF_WORK_SYSCALL_ENTRY,TI_flags(%ebp) jnz sysenter_audit sysenter_do_call: -@@ -438,12 +610,24 @@ sysenter_after_call: +@@ -438,12 +611,24 @@ sysenter_after_call: testl $_TIF_ALLWORK_MASK, %ecx jne sysexit_audit sysenter_exit: @@ -19202,7 +19209,7 @@ index 0fa4f89..40ff646 100644 PTGS_TO_GS ENABLE_INTERRUPTS_SYSEXIT -@@ -460,6 +644,9 @@ sysenter_audit: +@@ -460,6 +645,9 @@ sysenter_audit: movl %eax,%edx /* 2nd arg: syscall number */ movl $AUDIT_ARCH_I386,%eax /* 1st arg: audit arch */ call audit_syscall_entry @@ -19212,7 +19219,7 @@ index 0fa4f89..40ff646 100644 pushl_cfi %ebx movl PT_EAX(%esp),%eax /* reload syscall number */ jmp sysenter_do_call -@@ -486,11 +673,17 @@ sysexit_audit: +@@ -486,11 +674,17 @@ sysexit_audit: CFI_ENDPROC .pushsection .fixup,"ax" @@ -19232,7 +19239,7 @@ index 0fa4f89..40ff646 100644 .popsection PTGS_TO_GS_EX ENDPROC(ia32_sysenter_target) -@@ -505,6 +698,11 @@ ENTRY(system_call) +@@ -505,6 +699,11 @@ ENTRY(system_call) pushl_cfi %eax # save orig_eax SAVE_ALL GET_THREAD_INFO(%ebp) @@ -19244,7 +19251,7 @@ index 0fa4f89..40ff646 100644 # system call tracing in operation / emulation testl $_TIF_WORK_SYSCALL_ENTRY,TI_flags(%ebp) jnz syscall_trace_entry -@@ -524,6 +722,15 @@ syscall_exit: +@@ -524,6 +723,15 @@ syscall_exit: testl $_TIF_ALLWORK_MASK, %ecx # current->work jne syscall_exit_work @@ -19260,7 +19267,7 @@ index 0fa4f89..40ff646 100644 restore_all: TRACE_IRQS_IRET restore_all_notrace: -@@ -581,14 +788,34 @@ ldt_ss: +@@ -581,14 +789,34 @@ ldt_ss: * compensating for the offset by changing to the ESPFIX segment with * a base address that matches for the difference. */ @@ -19298,7 +19305,7 @@ index 0fa4f89..40ff646 100644 pushl_cfi $__ESPFIX_SS pushl_cfi %eax /* new kernel esp */ /* Disable interrupts, but do not irqtrace this section: we -@@ -618,34 +845,28 @@ work_resched: +@@ -618,34 +846,28 @@ work_resched: movl TI_flags(%ebp), %ecx andl $_TIF_WORK_MASK, %ecx # is there any work to be done other # than syscall tracing? @@ -19338,7 +19345,7 @@ index 0fa4f89..40ff646 100644 # perform syscall exit tracing ALIGN -@@ -653,11 +874,14 @@ syscall_trace_entry: +@@ -653,11 +875,14 @@ syscall_trace_entry: movl $-ENOSYS,PT_EAX(%esp) movl %esp, %eax call syscall_trace_enter @@ -19354,7 +19361,7 @@ index 0fa4f89..40ff646 100644 # perform syscall exit tracing ALIGN -@@ -670,25 +894,29 @@ syscall_exit_work: +@@ -670,25 +895,29 @@ syscall_exit_work: movl %esp, %eax call syscall_trace_leave jmp resume_userspace @@ -19388,7 +19395,7 @@ index 0fa4f89..40ff646 100644 CFI_ENDPROC /* * End of kprobes section -@@ -762,6 +990,36 @@ ptregs_clone: +@@ -762,6 +991,36 @@ ptregs_clone: CFI_ENDPROC ENDPROC(ptregs_clone) @@ -19425,7 +19432,7 @@ index 0fa4f89..40ff646 100644 .macro FIXUP_ESPFIX_STACK /* * Switch back for ESPFIX stack to the normal zerobased stack -@@ -772,8 +1030,15 @@ ENDPROC(ptregs_clone) +@@ -772,8 +1031,15 @@ ENDPROC(ptregs_clone) */ #ifdef CONFIG_X86_ESPFIX32 /* fixup the stack */ @@ -19443,7 +19450,7 @@ index 0fa4f89..40ff646 100644 shl $16, %eax addl %esp, %eax /* the adjusted stack pointer */ pushl_cfi $__KERNEL_DS -@@ -829,7 +1094,7 @@ vector=vector+1 +@@ -829,7 +1095,7 @@ vector=vector+1 .endr 2: jmp common_interrupt .endr @@ -19452,7 +19459,7 @@ index 0fa4f89..40ff646 100644 .previous END(interrupt) -@@ -877,7 +1142,7 @@ ENTRY(coprocessor_error) +@@ -877,7 +1143,7 @@ ENTRY(coprocessor_error) pushl_cfi $do_coprocessor_error jmp error_code CFI_ENDPROC @@ -19461,7 +19468,7 @@ index 0fa4f89..40ff646 100644 ENTRY(simd_coprocessor_error) RING0_INT_FRAME -@@ -898,7 +1163,7 @@ ENTRY(simd_coprocessor_error) +@@ -898,7 +1164,7 @@ ENTRY(simd_coprocessor_error) #endif jmp error_code CFI_ENDPROC @@ -19470,7 +19477,7 @@ index 0fa4f89..40ff646 100644 ENTRY(device_not_available) RING0_INT_FRAME -@@ -906,7 +1171,7 @@ ENTRY(device_not_available) +@@ -906,7 +1172,7 @@ ENTRY(device_not_available) pushl_cfi $do_device_not_available jmp error_code CFI_ENDPROC @@ -19479,7 +19486,7 @@ index 0fa4f89..40ff646 100644 #ifdef CONFIG_PARAVIRT ENTRY(native_iret) -@@ -915,12 +1180,12 @@ ENTRY(native_iret) +@@ -915,12 +1181,12 @@ ENTRY(native_iret) .align 4 .long native_iret, iret_exc .previous @@ -19494,7 +19501,7 @@ index 0fa4f89..40ff646 100644 #endif ENTRY(overflow) -@@ -929,7 +1194,7 @@ ENTRY(overflow) +@@ -929,7 +1195,7 @@ ENTRY(overflow) pushl_cfi $do_overflow jmp error_code CFI_ENDPROC @@ -19503,7 +19510,7 @@ index 0fa4f89..40ff646 100644 ENTRY(bounds) RING0_INT_FRAME -@@ -937,7 +1202,7 @@ ENTRY(bounds) +@@ -937,7 +1203,7 @@ ENTRY(bounds) pushl_cfi $do_bounds jmp error_code CFI_ENDPROC @@ -19512,7 +19519,7 @@ index 0fa4f89..40ff646 100644 ENTRY(invalid_op) RING0_INT_FRAME -@@ -945,7 +1210,7 @@ ENTRY(invalid_op) +@@ -945,7 +1211,7 @@ ENTRY(invalid_op) pushl_cfi $do_invalid_op jmp error_code CFI_ENDPROC @@ -19521,7 +19528,7 @@ index 0fa4f89..40ff646 100644 ENTRY(coprocessor_segment_overrun) RING0_INT_FRAME -@@ -953,35 +1218,35 @@ ENTRY(coprocessor_segment_overrun) +@@ -953,35 +1219,35 @@ ENTRY(coprocessor_segment_overrun) pushl_cfi $do_coprocessor_segment_overrun jmp error_code CFI_ENDPROC @@ -19562,7 +19569,7 @@ index 0fa4f89..40ff646 100644 ENTRY(divide_error) RING0_INT_FRAME -@@ -989,7 +1254,7 @@ ENTRY(divide_error) +@@ -989,7 +1255,7 @@ ENTRY(divide_error) pushl_cfi $do_divide_error jmp error_code CFI_ENDPROC @@ -19571,7 +19578,7 @@ index 0fa4f89..40ff646 100644 #ifdef CONFIG_X86_MCE ENTRY(machine_check) -@@ -998,7 +1263,7 @@ ENTRY(machine_check) +@@ -998,7 +1264,7 @@ ENTRY(machine_check) pushl_cfi machine_check_vector jmp error_code CFI_ENDPROC @@ -19580,7 +19587,7 @@ index 0fa4f89..40ff646 100644 #endif ENTRY(spurious_interrupt_bug) -@@ -1007,7 +1272,7 @@ ENTRY(spurious_interrupt_bug) +@@ -1007,7 +1273,7 @@ ENTRY(spurious_interrupt_bug) pushl_cfi $do_spurious_interrupt_bug jmp error_code CFI_ENDPROC @@ -19589,7 +19596,7 @@ index 0fa4f89..40ff646 100644 /* * End of kprobes section */ -@@ -1123,7 +1388,7 @@ BUILD_INTERRUPT3(xen_hvm_callback_vector, XEN_HVM_EVTCHN_CALLBACK, +@@ -1123,7 +1389,7 @@ BUILD_INTERRUPT3(xen_hvm_callback_vector, XEN_HVM_EVTCHN_CALLBACK, ENTRY(mcount) ret @@ -19598,7 +19605,7 @@ index 0fa4f89..40ff646 100644 ENTRY(ftrace_caller) cmpl $0, function_trace_stop -@@ -1152,7 +1417,7 @@ ftrace_graph_call: +@@ -1152,7 +1418,7 @@ ftrace_graph_call: .globl ftrace_stub ftrace_stub: ret @@ -19607,7 +19614,7 @@ index 0fa4f89..40ff646 100644 #else /* ! CONFIG_DYNAMIC_FTRACE */ -@@ -1188,7 +1453,7 @@ trace: +@@ -1188,7 +1454,7 @@ trace: popl %ecx popl %eax jmp ftrace_stub @@ -19616,7 +19623,7 @@ index 0fa4f89..40ff646 100644 #endif /* CONFIG_DYNAMIC_FTRACE */ #endif /* CONFIG_FUNCTION_TRACER */ -@@ -1209,7 +1474,7 @@ ENTRY(ftrace_graph_caller) +@@ -1209,7 +1475,7 @@ ENTRY(ftrace_graph_caller) popl %ecx popl %eax ret @@ -19625,7 +19632,7 @@ index 0fa4f89..40ff646 100644 .globl return_to_handler return_to_handler: -@@ -1223,7 +1488,6 @@ return_to_handler: +@@ -1223,7 +1489,6 @@ return_to_handler: jmp *%ecx #endif @@ -19633,7 +19640,7 @@ index 0fa4f89..40ff646 100644 #include "syscall_table_32.S" syscall_table_size=(.-sys_call_table) -@@ -1269,15 +1533,18 @@ error_code: +@@ -1269,15 +1534,18 @@ error_code: movl $-1, PT_ORIG_EAX(%esp) # no syscall to restart REG_TO_PTGS %ecx SET_KERNEL_GS %ecx @@ -19654,7 +19661,7 @@ index 0fa4f89..40ff646 100644 /* * Debug traps and NMI can happen at the one SYSENTER instruction -@@ -1319,7 +1586,7 @@ debug_stack_correct: +@@ -1319,7 +1587,7 @@ debug_stack_correct: call do_debug jmp ret_from_exception CFI_ENDPROC @@ -19663,7 +19670,7 @@ index 0fa4f89..40ff646 100644 /* * NMI is doubly nasty. It can happen _while_ we're handling -@@ -1358,6 +1625,9 @@ nmi_stack_correct: +@@ -1358,6 +1626,9 @@ nmi_stack_correct: xorl %edx,%edx # zero error code movl %esp,%eax # pt_regs pointer call do_nmi @@ -19673,7 +19680,7 @@ index 0fa4f89..40ff646 100644 jmp restore_all_notrace CFI_ENDPROC -@@ -1395,13 +1665,16 @@ nmi_espfix_stack: +@@ -1395,13 +1666,16 @@ nmi_espfix_stack: FIXUP_ESPFIX_STACK # %eax == %esp xorl %edx,%edx # zero error code call do_nmi @@ -19691,7 +19698,7 @@ index 0fa4f89..40ff646 100644 ENTRY(int3) RING0_INT_FRAME -@@ -1413,14 +1686,14 @@ ENTRY(int3) +@@ -1413,14 +1687,14 @@ ENTRY(int3) call do_int3 jmp ret_from_exception CFI_ENDPROC @@ -19708,7 +19715,7 @@ index 0fa4f89..40ff646 100644 #ifdef CONFIG_KVM_GUEST ENTRY(async_page_fault) -@@ -1428,7 +1701,7 @@ ENTRY(async_page_fault) +@@ -1428,7 +1702,7 @@ ENTRY(async_page_fault) pushl_cfi $do_async_page_fault jmp error_code CFI_ENDPROC @@ -19718,7 +19725,7 @@ index 0fa4f89..40ff646 100644 /* diff --git a/arch/x86/kernel/entry_64.S b/arch/x86/kernel/entry_64.S -index 9d28dbac..43bde59 100644 +index 9d28dbac..d5f7d1d 100644 --- a/arch/x86/kernel/entry_64.S +++ b/arch/x86/kernel/entry_64.S @@ -56,6 +56,8 @@ @@ -19794,7 +19801,7 @@ index 9d28dbac..43bde59 100644 jmp *%rdi #endif -@@ -179,6 +187,285 @@ ENTRY(native_usergs_sysret64) +@@ -179,6 +187,286 @@ ENTRY(native_usergs_sysret64) ENDPROC(native_usergs_sysret64) #endif /* CONFIG_PARAVIRT */ @@ -20054,6 +20061,7 @@ index 9d28dbac..43bde59 100644 + jne 1b + +2: cld ++ or $2*8, %rdi + mov %esp, %ecx + sub %edi, %ecx + @@ -20080,7 +20088,7 @@ index 9d28dbac..43bde59 100644 .macro TRACE_IRQS_IRETQ offset=ARGOFFSET #ifdef CONFIG_TRACE_IRQFLAGS -@@ -232,8 +519,8 @@ ENDPROC(native_usergs_sysret64) +@@ -232,8 +520,8 @@ ENDPROC(native_usergs_sysret64) .endm .macro UNFAKE_STACK_FRAME @@ -20091,7 +20099,7 @@ index 9d28dbac..43bde59 100644 .endm /* -@@ -302,25 +589,26 @@ ENDPROC(native_usergs_sysret64) +@@ -302,25 +590,26 @@ ENDPROC(native_usergs_sysret64) /* save partial stack frame */ .macro SAVE_ARGS_IRQ cld @@ -20131,7 +20139,7 @@ index 9d28dbac..43bde59 100644 je 1f SWAPGS /* -@@ -341,24 +629,39 @@ ENDPROC(native_usergs_sysret64) +@@ -341,24 +630,39 @@ ENDPROC(native_usergs_sysret64) 0x06 /* DW_OP_deref */, \ 0x08 /* DW_OP_const1u */, SS+8-RBP, \ 0x22 /* DW_OP_plus */ @@ -20175,7 +20183,7 @@ index 9d28dbac..43bde59 100644 /* save complete stack frame */ .pushsection .kprobes.text, "ax" -@@ -387,10 +690,21 @@ ENTRY(save_paranoid) +@@ -387,10 +691,21 @@ ENTRY(save_paranoid) js 1f /* negative -> in kernel */ SWAPGS xorl %ebx,%ebx @@ -20200,7 +20208,7 @@ index 9d28dbac..43bde59 100644 /* * A newly forked process directly context switches into this address. -@@ -411,7 +725,7 @@ ENTRY(ret_from_fork) +@@ -411,7 +726,7 @@ ENTRY(ret_from_fork) RESTORE_REST @@ -20209,7 +20217,7 @@ index 9d28dbac..43bde59 100644 je int_ret_from_sys_call testl $_TIF_IA32, TI_flags(%rcx) # 32-bit compat task needs IRET -@@ -421,7 +735,7 @@ ENTRY(ret_from_fork) +@@ -421,7 +736,7 @@ ENTRY(ret_from_fork) jmp ret_from_sys_call # go to the SYSRET fastpath CFI_ENDPROC @@ -20218,7 +20226,7 @@ index 9d28dbac..43bde59 100644 /* * System call entry. Up to 6 arguments in registers are supported. -@@ -457,7 +771,7 @@ END(ret_from_fork) +@@ -457,7 +772,7 @@ END(ret_from_fork) ENTRY(system_call) CFI_STARTPROC simple CFI_SIGNAL_FRAME @@ -20227,7 +20235,7 @@ index 9d28dbac..43bde59 100644 CFI_REGISTER rip,rcx /*CFI_REGISTER rflags,r11*/ SWAPGS_UNSAFE_STACK -@@ -470,12 +784,18 @@ ENTRY(system_call_after_swapgs) +@@ -470,12 +785,18 @@ ENTRY(system_call_after_swapgs) movq %rsp,PER_CPU_VAR(old_rsp) movq PER_CPU_VAR(kernel_stack),%rsp @@ -20247,7 +20255,7 @@ index 9d28dbac..43bde59 100644 movq %rax,ORIG_RAX-ARGOFFSET(%rsp) movq %rcx,RIP-ARGOFFSET(%rsp) CFI_REL_OFFSET rip,RIP-ARGOFFSET -@@ -504,6 +824,8 @@ sysret_check: +@@ -504,6 +825,8 @@ sysret_check: andl %edi,%edx jnz sysret_careful CFI_REMEMBER_STATE @@ -20256,7 +20264,7 @@ index 9d28dbac..43bde59 100644 /* * sysretq will re-enable interrupts: */ -@@ -562,6 +884,9 @@ auditsys: +@@ -562,6 +885,9 @@ auditsys: movq %rax,%rsi /* 2nd arg: syscall number */ movl $AUDIT_ARCH_X86_64,%edi /* 1st arg: audit arch */ call audit_syscall_entry @@ -20266,7 +20274,7 @@ index 9d28dbac..43bde59 100644 LOAD_ARGS 0 /* reload call-clobbered registers */ jmp system_call_fastpath -@@ -592,12 +917,15 @@ tracesys: +@@ -592,12 +918,15 @@ tracesys: FIXUP_TOP_OF_STACK %rdi movq %rsp,%rdi call syscall_trace_enter @@ -20283,7 +20291,7 @@ index 9d28dbac..43bde59 100644 RESTORE_REST cmpq $__NR_syscall_max,%rax ja int_ret_from_sys_call /* RAX(%rsp) set to -ENOSYS above */ -@@ -613,7 +941,7 @@ tracesys: +@@ -613,7 +942,7 @@ tracesys: GLOBAL(int_ret_from_sys_call) DISABLE_INTERRUPTS(CLBR_NONE) TRACE_IRQS_OFF @@ -20292,7 +20300,7 @@ index 9d28dbac..43bde59 100644 je retint_restore_args movl $_TIF_ALLWORK_MASK,%edi /* edi: mask to check */ -@@ -624,7 +952,9 @@ GLOBAL(int_with_check) +@@ -624,7 +953,9 @@ GLOBAL(int_with_check) andl %edi,%edx jnz int_careful andl $~TS_COMPAT,TI_status(%rcx) @@ -20303,7 +20311,7 @@ index 9d28dbac..43bde59 100644 /* Either reschedule or signal or syscall exit tracking needed. */ /* First do a reschedule test. */ -@@ -670,7 +1000,7 @@ int_restore_rest: +@@ -670,7 +1001,7 @@ int_restore_rest: TRACE_IRQS_OFF jmp int_with_check CFI_ENDPROC @@ -20312,7 +20320,7 @@ index 9d28dbac..43bde59 100644 /* * Certain special system calls that need to save a complete full stack frame. -@@ -678,15 +1008,13 @@ END(system_call) +@@ -678,15 +1009,13 @@ END(system_call) .macro PTREGSCALL label,func,arg ENTRY(\label) PARTIAL_FRAME 1 8 /* offset 8: return address */ @@ -20329,7 +20337,7 @@ index 9d28dbac..43bde59 100644 .endm PTREGSCALL stub_clone, sys_clone, %r8 -@@ -701,12 +1029,17 @@ ENTRY(ptregscall_common) +@@ -701,12 +1030,17 @@ ENTRY(ptregscall_common) movq_cfi_restore R15+8, r15 movq_cfi_restore R14+8, r14 movq_cfi_restore R13+8, r13 @@ -20349,7 +20357,7 @@ index 9d28dbac..43bde59 100644 ENTRY(stub_execve) CFI_STARTPROC -@@ -721,7 +1054,7 @@ ENTRY(stub_execve) +@@ -721,7 +1055,7 @@ ENTRY(stub_execve) RESTORE_REST jmp int_ret_from_sys_call CFI_ENDPROC @@ -20358,7 +20366,7 @@ index 9d28dbac..43bde59 100644 /* * sigreturn is special because it needs to restore all registers on return. -@@ -739,7 +1072,7 @@ ENTRY(stub_rt_sigreturn) +@@ -739,7 +1073,7 @@ ENTRY(stub_rt_sigreturn) RESTORE_REST jmp int_ret_from_sys_call CFI_ENDPROC @@ -20367,7 +20375,7 @@ index 9d28dbac..43bde59 100644 /* * Build the entry stubs and pointer table with some assembler magic. -@@ -774,7 +1107,7 @@ vector=vector+1 +@@ -774,7 +1108,7 @@ vector=vector+1 2: jmp common_interrupt .endr CFI_ENDPROC @@ -20376,7 +20384,7 @@ index 9d28dbac..43bde59 100644 .previous END(interrupt) -@@ -791,8 +1124,8 @@ END(interrupt) +@@ -791,8 +1125,8 @@ END(interrupt) /* 0(%rsp): ~(interrupt number) */ .macro interrupt func /* reserve pt_regs for scratch regs and rbp */ @@ -20387,7 +20395,7 @@ index 9d28dbac..43bde59 100644 SAVE_ARGS_IRQ call \func .endm -@@ -819,13 +1152,13 @@ ret_from_intr: +@@ -819,13 +1153,13 @@ ret_from_intr: /* Restore saved previous stack */ popq %rsi CFI_DEF_CFA_REGISTER rsi @@ -20404,7 +20412,7 @@ index 9d28dbac..43bde59 100644 je retint_kernel /* Interrupt came from user space */ -@@ -847,12 +1180,16 @@ retint_swapgs: /* return to user-space */ +@@ -847,12 +1181,16 @@ retint_swapgs: /* return to user-space */ * The iretq could re-enable interrupts: */ DISABLE_INTERRUPTS(CLBR_ANY) @@ -20421,7 +20429,7 @@ index 9d28dbac..43bde59 100644 /* * The iretq could re-enable interrupts: */ -@@ -890,15 +1227,15 @@ native_irq_return_ldt: +@@ -890,15 +1228,15 @@ native_irq_return_ldt: SWAPGS movq PER_CPU_VAR(espfix_waddr),%rdi movq %rax,(0*8)(%rdi) /* RAX */ @@ -20442,7 +20450,7 @@ index 9d28dbac..43bde59 100644 movq %rax,(4*8)(%rdi) andl $0xffff0000,%eax popq_cfi %rdi -@@ -954,7 +1291,7 @@ ENTRY(retint_kernel) +@@ -954,7 +1292,7 @@ ENTRY(retint_kernel) jmp exit_intr #endif CFI_ENDPROC @@ -20451,7 +20459,7 @@ index 9d28dbac..43bde59 100644 /* * End of kprobes section -@@ -971,7 +1308,7 @@ ENTRY(\sym) +@@ -971,7 +1309,7 @@ ENTRY(\sym) interrupt \do_sym jmp ret_from_intr CFI_ENDPROC @@ -20460,7 +20468,7 @@ index 9d28dbac..43bde59 100644 .endm #ifdef CONFIG_SMP -@@ -1041,7 +1378,7 @@ ENTRY(\sym) +@@ -1041,7 +1379,7 @@ ENTRY(\sym) call \do_sym jmp error_exit /* %ebx: no swapgs flag */ CFI_ENDPROC @@ -20469,7 +20477,7 @@ index 9d28dbac..43bde59 100644 .endm .macro paranoidzeroentry sym do_sym -@@ -1058,10 +1395,10 @@ ENTRY(\sym) +@@ -1058,10 +1396,10 @@ ENTRY(\sym) call \do_sym jmp paranoid_exit /* %ebx: no swapgs flag */ CFI_ENDPROC @@ -20482,7 +20490,7 @@ index 9d28dbac..43bde59 100644 .macro paranoidzeroentry_ist sym do_sym ist ENTRY(\sym) INTR_FRAME -@@ -1073,12 +1410,18 @@ ENTRY(\sym) +@@ -1073,12 +1411,18 @@ ENTRY(\sym) TRACE_IRQS_OFF movq %rsp,%rdi /* pt_regs pointer */ xorl %esi,%esi /* no error code */ @@ -20502,7 +20510,7 @@ index 9d28dbac..43bde59 100644 .endm .macro errorentry sym do_sym -@@ -1095,7 +1438,7 @@ ENTRY(\sym) +@@ -1095,7 +1439,7 @@ ENTRY(\sym) call \do_sym jmp error_exit /* %ebx: no swapgs flag */ CFI_ENDPROC @@ -20511,7 +20519,7 @@ index 9d28dbac..43bde59 100644 .endm /* error code is on the stack already */ -@@ -1114,7 +1457,7 @@ ENTRY(\sym) +@@ -1114,7 +1458,7 @@ ENTRY(\sym) call \do_sym jmp paranoid_exit /* %ebx: no swapgs flag */ CFI_ENDPROC @@ -20520,7 +20528,7 @@ index 9d28dbac..43bde59 100644 .endm zeroentry divide_error do_divide_error -@@ -1144,9 +1487,10 @@ gs_change: +@@ -1144,9 +1488,10 @@ gs_change: 2: mfence /* workaround */ SWAPGS popfq_cfi @@ -20532,7 +20540,7 @@ index 9d28dbac..43bde59 100644 .section __ex_table,"a" .align 8 -@@ -1168,13 +1512,14 @@ ENTRY(kernel_thread_helper) +@@ -1168,13 +1513,14 @@ ENTRY(kernel_thread_helper) * Here we are in the child and the registers are set as they were * at kernel_thread() invocation in the parent. */ @@ -20548,7 +20556,7 @@ index 9d28dbac..43bde59 100644 /* * execve(). This function needs to use IRET, not SYSRET, to set up all state properly. -@@ -1201,11 +1546,11 @@ ENTRY(kernel_execve) +@@ -1201,11 +1547,11 @@ ENTRY(kernel_execve) RESTORE_REST testq %rax,%rax je int_ret_from_sys_call @@ -20562,7 +20570,7 @@ index 9d28dbac..43bde59 100644 /* Call softirq on interrupt stack. Interrupts are off. */ ENTRY(call_softirq) -@@ -1223,9 +1568,10 @@ ENTRY(call_softirq) +@@ -1223,9 +1569,10 @@ ENTRY(call_softirq) CFI_DEF_CFA_REGISTER rsp CFI_ADJUST_CFA_OFFSET -8 decl PER_CPU_VAR(irq_count) @@ -20574,7 +20582,7 @@ index 9d28dbac..43bde59 100644 #ifdef CONFIG_XEN zeroentry xen_hypervisor_callback xen_do_hypervisor_callback -@@ -1263,7 +1609,7 @@ ENTRY(xen_do_hypervisor_callback) # do_hypervisor_callback(struct *pt_regs) +@@ -1263,7 +1610,7 @@ ENTRY(xen_do_hypervisor_callback) # do_hypervisor_callback(struct *pt_regs) decl PER_CPU_VAR(irq_count) jmp error_exit CFI_ENDPROC @@ -20583,7 +20591,7 @@ index 9d28dbac..43bde59 100644 /* * Hypervisor uses this for application faults while it executes. -@@ -1322,7 +1668,7 @@ ENTRY(xen_failsafe_callback) +@@ -1322,7 +1669,7 @@ ENTRY(xen_failsafe_callback) SAVE_ALL jmp error_exit CFI_ENDPROC @@ -20592,7 +20600,7 @@ index 9d28dbac..43bde59 100644 apicinterrupt XEN_HVM_EVTCHN_CALLBACK \ xen_hvm_callback_vector xen_evtchn_do_upcall -@@ -1371,16 +1717,31 @@ ENTRY(paranoid_exit) +@@ -1371,16 +1718,31 @@ ENTRY(paranoid_exit) TRACE_IRQS_OFF testl %ebx,%ebx /* swapgs needed? */ jnz paranoid_restore @@ -20625,7 +20633,7 @@ index 9d28dbac..43bde59 100644 jmp irq_return paranoid_userspace: GET_THREAD_INFO(%rcx) -@@ -1409,7 +1770,7 @@ paranoid_schedule: +@@ -1409,7 +1771,7 @@ paranoid_schedule: TRACE_IRQS_OFF jmp paranoid_userspace CFI_ENDPROC @@ -20634,7 +20642,7 @@ index 9d28dbac..43bde59 100644 /* * Exception entry point. This expects an error code/orig_rax on the stack. -@@ -1436,12 +1797,23 @@ ENTRY(error_entry) +@@ -1436,12 +1798,23 @@ ENTRY(error_entry) movq_cfi r14, R14+8 movq_cfi r15, R15+8 xorl %ebx,%ebx @@ -20659,7 +20667,7 @@ index 9d28dbac..43bde59 100644 ret /* -@@ -1475,7 +1847,7 @@ error_bad_iret: +@@ -1475,7 +1848,7 @@ error_bad_iret: decl %ebx /* Return to usergs */ jmp error_sti CFI_ENDPROC @@ -20668,7 +20676,7 @@ index 9d28dbac..43bde59 100644 /* ebx: no swapgs flag (1: don't need swapgs, 0: need it) */ -@@ -1495,7 +1867,7 @@ ENTRY(error_exit) +@@ -1495,7 +1868,7 @@ ENTRY(error_exit) jnz retint_careful jmp retint_swapgs CFI_ENDPROC @@ -20677,7 +20685,7 @@ index 9d28dbac..43bde59 100644 /* runs on exception stack */ -@@ -1507,6 +1879,7 @@ ENTRY(nmi) +@@ -1507,6 +1880,7 @@ ENTRY(nmi) CFI_ADJUST_CFA_OFFSET ORIG_RAX-R15 call save_paranoid DEFAULT_FRAME 0 @@ -20685,7 +20693,7 @@ index 9d28dbac..43bde59 100644 /* paranoidentry do_nmi, 0; without TRACE_IRQS_OFF */ movq %rsp,%rdi movq $-1,%rsi -@@ -1517,12 +1890,28 @@ ENTRY(nmi) +@@ -1517,12 +1891,28 @@ ENTRY(nmi) DISABLE_INTERRUPTS(CLBR_NONE) testl %ebx,%ebx /* swapgs needed? */ jnz nmi_restore @@ -20715,7 +20723,7 @@ index 9d28dbac..43bde59 100644 jmp irq_return nmi_userspace: GET_THREAD_INFO(%rcx) -@@ -1551,14 +1940,14 @@ nmi_schedule: +@@ -1551,14 +1941,14 @@ nmi_schedule: jmp paranoid_exit CFI_ENDPROC #endif @@ -23015,7 +23023,7 @@ index 59b9b37..f02ee42 100644 +} +#endif diff --git a/arch/x86/kernel/process_32.c b/arch/x86/kernel/process_32.c -index 8598296..7c1af45 100644 +index 8598296..3fd3443 100644 --- a/arch/x86/kernel/process_32.c +++ b/arch/x86/kernel/process_32.c @@ -67,6 +67,7 @@ asmlinkage void ret_from_fork(void) __asm__("ret_from_fork"); @@ -23063,7 +23071,7 @@ index 8598296..7c1af45 100644 p->thread.sp = (unsigned long) childregs; p->thread.sp0 = (unsigned long) (childregs+1); -+ p->tinfo.lowest_stack = (unsigned long)task_stack_page(p); ++ p->tinfo.lowest_stack = (unsigned long)task_stack_page(p) + 2 * sizeof(unsigned long); p->thread.ip = (unsigned long) ret_from_fork; @@ -23112,7 +23120,7 @@ index 8598296..7c1af45 100644 } - diff --git a/arch/x86/kernel/process_64.c b/arch/x86/kernel/process_64.c -index 6a364a6..b147d11 100644 +index 6a364a6..030f5d6 100644 --- a/arch/x86/kernel/process_64.c +++ b/arch/x86/kernel/process_64.c @@ -89,7 +89,7 @@ static void __exit_idle(void) @@ -23138,7 +23146,7 @@ index 6a364a6..b147d11 100644 p->thread.sp = (unsigned long) childregs; p->thread.sp0 = (unsigned long) (childregs+1); p->thread.usersp = me->thread.usersp; -+ p->tinfo.lowest_stack = (unsigned long)task_stack_page(p); ++ p->tinfo.lowest_stack = (unsigned long)task_stack_page(p) + 2 * sizeof(unsigned long); set_tsk_thread_flag(p, TIF_FORK); @@ -32470,7 +32478,7 @@ index 26c731a..fb510c7 100644 This is the Linux Xen port. Enabling this will allow the kernel to boot in a paravirtualized environment under the diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c -index 5189fe8..d937469 100644 +index 5189fe8..1bf8944 100644 --- a/arch/x86/xen/enlighten.c +++ b/arch/x86/xen/enlighten.c @@ -86,8 +86,6 @@ EXPORT_SYMBOL_GPL(xen_start_info); @@ -32549,7 +32557,17 @@ index 5189fe8..d937469 100644 { if (pm_power_off) pm_power_off(); -@@ -1196,7 +1192,17 @@ asmlinkage void __init xen_start_kernel(void) +@@ -1144,6 +1140,9 @@ static void __init xen_setup_stackprotector(void) + pv_cpu_ops.load_gdt = xen_load_gdt_boot; + + setup_stack_canary_segment(0); ++#ifdef CONFIG_X86_64 ++ load_percpu_segment(0); ++#endif + switch_to_new_gdt(0); + + pv_cpu_ops.write_gdt_entry = xen_write_gdt_entry; +@@ -1196,7 +1195,17 @@ asmlinkage void __init xen_start_kernel(void) __userpte_alloc_gfp &= ~__GFP_HIGHMEM; /* Work out if we support NX */ @@ -32568,7 +32586,7 @@ index 5189fe8..d937469 100644 xen_setup_features(); -@@ -1227,13 +1233,6 @@ asmlinkage void __init xen_start_kernel(void) +@@ -1227,13 +1236,6 @@ asmlinkage void __init xen_start_kernel(void) machine_ops = xen_machine_ops; @@ -32582,7 +32600,7 @@ index 5189fe8..d937469 100644 xen_smp_init(); #ifdef CONFIG_ACPI_NUMA -@@ -1418,7 +1417,7 @@ static int __cpuinit xen_hvm_cpu_notify(struct notifier_block *self, +@@ -1418,7 +1420,7 @@ static int __cpuinit xen_hvm_cpu_notify(struct notifier_block *self, return NOTIFY_OK; } @@ -45942,6 +45960,19 @@ index 0e6e57e..060e208 100644 .notifier_call = macvtap_device_event, }; +diff --git a/drivers/net/ppp/ppp_deflate.c b/drivers/net/ppp/ppp_deflate.c +index 1dbdf82..43764cc 100644 +--- a/drivers/net/ppp/ppp_deflate.c ++++ b/drivers/net/ppp/ppp_deflate.c +@@ -268,7 +268,7 @@ static int z_compress(void *arg, unsigned char *rptr, unsigned char *obuf, + /* + * See if we managed to reduce the size of the packet. + */ +- if (olen < isize) { ++ if (olen < isize && olen <= osize) { + state->stats.comp_bytes += olen; + state->stats.comp_packets++; + } else { diff --git a/drivers/net/ppp/ppp_generic.c b/drivers/net/ppp/ppp_generic.c index 4782d79..359f1b9 100644 --- a/drivers/net/ppp/ppp_generic.c @@ -58075,6 +58106,19 @@ index 52a820a..1d8ab03 100644 } /* +diff --git a/fs/cifs/smbencrypt.c b/fs/cifs/smbencrypt.c +index 80d8508..6de30aa 100644 +--- a/fs/cifs/smbencrypt.c ++++ b/fs/cifs/smbencrypt.c +@@ -220,7 +220,7 @@ E_md4hash(const unsigned char *passwd, unsigned char *p16, + } + + rc = mdfour(p16, (unsigned char *) wpwd, len * sizeof(__le16)); +- memset(wpwd, 0, 129 * sizeof(__le16)); ++ memzero_explicit(wpwd, sizeof(wpwd)); + + return rc; + } diff --git a/fs/coda/cache.c b/fs/coda/cache.c index 4b2e5cb..67b96bb 100644 --- a/fs/coda/cache.c @@ -58384,7 +58428,7 @@ index 739fb59..5385976 100644 static int __init init_cramfs_fs(void) { diff --git a/fs/dcache.c b/fs/dcache.c -index 3f65742..9a9eeb5 100644 +index 3f65742..0972e8b 100644 --- a/fs/dcache.c +++ b/fs/dcache.c @@ -103,11 +103,11 @@ static unsigned int d_hash_shift __read_mostly; @@ -58403,7 +58447,19 @@ index 3f65742..9a9eeb5 100644 return dentry_hashtable + (hash & D_HASHMASK); } -@@ -3080,7 +3080,8 @@ void __init vfs_caches_init(unsigned long mempages) +@@ -1034,8 +1034,10 @@ ascend: + write_sequnlock(&rename_lock); + return 0; /* No mount points found in tree */ + positive: +- if (!locked && read_seqretry(&rename_lock, seq)) ++ if (!locked && read_seqretry(&rename_lock, seq)) { ++ rcu_read_lock(); + goto rename_retry; ++ } + if (locked) + write_sequnlock(&rename_lock); + return 1; +@@ -3080,7 +3082,8 @@ void __init vfs_caches_init(unsigned long mempages) mempages -= reserve; names_cachep = kmem_cache_create("names_cache", PATH_MAX, 0, @@ -58565,7 +58621,7 @@ index 451b9b8..12e5a03 100644 out_free_fd: diff --git a/fs/exec.c b/fs/exec.c -index 78199eb..8958766 100644 +index 78199eb..a1fb382 100644 --- a/fs/exec.c +++ b/fs/exec.c @@ -55,12 +55,35 @@ @@ -59475,7 +59531,7 @@ index 78199eb..8958766 100644 +{ + unsigned long sp = (unsigned long)&sp; + if (sp < current_thread_info()->lowest_stack && -+ sp > (unsigned long)task_stack_page(current)) ++ sp >= (unsigned long)task_stack_page(current) + 2 * sizeof(unsigned long)) + current_thread_info()->lowest_stack = sp; + if (unlikely((sp & ~(THREAD_SIZE - 1)) < (THREAD_SIZE/16))) + BUG(); @@ -60142,7 +60198,7 @@ index 22764c7..86372c9 100644 break; err = alloc_fd(arg, cmd == F_DUPFD_CLOEXEC ? O_CLOEXEC : 0); diff --git a/fs/fhandle.c b/fs/fhandle.c -index 6b08864..4b42b2d 100644 +index 6b08864..030db71 100644 --- a/fs/fhandle.c +++ b/fs/fhandle.c @@ -8,6 +8,7 @@ @@ -60162,6 +60218,18 @@ index 6b08864..4b42b2d 100644 retval = -EPERM; goto out_err; } +@@ -196,8 +197,9 @@ static int handle_to_path(int mountdirfd, struct file_handle __user *ufh, + goto out_err; + } + /* copy the full handle */ +- if (copy_from_user(handle, ufh, +- sizeof(struct file_handle) + ++ *handle = f_handle; ++ if (copy_from_user(&handle->f_handle, ++ &ufh->f_handle, + f_handle.handle_bytes)) { + retval = -EFAULT; + goto out_handle; diff --git a/fs/fifo.c b/fs/fifo.c index cf6f434..3d7942c 100644 --- a/fs/fifo.c @@ -85491,7 +85559,7 @@ index ea0c02f..0eed39d 100644 #ifdef __arch_swab64 return __arch_swab64(val); diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h -index 86a24b1..e6974f1 100644 +index 86a24b11..e6974f1 100644 --- a/include/linux/syscalls.h +++ b/include/linux/syscalls.h @@ -83,12 +83,20 @@ struct file_handle; @@ -108089,6 +108157,27 @@ index 88eace5..b5947e7 100644 continue; } list_del_init(&rm->m_conn_item); +diff --git a/net/rds/sysctl.c b/net/rds/sysctl.c +index 25ad0c7..065026f 100644 +--- a/net/rds/sysctl.c ++++ b/net/rds/sysctl.c +@@ -71,14 +71,14 @@ static ctl_table rds_sysctl_rds_table[] = { + { + .procname = "max_unacked_packets", + .data = &rds_sysctl_max_unacked_packets, +- .maxlen = sizeof(unsigned long), ++ .maxlen = sizeof(int), + .mode = 0644, + .proc_handler = proc_dointvec, + }, + { + .procname = "max_unacked_bytes", + .data = &rds_sysctl_max_unacked_bytes, +- .maxlen = sizeof(unsigned long), ++ .maxlen = sizeof(int), + .mode = 0644, + .proc_handler = proc_dointvec, + }, diff --git a/net/rds/tcp.c b/net/rds/tcp.c index edac9ef..16bcb98 100644 --- a/net/rds/tcp.c @@ -108533,10 +108622,38 @@ index 76388b0..a967f68 100644 sctp_generate_t1_cookie_event, sctp_generate_t1_init_event, diff --git a/net/sctp/socket.c b/net/sctp/socket.c -index c28eb7b..7afe73d 100644 +index c28eb7b..832978a 100644 --- a/net/sctp/socket.c +++ b/net/sctp/socket.c -@@ -2183,11 +2183,13 @@ static int sctp_setsockopt_events(struct sock *sk, char __user *optval, +@@ -1611,6 +1611,7 @@ SCTP_STATIC int sctp_sendmsg(struct kiocb *iocb, struct sock *sk, + sctp_scope_t scope; + long timeo; + __u16 sinfo_flags = 0; ++ bool wait_connect = false; + struct sctp_datamsg *datamsg; + int msg_flags = msg->msg_flags; + +@@ -1929,6 +1930,7 @@ SCTP_STATIC int sctp_sendmsg(struct kiocb *iocb, struct sock *sk, + err = sctp_primitive_ASSOCIATE(asoc, NULL); + if (err < 0) + goto out_free; ++ wait_connect = true; + SCTP_DEBUG_PRINTK("We associated primitively.\n"); + } + +@@ -1968,6 +1970,11 @@ SCTP_STATIC int sctp_sendmsg(struct kiocb *iocb, struct sock *sk, + else + err = msg_len; + ++ if (unlikely(wait_connect)) { ++ timeo = sock_sndtimeo(sk, msg_flags & MSG_DONTWAIT); ++ sctp_wait_for_connect(asoc, &timeo); ++ } ++ + /* If we are already past ASSOCIATE, the lower + * layers are responsible for association cleanup. + */ +@@ -2183,11 +2190,13 @@ static int sctp_setsockopt_events(struct sock *sk, char __user *optval, { struct sctp_association *asoc; struct sctp_ulpevent *event; @@ -108551,7 +108668,7 @@ index c28eb7b..7afe73d 100644 /* * At the time when a user app subscribes to SCTP_SENDER_DRY_EVENT, -@@ -4173,13 +4175,16 @@ static int sctp_getsockopt_disable_fragments(struct sock *sk, int len, +@@ -4173,13 +4182,16 @@ static int sctp_getsockopt_disable_fragments(struct sock *sk, int len, static int sctp_getsockopt_events(struct sock *sk, int len, char __user *optval, int __user *optlen) { @@ -108569,7 +108686,7 @@ index c28eb7b..7afe73d 100644 return -EFAULT; return 0; } -@@ -4197,6 +4202,8 @@ static int sctp_getsockopt_events(struct sock *sk, int len, char __user *optval, +@@ -4197,6 +4209,8 @@ static int sctp_getsockopt_events(struct sock *sk, int len, char __user *optval, */ static int sctp_getsockopt_autoclose(struct sock *sk, int len, char __user *optval, int __user *optlen) { @@ -108578,7 +108695,7 @@ index c28eb7b..7afe73d 100644 /* Applicable to UDP-style socket only */ if (sctp_style(sk, TCP)) return -EOPNOTSUPP; -@@ -4205,7 +4212,8 @@ static int sctp_getsockopt_autoclose(struct sock *sk, int len, char __user *optv +@@ -4205,7 +4219,8 @@ static int sctp_getsockopt_autoclose(struct sock *sk, int len, char __user *optv len = sizeof(int); if (put_user(len, optlen)) return -EFAULT; @@ -108588,7 +108705,7 @@ index c28eb7b..7afe73d 100644 return -EFAULT; return 0; } -@@ -4569,12 +4577,15 @@ static int sctp_getsockopt_delayed_ack(struct sock *sk, int len, +@@ -4569,12 +4584,15 @@ static int sctp_getsockopt_delayed_ack(struct sock *sk, int len, */ static int sctp_getsockopt_initmsg(struct sock *sk, int len, char __user *optval, int __user *optlen) { @@ -108605,7 +108722,7 @@ index c28eb7b..7afe73d 100644 return -EFAULT; return 0; } -@@ -4615,6 +4626,8 @@ static int sctp_getsockopt_peer_addrs(struct sock *sk, int len, +@@ -4615,6 +4633,8 @@ static int sctp_getsockopt_peer_addrs(struct sock *sk, int len, addrlen = sctp_get_af_specific(temp.sa.sa_family)->sockaddr_len; if (space_left < addrlen) return -ENOMEM; @@ -110272,6 +110389,19 @@ index ede01a8..756e6bd 100644 if (err) goto out; +diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include +index 978416d..a1c341e 100644 +--- a/scripts/Kbuild.include ++++ b/scripts/Kbuild.include +@@ -143,7 +143,7 @@ cc-ifversion = $(shell [ $(call cc-version, $(CC)) $(1) $(2) ] && echo $(3)) + # cc-ldoption + # Usage: ldflags += $(call cc-ldoption, -Wl$(comma)--hash-style=both) + cc-ldoption = $(call try-run,\ +- $(CC) $(1) -nostdlib -x c /dev/null -o "$$TMP",$(1),$(2)) ++ $(CC) $(1) -Wl,-r -nostdlib -x c /dev/null -o "$$TMP",$(1),$(2)) + + # ld-option + # Usage: LDFLAGS += $(call ld-option, -X) diff --git a/scripts/Makefile.build b/scripts/Makefile.build index d2b366c1..2d5a6f8 100644 --- a/scripts/Makefile.build |