summaryrefslogtreecommitdiffstats
path: root/main/linux-virt-grsec
diff options
context:
space:
mode:
authorLeonardo Arena <rnalrd@alpinelinux.org>2013-12-13 14:53:19 +0000
committerLeonardo Arena <rnalrd@alpinelinux.org>2013-12-13 14:54:01 +0000
commit68116ecd619f49779ae42c65a4df89e511e525aa (patch)
tree953a0568201f5e5beaf54d952aa2506f421c2937 /main/linux-virt-grsec
parent15c4f5644f5a4ceabf48320bfc7a11747d8093fa (diff)
downloadaports-68116ecd619f49779ae42c65a4df89e511e525aa.tar.bz2
aports-68116ecd619f49779ae42c65a4df89e511e525aa.tar.xz
main/linux-virt-grsec: upgrade to version 3.12.4
Diffstat (limited to 'main/linux-virt-grsec')
-rw-r--r--main/linux-virt-grsec/0001-net-inform-NETDEV_CHANGE-callbacks-which-flags-were-.patch68
-rw-r--r--main/linux-virt-grsec/0002-arp-flush-arp-cache-on-IFF_NOARP-change.patch35
-rw-r--r--main/linux-virt-grsec/0003-ipv4-properly-refresh-rtable-entries-on-pmtu-redirec.patch201
-rw-r--r--main/linux-virt-grsec/0004-ipv4-rate-limit-updating-of-next-hop-exceptions-with.patch37
-rw-r--r--main/linux-virt-grsec/0005-ipv4-use-separate-genid-for-next-hop-exceptions.patch116
-rw-r--r--main/linux-virt-grsec/0006-ipv4-use-next-hop-exceptions-also-for-input-routes.patch213
-rw-r--r--main/linux-virt-grsec/APKBUILD62
-rw-r--r--main/linux-virt-grsec/grsecurity-3.0-3.12.4-201312081754.patch (renamed from main/linux-virt-grsec/grsecurity-2.9.1-3.10.23-unofficial.patch)28097
-rw-r--r--main/linux-virt-grsec/kernelconfig.x86262
-rw-r--r--main/linux-virt-grsec/kernelconfig.x86_64256
-rw-r--r--main/linux-virt-grsec/sysctl_lxc.patch31
11 files changed, 15840 insertions, 13538 deletions
diff --git a/main/linux-virt-grsec/0001-net-inform-NETDEV_CHANGE-callbacks-which-flags-were-.patch b/main/linux-virt-grsec/0001-net-inform-NETDEV_CHANGE-callbacks-which-flags-were-.patch
deleted file mode 100644
index 7357a330f..000000000
--- a/main/linux-virt-grsec/0001-net-inform-NETDEV_CHANGE-callbacks-which-flags-were-.patch
+++ /dev/null
@@ -1,68 +0,0 @@
-From 1225b1090991bdcab819bdab96be329397563f1c Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Timo=20Ter=C3=A4s?= <timo.teras@iki.fi>
-Date: Thu, 23 May 2013 11:30:23 +0300
-Subject: [PATCH 1/6] net: inform NETDEV_CHANGE callbacks which flags were
- changed
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-In certain cases (like the follow up commit to arp.c) will need to
-check which flags actually changed to avoid excessive work.
-
-Ben Hutchings nicely worded why to put these transient flags to
-struct net_device for the time being:
-> It's inelegant to put transient data associated with an event in a
-> persistent data structure. On the other hand, having every user cache
-> the old state is pretty awful as well.
->
-> Really, netdev notifiers should be changed to accept a structure that
-> encapsulates the changes rather than just a pointer to the net_device.
-> But making such a change would be an enormous pain and error-prone
-> because notifier functions aren't type-safe.
->
-> As an interim solution, I think either the general flags_changed or
-> old_flags would be preferable to defining extra transient flags.
-
-Signed-off-by: Timo Teräs <timo.teras@iki.fi>
-Acked-by: Ben Hutchings <bhutchings@solarflare.com>
----
- include/linux/netdevice.h | 4 +++-
- net/core/dev.c | 5 ++++-
- 2 files changed, 7 insertions(+), 2 deletions(-)
-
-diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
-index 6151e90..8b3c649 100644
---- a/include/linux/netdevice.h
-+++ b/include/linux/netdevice.h
-@@ -1112,7 +1112,9 @@ struct net_device {
- /* Hardware header description */
- const struct header_ops *header_ops;
-
-- unsigned int flags; /* interface flags (a la BSD) */
-+ unsigned int flags; /* interface flags (a la BSD) */
-+ unsigned int flags_changed; /* flags that are being changed
-+ * valid during NETDEV_CHANGE notifier */
- unsigned int priv_flags; /* Like 'flags' but invisible to userspace.
- * See if.h for definitions. */
- unsigned short gflags;
-diff --git a/net/core/dev.c b/net/core/dev.c
-index 9a278e9..2f3feae 100644
---- a/net/core/dev.c
-+++ b/net/core/dev.c
-@@ -4683,8 +4683,11 @@ void __dev_notify_flags(struct net_device *dev, unsigned int old_flags)
- }
-
- if (dev->flags & IFF_UP &&
-- (changes & ~(IFF_UP | IFF_PROMISC | IFF_ALLMULTI | IFF_VOLATILE)))
-+ (changes & ~(IFF_UP | IFF_PROMISC | IFF_ALLMULTI | IFF_VOLATILE))) {
-+ dev->flags_changed = changes;
- call_netdevice_notifiers(NETDEV_CHANGE, dev);
-+ dev->flags_changed = 0;
-+ }
- }
-
- /**
---
-1.8.2.3
-
diff --git a/main/linux-virt-grsec/0002-arp-flush-arp-cache-on-IFF_NOARP-change.patch b/main/linux-virt-grsec/0002-arp-flush-arp-cache-on-IFF_NOARP-change.patch
deleted file mode 100644
index 0e364f471..000000000
--- a/main/linux-virt-grsec/0002-arp-flush-arp-cache-on-IFF_NOARP-change.patch
+++ /dev/null
@@ -1,35 +0,0 @@
-From 36fbd62c47d800705d9989c69994359711514165 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Timo=20Ter=C3=A4s?= <timo.teras@iki.fi>
-Date: Thu, 23 May 2013 11:43:55 +0300
-Subject: [PATCH 2/6] arp: flush arp cache on IFF_NOARP change
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-IFF_NOARP affects what kind of neighbor entries are created
-(nud NOARP or nud INCOMPLETE). If the flag changes, flush the arp
-cache to refresh all entries.
-
-Signed-off-by: Timo Teräs <timo.teras@iki.fi>
----
- net/ipv4/arp.c | 4 ++++
- 1 file changed, 4 insertions(+)
-
-diff --git a/net/ipv4/arp.c b/net/ipv4/arp.c
-index fea4929..2a06ecf 100644
---- a/net/ipv4/arp.c
-+++ b/net/ipv4/arp.c
-@@ -1226,6 +1226,10 @@ static int arp_netdev_event(struct notifier_block *this, unsigned long event,
- neigh_changeaddr(&arp_tbl, dev);
- rt_cache_flush(dev_net(dev));
- break;
-+ case NETDEV_CHANGE:
-+ if (dev->flags_changed & IFF_NOARP)
-+ neigh_changeaddr(&arp_tbl, dev);
-+ break;
- default:
- break;
- }
---
-1.8.2.3
-
diff --git a/main/linux-virt-grsec/0003-ipv4-properly-refresh-rtable-entries-on-pmtu-redirec.patch b/main/linux-virt-grsec/0003-ipv4-properly-refresh-rtable-entries-on-pmtu-redirec.patch
deleted file mode 100644
index 807dba0b3..000000000
--- a/main/linux-virt-grsec/0003-ipv4-properly-refresh-rtable-entries-on-pmtu-redirec.patch
+++ /dev/null
@@ -1,201 +0,0 @@
-From 777eadba40c19bcfdb48807e7b0547ef30555671 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Timo=20Ter=C3=A4s?= <timo.teras@iki.fi>
-Date: Sat, 25 May 2013 15:42:30 +0300
-Subject: [PATCH 3/6] ipv4: properly refresh rtable entries on pmtu/redirect
- events
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-This reverts commit 05ab86c5 (xfrm4: Invalidate all ipv4 routes on
-IPsec pmtu events). Flushing all cached entries is not needed.
-
-Instead, invalidate only the related next hop dsts to recheck for
-the added next hop exception where needed. This also fixes a subtle
-race due to bumping generation id's before updating the pmtu.
-
-Cc: Steffen Klassert <steffen.klassert@secunet.com>
-Signed-off-by: Timo Teräs <timo.teras@iki.fi>
----
- net/ipv4/ah4.c | 7 ++-----
- net/ipv4/esp4.c | 7 ++-----
- net/ipv4/ipcomp.c | 7 ++-----
- net/ipv4/route.c | 63 ++++++++++++++++++++++++++++++++-----------------------
- 4 files changed, 43 insertions(+), 41 deletions(-)
-
-diff --git a/net/ipv4/ah4.c b/net/ipv4/ah4.c
-index 2e7f194..7179026 100644
---- a/net/ipv4/ah4.c
-+++ b/net/ipv4/ah4.c
-@@ -419,12 +419,9 @@ static void ah4_err(struct sk_buff *skb, u32 info)
- if (!x)
- return;
-
-- if (icmp_hdr(skb)->type == ICMP_DEST_UNREACH) {
-- atomic_inc_unchecked(&flow_cache_genid);
-- rt_genid_bump(net);
--
-+ if (icmp_hdr(skb)->type == ICMP_DEST_UNREACH)
- ipv4_update_pmtu(skb, net, info, 0, 0, IPPROTO_AH, 0);
-- } else
-+ else
- ipv4_redirect(skb, net, 0, 0, IPPROTO_AH, 0);
- xfrm_state_put(x);
- }
-diff --git a/net/ipv4/esp4.c b/net/ipv4/esp4.c
-index 4cfe34d..ab3d814 100644
---- a/net/ipv4/esp4.c
-+++ b/net/ipv4/esp4.c
-@@ -502,12 +502,9 @@ static void esp4_err(struct sk_buff *skb, u32 info)
- if (!x)
- return;
-
-- if (icmp_hdr(skb)->type == ICMP_DEST_UNREACH) {
-- atomic_inc_unchecked(&flow_cache_genid);
-- rt_genid_bump(net);
--
-+ if (icmp_hdr(skb)->type == ICMP_DEST_UNREACH)
- ipv4_update_pmtu(skb, net, info, 0, 0, IPPROTO_ESP, 0);
-- } else
-+ else
- ipv4_redirect(skb, net, 0, 0, IPPROTO_ESP, 0);
- xfrm_state_put(x);
- }
-diff --git a/net/ipv4/ipcomp.c b/net/ipv4/ipcomp.c
-index f01d1b1..48b3f0b 100644
---- a/net/ipv4/ipcomp.c
-+++ b/net/ipv4/ipcomp.c
-@@ -47,12 +47,9 @@ static void ipcomp4_err(struct sk_buff *skb, u32 info)
- if (!x)
- return;
-
-- if (icmp_hdr(skb)->type == ICMP_DEST_UNREACH) {
-- atomic_inc_unchecked(&flow_cache_genid);
-- rt_genid_bump(net);
--
-+ if (icmp_hdr(skb)->type == ICMP_DEST_UNREACH)
- ipv4_update_pmtu(skb, net, info, 0, 0, IPPROTO_COMP, 0);
-- } else
-+ else
- ipv4_redirect(skb, net, 0, 0, IPPROTO_COMP, 0);
- xfrm_state_put(x);
- }
-diff --git a/net/ipv4/route.c b/net/ipv4/route.c
-index 6e28514..8dedfeb 100644
---- a/net/ipv4/route.c
-+++ b/net/ipv4/route.c
-@@ -594,11 +594,25 @@ static inline u32 fnhe_hashfun(__be32 daddr)
- return hval & (FNHE_HASH_SIZE - 1);
- }
-
-+static void fill_route_from_fnhe(struct rtable *rt, struct fib_nh_exception *fnhe)
-+{
-+ rt->rt_pmtu = fnhe->fnhe_pmtu;
-+ rt->dst.expires = fnhe->fnhe_expires;
-+
-+ if (fnhe->fnhe_gw) {
-+ rt->rt_flags |= RTCF_REDIRECTED;
-+ rt->rt_gateway = fnhe->fnhe_gw;
-+ rt->rt_uses_gateway = 1;
-+ }
-+}
-+
- static void update_or_create_fnhe(struct fib_nh *nh, __be32 daddr, __be32 gw,
- u32 pmtu, unsigned long expires)
- {
- struct fnhe_hash_bucket *hash;
- struct fib_nh_exception *fnhe;
-+ struct rtable *rt;
-+ unsigned int i;
- int depth;
- u32 hval = fnhe_hashfun(daddr);
-
-@@ -627,8 +641,12 @@ static void update_or_create_fnhe(struct fib_nh *nh, __be32 daddr, __be32 gw,
- fnhe->fnhe_gw = gw;
- if (pmtu) {
- fnhe->fnhe_pmtu = pmtu;
-- fnhe->fnhe_expires = expires;
-+ fnhe->fnhe_expires = max(1UL, expires);
- }
-+ /* Update all cached dsts too */
-+ rt = rcu_dereference(fnhe->fnhe_rth);
-+ if (rt)
-+ fill_route_from_fnhe(rt, fnhe);
- } else {
- if (depth > FNHE_RECLAIM_DEPTH)
- fnhe = fnhe_oldest(hash);
-@@ -644,6 +662,18 @@ static void update_or_create_fnhe(struct fib_nh *nh, __be32 daddr, __be32 gw,
- fnhe->fnhe_gw = gw;
- fnhe->fnhe_pmtu = pmtu;
- fnhe->fnhe_expires = expires;
-+
-+ /* Exception created; mark the cached routes for the nexthop
-+ * stale, so anyone caching it rechecks if this exception
-+ * applies to them.
-+ */
-+ for_each_possible_cpu(i) {
-+ struct rtable __rcu **prt;
-+ prt = per_cpu_ptr(nh->nh_pcpu_rth_output, i);
-+ rt = rcu_dereference(*prt);
-+ if (rt)
-+ rt->dst.obsolete = DST_OBSOLETE_KILL;
-+ }
- }
-
- fnhe->fnhe_stamp = jiffies;
-@@ -917,13 +947,6 @@ static void __ip_rt_update_pmtu(struct rtable *rt, struct flowi4 *fl4, u32 mtu)
- if (mtu < ip_rt_min_pmtu)
- mtu = ip_rt_min_pmtu;
-
-- if (!rt->rt_pmtu) {
-- dst->obsolete = DST_OBSOLETE_KILL;
-- } else {
-- rt->rt_pmtu = mtu;
-- dst->expires = max(1UL, jiffies + ip_rt_mtu_expires);
-- }
--
- rcu_read_lock();
- if (fib_lookup(dev_net(dst->dev), fl4, &res) == 0) {
- struct fib_nh *nh = &FIB_RES_NH(res);
-@@ -1063,11 +1086,11 @@ static struct dst_entry *ipv4_dst_check(struct dst_entry *dst, u32 cookie)
- * DST_OBSOLETE_FORCE_CHK which forces validation calls down
- * into this function always.
- *
-- * When a PMTU/redirect information update invalidates a
-- * route, this is indicated by setting obsolete to
-- * DST_OBSOLETE_KILL.
-+ * When a PMTU/redirect information update invalidates a route,
-+ * this is indicated by setting obsolete to DST_OBSOLETE_KILL or
-+ * DST_OBSOLETE_DEAD by dst_free().
- */
-- if (dst->obsolete == DST_OBSOLETE_KILL || rt_is_expired(rt))
-+ if (dst->obsolete != DST_OBSOLETE_FORCE_CHK || rt_is_expired(rt))
- return NULL;
- return dst;
- }
-@@ -1215,20 +1238,8 @@ static bool rt_bind_exception(struct rtable *rt, struct fib_nh_exception *fnhe,
- fnhe->fnhe_pmtu = 0;
- fnhe->fnhe_expires = 0;
- }
-- if (fnhe->fnhe_pmtu) {
-- unsigned long expires = fnhe->fnhe_expires;
-- unsigned long diff = expires - jiffies;
--
-- if (time_before(jiffies, expires)) {
-- rt->rt_pmtu = fnhe->fnhe_pmtu;
-- dst_set_expires(&rt->dst, diff);
-- }
-- }
-- if (fnhe->fnhe_gw) {
-- rt->rt_flags |= RTCF_REDIRECTED;
-- rt->rt_gateway = fnhe->fnhe_gw;
-- rt->rt_uses_gateway = 1;
-- } else if (!rt->rt_gateway)
-+ fill_route_from_fnhe(rt, fnhe);
-+ if (!rt->rt_gateway)
- rt->rt_gateway = daddr;
-
- rcu_assign_pointer(fnhe->fnhe_rth, rt);
---
-1.8.2.3
-
diff --git a/main/linux-virt-grsec/0004-ipv4-rate-limit-updating-of-next-hop-exceptions-with.patch b/main/linux-virt-grsec/0004-ipv4-rate-limit-updating-of-next-hop-exceptions-with.patch
deleted file mode 100644
index 9b2ad8913..000000000
--- a/main/linux-virt-grsec/0004-ipv4-rate-limit-updating-of-next-hop-exceptions-with.patch
+++ /dev/null
@@ -1,37 +0,0 @@
-From 90f586dba1465a73295d752abe2451e924ba1888 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Timo=20Ter=C3=A4s?= <timo.teras@iki.fi>
-Date: Mon, 27 May 2013 08:33:10 +0300
-Subject: [PATCH 4/6] ipv4: rate limit updating of next hop exceptions with
- same pmtu
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-The tunnel devices call update_pmtu for each packet sent, this causes
-contention on the fnhe_lock. Ignore the pmtu update if pmtu is not
-actually changed, and there is still plenty of time before the entry
-expires.
-
-Signed-off-by: Timo Teräs <timo.teras@iki.fi>
----
- net/ipv4/route.c | 4 ++++
- 1 file changed, 4 insertions(+)
-
-diff --git a/net/ipv4/route.c b/net/ipv4/route.c
-index 8dedfeb..85b9c07 100644
---- a/net/ipv4/route.c
-+++ b/net/ipv4/route.c
-@@ -947,6 +947,10 @@ static void __ip_rt_update_pmtu(struct rtable *rt, struct flowi4 *fl4, u32 mtu)
- if (mtu < ip_rt_min_pmtu)
- mtu = ip_rt_min_pmtu;
-
-+ if (rt->rt_pmtu == mtu &&
-+ time_before(jiffies, dst->expires - ip_rt_mtu_expires / 2))
-+ return;
-+
- rcu_read_lock();
- if (fib_lookup(dev_net(dst->dev), fl4, &res) == 0) {
- struct fib_nh *nh = &FIB_RES_NH(res);
---
-1.8.2.3
-
diff --git a/main/linux-virt-grsec/0005-ipv4-use-separate-genid-for-next-hop-exceptions.patch b/main/linux-virt-grsec/0005-ipv4-use-separate-genid-for-next-hop-exceptions.patch
deleted file mode 100644
index 40cd4fc6c..000000000
--- a/main/linux-virt-grsec/0005-ipv4-use-separate-genid-for-next-hop-exceptions.patch
+++ /dev/null
@@ -1,116 +0,0 @@
-From 4a7dbb238480fac2b1ad02a74240efcf225c1f45 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Timo=20Ter=C3=A4s?= <timo.teras@iki.fi>
-Date: Mon, 27 May 2013 10:55:52 +0300
-Subject: [PATCH 5/6] ipv4: use separate genid for next hop exceptions
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-commit 13d82bf5 (ipv4: Fix flushing of cached routing informations)
-added the support to flush learned pmtu information.
-
-However, using rt_genid is quite heavy as it is bumped on route
-add/change and multicast events amongst other places. These can
-happen quote often, especially if using dynamic routing protocols.
-
-While this is ok with routes (as they are just recreated locally),
-the pmtu information is learned from remote systems and the icmp
-notification can come with long delays. It is worthy to have separate
-genid to avoid excessive pmtu resets.
-
-Cc: Steffen Klassert <steffen.klassert@secunet.com>
-Signed-off-by: Timo Teräs <timo.teras@iki.fi>
----
- include/net/ip_fib.h | 1 +
- include/net/net_namespace.h | 11 +++++++++++
- net/ipv4/route.c | 12 ++++++++++--
- 3 files changed, 22 insertions(+), 2 deletions(-)
-
-diff --git a/include/net/ip_fib.h b/include/net/ip_fib.h
-index e49db91..44424e9 100644
---- a/include/net/ip_fib.h
-+++ b/include/net/ip_fib.h
-@@ -51,6 +51,7 @@ struct rtable;
-
- struct fib_nh_exception {
- struct fib_nh_exception __rcu *fnhe_next;
-+ int fnhe_genid;
- __be32 fnhe_daddr;
- u32 fnhe_pmtu;
- __be32 fnhe_gw;
-diff --git a/include/net/net_namespace.h b/include/net/net_namespace.h
-index de644bc..b5a5baf 100644
---- a/include/net/net_namespace.h
-+++ b/include/net/net_namespace.h
-@@ -116,6 +116,7 @@ struct net {
- struct netns_ipvs *ipvs;
- struct sock *diag_nlsk;
- atomic_unchecked_t rt_genid;
-+ atomic_unchecked_t fnhe_genid;
- };
-
- /*
-@@ -338,4 +339,14 @@ static inline void rt_genid_bump(struct net *net)
- atomic_inc_unchecked(&net->rt_genid);
- }
-
-+static inline int fnhe_genid(struct net *net)
-+{
-+ return atomic_read_unchecked(&net->fnhe_genid);
-+}
-+
-+static inline void fnhe_genid_bump(struct net *net)
-+{
-+ atomic_inc_unchecked(&net->fnhe_genid);
-+}
-+
- #endif /* __NET_NET_NAMESPACE_H */
-diff --git a/net/ipv4/route.c b/net/ipv4/route.c
-index 85b9c07..f44a4bb 100644
---- a/net/ipv4/route.c
-+++ b/net/ipv4/route.c
-@@ -658,6 +658,7 @@ static void update_or_create_fnhe(struct fib_nh *nh, __be32 daddr, __be32 gw,
- fnhe->fnhe_next = hash->chain;
- rcu_assign_pointer(hash->chain, fnhe);
- }
-+ fnhe->fnhe_genid = fnhe_genid(dev_net(nh->nh_dev));
- fnhe->fnhe_daddr = daddr;
- fnhe->fnhe_gw = gw;
- fnhe->fnhe_pmtu = pmtu;
-@@ -1236,8 +1237,11 @@ static bool rt_bind_exception(struct rtable *rt, struct fib_nh_exception *fnhe,
- spin_lock_bh(&fnhe_lock);
-
- if (daddr == fnhe->fnhe_daddr) {
-+ int genid = fnhe_genid(dev_net(rt->dst.dev));
- struct rtable *orig = rcu_dereference(fnhe->fnhe_rth);
-- if (orig && rt_is_expired(orig)) {
-+
-+ if (fnhe->fnhe_genid != genid) {
-+ fnhe->fnhe_genid = genid;
- fnhe->fnhe_gw = 0;
- fnhe->fnhe_pmtu = 0;
- fnhe->fnhe_expires = 0;
-@@ -2443,8 +2447,11 @@ static int ipv4_sysctl_rtcache_flush(ctl_table *__ctl, int write,
- void __user *buffer,
- size_t *lenp, loff_t *ppos)
- {
-+ struct net *net = (struct net *)__ctl->extra1;
-+
- if (write) {
-- rt_cache_flush((struct net *)__ctl->extra1);
-+ rt_cache_flush(net);
-+ fnhe_genid_bump(net);
- return 0;
- }
-
-@@ -2619,6 +2626,7 @@ static __net_initdata struct pernet_operations sysctl_route_ops = {
- static __net_init int rt_genid_init(struct net *net)
- {
- atomic_set_unchecked(&net->rt_genid, 0);
-+ atomic_set_unchecked(&net->fnhe_genid, 0);
- get_random_bytes(&net->ipv4.dev_addr_genid,
- sizeof(net->ipv4.dev_addr_genid));
- return 0;
---
-1.8.2.3
-
diff --git a/main/linux-virt-grsec/0006-ipv4-use-next-hop-exceptions-also-for-input-routes.patch b/main/linux-virt-grsec/0006-ipv4-use-next-hop-exceptions-also-for-input-routes.patch
deleted file mode 100644
index 9b78e76b2..000000000
--- a/main/linux-virt-grsec/0006-ipv4-use-next-hop-exceptions-also-for-input-routes.patch
+++ /dev/null
@@ -1,213 +0,0 @@
-From 87151ab93a08bcc4abe23aa2e87fbc2b956ae2cc Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Timo=20Ter=C3=A4s?= <timo.teras@iki.fi>
-Date: Mon, 27 May 2013 08:40:22 +0300
-Subject: [PATCH 6/6] ipv4: use next hop exceptions also for input routes
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-Commit d2d68ba9 (ipv4: Cache input routes in fib_info nexthops)
-assmued that "locally destined, and routed packets, never trigger
-PMTU events or redirects that will be processed by us".
-
-However, it seems that tunnel devices do trigger PMTU events in certain
-cases. At least ip_gre, ip6_gre, sit, and ipip do use the inner flow's
-skb_dst(skb)->ops->update_pmtu to propage mtu information from the
-outer flows. These can cause the inner flow mtu to be decreased. If
-next hop exceptions are not consulted for pmtu, IP fragmentation will
-not be done properly for these routes.
-
-It also seems that we really need to have the PMTU information always
-for netfilter TCPMSS clamp-to-pmtu feature to work properly.
-
-So for the time being, cache separate copies of input routes for
-each next hop exception.
-
-Signed-off-by: Timo Teräs <timo.teras@iki.fi>
----
- include/net/ip_fib.h | 3 ++-
- net/ipv4/fib_semantics.c | 3 ++-
- net/ipv4/route.c | 65 +++++++++++++++++++++++++++++++++++++-----------
- 3 files changed, 54 insertions(+), 17 deletions(-)
-
-diff --git a/include/net/ip_fib.h b/include/net/ip_fib.h
-index 44424e9..aac8553 100644
---- a/include/net/ip_fib.h
-+++ b/include/net/ip_fib.h
-@@ -56,7 +56,8 @@ struct fib_nh_exception {
- u32 fnhe_pmtu;
- __be32 fnhe_gw;
- unsigned long fnhe_expires;
-- struct rtable __rcu *fnhe_rth;
-+ struct rtable __rcu *fnhe_rth_input;
-+ struct rtable __rcu *fnhe_rth_output;
- unsigned long fnhe_stamp;
- };
-
-diff --git a/net/ipv4/fib_semantics.c b/net/ipv4/fib_semantics.c
-index 8f6cb7a..d5dbca5 100644
---- a/net/ipv4/fib_semantics.c
-+++ b/net/ipv4/fib_semantics.c
-@@ -169,7 +169,8 @@ static void free_nh_exceptions(struct fib_nh *nh)
-
- next = rcu_dereference_protected(fnhe->fnhe_next, 1);
-
-- rt_fibinfo_free(&fnhe->fnhe_rth);
-+ rt_fibinfo_free(&fnhe->fnhe_rth_input);
-+ rt_fibinfo_free(&fnhe->fnhe_rth_output);
-
- kfree(fnhe);
-
-diff --git a/net/ipv4/route.c b/net/ipv4/route.c
-index f44a4bb..a7a36f7 100644
---- a/net/ipv4/route.c
-+++ b/net/ipv4/route.c
-@@ -565,10 +565,25 @@ static inline void rt_free(struct rtable *rt)
-
- static DEFINE_SPINLOCK(fnhe_lock);
-
-+static void fnhe_flush_routes(struct fib_nh_exception *fnhe)
-+{
-+ struct rtable *rt;
-+
-+ rt = rcu_dereference(fnhe->fnhe_rth_input);
-+ if (rt) {
-+ RCU_INIT_POINTER(fnhe->fnhe_rth_input, NULL);
-+ rt_free(rt);
-+ }
-+ rt = rcu_dereference(fnhe->fnhe_rth_output);
-+ if (rt) {
-+ RCU_INIT_POINTER(fnhe->fnhe_rth_output, NULL);
-+ rt_free(rt);
-+ }
-+}
-+
- static struct fib_nh_exception *fnhe_oldest(struct fnhe_hash_bucket *hash)
- {
- struct fib_nh_exception *fnhe, *oldest;
-- struct rtable *orig;
-
- oldest = rcu_dereference(hash->chain);
- for (fnhe = rcu_dereference(oldest->fnhe_next); fnhe;
-@@ -576,11 +591,7 @@ static struct fib_nh_exception *fnhe_oldest(struct fnhe_hash_bucket *hash)
- if (time_before(fnhe->fnhe_stamp, oldest->fnhe_stamp))
- oldest = fnhe;
- }
-- orig = rcu_dereference(oldest->fnhe_rth);
-- if (orig) {
-- RCU_INIT_POINTER(oldest->fnhe_rth, NULL);
-- rt_free(orig);
-- }
-+ fnhe_flush_routes(oldest);
- return oldest;
- }
-
-@@ -644,7 +655,10 @@ static void update_or_create_fnhe(struct fib_nh *nh, __be32 daddr, __be32 gw,
- fnhe->fnhe_expires = max(1UL, expires);
- }
- /* Update all cached dsts too */
-- rt = rcu_dereference(fnhe->fnhe_rth);
-+ rt = rcu_dereference(fnhe->fnhe_rth_input);
-+ if (rt)
-+ fill_route_from_fnhe(rt, fnhe);
-+ rt = rcu_dereference(fnhe->fnhe_rth_output);
- if (rt)
- fill_route_from_fnhe(rt, fnhe);
- } else {
-@@ -668,6 +682,10 @@ static void update_or_create_fnhe(struct fib_nh *nh, __be32 daddr, __be32 gw,
- * stale, so anyone caching it rechecks if this exception
- * applies to them.
- */
-+ rt = rcu_dereference(nh->nh_rth_input);
-+ if (rt)
-+ rt->dst.obsolete = DST_OBSOLETE_KILL;
-+
- for_each_possible_cpu(i) {
- struct rtable __rcu **prt;
- prt = per_cpu_ptr(nh->nh_pcpu_rth_output, i);
-@@ -1237,25 +1255,36 @@ static bool rt_bind_exception(struct rtable *rt, struct fib_nh_exception *fnhe,
- spin_lock_bh(&fnhe_lock);
-
- if (daddr == fnhe->fnhe_daddr) {
-+ struct rtable __rcu **porig;
-+ struct rtable *orig;
- int genid = fnhe_genid(dev_net(rt->dst.dev));
-- struct rtable *orig = rcu_dereference(fnhe->fnhe_rth);
-+
-+ if (rt_is_input_route(rt))
-+ porig = &fnhe->fnhe_rth_input;
-+ else
-+ porig = &fnhe->fnhe_rth_output;
-+ orig = rcu_dereference(*porig);
-
- if (fnhe->fnhe_genid != genid) {
- fnhe->fnhe_genid = genid;
- fnhe->fnhe_gw = 0;
- fnhe->fnhe_pmtu = 0;
- fnhe->fnhe_expires = 0;
-+ fnhe_flush_routes(fnhe);
-+ orig = NULL;
- }
- fill_route_from_fnhe(rt, fnhe);
- if (!rt->rt_gateway)
- rt->rt_gateway = daddr;
-
-- rcu_assign_pointer(fnhe->fnhe_rth, rt);
-- if (orig)
-- rt_free(orig);
-+ if (!(rt->dst.flags & DST_NOCACHE)) {
-+ rcu_assign_pointer(*porig, rt);
-+ if (orig)
-+ rt_free(orig);
-+ ret = true;
-+ }
-
- fnhe->fnhe_stamp = jiffies;
-- ret = true;
- }
- spin_unlock_bh(&fnhe_lock);
-
-@@ -1487,6 +1516,7 @@ static int __mkroute_input(struct sk_buff *skb,
- struct in_device *in_dev,
- __be32 daddr, __be32 saddr, u32 tos)
- {
-+ struct fib_nh_exception *fnhe;
- struct rtable *rth;
- int err;
- struct in_device *out_dev;
-@@ -1533,8 +1563,13 @@ static int __mkroute_input(struct sk_buff *skb,
- }
- }
-
-+ fnhe = find_exception(&FIB_RES_NH(*res), daddr);
- if (do_cache) {
-- rth = rcu_dereference(FIB_RES_NH(*res).nh_rth_input);
-+ if (fnhe != NULL)
-+ rth = rcu_dereference(fnhe->fnhe_rth_input);
-+ else
-+ rth = rcu_dereference(FIB_RES_NH(*res).nh_rth_input);
-+
- if (rt_cache_valid(rth)) {
- skb_dst_set_noref(skb, &rth->dst);
- goto out;
-@@ -1562,7 +1597,7 @@ static int __mkroute_input(struct sk_buff *skb,
- rth->dst.input = ip_forward;
- rth->dst.output = ip_output;
-
-- rt_set_nexthop(rth, daddr, res, NULL, res->fi, res->type, itag);
-+ rt_set_nexthop(rth, daddr, res, fnhe, res->fi, res->type, itag);
- skb_dst_set(skb, &rth->dst);
- out:
- err = 0;
-@@ -1877,7 +1912,7 @@ static struct rtable *__mkroute_output(const struct fib_result *res,
-
- fnhe = find_exception(nh, fl4->daddr);
- if (fnhe)
-- prth = &fnhe->fnhe_rth;
-+ prth = &fnhe->fnhe_rth_output;
- else {
- if (unlikely(fl4->flowi4_flags &
- FLOWI_FLAG_KNOWN_NH &&
---
-1.8.2.3
-
diff --git a/main/linux-virt-grsec/APKBUILD b/main/linux-virt-grsec/APKBUILD
index d84481715..7ff29e78e 100644
--- a/main/linux-virt-grsec/APKBUILD
+++ b/main/linux-virt-grsec/APKBUILD
@@ -3,7 +3,7 @@
_flavor=grsec
pkgname=linux-virt-${_flavor}
-pkgver=3.10.23
+pkgver=3.12.4
case $pkgver in
*.*.*) _kernver=${pkgver%.*};;
*.*) _kernver=${pkgver};;
@@ -18,15 +18,8 @@ _config=${config:-kernelconfig.${CARCH}}
install=
source="http://ftp.kernel.org/pub/linux/kernel/v3.x/linux-$_kernver.tar.xz
http://ftp.kernel.org/pub/linux/kernel/v3.x/patch-$pkgver.xz
- grsecurity-2.9.1-$pkgver-unofficial.patch
- 0001-net-inform-NETDEV_CHANGE-callbacks-which-flags-were-.patch
- 0002-arp-flush-arp-cache-on-IFF_NOARP-change.patch
- 0003-ipv4-properly-refresh-rtable-entries-on-pmtu-redirec.patch
- 0004-ipv4-rate-limit-updating-of-next-hop-exceptions-with.patch
- 0005-ipv4-use-separate-genid-for-next-hop-exceptions.patch
- 0006-ipv4-use-next-hop-exceptions-also-for-input-routes.patch
+ grsecurity-3.0-$pkgver-201312081754.patch
fix-memory-map-for-PIE-applications.patch
- sysctl_lxc.patch
kernelconfig.x86
kernelconfig.x86_64
@@ -150,42 +143,21 @@ dev() {
"$subpkgdir"/lib/modules/${_abi_release}/build
}
-md5sums="4f25cd5bec5f8d5a7d935b3f2ccb8481 linux-3.10.tar.xz
-8b9650e10f8beee769545b51202766a5 patch-3.10.23.xz
-82efe899230f7246ca99f3d334c0c1b8 grsecurity-2.9.1-3.10.23-unofficial.patch
-a16f11b12381efb3bec79b9bfb329836 0001-net-inform-NETDEV_CHANGE-callbacks-which-flags-were-.patch
-656ae7b10dd2f18dbfa1011041d08d60 0002-arp-flush-arp-cache-on-IFF_NOARP-change.patch
-aa454ffb96428586447775c21449e284 0003-ipv4-properly-refresh-rtable-entries-on-pmtu-redirec.patch
-2a12a3717052e878c0cd42aa935bfcf4 0004-ipv4-rate-limit-updating-of-next-hop-exceptions-with.patch
-6ce5fed63aad3f1a1ff1b9ba7b741822 0005-ipv4-use-separate-genid-for-next-hop-exceptions.patch
-1a5800a2122ba0cc0d06733cb3bb8b8f 0006-ipv4-use-next-hop-exceptions-also-for-input-routes.patch
+md5sums="cc6ee608854e0da4b64f6c1ff8b6398c linux-3.12.tar.xz
+511b5a2f0de55b5e91fd293766ce182b patch-3.12.4.xz
+97395c529c1dd1826fff077c1ba9814e grsecurity-3.0-3.12.4-201312081754.patch
c6a4ae7e8ca6159e1631545515805216 fix-memory-map-for-PIE-applications.patch
-b3c0153d53e508e03d73b94d15b24a96 sysctl_lxc.patch
-539c848d541c1656851fe865018273df kernelconfig.x86
-82cd965fc82651f2e6b35e75c17d8031 kernelconfig.x86_64"
-sha256sums="df27fa92d27a9c410bfe6c4a89f141638500d7eadcca5cce578954efc2ad3544 linux-3.10.tar.xz
-bdf3983ff3e26c5781edb19a8d0d7765e2e0282cfabda2b0652cc0deff53f445 patch-3.10.23.xz
-f0dfa654e64e79c96127a0f8cd4867a0170f099c7116e7f45e27572294b1b818 grsecurity-2.9.1-3.10.23-unofficial.patch
-6af3757ac36a6cd3cda7b0a71b08143726383b19261294a569ad7f4042c72df3 0001-net-inform-NETDEV_CHANGE-callbacks-which-flags-were-.patch
-dc8e82108615657f1fb9d641efd42255a5761c06edde1b00a41ae0d314d548f0 0002-arp-flush-arp-cache-on-IFF_NOARP-change.patch
-0985caa0f3ee8ed0959aeaa4214f5f8057ae8e61d50dcae39194912d31e14892 0003-ipv4-properly-refresh-rtable-entries-on-pmtu-redirec.patch
-260fd1807838b68305a96992bf7d3302a2a8ef3a3b08fe079ba9a07e6422f736 0004-ipv4-rate-limit-updating-of-next-hop-exceptions-with.patch
-ae32bb72afa170e6c3788c564b342763aba5945afacc1e2ebfc096adf50d77a3 0005-ipv4-use-separate-genid-for-next-hop-exceptions.patch
-fc613ac466610b866b721c41836fd5bfb2d4b75bceb67972dc6369d7f62ff47e 0006-ipv4-use-next-hop-exceptions-also-for-input-routes.patch
+cc0bc34dd6d4f4396fa70ceaa5aa4a1a kernelconfig.x86
+93a67bcefa885e0089247694c3e1fa25 kernelconfig.x86_64"
+sha256sums="2e120ec7fde19fa51dc6b6cc11c81860a0775defcad5a5bf910ed9a50e845a02 linux-3.12.tar.xz
+b1e21b37e29c7f32f1395356958019ff1ac2f2e75bcc7dda2a60ba79cfffd845 patch-3.12.4.xz
+695fb49d9a8960f5ed8d11b24ce0286346b7dde9876d65a283210a8579b3b09e grsecurity-3.0-3.12.4-201312081754.patch
500f3577310be52e87b9fecdc2e9c4ca43210fd97d69089f9005d484563f74c7 fix-memory-map-for-PIE-applications.patch
-9ba55b0f45d5aa97503e376a13be6d249a10f32e36687055b2fa1e5a39fa0584 sysctl_lxc.patch
-997d4c8a5a2b911047d26fe1bf8ee8d5cd3b7133e6abdc07b7deacd0b3eb2330 kernelconfig.x86
-7845194551137fbc3b69a75249696bc843bb7fe7f4a4e6b0582c0ca0856caa64 kernelconfig.x86_64"
-sha512sums="5fb109fcbd59bf3dffc911b853894f0a84afa75151368f783a1252c5ff60c7a1504de216c0012be446df983e2dea400ad8eeed3ce04f24dc61d0ef76c174dc35 linux-3.10.tar.xz
-0fdb65f1c45e490e1f2206589273e4b8f0f142ab6b16341cb52977e0c6a983b359f01456a9cae3e1c139d5ead5de106c10909b7fdb6a156675cad5d39374e97f patch-3.10.23.xz
-8905d7215d9f82662e0e7b897fc2fb258c5978d12fed9cf618e60c7b0926af2f76e3b242140e9d3ab4988cee684f350aaf26270d1a8518297cde9928361d146d grsecurity-2.9.1-3.10.23-unofficial.patch
-81e78593288e8b0fd2c03ea9fc1450323887707f087e911f172450a122bc9b591ee83394836789730d951aeec13d0b75a64e1c05f04364abf8f80d883ddc4a02 0001-net-inform-NETDEV_CHANGE-callbacks-which-flags-were-.patch
-51ecb15b669f6a82940a13a38939116e003bf5dfd24496771c8279e907b72adcc63d607f0340a2940d757e12ddadb7d45c7af78ae311d284935a6296dbcac00c 0002-arp-flush-arp-cache-on-IFF_NOARP-change.patch
-57d0a8bd35d19cf657ded58efe24517d2252aec6984040713ba173a34edb5887ececaa2985076bc6a149eaa57639fd98a042c1c2d226ed4ad8dd5ed0e230717e 0003-ipv4-properly-refresh-rtable-entries-on-pmtu-redirec.patch
-d2f578ad1d6e1fe52b55863e5bf338ae8201b828a498ec3e42e549c55295d3d1c6c3adfa9e226d711e3486628ed56ab996484e219d79ac4b0c0ec684ebd380aa 0004-ipv4-rate-limit-updating-of-next-hop-exceptions-with.patch
-28a33e644bf2faf99c8dd6dbccfe14e140dfdd8824a8fb2d58aa7deb9e572f130d92b6b35ee181084050d82166bdf2e498a451a2a538a67b7ab84204405d2d87 0005-ipv4-use-separate-genid-for-next-hop-exceptions.patch
-249140374c19a5599876268ff5b3cda2e136681aee103b4a9fff5d7d346f8e3295a907fb43db0701b8a9fece64c299ad2abac0434259cce6631307ce84090205 0006-ipv4-use-next-hop-exceptions-also-for-input-routes.patch
+bb7418bfdfbe45476331412b17a06abb08f8a0f44fe8ff978fd3413e8671ae66 kernelconfig.x86
+4a11a2edd0dc69687f96f6c80140537b8ba74684244af59a1ffe74cd69712c6c kernelconfig.x86_64"
+sha512sums="4ba5797e0772726d05c9f2eee66dc6dc2a5033c749ef44764c805a83da739ed5d0c6443b76785e38fe1ef74cc7ade787e48144faed0cfcb6f124f05248c700ff linux-3.12.tar.xz
+efbb8e2a343935651101b43e7b977dd8c69aca7871b75d221edb32f93bd8ad83c6d0ae8d6622249019f8448fee8d3d754192bf7947602b8ed435bd786f1bb241 patch-3.12.4.xz
+f9a9bfee3977624fa2e4cc047e35dad42c71fd9eaec1c73f7bd9ad951d23809cc690bb5070c6d56879db9bcf88f04ad8365aa0f8c302fb756dac2cfd720ac88d grsecurity-3.0-3.12.4-201312081754.patch
4665c56ae1bbac311f9205d64918e84ee8b01d47d6e2396ff6b8adfb10aada7f7254531ce62e31edbb65c2a54a830f09ad05d314dfcd75d6272f4068945ad7c7 fix-memory-map-for-PIE-applications.patch
-41071e21c59997604a380575d3c4171d35a12eaae6ddcf158d95e4fd5ccc69d61753cbd38b7bd08d879cce5bfea3fed2df15e5a3dca944f6f7cbd95d5d2daa23 sysctl_lxc.patch
-08f5bb86f03415f60e9bb171ffa192fa70fa85dafeada10817a4b8ae7932fffd1b0f2df01750407e576bb71cd6c3f2c5fe76f2613922cd77f398bce134fd3ec2 kernelconfig.x86
-7a373bec279fe00601bff7ed64c5a09bb4318bf07557fece194afb426d78bf13191b0510642192518f3ffa68b9a36aa6f971f77f55ea09ae4f42c4a84afc00a5 kernelconfig.x86_64"
+b2245e3eeb020651eb36289d658b32a0ace45e00c392113e8589dbc31f5bd602fb3284b915b4924c235c7886f5e773ad731ddb392ca9e7b10528e0344bdafaef kernelconfig.x86
+203ef17038ebdb92dbdd6547875816012442f6d4c3d5ea43d9f4898b4c074feda85c485c3bf2aa1b6de127985292aaeef3596e66f06282c7853f9ff7db0a5df4 kernelconfig.x86_64"
diff --git a/main/linux-virt-grsec/grsecurity-2.9.1-3.10.23-unofficial.patch b/main/linux-virt-grsec/grsecurity-3.0-3.12.4-201312081754.patch
index cc4eeaf73..fa9c2c7fd 100644
--- a/main/linux-virt-grsec/grsecurity-2.9.1-3.10.23-unofficial.patch
+++ b/main/linux-virt-grsec/grsecurity-3.0-3.12.4-201312081754.patch
@@ -229,10 +229,10 @@ index b89a739..79768fb 100644
+zconf.lex.c
zoffset.h
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
-index 2fe6e76..889ee23 100644
+index fcbb736..5508d8c 100644
--- a/Documentation/kernel-parameters.txt
+++ b/Documentation/kernel-parameters.txt
-@@ -976,6 +976,10 @@ bytes respectively. Such letter suffixes can also be entirely omitted.
+@@ -1031,6 +1031,10 @@ bytes respectively. Such letter suffixes can also be entirely omitted.
Format: <unsigned int> such that (rxsize & ~0x1fffc0) == 0.
Default: 1024
@@ -243,7 +243,7 @@ index 2fe6e76..889ee23 100644
hashdist= [KNL,NUMA] Large hashes allocated during boot
are distributed across NUMA nodes. Defaults on
for 64-bit NUMA, off otherwise.
-@@ -1928,6 +1932,10 @@ bytes respectively. Such letter suffixes can also be entirely omitted.
+@@ -1999,6 +2003,10 @@ bytes respectively. Such letter suffixes can also be entirely omitted.
noexec=on: enable non-executable mappings (default)
noexec=off: disable non-executable mappings
@@ -254,7 +254,7 @@ index 2fe6e76..889ee23 100644
nosmap [X86]
Disable SMAP (Supervisor Mode Access Prevention)
even if it is supported by processor.
-@@ -2195,6 +2203,25 @@ bytes respectively. Such letter suffixes can also be entirely omitted.
+@@ -2266,6 +2274,25 @@ bytes respectively. Such letter suffixes can also be entirely omitted.
the specified number of seconds. This is to be used if
your oopses keep scrolling off the screen.
@@ -281,7 +281,7 @@ index 2fe6e76..889ee23 100644
pcd. [PARIDE]
diff --git a/Makefile b/Makefile
-index c6d2ec5..b2bfe62 100644
+index 3b7165e..9112a63 100644
--- a/Makefile
+++ b/Makefile
@@ -241,8 +241,9 @@ CONFIG_SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \
@@ -399,8 +399,8 @@ index c6d2ec5..b2bfe62 100644
+$(vmlinux-dirs): gcc-plugins prepare scripts
$(Q)$(MAKE) $(build)=$@
- # Store (new) KERNELRELASE string in include/config/kernel.release
-@@ -835,6 +897,7 @@ prepare0: archprepare FORCE
+ define filechk_kernel.release
+@@ -838,6 +900,7 @@ prepare0: archprepare FORCE
$(Q)$(MAKE) $(build)=.
# All the preparing..
@@ -408,7 +408,7 @@ index c6d2ec5..b2bfe62 100644
prepare: prepare0
# Generate some files
-@@ -942,6 +1005,8 @@ all: modules
+@@ -945,6 +1008,8 @@ all: modules
# using awk while concatenating to the final file.
PHONY += modules
@@ -417,7 +417,7 @@ index c6d2ec5..b2bfe62 100644
modules: $(vmlinux-dirs) $(if $(KBUILD_BUILTIN),vmlinux) modules.builtin
$(Q)$(AWK) '!x[$$0]++' $(vmlinux-dirs:%=$(objtree)/%/modules.order) > $(objtree)/modules.order
@$(kecho) ' Building modules, stage 2.';
-@@ -957,7 +1022,7 @@ modules.builtin: $(vmlinux-dirs:%=%/modules.builtin)
+@@ -960,7 +1025,7 @@ modules.builtin: $(vmlinux-dirs:%=%/modules.builtin)
# Target to prepare building external modules
PHONY += modules_prepare
@@ -426,7 +426,7 @@ index c6d2ec5..b2bfe62 100644
# Target to install modules
PHONY += modules_install
-@@ -1023,7 +1088,7 @@ MRPROPER_FILES += .config .config.old .version .old_version $(version_h) \
+@@ -1026,7 +1091,7 @@ MRPROPER_FILES += .config .config.old .version .old_version $(version_h) \
Module.symvers tags TAGS cscope* GPATH GTAGS GRTAGS GSYMS \
signing_key.priv signing_key.x509 x509.genkey \
extra_certificates signing_key.x509.keyid \
@@ -435,7 +435,7 @@ index c6d2ec5..b2bfe62 100644
# clean - Delete most, but leave enough to build external modules
#
-@@ -1063,6 +1128,7 @@ distclean: mrproper
+@@ -1066,6 +1131,7 @@ distclean: mrproper
\( -name '*.orig' -o -name '*.rej' -o -name '*~' \
-o -name '*.bak' -o -name '#*#' -o -name '.*.orig' \
-o -name '.*.rej' \
@@ -443,7 +443,7 @@ index c6d2ec5..b2bfe62 100644
-o -name '*%' -o -name '.*.cmd' -o -name 'core' \) \
-type f -print | xargs rm -f
-@@ -1223,6 +1289,8 @@ PHONY += $(module-dirs) modules
+@@ -1227,6 +1293,8 @@ PHONY += $(module-dirs) modules
$(module-dirs): crmodverdir $(objtree)/Module.symvers
$(Q)$(MAKE) $(build)=$(patsubst _module_%,%,$@)
@@ -452,7 +452,7 @@ index c6d2ec5..b2bfe62 100644
modules: $(module-dirs)
@$(kecho) ' Building modules, stage 2.';
$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost
-@@ -1359,17 +1427,21 @@ else
+@@ -1366,17 +1434,21 @@ else
target-dir = $(if $(KBUILD_EXTMOD),$(dir $<),$(dir $@))
endif
@@ -478,7 +478,7 @@ index c6d2ec5..b2bfe62 100644
$(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
%.symtypes: %.c prepare scripts FORCE
$(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
-@@ -1379,11 +1451,15 @@ endif
+@@ -1386,11 +1458,15 @@ endif
$(cmd_crmodverdir)
$(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1) \
$(build)=$(build-dir)
@@ -497,10 +497,10 @@ index c6d2ec5..b2bfe62 100644
$(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1) \
$(build)=$(build-dir) $(@:.ko=.o)
diff --git a/arch/alpha/include/asm/atomic.h b/arch/alpha/include/asm/atomic.h
-index c2cbe4f..f7264b4 100644
+index 78b03ef..da28a51 100644
--- a/arch/alpha/include/asm/atomic.h
+++ b/arch/alpha/include/asm/atomic.h
-@@ -250,6 +250,16 @@ static __inline__ int atomic64_add_unless(atomic64_t *v, long a, long u)
+@@ -292,6 +292,16 @@ static inline long atomic64_dec_if_positive(atomic64_t *v)
#define atomic_dec(v) atomic_sub(1,(v))
#define atomic64_dec(v) atomic64_sub(1,(v))
@@ -579,7 +579,7 @@ index bc2a0da..8ad11ee 100644
static inline void
diff --git a/arch/alpha/include/asm/pgtable.h b/arch/alpha/include/asm/pgtable.h
-index 81a4342..348b927 100644
+index d8f9b7e..f6222fa 100644
--- a/arch/alpha/include/asm/pgtable.h
+++ b/arch/alpha/include/asm/pgtable.h
@@ -102,6 +102,17 @@ struct vm_area_struct;
@@ -614,10 +614,10 @@ index 2fd00b7..cfd5069 100644
for (i = 0; i < n; i++) {
diff --git a/arch/alpha/kernel/osf_sys.c b/arch/alpha/kernel/osf_sys.c
-index b9e37ad..44c24e7 100644
+index 1402fcc..0b1abd2 100644
--- a/arch/alpha/kernel/osf_sys.c
+++ b/arch/alpha/kernel/osf_sys.c
-@@ -1297,10 +1297,11 @@ SYSCALL_DEFINE1(old_adjtimex, struct timex32 __user *, txc_p)
+@@ -1298,10 +1298,11 @@ SYSCALL_DEFINE1(old_adjtimex, struct timex32 __user *, txc_p)
generic version except that we know how to honor ADDR_LIMIT_32BIT. */
static unsigned long
@@ -631,7 +631,7 @@ index b9e37ad..44c24e7 100644
info.flags = 0;
info.length = len;
-@@ -1308,6 +1309,7 @@ arch_get_unmapped_area_1(unsigned long addr, unsigned long len,
+@@ -1309,6 +1310,7 @@ arch_get_unmapped_area_1(unsigned long addr, unsigned long len,
info.high_limit = limit;
info.align_mask = 0;
info.align_offset = 0;
@@ -639,7 +639,7 @@ index b9e37ad..44c24e7 100644
return vm_unmapped_area(&info);
}
-@@ -1340,20 +1342,24 @@ arch_get_unmapped_area(struct file *filp, unsigned long addr,
+@@ -1341,20 +1343,24 @@ arch_get_unmapped_area(struct file *filp, unsigned long addr,
merely specific addresses, but regions of memory -- perhaps
this feature should be incorporated into all ports? */
@@ -669,7 +669,7 @@ index b9e37ad..44c24e7 100644
return addr;
}
diff --git a/arch/alpha/mm/fault.c b/arch/alpha/mm/fault.c
-index 0c4132d..88f0d53 100644
+index 98838a0..b304fb4 100644
--- a/arch/alpha/mm/fault.c
+++ b/arch/alpha/mm/fault.c
@@ -53,6 +53,124 @@ __load_new_mm_context(struct mm_struct *next_mm)
@@ -829,10 +829,10 @@ index 0c4132d..88f0d53 100644
/* Allow reads even for write-only mappings */
if (!(vma->vm_flags & (VM_READ | VM_WRITE)))
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
-index 18a9f5e..ca910b7 100644
+index 1ad6fb6..9406b3d 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
-@@ -1766,7 +1766,7 @@ config ALIGNMENT_TRAP
+@@ -1832,7 +1832,7 @@ config ALIGNMENT_TRAP
config UACCESS_WITH_MEMCPY
bool "Use kernel mem{cpy,set}() for {copy_to,clear}_user()"
@@ -841,6 +841,14 @@ index 18a9f5e..ca910b7 100644
default y if CPU_FEROCEON
help
Implement faster copy_to_user and clear_user methods for CPU
+@@ -2097,6 +2097,7 @@ config XIP_PHYS_ADDR
+ config KEXEC
+ bool "Kexec system call (EXPERIMENTAL)"
+ depends on (!SMP || PM_SLEEP_SMP)
++ depends on !GRKERNSEC_KMEM
+ help
+ kexec is a system call that implements the ability to shutdown your
+ current kernel, and to start another kernel. It is like a reboot
diff --git a/arch/arm/include/asm/atomic.h b/arch/arm/include/asm/atomic.h
index da1c77d..2ee6056 100644
--- a/arch/arm/include/asm/atomic.h
@@ -1267,11 +1275,13 @@ index da1c77d..2ee6056 100644
static inline u64 atomic64_add_return(u64 i, atomic64_t *v)
{
+- u64 result;
+- unsigned long tmp;
+ u64 result, tmp;
-+
-+ smp_mb();
-+
-+ __asm__ __volatile__("@ atomic64_add_return\n"
+
+ smp_mb();
+
+ __asm__ __volatile__("@ atomic64_add_return\n"
+"1: ldrexd %1, %H1, [%3]\n"
+" adds %0, %1, %4\n"
+" adcs %H0, %H1, %H4\n"
@@ -1304,21 +1314,19 @@ index da1c77d..2ee6056 100644
+
+static inline u64 atomic64_add_return_unchecked(u64 i, atomic64_unchecked_t *v)
+{
- u64 result;
- unsigned long tmp;
-
- smp_mb();
-
-- __asm__ __volatile__("@ atomic64_add_return\n"
++ u64 result;
++ unsigned long tmp;
++
++ smp_mb();
++
+ __asm__ __volatile__("@ atomic64_add_return_unchecked\n"
"1: ldrexd %0, %H0, [%3]\n"
" adds %0, %0, %4\n"
" adc %H0, %H0, %H4\n"
-@@ -342,23 +654,34 @@ static inline void atomic64_sub(u64 i, atomic64_t *v)
+@@ -342,6 +654,36 @@ static inline void atomic64_sub(u64 i, atomic64_t *v)
__asm__ __volatile__("@ atomic64_sub\n"
"1: ldrexd %0, %H0, [%3]\n"
" subs %0, %0, %4\n"
--" sbc %H0, %H0, %H4\n"
+" sbcs %H0, %H0, %H4\n"
+
+#ifdef CONFIG_PAX_REFCOUNT
@@ -1327,46 +1335,45 @@ index da1c77d..2ee6056 100644
+"3:\n"
+#endif
+
- " strexd %1, %0, %H0, [%3]\n"
- " teq %1, #0\n"
- " bne 1b"
++" strexd %1, %0, %H0, [%3]\n"
++" teq %1, #0\n"
++" bne 1b"
+
+#ifdef CONFIG_PAX_REFCOUNT
+"\n4:\n"
+ _ASM_EXTABLE(2b, 4b)
+#endif
+
- : "=&r" (result), "=&r" (tmp), "+Qo" (v->counter)
- : "r" (&v->counter), "r" (i)
- : "cc");
- }
-
--static inline u64 atomic64_sub_return(u64 i, atomic64_t *v)
-+static inline void atomic64_sub_unchecked(u64 i, atomic64_unchecked_t *v)
- {
- u64 result;
- unsigned long tmp;
-
-- smp_mb();
--
-- __asm__ __volatile__("@ atomic64_sub_return\n"
-+ __asm__ __volatile__("@ atomic64_sub_unchecked\n"
- "1: ldrexd %0, %H0, [%3]\n"
- " subs %0, %0, %4\n"
- " sbc %H0, %H0, %H4\n"
-@@ -368,6 +691,39 @@ static inline u64 atomic64_sub_return(u64 i, atomic64_t *v)
- : "=&r" (result), "=&r" (tmp), "+Qo" (v->counter)
- : "r" (&v->counter), "r" (i)
- : "cc");
++ : "=&r" (result), "=&r" (tmp), "+Qo" (v->counter)
++ : "r" (&v->counter), "r" (i)
++ : "cc");
+}
+
-+static inline u64 atomic64_sub_return(u64 i, atomic64_t *v)
++static inline void atomic64_sub_unchecked(u64 i, atomic64_unchecked_t *v)
+{
-+ u64 result, tmp;
-+
-+ smp_mb();
++ u64 result;
++ unsigned long tmp;
+
-+ __asm__ __volatile__("@ atomic64_sub_return\n"
++ __asm__ __volatile__("@ atomic64_sub_unchecked\n"
++"1: ldrexd %0, %H0, [%3]\n"
++" subs %0, %0, %4\n"
+ " sbc %H0, %H0, %H4\n"
+ " strexd %1, %0, %H0, [%3]\n"
+ " teq %1, #0\n"
+@@ -353,18 +695,32 @@ static inline void atomic64_sub(u64 i, atomic64_t *v)
+
+ static inline u64 atomic64_sub_return(u64 i, atomic64_t *v)
+ {
+- u64 result;
+- unsigned long tmp;
++ u64 result, tmp;
+
+ smp_mb();
+
+ __asm__ __volatile__("@ atomic64_sub_return\n"
+-"1: ldrexd %0, %H0, [%3]\n"
+-" subs %0, %0, %4\n"
+-" sbc %H0, %H0, %H4\n"
+"1: ldrexd %1, %H1, [%3]\n"
+" subs %0, %1, %4\n"
+" sbcs %H0, %H1, %H4\n"
@@ -1379,21 +1386,18 @@ index da1c77d..2ee6056 100644
+"3:\n"
+#endif
+
-+" strexd %1, %0, %H0, [%3]\n"
-+" teq %1, #0\n"
-+" bne 1b"
+ " strexd %1, %0, %H0, [%3]\n"
+ " teq %1, #0\n"
+ " bne 1b"
+
+#ifdef CONFIG_PAX_REFCOUNT
+"\n4:\n"
+ _ASM_EXTABLE(2b, 4b)
+#endif
+
-+ : "=&r" (result), "=&r" (tmp), "+Qo" (v->counter)
-+ : "r" (&v->counter), "r" (i)
-+ : "cc");
-
- smp_mb();
-
+ : "=&r" (result), "=&r" (tmp), "+Qo" (v->counter)
+ : "r" (&v->counter), "r" (i)
+ : "cc");
@@ -398,6 +754,30 @@ static inline u64 atomic64_cmpxchg(atomic64_t *ptr, u64 old, u64 new)
return oldval;
}
@@ -1534,7 +1538,7 @@ index 75fe66b..ba3dee4 100644
#endif
diff --git a/arch/arm/include/asm/cacheflush.h b/arch/arm/include/asm/cacheflush.h
-index 17d0ae8..014e350 100644
+index 15f2d5b..43ffa53 100644
--- a/arch/arm/include/asm/cacheflush.h
+++ b/arch/arm/include/asm/cacheflush.h
@@ -116,7 +116,7 @@ struct cpu_cache_fns {
@@ -1598,15 +1602,15 @@ index 6ddbe44..b5e38b1 100644
+#define DOMAIN_KERNELCLIENT 1
#define DOMAIN_MANAGER 3
+#define DOMAIN_VECTORS DOMAIN_USER
-+#else
+ #else
+
+#ifdef CONFIG_PAX_KERNEXEC
-+#define DOMAIN_MANAGER 1
-+#define DOMAIN_KERNEXEC 3
- #else
#define DOMAIN_MANAGER 1
- #endif
-
++#define DOMAIN_KERNEXEC 3
++#else
++#define DOMAIN_MANAGER 1
++#endif
++
+#ifdef CONFIG_PAX_MEMORY_UDEREF
+#define DOMAIN_USERCLIENT 0
+#define DOMAIN_UDEREF 1
@@ -1617,8 +1621,8 @@ index 6ddbe44..b5e38b1 100644
+#endif
+#define DOMAIN_KERNELCLIENT 1
+
-+#endif
-+
+ #endif
+
#define domain_val(dom,type) ((type) << (2*(dom)))
#ifndef __ASSEMBLY__
@@ -1646,10 +1650,10 @@ index 6ddbe44..b5e38b1 100644
static inline void set_domain(unsigned val) { }
static inline void modify_domain(unsigned dom, unsigned type) { }
diff --git a/arch/arm/include/asm/elf.h b/arch/arm/include/asm/elf.h
-index 56211f2..17e8a25 100644
+index f4b46d3..abc9b2b 100644
--- a/arch/arm/include/asm/elf.h
+++ b/arch/arm/include/asm/elf.h
-@@ -116,7 +116,14 @@ int dump_task_regs(struct task_struct *t, elf_gregset_t *elfregs);
+@@ -114,7 +114,14 @@ int dump_task_regs(struct task_struct *t, elf_gregset_t *elfregs);
the loader. We need to make sure that it is out of the way of the program
that it will "exec", and that there is sufficient room for the brk. */
@@ -1665,7 +1669,7 @@ index 56211f2..17e8a25 100644
/* When the program starts, a1 contains a pointer to a function to be
registered with atexit, as per the SVR4 ABI. A value of 0 means we
-@@ -126,10 +133,6 @@ int dump_task_regs(struct task_struct *t, elf_gregset_t *elfregs);
+@@ -124,10 +131,6 @@ int dump_task_regs(struct task_struct *t, elf_gregset_t *elfregs);
extern void elf_set_personality(const struct elf32_hdr *);
#define SET_PERSONALITY(ex) elf_set_personality(&(ex))
@@ -1795,7 +1799,7 @@ index 2fe141f..192dc01 100644
#ifdef CONFIG_MMU
extern void iotable_init(struct map_desc *, int);
diff --git a/arch/arm/include/asm/outercache.h b/arch/arm/include/asm/outercache.h
-index 12f71a1..04e063c 100644
+index f94784f..9a09a4a 100644
--- a/arch/arm/include/asm/outercache.h
+++ b/arch/arm/include/asm/outercache.h
@@ -35,7 +35,7 @@ struct outer_cache_fns {
@@ -1805,10 +1809,10 @@ index 12f71a1..04e063c 100644
-};
+} __no_const;
- #ifdef CONFIG_OUTER_CACHE
+ extern struct outer_cache_fns outer_cache;
diff --git a/arch/arm/include/asm/page.h b/arch/arm/include/asm/page.h
-index cbdc7a2..32f44fe 100644
+index 4355f0e..c229913 100644
--- a/arch/arm/include/asm/page.h
+++ b/arch/arm/include/asm/page.h
@@ -114,7 +114,7 @@ struct cpu_user_fns {
@@ -1932,18 +1936,10 @@ index f97ee02..cc9fe9e 100644
* These are the memory types, defined to be compatible with
* pre-ARMv6 CPUs cacheable and bufferable bits: XXCB
diff --git a/arch/arm/include/asm/pgtable-3level-hwdef.h b/arch/arm/include/asm/pgtable-3level-hwdef.h
-index 18f5cef..25b8f43 100644
+index 626989f..9d67a33 100644
--- a/arch/arm/include/asm/pgtable-3level-hwdef.h
+++ b/arch/arm/include/asm/pgtable-3level-hwdef.h
-@@ -41,6 +41,7 @@
- */
- #define PMD_SECT_BUFFERABLE (_AT(pmdval_t, 1) << 2)
- #define PMD_SECT_CACHEABLE (_AT(pmdval_t, 1) << 3)
-+#define PMD_SECT_RDONLY (_AT(pmdval_t, 1) << 7)
- #define PMD_SECT_S (_AT(pmdval_t, 3) << 8)
- #define PMD_SECT_AF (_AT(pmdval_t, 1) << 10)
- #define PMD_SECT_nG (_AT(pmdval_t, 1) << 11)
-@@ -71,6 +72,7 @@
+@@ -75,6 +75,7 @@
#define PTE_EXT_SHARED (_AT(pteval_t, 3) << 8) /* SH[1:0], inner shareable */
#define PTE_EXT_AF (_AT(pteval_t, 1) << 10) /* Access Flag */
#define PTE_EXT_NG (_AT(pteval_t, 1) << 11) /* nG */
@@ -1952,10 +1948,10 @@ index 18f5cef..25b8f43 100644
/*
diff --git a/arch/arm/include/asm/pgtable-3level.h b/arch/arm/include/asm/pgtable-3level.h
-index 86b8fe3..e25f975 100644
+index 5689c18..eea12f9 100644
--- a/arch/arm/include/asm/pgtable-3level.h
+++ b/arch/arm/include/asm/pgtable-3level.h
-@@ -74,6 +74,7 @@
+@@ -82,6 +82,7 @@
#define L_PTE_RDONLY (_AT(pteval_t, 1) << 7) /* AP[2] */
#define L_PTE_SHARED (_AT(pteval_t, 3) << 8) /* SH[1:0], inner shareable */
#define L_PTE_YOUNG (_AT(pteval_t, 1) << 10) /* AF */
@@ -1963,7 +1959,7 @@ index 86b8fe3..e25f975 100644
#define L_PTE_XN (_AT(pteval_t, 1) << 54) /* XN */
#define L_PTE_DIRTY (_AT(pteval_t, 1) << 55) /* unused */
#define L_PTE_SPECIAL (_AT(pteval_t, 1) << 56) /* unused */
-@@ -82,6 +83,7 @@
+@@ -95,6 +96,7 @@
/*
* To be used in assembly code with the upper page attributes.
*/
@@ -1972,10 +1968,10 @@ index 86b8fe3..e25f975 100644
#define L_PTE_DIRTY_HIGH (1 << (55 - 32))
diff --git a/arch/arm/include/asm/pgtable.h b/arch/arm/include/asm/pgtable.h
-index 9bcd262..1ff999b 100644
+index be956db..c8f25e2 100644
--- a/arch/arm/include/asm/pgtable.h
+++ b/arch/arm/include/asm/pgtable.h
-@@ -30,6 +30,9 @@
+@@ -33,6 +33,9 @@
#include <asm/pgtable-2level.h>
#endif
@@ -1985,7 +1981,7 @@ index 9bcd262..1ff999b 100644
/*
* Just any arbitrary offset to the start of the vmalloc VM area: the
* current 8MB value just means that there will be a 8MB "hole" after the
-@@ -45,6 +48,9 @@
+@@ -48,6 +51,9 @@
#define LIBRARY_TEXT_START 0x0c000000
#ifndef __ASSEMBLY__
@@ -1995,7 +1991,7 @@ index 9bcd262..1ff999b 100644
extern void __pte_error(const char *file, int line, pte_t);
extern void __pmd_error(const char *file, int line, pmd_t);
extern void __pgd_error(const char *file, int line, pgd_t);
-@@ -53,6 +59,48 @@ extern void __pgd_error(const char *file, int line, pgd_t);
+@@ -56,6 +62,48 @@ extern void __pgd_error(const char *file, int line, pgd_t);
#define pmd_ERROR(pmd) __pmd_error(__FILE__, __LINE__, pmd)
#define pgd_ERROR(pgd) __pgd_error(__FILE__, __LINE__, pgd)
@@ -2044,7 +2040,7 @@ index 9bcd262..1ff999b 100644
/*
* This is the lowest virtual address we can permit any user space
* mapping to be mapped at. This is particularly important for
-@@ -72,8 +120,8 @@ extern void __pgd_error(const char *file, int line, pgd_t);
+@@ -75,8 +123,8 @@ extern void __pgd_error(const char *file, int line, pgd_t);
/*
* The pgprot_* and protection_map entries will be fixed up in runtime
* to include the cachable and bufferable bits based on memory policy,
@@ -2055,7 +2051,7 @@ index 9bcd262..1ff999b 100644
*/
#define _L_PTE_DEFAULT L_PTE_PRESENT | L_PTE_YOUNG
-@@ -257,7 +305,7 @@ static inline pte_t pte_mkspecial(pte_t pte) { return pte; }
+@@ -260,7 +308,7 @@ static inline pte_t pte_mkspecial(pte_t pte) { return pte; }
static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
{
const pteval_t mask = L_PTE_XN | L_PTE_RDONLY | L_PTE_USER |
@@ -2065,7 +2061,7 @@ index 9bcd262..1ff999b 100644
return pte;
}
diff --git a/arch/arm/include/asm/proc-fns.h b/arch/arm/include/asm/proc-fns.h
-index f3628fb..a0672dd 100644
+index 5324c11..bcae5f0 100644
--- a/arch/arm/include/asm/proc-fns.h
+++ b/arch/arm/include/asm/proc-fns.h
@@ -75,7 +75,7 @@ extern struct processor {
@@ -2078,7 +2074,7 @@ index f3628fb..a0672dd 100644
#ifndef MULTI_CPU
extern void cpu_proc_init(void);
diff --git a/arch/arm/include/asm/psci.h b/arch/arm/include/asm/psci.h
-index ce0dbe7..c085b6f 100644
+index c4ae171..ea0c0c2 100644
--- a/arch/arm/include/asm/psci.h
+++ b/arch/arm/include/asm/psci.h
@@ -29,7 +29,7 @@ struct psci_operations {
@@ -2089,12 +2085,12 @@ index ce0dbe7..c085b6f 100644
+} __no_const;
extern struct psci_operations psci_ops;
-
+ extern struct smp_operations psci_smp_ops;
diff --git a/arch/arm/include/asm/smp.h b/arch/arm/include/asm/smp.h
-index d3a22be..3a69ad5 100644
+index a8cae71c..65dd797 100644
--- a/arch/arm/include/asm/smp.h
+++ b/arch/arm/include/asm/smp.h
-@@ -107,7 +107,7 @@ struct smp_operations {
+@@ -110,7 +110,7 @@ struct smp_operations {
int (*cpu_disable)(unsigned int cpu);
#endif
#endif
@@ -2104,10 +2100,10 @@ index d3a22be..3a69ad5 100644
/*
* set platform specific SMP operations
diff --git a/arch/arm/include/asm/thread_info.h b/arch/arm/include/asm/thread_info.h
-index f00b569..aa5bb41 100644
+index df5e13d..97efb82 100644
--- a/arch/arm/include/asm/thread_info.h
+++ b/arch/arm/include/asm/thread_info.h
-@@ -77,9 +77,9 @@ struct thread_info {
+@@ -88,9 +88,9 @@ struct thread_info {
.flags = 0, \
.preempt_count = INIT_PREEMPT_COUNT, \
.addr_limit = KERNEL_DS, \
@@ -2120,7 +2116,7 @@ index f00b569..aa5bb41 100644
.restart_block = { \
.fn = do_no_restart_syscall, \
}, \
-@@ -152,7 +152,11 @@ extern int vfp_restore_user_hwstate(struct user_vfp __user *,
+@@ -163,7 +163,11 @@ extern int vfp_restore_user_hwstate(struct user_vfp __user *,
#define TIF_SYSCALL_AUDIT 9
#define TIF_SYSCALL_TRACEPOINT 10
#define TIF_SECCOMP 11 /* seccomp syscall filtering active */
@@ -2133,7 +2129,7 @@ index f00b569..aa5bb41 100644
#define TIF_USING_IWMMXT 17
#define TIF_MEMDIE 18 /* is terminating due to OOM killer */
#define TIF_RESTORE_SIGMASK 20
-@@ -165,10 +169,11 @@ extern int vfp_restore_user_hwstate(struct user_vfp __user *,
+@@ -176,10 +180,11 @@ extern int vfp_restore_user_hwstate(struct user_vfp __user *,
#define _TIF_SYSCALL_TRACEPOINT (1 << TIF_SYSCALL_TRACEPOINT)
#define _TIF_SECCOMP (1 << TIF_SECCOMP)
#define _TIF_USING_IWMMXT (1 << TIF_USING_IWMMXT)
@@ -2147,7 +2143,7 @@ index f00b569..aa5bb41 100644
/*
* Change these and you break ASM code in entry-common.S
diff --git a/arch/arm/include/asm/uaccess.h b/arch/arm/include/asm/uaccess.h
-index 7e1f760..de33b13 100644
+index 72abdc5..9eba222 100644
--- a/arch/arm/include/asm/uaccess.h
+++ b/arch/arm/include/asm/uaccess.h
@@ -18,6 +18,7 @@
@@ -2156,9 +2152,9 @@ index 7e1f760..de33b13 100644
#include <asm/compiler.h>
+#include <asm/pgtable.h>
- #define VERIFY_READ 0
- #define VERIFY_WRITE 1
-@@ -63,11 +64,38 @@ extern int __put_user_bad(void);
+ #if __LINUX_ARM_ARCH__ < 6
+ #include <asm-generic/uaccess-unaligned.h>
+@@ -70,11 +71,38 @@ extern int __put_user_bad(void);
static inline void set_fs(mm_segment_t fs)
{
current_thread_info()->addr_limit = fs;
@@ -2198,7 +2194,7 @@ index 7e1f760..de33b13 100644
#define __addr_ok(addr) ({ \
unsigned long flag; \
__asm__("cmp %2, %0; movlo %0, #0" \
-@@ -143,8 +171,12 @@ extern int __get_user_4(void *);
+@@ -150,8 +178,12 @@ extern int __get_user_4(void *);
#define get_user(x,p) \
({ \
@@ -2212,7 +2208,7 @@ index 7e1f760..de33b13 100644
})
extern int __put_user_1(void *, unsigned int);
-@@ -188,8 +220,12 @@ extern int __put_user_8(void *, unsigned long long);
+@@ -195,8 +227,12 @@ extern int __put_user_8(void *, unsigned long long);
#define put_user(x,p) \
({ \
@@ -2226,7 +2222,7 @@ index 7e1f760..de33b13 100644
})
#else /* CONFIG_MMU */
-@@ -230,13 +266,17 @@ static inline void set_fs(mm_segment_t fs)
+@@ -237,13 +273,17 @@ static inline void set_fs(mm_segment_t fs)
#define __get_user(x,ptr) \
({ \
long __gu_err = 0; \
@@ -2244,7 +2240,7 @@ index 7e1f760..de33b13 100644
(void) 0; \
})
-@@ -312,13 +352,17 @@ do { \
+@@ -319,13 +359,17 @@ do { \
#define __put_user(x,ptr) \
({ \
long __pu_err = 0; \
@@ -2262,7 +2258,7 @@ index 7e1f760..de33b13 100644
(void) 0; \
})
-@@ -418,11 +462,44 @@ do { \
+@@ -425,11 +469,44 @@ do { \
#ifdef CONFIG_MMU
@@ -2310,7 +2306,7 @@ index 7e1f760..de33b13 100644
#else
#define __copy_from_user(to,from,n) (memcpy(to, (void __force *)from, n), 0)
#define __copy_to_user(to,from,n) (memcpy((void __force *)to, from, n), 0)
-@@ -431,6 +508,9 @@ extern unsigned long __must_check __clear_user_std(void __user *addr, unsigned l
+@@ -438,6 +515,9 @@ extern unsigned long __must_check __clear_user_std(void __user *addr, unsigned l
static inline unsigned long __must_check copy_from_user(void *to, const void __user *from, unsigned long n)
{
@@ -2320,7 +2316,7 @@ index 7e1f760..de33b13 100644
if (access_ok(VERIFY_READ, from, n))
n = __copy_from_user(to, from, n);
else /* security hole - plug it */
-@@ -440,6 +520,9 @@ static inline unsigned long __must_check copy_from_user(void *to, const void __u
+@@ -447,6 +527,9 @@ static inline unsigned long __must_check copy_from_user(void *to, const void __u
static inline unsigned long __must_check copy_to_user(void __user *to, const void *from, unsigned long n)
{
@@ -2331,10 +2327,10 @@ index 7e1f760..de33b13 100644
n = __copy_to_user(to, from, n);
return n;
diff --git a/arch/arm/include/uapi/asm/ptrace.h b/arch/arm/include/uapi/asm/ptrace.h
-index 96ee092..37f1844 100644
+index 5af0ed1..cea83883 100644
--- a/arch/arm/include/uapi/asm/ptrace.h
+++ b/arch/arm/include/uapi/asm/ptrace.h
-@@ -73,7 +73,7 @@
+@@ -92,7 +92,7 @@
* ARMv7 groups of PSR bits
*/
#define APSR_MASK 0xf80f0000 /* N, Z, C, V, Q and GE flags */
@@ -2370,7 +2366,7 @@ index 60d3b73..e5a0f22 100644
EXPORT_SYMBOL(__get_user_1);
EXPORT_SYMBOL(__get_user_2);
diff --git a/arch/arm/kernel/entry-armv.S b/arch/arm/kernel/entry-armv.S
-index 32640ae..7034750 100644
+index ec3e5cf..b450ee3 100644
--- a/arch/arm/kernel/entry-armv.S
+++ b/arch/arm/kernel/entry-armv.S
@@ -47,6 +47,87 @@
@@ -2512,17 +2508,7 @@ index 32640ae..7034750 100644
sub sp, sp, #S_FRAME_SIZE
ARM( stmib sp, {r1 - r12} )
THUMB( stmia sp, {r0 - r12} )
-@@ -358,7 +455,8 @@ ENDPROC(__pabt_svc)
- .endm
-
- .macro kuser_cmpxchg_check
--#if !defined(CONFIG_CPU_32v6K) && !defined(CONFIG_NEEDS_SYSCALL_FOR_CMPXCHG)
-+#if !defined(CONFIG_CPU_32v6K) && defined(CONFIG_KUSER_HELPERS) && \
-+ !defined(CONFIG_NEEDS_SYSCALL_FOR_CMPXCHG)
- #ifndef CONFIG_MMU
- #warning "NPTL on non MMU needs fixing"
- #else
-@@ -415,7 +513,9 @@ __und_usr:
+@@ -416,7 +513,9 @@ __und_usr:
tst r3, #PSR_T_BIT @ Thumb mode?
bne __und_usr_thumb
sub r4, r2, #4 @ ARM instr at LR - 4
@@ -2532,7 +2518,7 @@ index 32640ae..7034750 100644
#ifdef CONFIG_CPU_ENDIAN_BE8
rev r0, r0 @ little endian instruction
#endif
-@@ -450,10 +550,14 @@ __und_usr_thumb:
+@@ -451,10 +550,14 @@ __und_usr_thumb:
*/
.arch armv6t2
#endif
@@ -2547,7 +2533,7 @@ index 32640ae..7034750 100644
add r2, r2, #2 @ r2 is PC + 2, make it PC + 4
str r2, [sp, #S_PC] @ it's a 2x16bit instr, update
orr r0, r0, r5, lsl #16
-@@ -482,7 +586,8 @@ ENDPROC(__und_usr)
+@@ -483,7 +586,8 @@ ENDPROC(__und_usr)
*/
.pushsection .fixup, "ax"
.align 2
@@ -2557,16 +2543,16 @@ index 32640ae..7034750 100644
.popsection
.pushsection __ex_table,"a"
.long 1b, 4b
-@@ -691,7 +796,7 @@ ENTRY(__switch_to)
- THUMB( stmia ip!, {r4 - sl, fp} ) @ Store most regs on stack
- THUMB( str sp, [ip], #4 )
+@@ -693,7 +797,7 @@ ENTRY(__switch_to)
THUMB( str lr, [ip], #4 )
+ ldr r4, [r2, #TI_TP_VALUE]
+ ldr r5, [r2, #TI_TP_VALUE + 4]
-#ifdef CONFIG_CPU_USE_DOMAINS
+#if defined(CONFIG_CPU_USE_DOMAINS) || defined(CONFIG_PAX_KERNEXEC) || defined(CONFIG_PAX_MEMORY_UDEREF)
ldr r6, [r2, #TI_CPU_DOMAIN]
#endif
- set_tls r3, r4, r5
-@@ -700,7 +805,7 @@ ENTRY(__switch_to)
+ switch_tls r1, r4, r5, r3, r7
+@@ -702,7 +806,7 @@ ENTRY(__switch_to)
ldr r8, =__stack_chk_guard
ldr r7, [r7, #TSK_STACK_CANARY]
#endif
@@ -2576,7 +2562,7 @@ index 32640ae..7034750 100644
#endif
mov r5, r0
diff --git a/arch/arm/kernel/entry-common.S b/arch/arm/kernel/entry-common.S
-index bc5bc0a..d0998ca 100644
+index bc6bd96..bd026cb 100644
--- a/arch/arm/kernel/entry-common.S
+++ b/arch/arm/kernel/entry-common.S
@@ -10,18 +10,46 @@
@@ -2629,16 +2615,8 @@ index bc5bc0a..d0998ca 100644
.align 5
/*
* This is the fast syscall return path. We do as little as
-@@ -350,6 +378,7 @@ ENDPROC(ftrace_stub)
-
- .align 5
- ENTRY(vector_swi)
-+
- sub sp, sp, #S_FRAME_SIZE
- stmia sp, {r0 - r12} @ Calling r0 - r12
- ARM( add r8, sp, #S_PC )
-@@ -399,6 +428,12 @@ ENTRY(vector_swi)
- ldr scno, [lr, #-4] @ get SWI instruction
+@@ -413,6 +441,12 @@ ENTRY(vector_swi)
+ USER( ldr scno, [lr, #-4] ) @ get SWI instruction
#endif
+ /*
@@ -2647,14 +2625,14 @@ index bc5bc0a..d0998ca 100644
+ */
+ pax_enter_kernel_user
+
- #ifdef CONFIG_ALIGNMENT_TRAP
- ldr ip, __cr_alignment
- ldr ip, [ip]
+ adr tbl, sys_call_table @ load syscall table pointer
+
+ #if defined(CONFIG_OABI_COMPAT)
diff --git a/arch/arm/kernel/entry-header.S b/arch/arm/kernel/entry-header.S
-index 160f337..db67ee4 100644
+index 39f89fb..d612bd9 100644
--- a/arch/arm/kernel/entry-header.S
+++ b/arch/arm/kernel/entry-header.S
-@@ -73,6 +73,60 @@
+@@ -184,6 +184,60 @@
msr cpsr_c, \rtemp @ switch back to the SVC mode
.endm
@@ -2715,7 +2693,7 @@ index 160f337..db67ee4 100644
#ifndef CONFIG_THUMB2_KERNEL
.macro svc_exit, rpsr, irq = 0
.if \irq != 0
-@@ -92,6 +146,9 @@
+@@ -203,6 +257,9 @@
blne trace_hardirqs_off
#endif
.endif
@@ -2725,7 +2703,7 @@ index 160f337..db67ee4 100644
msr spsr_cxsf, \rpsr
#if defined(CONFIG_CPU_V6)
ldr r0, [sp]
-@@ -155,6 +212,9 @@
+@@ -266,6 +323,9 @@
blne trace_hardirqs_off
#endif
.endif
@@ -2736,34 +2714,22 @@ index 160f337..db67ee4 100644
ldrd r0, r1, [sp, #S_LR] @ calling lr and pc
clrex @ clear the exclusive monitor
diff --git a/arch/arm/kernel/fiq.c b/arch/arm/kernel/fiq.c
-index 25442f4..d4948fc 100644
+index 918875d..cd5fa27 100644
--- a/arch/arm/kernel/fiq.c
+++ b/arch/arm/kernel/fiq.c
-@@ -84,17 +84,16 @@ int show_fiq_list(struct seq_file *p, int prec)
-
- void set_fiq_handler(void *start, unsigned int length)
- {
--#if defined(CONFIG_CPU_USE_DOMAINS)
-- void *base = (void *)0xffff0000;
--#else
+@@ -87,7 +87,10 @@ void set_fiq_handler(void *start, unsigned int length)
void *base = vectors_page;
--#endif
unsigned offset = FIQ_OFFSET;
+ pax_open_kernel();
memcpy(base + offset, start, length);
+ pax_close_kernel();
+
-+ if (!cache_is_vipt_nonaliasing())
-+ flush_icache_range(base + offset, offset + length);
- flush_icache_range(0xffff0000 + offset, 0xffff0000 + offset + length);
-- if (!vectors_high())
-- flush_icache_range(offset, offset + length);
- }
-
- int claim_fiq(struct fiq_handler *f)
+ if (!cache_is_vipt_nonaliasing())
+ flush_icache_range((unsigned long)base + offset, offset +
+ length);
diff --git a/arch/arm/kernel/head.S b/arch/arm/kernel/head.S
-index 8bac553..caee108 100644
+index 476de57..4857a76 100644
--- a/arch/arm/kernel/head.S
+++ b/arch/arm/kernel/head.S
@@ -52,7 +52,9 @@
@@ -2777,7 +2743,7 @@ index 8bac553..caee108 100644
.endm
/*
-@@ -434,7 +436,7 @@ __enable_mmu:
+@@ -432,7 +434,7 @@ __enable_mmu:
mov r5, #(domain_val(DOMAIN_USER, DOMAIN_MANAGER) | \
domain_val(DOMAIN_KERNEL, DOMAIN_MANAGER) | \
domain_val(DOMAIN_TABLE, DOMAIN_MANAGER) | \
@@ -2786,24 +2752,11 @@ index 8bac553..caee108 100644
mcr p15, 0, r5, c3, c0, 0 @ load domain access register
mcr p15, 0, r4, c2, c0, 0 @ load page table pointer
#endif
-diff --git a/arch/arm/kernel/hw_breakpoint.c b/arch/arm/kernel/hw_breakpoint.c
-index 1fd749e..47adb08 100644
---- a/arch/arm/kernel/hw_breakpoint.c
-+++ b/arch/arm/kernel/hw_breakpoint.c
-@@ -1029,7 +1029,7 @@ static int __cpuinit dbg_reset_notify(struct notifier_block *self,
- return NOTIFY_OK;
- }
-
--static struct notifier_block __cpuinitdata dbg_reset_nb = {
-+static struct notifier_block dbg_reset_nb = {
- .notifier_call = dbg_reset_notify,
- };
-
diff --git a/arch/arm/kernel/module.c b/arch/arm/kernel/module.c
-index 1e9be5d..03edbc2 100644
+index 084dc88..fce4e68 100644
--- a/arch/arm/kernel/module.c
+++ b/arch/arm/kernel/module.c
-@@ -37,12 +37,37 @@
+@@ -37,12 +37,39 @@
#endif
#ifdef CONFIG_MMU
@@ -2834,11 +2787,13 @@ index 1e9be5d..03edbc2 100644
+{
+ module_free(mod, module_region);
+}
++EXPORT_SYMBOL(module_free_exec);
+
+void *module_alloc_exec(unsigned long size)
+{
+ return __module_alloc(size, PAGE_KERNEL_EXEC);
+}
++EXPORT_SYMBOL(module_alloc_exec);
+#endif
#endif
@@ -2863,37 +2818,11 @@ index 07314af..c46655c 100644
flush_icache_range((uintptr_t)(addr),
(uintptr_t)(addr) + size);
-diff --git a/arch/arm/kernel/perf_event.c b/arch/arm/kernel/perf_event.c
-index e19edc6..e186ee1 100644
---- a/arch/arm/kernel/perf_event.c
-+++ b/arch/arm/kernel/perf_event.c
-@@ -56,7 +56,7 @@ armpmu_map_hw_event(const unsigned (*event_map)[PERF_COUNT_HW_MAX], u64 config)
- int mapping;
-
- if (config >= PERF_COUNT_HW_MAX)
-- return -ENOENT;
-+ return -EINVAL;
-
- mapping = (*event_map)[config];
- return mapping == HW_OP_UNSUPPORTED ? -ENOENT : mapping;
-diff --git a/arch/arm/kernel/perf_event_cpu.c b/arch/arm/kernel/perf_event_cpu.c
-index 1f2740e..b36e225 100644
---- a/arch/arm/kernel/perf_event_cpu.c
-+++ b/arch/arm/kernel/perf_event_cpu.c
-@@ -171,7 +171,7 @@ static int __cpuinit cpu_pmu_notify(struct notifier_block *b,
- return NOTIFY_OK;
- }
-
--static struct notifier_block __cpuinitdata cpu_pmu_hotplug_notifier = {
-+static struct notifier_block cpu_pmu_hotplug_notifier = {
- .notifier_call = cpu_pmu_notify,
- };
-
diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c
-index ab1fe3b..dcd439f 100644
+index 94f6b05..efd7312 100644
--- a/arch/arm/kernel/process.c
+++ b/arch/arm/kernel/process.c
-@@ -223,6 +223,7 @@ void machine_power_off(void)
+@@ -217,6 +217,7 @@ void machine_power_off(void)
if (pm_power_off)
pm_power_off();
@@ -2901,16 +2830,16 @@ index ab1fe3b..dcd439f 100644
}
/*
-@@ -236,7 +237,7 @@ void machine_power_off(void)
+@@ -230,7 +231,7 @@ void machine_power_off(void)
* executing pre-reset code, and using RAM that the primary CPU's code wishes
* to use. Implementing such co-ordination would be essentially impossible.
*/
-void machine_restart(char *cmd)
+__noreturn void machine_restart(char *cmd)
{
+ local_irq_disable();
smp_send_stop();
-
-@@ -258,8 +259,8 @@ void __show_regs(struct pt_regs *regs)
+@@ -253,8 +254,8 @@ void __show_regs(struct pt_regs *regs)
show_regs_print_info(KERN_DEFAULT);
@@ -2921,7 +2850,7 @@ index ab1fe3b..dcd439f 100644
printk("pc : [<%08lx>] lr : [<%08lx>] psr: %08lx\n"
"sp : %08lx ip : %08lx fp : %08lx\n",
regs->ARM_pc, regs->ARM_lr, regs->ARM_cpsr,
-@@ -426,12 +427,6 @@ unsigned long get_wchan(struct task_struct *p)
+@@ -422,12 +423,6 @@ unsigned long get_wchan(struct task_struct *p)
return 0;
}
@@ -2934,7 +2863,7 @@ index ab1fe3b..dcd439f 100644
#ifdef CONFIG_MMU
#ifdef CONFIG_KUSER_HELPERS
/*
-@@ -447,7 +442,7 @@ static struct vm_area_struct gate_vma = {
+@@ -443,7 +438,7 @@ static struct vm_area_struct gate_vma = {
static int __init gate_vma_init(void)
{
@@ -2943,7 +2872,7 @@ index ab1fe3b..dcd439f 100644
return 0;
}
arch_initcall(gate_vma_init);
-@@ -473,41 +468,16 @@ int in_gate_area_no_mm(unsigned long addr)
+@@ -469,41 +464,16 @@ int in_gate_area_no_mm(unsigned long addr)
const char *arch_vma_name(struct vm_area_struct *vma)
{
@@ -2989,7 +2918,7 @@ index ab1fe3b..dcd439f 100644
}
#endif
diff --git a/arch/arm/kernel/psci.c b/arch/arm/kernel/psci.c
-index 3653164..d83e55d 100644
+index 4693188..4596c5e 100644
--- a/arch/arm/kernel/psci.c
+++ b/arch/arm/kernel/psci.c
@@ -24,7 +24,7 @@
@@ -3002,10 +2931,10 @@ index 3653164..d83e55d 100644
static int (*invoke_psci_fn)(u32, u32, u32, u32);
diff --git a/arch/arm/kernel/ptrace.c b/arch/arm/kernel/ptrace.c
-index 03deeff..741ce88 100644
+index 0dd3b79..e018f64 100644
--- a/arch/arm/kernel/ptrace.c
+++ b/arch/arm/kernel/ptrace.c
-@@ -937,10 +937,19 @@ static int tracehook_report_syscall(struct pt_regs *regs,
+@@ -929,10 +929,19 @@ static int tracehook_report_syscall(struct pt_regs *regs,
return current_thread_info()->syscall;
}
@@ -3026,10 +2955,10 @@ index 03deeff..741ce88 100644
if (secure_computing(scno) == -1)
return -1;
diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c
-index b4b1d39..efdc9be 100644
+index 0e1e2b3..c0e821d 100644
--- a/arch/arm/kernel/setup.c
+++ b/arch/arm/kernel/setup.c
-@@ -97,21 +97,23 @@ EXPORT_SYMBOL(system_serial_high);
+@@ -98,21 +98,23 @@ EXPORT_SYMBOL(system_serial_high);
unsigned int elf_hwcap __read_mostly;
EXPORT_SYMBOL(elf_hwcap);
@@ -3058,7 +2987,7 @@ index b4b1d39..efdc9be 100644
EXPORT_SYMBOL(outer_cache);
#endif
-@@ -236,9 +238,13 @@ static int __get_cpu_architecture(void)
+@@ -245,9 +247,13 @@ static int __get_cpu_architecture(void)
asm("mrc p15, 0, %0, c0, c1, 4"
: "=r" (mmfr0));
if ((mmfr0 & 0x0000000f) >= 0x00000003 ||
@@ -3074,7 +3003,7 @@ index b4b1d39..efdc9be 100644
(mmfr0 & 0x000000f0) == 0x00000020)
cpu_arch = CPU_ARCH_ARMv6;
else
-@@ -479,7 +485,7 @@ static void __init setup_processor(void)
+@@ -571,7 +577,7 @@ static void __init setup_processor(void)
__cpu_architecture = __get_cpu_architecture();
#ifdef MULTI_CPU
@@ -3084,7 +3013,7 @@ index b4b1d39..efdc9be 100644
#ifdef MULTI_TLB
cpu_tlb = *list->tlb;
diff --git a/arch/arm/kernel/signal.c b/arch/arm/kernel/signal.c
-index 5a42c12..a2bb7c6 100644
+index ab33042..11248a8 100644
--- a/arch/arm/kernel/signal.c
+++ b/arch/arm/kernel/signal.c
@@ -45,8 +45,6 @@ static const unsigned long sigreturn_codes[7] = {
@@ -3096,7 +3025,7 @@ index 5a42c12..a2bb7c6 100644
#ifdef CONFIG_CRUNCH
static int preserve_crunch_context(struct crunch_sigframe __user *frame)
{
-@@ -406,8 +404,7 @@ setup_return(struct pt_regs *regs, struct ksignal *ksig,
+@@ -411,8 +409,7 @@ setup_return(struct pt_regs *regs, struct ksignal *ksig,
* except when the MPU has protected the vectors
* page from PL0
*/
@@ -3106,7 +3035,7 @@ index 5a42c12..a2bb7c6 100644
} else
#endif
{
-@@ -611,33 +608,3 @@ do_work_pending(struct pt_regs *regs, unsigned int thread_flags, int syscall)
+@@ -616,33 +613,3 @@ do_work_pending(struct pt_regs *regs, unsigned int thread_flags, int syscall)
} while (thread_flags & _TIF_WORK_MASK);
return 0;
}
@@ -3141,7 +3070,7 @@ index 5a42c12..a2bb7c6 100644
- return page;
-}
diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c
-index 5919eb4..b5d6dfe 100644
+index 72024ea..ae302dd 100644
--- a/arch/arm/kernel/smp.c
+++ b/arch/arm/kernel/smp.c
@@ -70,7 +70,7 @@ enum ipi_msg_type {
@@ -3154,7 +3083,7 @@ index 5919eb4..b5d6dfe 100644
void __init smp_set_ops(struct smp_operations *ops)
{
diff --git a/arch/arm/kernel/traps.c b/arch/arm/kernel/traps.c
-index 6b9567e..b8af2d6 100644
+index 8fcda14..4512b9d 100644
--- a/arch/arm/kernel/traps.c
+++ b/arch/arm/kernel/traps.c
@@ -55,7 +55,7 @@ static void dump_mem(const char *, const char *, unsigned long, unsigned long);
@@ -3185,7 +3114,7 @@ index 6b9567e..b8af2d6 100644
if (signr)
do_exit(signr);
}
-@@ -592,7 +597,9 @@ asmlinkage int arm_syscall(int no, struct pt_regs *regs)
+@@ -628,7 +633,9 @@ asmlinkage int arm_syscall(int no, struct pt_regs *regs)
* The user helper at 0xffff0fe0 must be used instead.
* (see entry-armv.S for details)
*/
@@ -3195,7 +3124,7 @@ index 6b9567e..b8af2d6 100644
}
return 0;
-@@ -848,5 +855,9 @@ void __init early_trap_init(void *vectors_base)
+@@ -885,7 +892,11 @@ void __init early_trap_init(void *vectors_base)
kuser_init(vectors_base);
flush_icache_range(vectors, vectors + PAGE_SIZE * 2);
@@ -3205,9 +3134,11 @@ index 6b9567e..b8af2d6 100644
+ modify_domain(DOMAIN_USER, DOMAIN_USERCLIENT);
+#endif
+
- }
+ #else /* ifndef CONFIG_CPU_V7M */
+ /*
+ * on V7-M there is no need to copy the vector table to a dedicated
diff --git a/arch/arm/kernel/vmlinux.lds.S b/arch/arm/kernel/vmlinux.lds.S
-index 33f2ea3..0b91824 100644
+index 7bcee5c..e2f3249 100644
--- a/arch/arm/kernel/vmlinux.lds.S
+++ b/arch/arm/kernel/vmlinux.lds.S
@@ -8,7 +8,11 @@
@@ -3223,7 +3154,16 @@ index 33f2ea3..0b91824 100644
#define PROC_INFO \
. = ALIGN(4); \
VMLINUX_SYMBOL(__proc_info_begin) = .; \
-@@ -94,6 +98,11 @@ SECTIONS
+@@ -34,7 +38,7 @@
+ #endif
+
+ #if (defined(CONFIG_SMP_ON_UP) && !defined(CONFIG_DEBUG_SPINLOCK)) || \
+- defined(CONFIG_GENERIC_BUG)
++ defined(CONFIG_GENERIC_BUG) || defined(CONFIG_PAX_REFCOUNT)
+ #define ARM_EXIT_KEEP(x) x
+ #define ARM_EXIT_DISCARD(x)
+ #else
+@@ -90,6 +94,11 @@ SECTIONS
_text = .;
HEAD_TEXT
}
@@ -3235,7 +3175,7 @@ index 33f2ea3..0b91824 100644
.text : { /* Real text segment */
_stext = .; /* Text and read-only data */
__exception_text_start = .;
-@@ -116,6 +125,8 @@ SECTIONS
+@@ -112,6 +121,8 @@ SECTIONS
ARM_CPU_KEEP(PROC_INFO)
}
@@ -3244,7 +3184,7 @@ index 33f2ea3..0b91824 100644
RO_DATA(PAGE_SIZE)
. = ALIGN(4);
-@@ -146,7 +157,9 @@ SECTIONS
+@@ -142,7 +153,9 @@ SECTIONS
NOTES
@@ -3255,7 +3195,7 @@ index 33f2ea3..0b91824 100644
#ifndef CONFIG_XIP_KERNEL
. = ALIGN(PAGE_SIZE);
-@@ -224,6 +237,11 @@ SECTIONS
+@@ -220,6 +233,11 @@ SECTIONS
. = PAGE_OFFSET + TEXT_OFFSET;
#else
__init_end = .;
@@ -3268,7 +3208,7 @@ index 33f2ea3..0b91824 100644
__data_loc = .;
#endif
diff --git a/arch/arm/kvm/arm.c b/arch/arm/kvm/arm.c
-index ef1703b..46b77f3 100644
+index 9c697db..115237f 100644
--- a/arch/arm/kvm/arm.c
+++ b/arch/arm/kvm/arm.c
@@ -56,7 +56,7 @@ static unsigned long hyp_default_vectors;
@@ -3280,7 +3220,7 @@ index ef1703b..46b77f3 100644
static u8 kvm_next_vmid;
static DEFINE_SPINLOCK(kvm_vmid_lock);
-@@ -392,7 +392,7 @@ void force_vm_exit(const cpumask_t *mask)
+@@ -396,7 +396,7 @@ void force_vm_exit(const cpumask_t *mask)
*/
static bool need_new_vmid_gen(struct kvm *kvm)
{
@@ -3289,7 +3229,7 @@ index ef1703b..46b77f3 100644
}
/**
-@@ -425,7 +425,7 @@ static void update_vttbr(struct kvm *kvm)
+@@ -429,7 +429,7 @@ static void update_vttbr(struct kvm *kvm)
/* First user of a new VMID generation? */
if (unlikely(kvm_next_vmid == 0)) {
@@ -3298,7 +3238,7 @@ index ef1703b..46b77f3 100644
kvm_next_vmid = 1;
/*
-@@ -442,7 +442,7 @@ static void update_vttbr(struct kvm *kvm)
+@@ -446,7 +446,7 @@ static void update_vttbr(struct kvm *kvm)
kvm_call_hyp(__kvm_flush_vm_context);
}
@@ -3419,7 +3359,7 @@ index 7d08b43..f7ca7ea 100644
#include "csumpartialcopygeneric.S"
diff --git a/arch/arm/lib/delay.c b/arch/arm/lib/delay.c
-index 64dbfa5..84a3fd9 100644
+index 5306de3..aed6d03 100644
--- a/arch/arm/lib/delay.c
+++ b/arch/arm/lib/delay.c
@@ -28,7 +28,7 @@
@@ -3432,7 +3372,7 @@ index 64dbfa5..84a3fd9 100644
.const_udelay = __loop_const_udelay,
.udelay = __loop_udelay,
diff --git a/arch/arm/lib/uaccess_with_memcpy.c b/arch/arm/lib/uaccess_with_memcpy.c
-index 025f742..8432b08 100644
+index 025f742..a9e5b3b 100644
--- a/arch/arm/lib/uaccess_with_memcpy.c
+++ b/arch/arm/lib/uaccess_with_memcpy.c
@@ -104,7 +104,7 @@ out:
@@ -3444,11 +3384,20 @@ index 025f742..8432b08 100644
{
/*
* This test is stubbed out of the main function above to keep
+@@ -155,7 +155,7 @@ out:
+ return n;
+ }
+
+-unsigned long __clear_user(void __user *addr, unsigned long n)
++unsigned long ___clear_user(void __user *addr, unsigned long n)
+ {
+ /* See rational for this in __copy_to_user() above. */
+ if (n < 64)
diff --git a/arch/arm/mach-kirkwood/common.c b/arch/arm/mach-kirkwood/common.c
-index f389228..592ef66 100644
+index 1767611..d2e7e24 100644
--- a/arch/arm/mach-kirkwood/common.c
+++ b/arch/arm/mach-kirkwood/common.c
-@@ -149,7 +149,16 @@ static void clk_gate_fn_disable(struct clk_hw *hw)
+@@ -156,7 +156,16 @@ static void clk_gate_fn_disable(struct clk_hw *hw)
clk_gate_ops.disable(hw);
}
@@ -3466,7 +3415,7 @@ index f389228..592ef66 100644
static struct clk __init *clk_register_gate_fn(struct device *dev,
const char *name,
-@@ -183,14 +192,6 @@ static struct clk __init *clk_register_gate_fn(struct device *dev,
+@@ -190,14 +199,6 @@ static struct clk __init *clk_register_gate_fn(struct device *dev,
gate_fn->fn_en = fn_en;
gate_fn->fn_dis = fn_dis;
@@ -3482,10 +3431,10 @@ index f389228..592ef66 100644
if (IS_ERR(clk))
diff --git a/arch/arm/mach-omap2/board-n8x0.c b/arch/arm/mach-omap2/board-n8x0.c
-index f6eeb87..cc90868 100644
+index 827d1500..2885dc6 100644
--- a/arch/arm/mach-omap2/board-n8x0.c
+++ b/arch/arm/mach-omap2/board-n8x0.c
-@@ -631,7 +631,7 @@ static int n8x0_menelaus_late_init(struct device *dev)
+@@ -627,7 +627,7 @@ static int n8x0_menelaus_late_init(struct device *dev)
}
#endif
@@ -3495,18 +3444,18 @@ index f6eeb87..cc90868 100644
};
diff --git a/arch/arm/mach-omap2/gpmc.c b/arch/arm/mach-omap2/gpmc.c
-index 6c4da12..d9ca72d 100644
+index 579697a..1d5a3b2 100644
--- a/arch/arm/mach-omap2/gpmc.c
+++ b/arch/arm/mach-omap2/gpmc.c
-@@ -147,7 +147,6 @@ struct omap3_gpmc_regs {
+@@ -148,7 +148,6 @@ struct omap3_gpmc_regs {
};
static struct gpmc_client_irq gpmc_client_irq[GPMC_NR_IRQ];
-static struct irq_chip gpmc_irq_chip;
- static unsigned gpmc_irq_start;
+ static int gpmc_irq_start;
static struct resource gpmc_mem_root;
-@@ -711,6 +710,18 @@ static void gpmc_irq_noop(struct irq_data *data) { }
+@@ -716,6 +715,18 @@ static void gpmc_irq_noop(struct irq_data *data) { }
static unsigned int gpmc_irq_noop_ret(struct irq_data *data) { return 0; }
@@ -3525,7 +3474,7 @@ index 6c4da12..d9ca72d 100644
static int gpmc_setup_irq(void)
{
int i;
-@@ -725,15 +736,6 @@ static int gpmc_setup_irq(void)
+@@ -730,15 +741,6 @@ static int gpmc_setup_irq(void)
return gpmc_irq_start;
}
@@ -3541,11 +3490,33 @@ index 6c4da12..d9ca72d 100644
gpmc_client_irq[0].bitmask = GPMC_IRQ_FIFOEVENTENABLE;
gpmc_client_irq[1].bitmask = GPMC_IRQ_COUNT_EVENT;
+diff --git a/arch/arm/mach-omap2/omap-mpuss-lowpower.c b/arch/arm/mach-omap2/omap-mpuss-lowpower.c
+index f991016..145ebeb 100644
+--- a/arch/arm/mach-omap2/omap-mpuss-lowpower.c
++++ b/arch/arm/mach-omap2/omap-mpuss-lowpower.c
+@@ -84,7 +84,7 @@ struct cpu_pm_ops {
+ int (*finish_suspend)(unsigned long cpu_state);
+ void (*resume)(void);
+ void (*scu_prepare)(unsigned int cpu_id, unsigned int cpu_state);
+-};
++} __no_const;
+
+ static DEFINE_PER_CPU(struct omap4_cpu_pm_info, omap4_pm_info);
+ static struct powerdomain *mpuss_pd;
+@@ -102,7 +102,7 @@ static void dummy_cpu_resume(void)
+ static void dummy_scu_prepare(unsigned int cpu_id, unsigned int cpu_state)
+ {}
+
+-struct cpu_pm_ops omap_pm_ops = {
++static struct cpu_pm_ops omap_pm_ops __read_only = {
+ .finish_suspend = default_finish_suspend,
+ .resume = dummy_cpu_resume,
+ .scu_prepare = dummy_scu_prepare,
diff --git a/arch/arm/mach-omap2/omap-wakeupgen.c b/arch/arm/mach-omap2/omap-wakeupgen.c
-index f8bb3b9..831e7b8 100644
+index 813c615..ce467c6 100644
--- a/arch/arm/mach-omap2/omap-wakeupgen.c
+++ b/arch/arm/mach-omap2/omap-wakeupgen.c
-@@ -339,7 +339,7 @@ static int __cpuinit irq_cpu_hotplug_notify(struct notifier_block *self,
+@@ -339,7 +339,7 @@ static int irq_cpu_hotplug_notify(struct notifier_block *self,
return NOTIFY_OK;
}
@@ -3555,10 +3526,10 @@ index f8bb3b9..831e7b8 100644
};
diff --git a/arch/arm/mach-omap2/omap_device.c b/arch/arm/mach-omap2/omap_device.c
-index e6d2307..d057195 100644
+index 53f0735..5b54eb6 100644
--- a/arch/arm/mach-omap2/omap_device.c
+++ b/arch/arm/mach-omap2/omap_device.c
-@@ -499,7 +499,7 @@ void omap_device_delete(struct omap_device *od)
+@@ -504,7 +504,7 @@ void omap_device_delete(struct omap_device *od)
struct platform_device __init *omap_device_build(const char *pdev_name,
int pdev_id,
struct omap_hwmod *oh,
@@ -3567,7 +3538,7 @@ index e6d2307..d057195 100644
{
struct omap_hwmod *ohs[] = { oh };
-@@ -527,7 +527,7 @@ struct platform_device __init *omap_device_build(const char *pdev_name,
+@@ -532,7 +532,7 @@ struct platform_device __init *omap_device_build(const char *pdev_name,
struct platform_device __init *omap_device_build_ss(const char *pdev_name,
int pdev_id,
struct omap_hwmod **ohs,
@@ -3577,10 +3548,10 @@ index e6d2307..d057195 100644
{
int ret = -ENOMEM;
diff --git a/arch/arm/mach-omap2/omap_device.h b/arch/arm/mach-omap2/omap_device.h
-index 044c31d..2ee0861 100644
+index 17ca1ae..beba869 100644
--- a/arch/arm/mach-omap2/omap_device.h
+++ b/arch/arm/mach-omap2/omap_device.h
-@@ -72,12 +72,12 @@ int omap_device_idle(struct platform_device *pdev);
+@@ -71,12 +71,12 @@ int omap_device_idle(struct platform_device *pdev);
/* Core code interface */
struct platform_device *omap_device_build(const char *pdev_name, int pdev_id,
@@ -3596,7 +3567,7 @@ index 044c31d..2ee0861 100644
struct omap_device *omap_device_alloc(struct platform_device *pdev,
struct omap_hwmod **ohs, int oh_cnt);
diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c
-index 7341eff..fd75e34 100644
+index 3d5db8c..ddfa144 100644
--- a/arch/arm/mach-omap2/omap_hwmod.c
+++ b/arch/arm/mach-omap2/omap_hwmod.c
@@ -194,10 +194,10 @@ struct omap_hwmod_soc_ops {
@@ -3637,10 +3608,10 @@ index d15c7bb..b2d1f0c 100644
sizeof(struct omap_wd_timer_platform_data));
WARN(IS_ERR(pdev), "Can't build omap_device for %s:%s.\n",
diff --git a/arch/arm/mach-tegra/cpuidle-tegra20.c b/arch/arm/mach-tegra/cpuidle-tegra20.c
-index 0cdba8d..297993e 100644
+index b82dcae..44ee5b6 100644
--- a/arch/arm/mach-tegra/cpuidle-tegra20.c
+++ b/arch/arm/mach-tegra/cpuidle-tegra20.c
-@@ -181,7 +181,7 @@ static int tegra20_idle_lp2_coupled(struct cpuidle_device *dev,
+@@ -180,7 +180,7 @@ static int tegra20_idle_lp2_coupled(struct cpuidle_device *dev,
bool entered_lp2 = false;
if (tegra_pending_sgi())
@@ -3650,10 +3621,10 @@ index 0cdba8d..297993e 100644
cpuidle_coupled_parallel_barrier(dev, &abort_barrier);
diff --git a/arch/arm/mach-ux500/setup.h b/arch/arm/mach-ux500/setup.h
-index cad3ca8..1d79e0f 100644
+index 656324a..0beba28 100644
--- a/arch/arm/mach-ux500/setup.h
+++ b/arch/arm/mach-ux500/setup.h
-@@ -37,13 +37,6 @@ extern void ux500_timer_init(void);
+@@ -40,13 +40,6 @@ extern void ux500_timer_init(void);
.type = MT_DEVICE, \
}
@@ -3668,10 +3639,10 @@ index cad3ca8..1d79e0f 100644
extern void ux500_cpu_die(unsigned int cpu);
diff --git a/arch/arm/mm/Kconfig b/arch/arm/mm/Kconfig
-index 08c9fe9..191320c 100644
+index cd2c88e..4dd9b67 100644
--- a/arch/arm/mm/Kconfig
+++ b/arch/arm/mm/Kconfig
-@@ -436,7 +436,7 @@ config CPU_32v5
+@@ -446,7 +446,7 @@ config CPU_32v5
config CPU_32v6
bool
@@ -3680,23 +3651,23 @@ index 08c9fe9..191320c 100644
select TLS_REG_EMUL if !CPU_32v6K && !MMU
config CPU_32v6K
-@@ -585,6 +585,7 @@ config CPU_CP15_MPU
+@@ -601,6 +601,7 @@ config CPU_CP15_MPU
config CPU_USE_DOMAINS
bool
-+ depends on !ARM_LPAE && !PAX_KERNEXEC
++ depends on !ARM_LPAE && !PAX_KERNEXEC && !PAX_MEMORY_UDEREF
help
This option enables or disables the use of domain switching
via the set_fs() function.
-@@ -780,6 +781,7 @@ config NEED_KUSER_HELPERS
+@@ -800,6 +801,7 @@ config NEED_KUSER_HELPERS
config KUSER_HELPERS
bool "Enable kuser helpers in vector page" if !NEED_KUSER_HELPERS
default y
-+ depends on !(CPU_V6 || CPU_V6K || CPU_V7)
++ depends on !(CPU_V6 || CPU_V6K || CPU_V7) || GRKERNSEC_OLD_ARM_USERLAND
help
Warning: disabling this option may break user programs.
-@@ -792,7 +794,7 @@ config KUSER_HELPERS
+@@ -812,7 +814,7 @@ config KUSER_HELPERS
See Documentation/arm/kernel_user_helpers.txt for details.
However, the fixed address nature of these helpers can be used
@@ -3770,11 +3741,24 @@ index 6f4585b..7b6f52b 100644
if (err) \
goto fault; \
} while (0)
+diff --git a/arch/arm/mm/cache-l2x0.c b/arch/arm/mm/cache-l2x0.c
+index 447da6f..77a5057 100644
+--- a/arch/arm/mm/cache-l2x0.c
++++ b/arch/arm/mm/cache-l2x0.c
+@@ -45,7 +45,7 @@ struct l2x0_of_data {
+ void (*setup)(const struct device_node *, u32 *, u32 *);
+ void (*save)(void);
+ struct outer_cache_fns outer_cache;
+-};
++} __do_const;
+
+ static bool of_init = false;
+
diff --git a/arch/arm/mm/context.c b/arch/arm/mm/context.c
-index eeab06e..2638dc2 100644
+index 84e6f77..0b52f31 100644
--- a/arch/arm/mm/context.c
+++ b/arch/arm/mm/context.c
-@@ -42,7 +42,7 @@
+@@ -43,7 +43,7 @@
#define NUM_USER_ASIDS ASID_FIRST_VERSION
static DEFINE_RAW_SPINLOCK(cpu_asid_lock);
@@ -3783,7 +3767,7 @@ index eeab06e..2638dc2 100644
static DECLARE_BITMAP(asid_map, NUM_USER_ASIDS);
static DEFINE_PER_CPU(atomic64_t, active_asids);
-@@ -188,7 +188,7 @@ static int is_reserved_asid(u64 asid)
+@@ -180,7 +180,7 @@ static int is_reserved_asid(u64 asid)
static u64 new_context(struct mm_struct *mm, unsigned int cpu)
{
u64 asid = atomic64_read(&mm->context.id);
@@ -3792,7 +3776,7 @@ index eeab06e..2638dc2 100644
if (asid != 0 && is_reserved_asid(asid)) {
/*
-@@ -206,7 +206,7 @@ static u64 new_context(struct mm_struct *mm, unsigned int cpu)
+@@ -198,7 +198,7 @@ static u64 new_context(struct mm_struct *mm, unsigned int cpu)
*/
asid = find_next_zero_bit(asid_map, NUM_USER_ASIDS, 1);
if (asid == NUM_USER_ASIDS) {
@@ -3801,7 +3785,7 @@ index eeab06e..2638dc2 100644
&asid_generation);
flush_context(cpu);
asid = find_next_zero_bit(asid_map, NUM_USER_ASIDS, 1);
-@@ -235,14 +235,14 @@ void check_and_switch_context(struct mm_struct *mm, struct task_struct *tsk)
+@@ -227,14 +227,14 @@ void check_and_switch_context(struct mm_struct *mm, struct task_struct *tsk)
cpu_set_reserved_ttbr0();
asid = atomic64_read(&mm->context.id);
@@ -3819,7 +3803,7 @@ index eeab06e..2638dc2 100644
atomic64_set(&mm->context.id, asid);
}
diff --git a/arch/arm/mm/fault.c b/arch/arm/mm/fault.c
-index 5dbf13f..a2d1876 100644
+index eb8830a..5360ce7 100644
--- a/arch/arm/mm/fault.c
+++ b/arch/arm/mm/fault.c
@@ -25,6 +25,7 @@
@@ -3830,10 +3814,21 @@ index 5dbf13f..a2d1876 100644
#include "fault.h"
-@@ -138,6 +139,20 @@ __do_kernel_fault(struct mm_struct *mm, unsigned long addr, unsigned int fsr,
+@@ -138,6 +139,31 @@ __do_kernel_fault(struct mm_struct *mm, unsigned long addr, unsigned int fsr,
if (fixup_exception(regs))
return;
++#ifdef CONFIG_PAX_MEMORY_UDEREF
++ if (addr < TASK_SIZE) {
++ if (current->signal->curr_ip)
++ printk(KERN_ERR "PAX: From %pI4: %s:%d, uid/euid: %u/%u, attempted to access userland memory at %08lx\n", &current->signal->curr_ip, current->comm, task_pid_nr(current),
++ from_kuid_munged(&init_user_ns, current_uid()), from_kuid_munged(&init_user_ns, current_euid()), addr);
++ else
++ printk(KERN_ERR "PAX: %s:%d, uid/euid: %u/%u, attempted to access userland memory at %08lx\n", current->comm, task_pid_nr(current),
++ from_kuid_munged(&init_user_ns, current_uid()), from_kuid_munged(&init_user_ns, current_euid()), addr);
++ }
++#endif
++
+#ifdef CONFIG_PAX_KERNEXEC
+ if ((fsr & FSR_WRITE) &&
+ (((unsigned long)_stext <= addr && addr < init_mm.end_code) ||
@@ -3851,7 +3846,7 @@ index 5dbf13f..a2d1876 100644
/*
* No handler, we'll have to terminate things with extreme prejudice.
*/
-@@ -174,6 +189,13 @@ __do_user_fault(struct task_struct *tsk, unsigned long addr,
+@@ -174,6 +200,13 @@ __do_user_fault(struct task_struct *tsk, unsigned long addr,
}
#endif
@@ -3865,7 +3860,7 @@ index 5dbf13f..a2d1876 100644
tsk->thread.address = addr;
tsk->thread.error_code = fsr;
tsk->thread.trap_no = 14;
-@@ -398,6 +420,33 @@ do_page_fault(unsigned long addr, unsigned int fsr, struct pt_regs *regs)
+@@ -401,6 +434,33 @@ do_page_fault(unsigned long addr, unsigned int fsr, struct pt_regs *regs)
}
#endif /* CONFIG_MMU */
@@ -3899,7 +3894,7 @@ index 5dbf13f..a2d1876 100644
/*
* First Level Translation Fault Handler
*
-@@ -543,9 +592,22 @@ do_DataAbort(unsigned long addr, unsigned int fsr, struct pt_regs *regs)
+@@ -548,9 +608,22 @@ do_DataAbort(unsigned long addr, unsigned int fsr, struct pt_regs *regs)
const struct fsr_info *inf = fsr_info + fsr_fs(fsr);
struct siginfo info;
@@ -3922,7 +3917,7 @@ index 5dbf13f..a2d1876 100644
printk(KERN_ALERT "Unhandled fault: %s (0x%03x) at 0x%08lx\n",
inf->name, fsr, addr);
-@@ -569,15 +631,68 @@ hook_ifault_code(int nr, int (*fn)(unsigned long, unsigned int, struct pt_regs *
+@@ -574,15 +647,98 @@ hook_ifault_code(int nr, int (*fn)(unsigned long, unsigned int, struct pt_regs *
ifsr_info[nr].name = name;
}
@@ -3946,11 +3941,41 @@ index 5dbf13f..a2d1876 100644
+ sys_rt_sigreturn(regs);
+ return;
+ }
++ if (pc == 0xffff0f60UL) {
++ /*
++ * PaX: __kuser_cmpxchg64 emulation
++ */
++ // TODO
++ //regs->ARM_pc = regs->ARM_lr;
++ //return;
++ }
++ if (pc == 0xffff0fa0UL) {
++ /*
++ * PaX: __kuser_memory_barrier emulation
++ */
++ // dmb(); implied by the exception
++ regs->ARM_pc = regs->ARM_lr;
++ return;
++ }
++ if (pc == 0xffff0fc0UL) {
++ /*
++ * PaX: __kuser_cmpxchg emulation
++ */
++ // TODO
++ //long new;
++ //int op;
++
++ //op = FUTEX_OP_SET << 28;
++ //new = futex_atomic_op_inuser(op, regs->ARM_r2);
++ //regs->ARM_r0 = old != new;
++ //regs->ARM_pc = regs->ARM_lr;
++ //return;
++ }
+ if (pc == 0xffff0fe0UL) {
+ /*
+ * PaX: __kuser_get_tls emulation
+ */
-+ regs->ARM_r0 = current_thread_info()->tp_value;
++ regs->ARM_r0 = current_thread_info()->tp_value[0];
+ regs->ARM_pc = regs->ARM_lr;
+ return;
+ }
@@ -3974,7 +3999,7 @@ index 5dbf13f..a2d1876 100644
+ if (fsr_fs(ifsr) == FAULT_CODE_DEBUG) {
+ unsigned int bkpt;
+
-+ if (!probe_kernel_address((unsigned int *)pc, bkpt) && cpu_to_le32(bkpt) == 0xe12f1073) {
++ if (!probe_kernel_address(pc, bkpt) && cpu_to_le32(bkpt) == 0xe12f1073) {
+ current->thread.error_code = ifsr;
+ current->thread.trap_no = 0;
+ pax_report_refcount_overflow(regs);
@@ -4022,7 +4047,7 @@ index cf08bdf..772656c 100644
unsigned long search_exception_table(unsigned long addr);
diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c
-index 0ecc43f..190b956 100644
+index 18ec4c5..479bb6a 100644
--- a/arch/arm/mm/init.c
+++ b/arch/arm/mm/init.c
@@ -30,6 +30,8 @@
@@ -4034,12 +4059,12 @@ index 0ecc43f..190b956 100644
#include <asm/mach/arch.h>
#include <asm/mach/map.h>
-@@ -726,7 +728,46 @@ void free_initmem(void)
+@@ -684,7 +686,46 @@ void free_initmem(void)
{
#ifdef CONFIG_HAVE_TCM
extern char __tcm_start, __tcm_end;
+#endif
-+
+
+#ifdef CONFIG_PAX_KERNEXEC
+ unsigned long addr;
+ pgd_t *pgd;
@@ -4076,16 +4101,16 @@ index 0ecc43f..190b956 100644
+ }
+ }
+#endif
-
++
+#ifdef CONFIG_HAVE_TCM
poison_init_mem(&__tcm_start, &__tcm_end - &__tcm_start);
- free_reserved_area(&__tcm_start, &__tcm_end, 0, "TCM link");
+ free_reserved_area(&__tcm_start, &__tcm_end, -1, "TCM link");
#endif
diff --git a/arch/arm/mm/ioremap.c b/arch/arm/mm/ioremap.c
-index 04d9006..c547d85 100644
+index f123d6e..04bf569 100644
--- a/arch/arm/mm/ioremap.c
+++ b/arch/arm/mm/ioremap.c
-@@ -392,9 +392,9 @@ __arm_ioremap_exec(unsigned long phys_addr, size_t size, bool cached)
+@@ -392,9 +392,9 @@ __arm_ioremap_exec(phys_addr_t phys_addr, size_t size, bool cached)
unsigned int mtype;
if (cached)
@@ -4098,7 +4123,7 @@ index 04d9006..c547d85 100644
return __arm_ioremap_caller(phys_addr, size, mtype,
__builtin_return_address(0));
diff --git a/arch/arm/mm/mmap.c b/arch/arm/mm/mmap.c
-index 10062ce..8695745 100644
+index 0c63562..7128a90 100644
--- a/arch/arm/mm/mmap.c
+++ b/arch/arm/mm/mmap.c
@@ -59,6 +59,7 @@ arch_get_unmapped_area(struct file *filp, unsigned long addr,
@@ -4186,7 +4211,7 @@ index 10062ce..8695745 100644
/* 8 bits of randomness in 20 address space bits */
if ((current->flags & PF_RANDOMIZE) &&
!(current->personality & ADDR_NO_RANDOMIZE))
-@@ -180,10 +194,22 @@ void arch_pick_mmap_layout(struct mm_struct *mm)
+@@ -180,9 +194,21 @@ void arch_pick_mmap_layout(struct mm_struct *mm)
if (mmap_is_legacy()) {
mm->mmap_base = TASK_UNMAPPED_BASE + random_factor;
@@ -4197,7 +4222,6 @@ index 10062ce..8695745 100644
+#endif
+
mm->get_unmapped_area = arch_get_unmapped_area;
- mm->unmap_area = arch_unmap_area;
} else {
mm->mmap_base = mmap_base(random_factor);
+
@@ -4207,10 +4231,10 @@ index 10062ce..8695745 100644
+#endif
+
mm->get_unmapped_area = arch_get_unmapped_area_topdown;
- mm->unmap_area = arch_unmap_area_topdown;
}
+ }
diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c
-index daf336f..4e6392c 100644
+index b1d17ee..7a6f4d3 100644
--- a/arch/arm/mm/mmu.c
+++ b/arch/arm/mm/mmu.c
@@ -36,6 +36,22 @@
@@ -4473,30 +4497,30 @@ index daf336f..4e6392c 100644
mem_types[MT_ROM].prot_sect |= cp->pmd;
switch (cp->pmd) {
-@@ -1166,18 +1255,15 @@ void __init arm_mm_memblock_reserve(void)
+@@ -1186,18 +1275,15 @@ void __init arm_mm_memblock_reserve(void)
* called function. This means you can't use any function or debugging
* method which may touch any device, otherwise the kernel _will_ crash.
*/
+
+static char vectors[PAGE_SIZE * 2] __read_only __aligned(PAGE_SIZE);
+
- static void __init devicemaps_init(struct machine_desc *mdesc)
+ static void __init devicemaps_init(const struct machine_desc *mdesc)
{
struct map_desc map;
unsigned long addr;
- void *vectors;
--
+
- /*
- * Allocate the vector page early.
- */
- vectors = early_alloc(PAGE_SIZE * 2);
-
+-
- early_trap_init(vectors);
+ early_trap_init(&vectors);
for (addr = VMALLOC_START; addr; addr += PMD_SIZE)
pmd_clear(pmd_off_k(addr));
-@@ -1217,7 +1303,7 @@ static void __init devicemaps_init(struct machine_desc *mdesc)
+@@ -1237,7 +1323,7 @@ static void __init devicemaps_init(const struct machine_desc *mdesc)
* location (0xffff0000). If we aren't using high-vectors, also
* create a mapping at the low-vectors virtual address.
*/
@@ -4505,7 +4529,7 @@ index daf336f..4e6392c 100644
map.virtual = 0xffff0000;
map.length = PAGE_SIZE;
#ifdef CONFIG_KUSER_HELPERS
-@@ -1287,8 +1373,39 @@ static void __init map_lowmem(void)
+@@ -1309,8 +1395,39 @@ static void __init map_lowmem(void)
map.pfn = __phys_to_pfn(start);
map.virtual = __phys_to_virt(start);
map.length = end - start;
@@ -4572,32 +4596,6 @@ index ce6d763..cfea917 100644
extern void *samsung_dmadev_get_ops(void);
extern void *s3c_dma_get_ops(void);
-diff --git a/arch/arm64/kernel/debug-monitors.c b/arch/arm64/kernel/debug-monitors.c
-index f4726dc..39ed646 100644
---- a/arch/arm64/kernel/debug-monitors.c
-+++ b/arch/arm64/kernel/debug-monitors.c
-@@ -149,7 +149,7 @@ static int __cpuinit os_lock_notify(struct notifier_block *self,
- return NOTIFY_OK;
- }
-
--static struct notifier_block __cpuinitdata os_lock_nb = {
-+static struct notifier_block os_lock_nb = {
- .notifier_call = os_lock_notify,
- };
-
-diff --git a/arch/arm64/kernel/hw_breakpoint.c b/arch/arm64/kernel/hw_breakpoint.c
-index 5ab825c..96aaec8 100644
---- a/arch/arm64/kernel/hw_breakpoint.c
-+++ b/arch/arm64/kernel/hw_breakpoint.c
-@@ -831,7 +831,7 @@ static int __cpuinit hw_breakpoint_reset_notify(struct notifier_block *self,
- return NOTIFY_OK;
- }
-
--static struct notifier_block __cpuinitdata hw_breakpoint_reset_nb = {
-+static struct notifier_block hw_breakpoint_reset_nb = {
- .notifier_call = hw_breakpoint_reset_notify,
- };
-
diff --git a/arch/avr32/include/asm/cache.h b/arch/avr32/include/asm/cache.h
index c3a58a1..78fbf54 100644
--- a/arch/avr32/include/asm/cache.h
@@ -4651,7 +4649,7 @@ index 479330b..53717a8 100644
#endif /* __ASM_AVR32_KMAP_TYPES_H */
diff --git a/arch/avr32/mm/fault.c b/arch/avr32/mm/fault.c
-index b2f2d2d..d1c85cb 100644
+index 0eca933..eb78c7b 100644
--- a/arch/avr32/mm/fault.c
+++ b/arch/avr32/mm/fault.c
@@ -41,6 +41,23 @@ static inline int notify_page_fault(struct pt_regs *regs, int trap)
@@ -4678,7 +4676,7 @@ index b2f2d2d..d1c85cb 100644
/*
* This routine handles page faults. It determines the address and the
* problem, and then passes it off to one of the appropriate routines.
-@@ -174,6 +191,16 @@ bad_area:
+@@ -176,6 +193,16 @@ bad_area:
up_read(&mm->mmap_sem);
if (user_mode(regs)) {
@@ -4847,6 +4845,18 @@ index f4ca594..adc72fd6 100644
#define __cacheline_aligned __aligned(L1_CACHE_BYTES)
#define ____cacheline_aligned __aligned(L1_CACHE_BYTES)
+diff --git a/arch/ia64/Kconfig b/arch/ia64/Kconfig
+index 7740ab1..17fa8c5 100644
+--- a/arch/ia64/Kconfig
++++ b/arch/ia64/Kconfig
+@@ -554,6 +554,7 @@ source "drivers/sn/Kconfig"
+ config KEXEC
+ bool "kexec system call"
+ depends on !IA64_HP_SIM && (!SMP || HOTPLUG_CPU)
++ depends on !GRKERNSEC_KMEM
+ help
+ kexec is a system call that implements the ability to shutdown your
+ current kernel, and to start another kernel. It is like a reboot
diff --git a/arch/ia64/include/asm/atomic.h b/arch/ia64/include/asm/atomic.h
index 6e6fe18..a6ae668 100644
--- a/arch/ia64/include/asm/atomic.h
@@ -4938,7 +4948,7 @@ index 96a8d92..617a1cf 100644
{
return quicklist_alloc(0, GFP_KERNEL, NULL);
diff --git a/arch/ia64/include/asm/pgtable.h b/arch/ia64/include/asm/pgtable.h
-index 815810c..d60bd4c 100644
+index 7935115..c0eca6a 100644
--- a/arch/ia64/include/asm/pgtable.h
+++ b/arch/ia64/include/asm/pgtable.h
@@ -12,7 +12,7 @@
@@ -4969,7 +4979,7 @@ index 815810c..d60bd4c 100644
#define PAGE_KERNEL __pgprot(__DIRTY_BITS | _PAGE_PL_0 | _PAGE_AR_RWX)
#define PAGE_KERNELRX __pgprot(__ACCESS_BITS | _PAGE_PL_0 | _PAGE_AR_RX)
diff --git a/arch/ia64/include/asm/spinlock.h b/arch/ia64/include/asm/spinlock.h
-index 54ff557..70c88b7 100644
+index 45698cd..e8e2dbc 100644
--- a/arch/ia64/include/asm/spinlock.h
+++ b/arch/ia64/include/asm/spinlock.h
@@ -71,7 +71,7 @@ static __always_inline void __ticket_spin_unlock(arch_spinlock_t *lock)
@@ -5043,32 +5053,6 @@ index 449c8c0..18965fb 100644
__cu_len; \
})
-diff --git a/arch/ia64/kernel/err_inject.c b/arch/ia64/kernel/err_inject.c
-index 2d67317..07d8bfa 100644
---- a/arch/ia64/kernel/err_inject.c
-+++ b/arch/ia64/kernel/err_inject.c
-@@ -256,7 +256,7 @@ static int __cpuinit err_inject_cpu_callback(struct notifier_block *nfb,
- return NOTIFY_OK;
- }
-
--static struct notifier_block __cpuinitdata err_inject_cpu_notifier =
-+static struct notifier_block err_inject_cpu_notifier =
- {
- .notifier_call = err_inject_cpu_callback,
- };
-diff --git a/arch/ia64/kernel/mca.c b/arch/ia64/kernel/mca.c
-index d7396db..b33e873 100644
---- a/arch/ia64/kernel/mca.c
-+++ b/arch/ia64/kernel/mca.c
-@@ -1922,7 +1922,7 @@ static int __cpuinit mca_cpu_callback(struct notifier_block *nfb,
- return NOTIFY_OK;
- }
-
--static struct notifier_block mca_cpu_notifier __cpuinitdata = {
-+static struct notifier_block mca_cpu_notifier = {
- .notifier_call = mca_cpu_callback
- };
-
diff --git a/arch/ia64/kernel/module.c b/arch/ia64/kernel/module.c
index 24603be..948052d 100644
--- a/arch/ia64/kernel/module.c
@@ -5162,10 +5146,10 @@ index 24603be..948052d 100644
DEBUGP("%s: placing gp at 0x%lx\n", __func__, gp);
}
diff --git a/arch/ia64/kernel/palinfo.c b/arch/ia64/kernel/palinfo.c
-index 2b3c2d7..a318d84 100644
+index ab33328..f39506c 100644
--- a/arch/ia64/kernel/palinfo.c
+++ b/arch/ia64/kernel/palinfo.c
-@@ -980,7 +980,7 @@ static int __cpuinit palinfo_cpu_callback(struct notifier_block *nfb,
+@@ -980,7 +980,7 @@ static int palinfo_cpu_callback(struct notifier_block *nfb,
return NOTIFY_OK;
}
@@ -5174,21 +5158,8 @@ index 2b3c2d7..a318d84 100644
{
.notifier_call = palinfo_cpu_callback,
.priority = 0,
-diff --git a/arch/ia64/kernel/salinfo.c b/arch/ia64/kernel/salinfo.c
-index 4bc580a..7767f24 100644
---- a/arch/ia64/kernel/salinfo.c
-+++ b/arch/ia64/kernel/salinfo.c
-@@ -609,7 +609,7 @@ salinfo_cpu_callback(struct notifier_block *nb, unsigned long action, void *hcpu
- return NOTIFY_OK;
- }
-
--static struct notifier_block salinfo_cpu_notifier __cpuinitdata =
-+static struct notifier_block salinfo_cpu_notifier =
- {
- .notifier_call = salinfo_cpu_callback,
- .priority = 0,
diff --git a/arch/ia64/kernel/sys_ia64.c b/arch/ia64/kernel/sys_ia64.c
-index 41e33f8..65180b2 100644
+index 41e33f8..65180b2a 100644
--- a/arch/ia64/kernel/sys_ia64.c
+++ b/arch/ia64/kernel/sys_ia64.c
@@ -28,6 +28,7 @@ arch_get_unmapped_area (struct file *filp, unsigned long addr, unsigned long len
@@ -5221,19 +5192,6 @@ index 41e33f8..65180b2 100644
return vm_unmapped_area(&info);
}
-diff --git a/arch/ia64/kernel/topology.c b/arch/ia64/kernel/topology.c
-index dc00b2c..cce53c2 100644
---- a/arch/ia64/kernel/topology.c
-+++ b/arch/ia64/kernel/topology.c
-@@ -445,7 +445,7 @@ static int __cpuinit cache_cpu_callback(struct notifier_block *nfb,
- return NOTIFY_OK;
- }
-
--static struct notifier_block __cpuinitdata cache_cpu_notifier =
-+static struct notifier_block cache_cpu_notifier =
- {
- .notifier_call = cache_cpu_callback
- };
diff --git a/arch/ia64/kernel/vmlinux.lds.S b/arch/ia64/kernel/vmlinux.lds.S
index 0ccb28f..8992469 100644
--- a/arch/ia64/kernel/vmlinux.lds.S
@@ -5248,7 +5206,7 @@ index 0ccb28f..8992469 100644
* ensure percpu data fits
* into percpu page size
diff --git a/arch/ia64/mm/fault.c b/arch/ia64/mm/fault.c
-index 6cf0341..d352594 100644
+index 7225dad..2a7c8256 100644
--- a/arch/ia64/mm/fault.c
+++ b/arch/ia64/mm/fault.c
@@ -72,6 +72,23 @@ mapped_kernel_page_is_present (unsigned long address)
@@ -5275,7 +5233,7 @@ index 6cf0341..d352594 100644
# define VM_READ_BIT 0
# define VM_WRITE_BIT 1
# define VM_EXEC_BIT 2
-@@ -149,8 +166,21 @@ retry:
+@@ -151,8 +168,21 @@ retry:
if (((isr >> IA64_ISR_R_BIT) & 1UL) && (!(vma->vm_flags & (VM_READ | VM_WRITE))))
goto bad_area;
@@ -5299,10 +5257,10 @@ index 6cf0341..d352594 100644
/*
* If for any reason at all we couldn't handle the fault, make
diff --git a/arch/ia64/mm/hugetlbpage.c b/arch/ia64/mm/hugetlbpage.c
-index 76069c1..c2aa816 100644
+index 68232db..6ca80af 100644
--- a/arch/ia64/mm/hugetlbpage.c
+++ b/arch/ia64/mm/hugetlbpage.c
-@@ -149,6 +149,7 @@ unsigned long hugetlb_get_unmapped_area(struct file *file, unsigned long addr, u
+@@ -154,6 +154,7 @@ unsigned long hugetlb_get_unmapped_area(struct file *file, unsigned long addr, u
unsigned long pgoff, unsigned long flags)
{
struct vm_unmapped_area_info info;
@@ -5310,7 +5268,7 @@ index 76069c1..c2aa816 100644
if (len > RGN_MAP_LIMIT)
return -ENOMEM;
-@@ -172,6 +173,7 @@ unsigned long hugetlb_get_unmapped_area(struct file *file, unsigned long addr, u
+@@ -177,6 +178,7 @@ unsigned long hugetlb_get_unmapped_area(struct file *file, unsigned long addr, u
info.high_limit = HPAGE_REGION_BASE + RGN_MAP_LIMIT;
info.align_mask = PAGE_MASK & (HPAGE_SIZE - 1);
info.align_offset = 0;
@@ -5319,7 +5277,7 @@ index 76069c1..c2aa816 100644
}
diff --git a/arch/ia64/mm/init.c b/arch/ia64/mm/init.c
-index d1fe4b4..2628f37 100644
+index b6f7f43..c04320d 100644
--- a/arch/ia64/mm/init.c
+++ b/arch/ia64/mm/init.c
@@ -120,6 +120,19 @@ ia64_init_addr_space (void)
@@ -5400,10 +5358,10 @@ index 0395c51..5f26031 100644
#define ARCH_DMA_MINALIGN L1_CACHE_BYTES
diff --git a/arch/metag/mm/hugetlbpage.c b/arch/metag/mm/hugetlbpage.c
-index 3c52fa6..11b2ad8 100644
+index 0424315..defcca9 100644
--- a/arch/metag/mm/hugetlbpage.c
+++ b/arch/metag/mm/hugetlbpage.c
-@@ -200,6 +200,7 @@ hugetlb_get_unmapped_area_new_pmd(unsigned long len)
+@@ -205,6 +205,7 @@ hugetlb_get_unmapped_area_new_pmd(unsigned long len)
info.high_limit = TASK_SIZE;
info.align_mask = PAGE_MASK & HUGEPT_MASK;
info.align_offset = 0;
@@ -5429,6 +5387,18 @@ index 4efe96a..60e8699 100644
#define SMP_CACHE_BYTES L1_CACHE_BYTES
+diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
+index f75ab4a..adc6968 100644
+--- a/arch/mips/Kconfig
++++ b/arch/mips/Kconfig
+@@ -2283,6 +2283,7 @@ source "kernel/Kconfig.preempt"
+
+ config KEXEC
+ bool "Kexec system call"
++ depends on !GRKERNSEC_KMEM
+ help
+ kexec is a system call that implements the ability to shutdown your
+ current kernel, and to start another kernel. It is like a reboot
diff --git a/arch/mips/include/asm/atomic.h b/arch/mips/include/asm/atomic.h
index 08b6079..8b554d2 100644
--- a/arch/mips/include/asm/atomic.h
@@ -6482,7 +6452,7 @@ index d44622c..64990d2 100644
/**
diff --git a/arch/mips/include/asm/page.h b/arch/mips/include/asm/page.h
-index f59552f..3abe9b9 100644
+index f6be474..12ad554 100644
--- a/arch/mips/include/asm/page.h
+++ b/arch/mips/include/asm/page.h
@@ -95,7 +95,7 @@ extern void copy_user_highpage(struct page *to, struct page *from,
@@ -6510,11 +6480,23 @@ index 881d18b..cea38bc 100644
#endif
/*
+diff --git a/arch/mips/include/asm/smtc_proc.h b/arch/mips/include/asm/smtc_proc.h
+index 25da651..ae2a259 100644
+--- a/arch/mips/include/asm/smtc_proc.h
++++ b/arch/mips/include/asm/smtc_proc.h
+@@ -18,6 +18,6 @@ extern struct smtc_cpu_proc smtc_cpu_stats[NR_CPUS];
+
+ /* Count of number of recoveries of "stolen" FPU access rights on 34K */
+
+-extern atomic_t smtc_fpu_recoveries;
++extern atomic_unchecked_t smtc_fpu_recoveries;
+
+ #endif /* __ASM_SMTC_PROC_H */
diff --git a/arch/mips/include/asm/thread_info.h b/arch/mips/include/asm/thread_info.h
-index 895320e..bf63e10 100644
+index 61215a3..213ee0e 100644
--- a/arch/mips/include/asm/thread_info.h
+++ b/arch/mips/include/asm/thread_info.h
-@@ -115,6 +115,8 @@ static inline struct thread_info *current_thread_info(void)
+@@ -116,6 +116,8 @@ static inline struct thread_info *current_thread_info(void)
#define TIF_32BIT_ADDR 23 /* 32-bit address space (o32/n32) */
#define TIF_FPUBOUND 24 /* thread bound to FPU-full CPU set */
#define TIF_LOAD_WATCH 25 /* If set, load watch registers */
@@ -6523,24 +6505,28 @@ index 895320e..bf63e10 100644
#define TIF_SYSCALL_TRACE 31 /* syscall trace active */
#define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE)
-@@ -130,15 +132,18 @@ static inline struct thread_info *current_thread_info(void)
+@@ -132,20 +134,18 @@ static inline struct thread_info *current_thread_info(void)
#define _TIF_32BIT_ADDR (1<<TIF_32BIT_ADDR)
#define _TIF_FPUBOUND (1<<TIF_FPUBOUND)
#define _TIF_LOAD_WATCH (1<<TIF_LOAD_WATCH)
+#define _TIF_GRSEC_SETXID (1<<TIF_GRSEC_SETXID)
-+
-+#define _TIF_SYSCALL_WORK (_TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT | _TIF_GRSEC_SETXID)
+
+-#define _TIF_WORK_SYSCALL_ENTRY (_TIF_NOHZ | _TIF_SYSCALL_TRACE | \
+- _TIF_SYSCALL_AUDIT)
++#define _TIF_WORK_SYSCALL_ENTRY (_TIF_NOHZ | _TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT | _TIF_GRSEC_SETXID)
/* work to do in syscall_trace_leave() */
--#define _TIF_WORK_SYSCALL_EXIT (_TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT)
-+#define _TIF_WORK_SYSCALL_EXIT (_TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT | _TIF_GRSEC_SETXID)
+-#define _TIF_WORK_SYSCALL_EXIT (_TIF_NOHZ | _TIF_SYSCALL_TRACE | \
+- _TIF_SYSCALL_AUDIT)
++#define _TIF_WORK_SYSCALL_EXIT (_TIF_NOHZ | _TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT | _TIF_GRSEC_SETXID)
/* work to do on interrupt/exception return */
#define _TIF_WORK_MASK \
(_TIF_SIGPENDING | _TIF_NEED_RESCHED | _TIF_NOTIFY_RESUME)
/* work to do on any return to u-space */
--#define _TIF_ALLWORK_MASK (_TIF_WORK_MASK | _TIF_WORK_SYSCALL_EXIT)
-+#define _TIF_ALLWORK_MASK (_TIF_WORK_MASK | _TIF_WORK_SYSCALL_EXIT | _TIF_GRSEC_SETXID)
+-#define _TIF_ALLWORK_MASK (_TIF_NOHZ | _TIF_WORK_MASK | \
+- _TIF_WORK_SYSCALL_EXIT)
++#define _TIF_ALLWORK_MASK (_TIF_NOHZ | _TIF_WORK_MASK | _TIF_WORK_SYSCALL_EXIT | _TIF_GRSEC_SETXID)
#endif /* __KERNEL__ */
@@ -6606,10 +6592,10 @@ index d1fea7a..45602ea 100644
void __init init_IRQ(void)
diff --git a/arch/mips/kernel/process.c b/arch/mips/kernel/process.c
-index c6a041d..b3e7318 100644
+index ddc7610..8c58f17 100644
--- a/arch/mips/kernel/process.c
+++ b/arch/mips/kernel/process.c
-@@ -563,15 +563,3 @@ unsigned long get_wchan(struct task_struct *task)
+@@ -566,15 +566,3 @@ unsigned long get_wchan(struct task_struct *task)
out:
return pc;
}
@@ -6626,10 +6612,10 @@ index c6a041d..b3e7318 100644
- return sp & ALMASK;
-}
diff --git a/arch/mips/kernel/ptrace.c b/arch/mips/kernel/ptrace.c
-index 9c6299c..2fb4c22 100644
+index 8ae1ebe..1bcbf47 100644
--- a/arch/mips/kernel/ptrace.c
+++ b/arch/mips/kernel/ptrace.c
-@@ -528,6 +528,10 @@ static inline int audit_arch(void)
+@@ -529,6 +529,10 @@ static inline int audit_arch(void)
return arch;
}
@@ -6640,7 +6626,7 @@ index 9c6299c..2fb4c22 100644
/*
* Notification of system call entry/exit
* - triggered by current->work.syscall_trace
-@@ -537,6 +541,11 @@ asmlinkage void syscall_trace_enter(struct pt_regs *regs)
+@@ -540,6 +544,11 @@ asmlinkage void syscall_trace_enter(struct pt_regs *regs)
/* do the secure computing check first */
secure_computing_strict(regs->regs[2]);
@@ -6652,74 +6638,66 @@ index 9c6299c..2fb4c22 100644
if (!(current->ptrace & PT_PTRACED))
goto out;
-diff --git a/arch/mips/kernel/scall32-o32.S b/arch/mips/kernel/scall32-o32.S
-index 9b36424..e7f4154 100644
---- a/arch/mips/kernel/scall32-o32.S
-+++ b/arch/mips/kernel/scall32-o32.S
-@@ -52,7 +52,7 @@ NESTED(handle_sys, PT_SIZE, sp)
-
- stack_done:
- lw t0, TI_FLAGS($28) # syscall tracing enabled?
-- li t1, _TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT
-+ li t1, _TIF_SYSCALL_WORK
- and t0, t1
- bnez t0, syscall_trace_entry # -> yes
-
-diff --git a/arch/mips/kernel/scall64-64.S b/arch/mips/kernel/scall64-64.S
-index 97a5909..59622f8 100644
---- a/arch/mips/kernel/scall64-64.S
-+++ b/arch/mips/kernel/scall64-64.S
-@@ -54,7 +54,7 @@ NESTED(handle_sys64, PT_SIZE, sp)
-
- sd a3, PT_R26(sp) # save a3 for syscall restarting
-
-- li t1, _TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT
-+ li t1, _TIF_SYSCALL_WORK
- LONG_L t0, TI_FLAGS($28) # syscall tracing enabled?
- and t0, t1, t0
- bnez t0, syscall_trace_entry
-diff --git a/arch/mips/kernel/scall64-n32.S b/arch/mips/kernel/scall64-n32.S
-index edcb659..fb2ab09 100644
---- a/arch/mips/kernel/scall64-n32.S
-+++ b/arch/mips/kernel/scall64-n32.S
-@@ -47,7 +47,7 @@ NESTED(handle_sysn32, PT_SIZE, sp)
-
- sd a3, PT_R26(sp) # save a3 for syscall restarting
-
-- li t1, _TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT
-+ li t1, _TIF_SYSCALL_WORK
- LONG_L t0, TI_FLAGS($28) # syscall tracing enabled?
- and t0, t1, t0
- bnez t0, n32_syscall_trace_entry
-diff --git a/arch/mips/kernel/scall64-o32.S b/arch/mips/kernel/scall64-o32.S
-index 74f485d..47d2c38 100644
---- a/arch/mips/kernel/scall64-o32.S
-+++ b/arch/mips/kernel/scall64-o32.S
-@@ -81,7 +81,7 @@ NESTED(handle_sys, PT_SIZE, sp)
- PTR 4b, bad_stack
- .previous
+diff --git a/arch/mips/kernel/smtc-proc.c b/arch/mips/kernel/smtc-proc.c
+index c10aa84..9ec2e60 100644
+--- a/arch/mips/kernel/smtc-proc.c
++++ b/arch/mips/kernel/smtc-proc.c
+@@ -31,7 +31,7 @@ unsigned long selfipis[NR_CPUS];
+
+ struct smtc_cpu_proc smtc_cpu_stats[NR_CPUS];
+
+-atomic_t smtc_fpu_recoveries;
++atomic_unchecked_t smtc_fpu_recoveries;
+
+ static int smtc_proc_show(struct seq_file *m, void *v)
+ {
+@@ -48,7 +48,7 @@ static int smtc_proc_show(struct seq_file *m, void *v)
+ for(i = 0; i < NR_CPUS; i++)
+ seq_printf(m, "%d: %ld\n", i, smtc_cpu_stats[i].selfipis);
+ seq_printf(m, "%d Recoveries of \"stolen\" FPU\n",
+- atomic_read(&smtc_fpu_recoveries));
++ atomic_read_unchecked(&smtc_fpu_recoveries));
+ return 0;
+ }
+
+@@ -73,7 +73,7 @@ void init_smtc_stats(void)
+ smtc_cpu_stats[i].selfipis = 0;
+ }
+
+- atomic_set(&smtc_fpu_recoveries, 0);
++ atomic_set_unchecked(&smtc_fpu_recoveries, 0);
+
+ proc_create("smtc", 0444, NULL, &smtc_proc_fops);
+ }
+diff --git a/arch/mips/kernel/smtc.c b/arch/mips/kernel/smtc.c
+index dfc1b91..11a2c07 100644
+--- a/arch/mips/kernel/smtc.c
++++ b/arch/mips/kernel/smtc.c
+@@ -1359,7 +1359,7 @@ void smtc_soft_dump(void)
+ }
+ smtc_ipi_qdump();
+ printk("%d Recoveries of \"stolen\" FPU\n",
+- atomic_read(&smtc_fpu_recoveries));
++ atomic_read_unchecked(&smtc_fpu_recoveries));
+ }
+
-- li t1, _TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT
-+ li t1, _TIF_SYSCALL_WORK
- LONG_L t0, TI_FLAGS($28) # syscall tracing enabled?
- and t0, t1, t0
- bnez t0, trace_a_syscall
diff --git a/arch/mips/kernel/sync-r4k.c b/arch/mips/kernel/sync-r4k.c
-index 1ff43d5..96fec68 100644
+index 84536bf..79caa4d 100644
--- a/arch/mips/kernel/sync-r4k.c
+++ b/arch/mips/kernel/sync-r4k.c
@@ -21,8 +21,8 @@
#include <asm/mipsregs.h>
- static atomic_t __cpuinitdata count_start_flag = ATOMIC_INIT(0);
--static atomic_t __cpuinitdata count_count_start = ATOMIC_INIT(0);
--static atomic_t __cpuinitdata count_count_stop = ATOMIC_INIT(0);
-+static atomic_unchecked_t __cpuinitdata count_count_start = ATOMIC_INIT(0);
-+static atomic_unchecked_t __cpuinitdata count_count_stop = ATOMIC_INIT(0);
- static atomic_t __cpuinitdata count_reference = ATOMIC_INIT(0);
+ static atomic_t count_start_flag = ATOMIC_INIT(0);
+-static atomic_t count_count_start = ATOMIC_INIT(0);
+-static atomic_t count_count_stop = ATOMIC_INIT(0);
++static atomic_unchecked_t count_count_start = ATOMIC_INIT(0);
++static atomic_unchecked_t count_count_stop = ATOMIC_INIT(0);
+ static atomic_t count_reference = ATOMIC_INIT(0);
#define COUNTON 100
-@@ -69,13 +69,13 @@ void __cpuinit synchronise_count_master(int cpu)
+@@ -69,13 +69,13 @@ void synchronise_count_master(int cpu)
for (i = 0; i < NR_LOOPS; i++) {
/* slaves loop on '!= 2' */
@@ -6736,7 +6714,7 @@ index 1ff43d5..96fec68 100644
/*
* Everyone initialises count in the last loop:
-@@ -86,11 +86,11 @@ void __cpuinit synchronise_count_master(int cpu)
+@@ -86,11 +86,11 @@ void synchronise_count_master(int cpu)
/*
* Wait for all slaves to leave the synchronization point:
*/
@@ -6751,7 +6729,7 @@ index 1ff43d5..96fec68 100644
}
/* Arrange for an interrupt in a short while */
write_c0_compare(read_c0_count() + COUNTON);
-@@ -131,8 +131,8 @@ void __cpuinit synchronise_count_slave(int cpu)
+@@ -131,8 +131,8 @@ void synchronise_count_slave(int cpu)
initcount = atomic_read(&count_reference);
for (i = 0; i < NR_LOOPS; i++) {
@@ -6762,7 +6740,7 @@ index 1ff43d5..96fec68 100644
mb();
/*
-@@ -141,8 +141,8 @@ void __cpuinit synchronise_count_slave(int cpu)
+@@ -141,8 +141,8 @@ void synchronise_count_slave(int cpu)
if (i == NR_LOOPS-1)
write_c0_count(initcount);
@@ -6774,19 +6752,20 @@ index 1ff43d5..96fec68 100644
}
/* Arrange for an interrupt in a short while */
diff --git a/arch/mips/kernel/traps.c b/arch/mips/kernel/traps.c
-index a75ae40..0d0f56a 100644
+index 524841f..3eef41e 100644
--- a/arch/mips/kernel/traps.c
+++ b/arch/mips/kernel/traps.c
-@@ -675,7 +675,17 @@ asmlinkage void do_ov(struct pt_regs *regs)
- {
+@@ -684,7 +684,18 @@ asmlinkage void do_ov(struct pt_regs *regs)
siginfo_t info;
+ prev_state = exception_enter();
- die_if_kernel("Integer overflow", regs);
+ if (unlikely(!user_mode(regs))) {
+
+#ifdef CONFIG_PAX_REFCOUNT
+ if (fixup_exception(regs)) {
+ pax_report_refcount_overflow(regs);
++ exception_exit(prev_state);
+ return;
+ }
+#endif
@@ -6797,10 +6776,10 @@ index a75ae40..0d0f56a 100644
info.si_code = FPE_INTOVF;
info.si_signo = SIGFPE;
diff --git a/arch/mips/mm/fault.c b/arch/mips/mm/fault.c
-index 0fead53..eeb00a6 100644
+index becc42b..9e43d4b 100644
--- a/arch/mips/mm/fault.c
+++ b/arch/mips/mm/fault.c
-@@ -27,6 +27,23 @@
+@@ -28,6 +28,23 @@
#include <asm/highmem.h> /* For VMALLOC_END */
#include <linux/kdebug.h>
@@ -6824,7 +6803,7 @@ index 0fead53..eeb00a6 100644
/*
* This routine handles page faults. It determines the address,
* and the problem, and then passes it off to one of the appropriate
-@@ -196,6 +213,14 @@ bad_area:
+@@ -199,6 +216,14 @@ bad_area:
bad_area_nosemaphore:
/* User mode accesses just cause a SIGSEGV */
if (user_mode(regs)) {
@@ -6840,7 +6819,7 @@ index 0fead53..eeb00a6 100644
tsk->thread.error_code = write;
#if 0
diff --git a/arch/mips/mm/mmap.c b/arch/mips/mm/mmap.c
-index 7e5fe27..9656513 100644
+index f1baadd..8537544 100644
--- a/arch/mips/mm/mmap.c
+++ b/arch/mips/mm/mmap.c
@@ -59,6 +59,7 @@ static unsigned long arch_get_unmapped_area_common(struct file *filp,
@@ -6891,7 +6870,7 @@ index 7e5fe27..9656513 100644
if (current->flags & PF_RANDOMIZE) {
random_factor = get_random_int();
random_factor = random_factor << PAGE_SHIFT;
-@@ -157,42 +167,27 @@ void arch_pick_mmap_layout(struct mm_struct *mm)
+@@ -157,40 +167,25 @@ void arch_pick_mmap_layout(struct mm_struct *mm)
if (mmap_is_legacy()) {
mm->mmap_base = TASK_UNMAPPED_BASE + random_factor;
@@ -6902,7 +6881,6 @@ index 7e5fe27..9656513 100644
+#endif
+
mm->get_unmapped_area = arch_get_unmapped_area;
- mm->unmap_area = arch_unmap_area;
} else {
mm->mmap_base = mmap_base(random_factor);
+
@@ -6912,7 +6890,6 @@ index 7e5fe27..9656513 100644
+#endif
+
mm->get_unmapped_area = arch_get_unmapped_area_topdown;
- mm->unmap_area = arch_unmap_area_topdown;
}
}
@@ -7123,7 +7100,7 @@ index fc987a1..6e068ef 100644
#endif
diff --git a/arch/parisc/include/asm/pgtable.h b/arch/parisc/include/asm/pgtable.h
-index 1e40d7f..a3eb445 100644
+index 34899b5..02dd060 100644
--- a/arch/parisc/include/asm/pgtable.h
+++ b/arch/parisc/include/asm/pgtable.h
@@ -223,6 +223,17 @@ extern void purge_tlb_entries(struct mm_struct *, unsigned long);
@@ -7339,10 +7316,10 @@ index 5dfd248..64914ac 100644
return addr;
}
diff --git a/arch/parisc/kernel/traps.c b/arch/parisc/kernel/traps.c
-index b3f87a3..5d5d03d 100644
+index 1cd1d0c..44ec918 100644
--- a/arch/parisc/kernel/traps.c
+++ b/arch/parisc/kernel/traps.c
-@@ -727,9 +727,7 @@ void notrace handle_interruption(int code, struct pt_regs *regs)
+@@ -722,9 +722,7 @@ void notrace handle_interruption(int code, struct pt_regs *regs)
down_read(&current->mm->mmap_sem);
vma = find_vma(current->mm,regs->iaoq[0]);
@@ -7354,7 +7331,7 @@ index b3f87a3..5d5d03d 100644
fault_space = regs->iasq[0];
diff --git a/arch/parisc/mm/fault.c b/arch/parisc/mm/fault.c
-index f247a34..dc0f219 100644
+index 0293588..3b229aa 100644
--- a/arch/parisc/mm/fault.c
+++ b/arch/parisc/mm/fault.c
@@ -15,6 +15,7 @@
@@ -7491,9 +7468,9 @@ index f247a34..dc0f219 100644
int fixup_exception(struct pt_regs *regs)
{
const struct exception_table_entry *fix;
-@@ -194,8 +305,33 @@ good_area:
+@@ -204,8 +315,33 @@ retry:
- acc_type = parisc_acctyp(code,regs->iir);
+ good_area:
- if ((vma->vm_flags & acc_type) != acc_type)
+ if ((vma->vm_flags & acc_type) != acc_type) {
@@ -7526,6 +7503,18 @@ index f247a34..dc0f219 100644
/*
* If for any reason at all we couldn't handle the fault, make
+diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
+index 38f3b7e..7e485c0 100644
+--- a/arch/powerpc/Kconfig
++++ b/arch/powerpc/Kconfig
+@@ -378,6 +378,7 @@ config ARCH_ENABLE_MEMORY_HOTREMOVE
+ config KEXEC
+ bool "kexec system call"
+ depends on (PPC_BOOK3S || FSL_BOOKE || (44x && !SMP))
++ depends on !GRKERNSEC_KMEM
+ help
+ kexec is a system call that implements the ability to shutdown your
+ current kernel, and to start another kernel. It is like a reboot
diff --git a/arch/powerpc/include/asm/atomic.h b/arch/powerpc/include/asm/atomic.h
index e3b1d41..8e81edf 100644
--- a/arch/powerpc/include/asm/atomic.h
@@ -7695,7 +7684,7 @@ index 88693ce..ac6f9ab 100644
#include <asm-generic/getorder.h>
diff --git a/arch/powerpc/include/asm/pgalloc-64.h b/arch/powerpc/include/asm/pgalloc-64.h
-index b66ae72..4a378cd 100644
+index f65e27b..23ffb5b 100644
--- a/arch/powerpc/include/asm/pgalloc-64.h
+++ b/arch/powerpc/include/asm/pgalloc-64.h
@@ -53,6 +53,7 @@ static inline void pgd_free(struct mm_struct *mm, pgd_t *pgd)
@@ -7727,7 +7716,7 @@ index b66ae72..4a378cd 100644
static inline void pmd_populate_kernel(struct mm_struct *mm, pmd_t *pmd,
pte_t *pte)
diff --git a/arch/powerpc/include/asm/pgtable.h b/arch/powerpc/include/asm/pgtable.h
-index 7aeb955..19f748e 100644
+index 7d6eacf..14c0240 100644
--- a/arch/powerpc/include/asm/pgtable.h
+++ b/arch/powerpc/include/asm/pgtable.h
@@ -2,6 +2,7 @@
@@ -7751,7 +7740,7 @@ index 4aad413..85d86bf 100644
#define _PAGE_NO_CACHE 0x020 /* I: cache inhibit */
#define _PAGE_WRITETHRU 0x040 /* W: cache write-through */
diff --git a/arch/powerpc/include/asm/reg.h b/arch/powerpc/include/asm/reg.h
-index e1fb161..2290d1d 100644
+index 10d1ef0..8f83abc 100644
--- a/arch/powerpc/include/asm/reg.h
+++ b/arch/powerpc/include/asm/reg.h
@@ -234,6 +234,7 @@
@@ -7763,7 +7752,7 @@ index e1fb161..2290d1d 100644
#define DSISR_ISSTORE 0x02000000 /* access was a store */
#define DSISR_DABRMATCH 0x00400000 /* hit data breakpoint */
diff --git a/arch/powerpc/include/asm/smp.h b/arch/powerpc/include/asm/smp.h
-index 48cfc85..891382f 100644
+index 98da78e..dc68271 100644
--- a/arch/powerpc/include/asm/smp.h
+++ b/arch/powerpc/include/asm/smp.h
@@ -50,7 +50,7 @@ struct smp_ops_t {
@@ -7810,7 +7799,7 @@ index ba7b197..d292e26 100644
#define _TIF_USER_WORK_MASK (_TIF_SIGPENDING | _TIF_NEED_RESCHED | \
_TIF_NOTIFY_RESUME | _TIF_UPROBE)
diff --git a/arch/powerpc/include/asm/uaccess.h b/arch/powerpc/include/asm/uaccess.h
-index 4db4959..aba5c41 100644
+index 9485b43..4718d50 100644
--- a/arch/powerpc/include/asm/uaccess.h
+++ b/arch/powerpc/include/asm/uaccess.h
@@ -318,52 +318,6 @@ do { \
@@ -7982,7 +7971,7 @@ index 4db4959..aba5c41 100644
static inline unsigned long clear_user(void __user *addr, unsigned long size)
diff --git a/arch/powerpc/kernel/exceptions-64e.S b/arch/powerpc/kernel/exceptions-64e.S
-index 645170a..6cf0271 100644
+index 2d06704..1616f1b 100644
--- a/arch/powerpc/kernel/exceptions-64e.S
+++ b/arch/powerpc/kernel/exceptions-64e.S
@@ -757,6 +757,7 @@ storage_fault_common:
@@ -8004,10 +7993,10 @@ index 645170a..6cf0271 100644
ld r4,_DAR(r1)
bl .bad_page_fault
diff --git a/arch/powerpc/kernel/exceptions-64s.S b/arch/powerpc/kernel/exceptions-64s.S
-index 902ca3c..e942155 100644
+index 3a9ed6a..b534681 100644
--- a/arch/powerpc/kernel/exceptions-64s.S
+++ b/arch/powerpc/kernel/exceptions-64s.S
-@@ -1357,10 +1357,10 @@ handle_page_fault:
+@@ -1364,10 +1364,10 @@ handle_page_fault:
11: ld r4,_DAR(r1)
ld r5,_DSISR(r1)
addi r3,r1,STACK_FRAME_OVERHEAD
@@ -8053,10 +8042,10 @@ index 2e3200c..72095ce 100644
/* Find this entry, or if that fails, the next avail. entry */
while (entry->jump[0]) {
diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c
-index 7baa27b..f6b394a 100644
+index 96d2fdf..f6d10c8 100644
--- a/arch/powerpc/kernel/process.c
+++ b/arch/powerpc/kernel/process.c
-@@ -884,8 +884,8 @@ void show_regs(struct pt_regs * regs)
+@@ -886,8 +886,8 @@ void show_regs(struct pt_regs * regs)
* Lookup NIP late so we have the best change of getting the
* above info out without failing
*/
@@ -8067,7 +8056,7 @@ index 7baa27b..f6b394a 100644
#endif
#ifdef CONFIG_PPC_TRANSACTIONAL_MEM
printk("PACATMSCRATCH [%llx]\n", get_paca()->tm_scratch);
-@@ -1345,10 +1345,10 @@ void show_stack(struct task_struct *tsk, unsigned long *stack)
+@@ -1352,10 +1352,10 @@ void show_stack(struct task_struct *tsk, unsigned long *stack)
newsp = stack[0];
ip = stack[STACK_FRAME_LR_SAVE];
if (!firstframe || ip != lr) {
@@ -8080,7 +8069,7 @@ index 7baa27b..f6b394a 100644
(void *)current->ret_stack[curr_frame].ret);
curr_frame--;
}
-@@ -1368,7 +1368,7 @@ void show_stack(struct task_struct *tsk, unsigned long *stack)
+@@ -1375,7 +1375,7 @@ void show_stack(struct task_struct *tsk, unsigned long *stack)
struct pt_regs *regs = (struct pt_regs *)
(sp + STACK_FRAME_OVERHEAD);
lr = regs->link;
@@ -8089,7 +8078,7 @@ index 7baa27b..f6b394a 100644
regs->trap, (void *)regs->nip, (void *)lr);
firstframe = 1;
}
-@@ -1404,58 +1404,3 @@ void notrace __ppc64_runlatch_off(void)
+@@ -1411,58 +1411,3 @@ void notrace __ppc64_runlatch_off(void)
mtspr(SPRN_CTRLT, ctrl);
}
#endif /* CONFIG_PPC64 */
@@ -8149,10 +8138,10 @@ index 7baa27b..f6b394a 100644
- return ret;
-}
diff --git a/arch/powerpc/kernel/ptrace.c b/arch/powerpc/kernel/ptrace.c
-index 64f7bd5..8dd550f 100644
+index 9a0d24c..e7fbedf 100644
--- a/arch/powerpc/kernel/ptrace.c
+++ b/arch/powerpc/kernel/ptrace.c
-@@ -1783,6 +1783,10 @@ long arch_ptrace(struct task_struct *child, long request,
+@@ -1761,6 +1761,10 @@ long arch_ptrace(struct task_struct *child, long request,
return ret;
}
@@ -8163,7 +8152,7 @@ index 64f7bd5..8dd550f 100644
/*
* We must return the syscall number to actually look up in the table.
* This can be -1L to skip running any syscall at all.
-@@ -1795,6 +1799,11 @@ long do_syscall_trace_enter(struct pt_regs *regs)
+@@ -1773,6 +1777,11 @@ long do_syscall_trace_enter(struct pt_regs *regs)
secure_computing_strict(regs->gpr[0]);
@@ -8175,7 +8164,7 @@ index 64f7bd5..8dd550f 100644
if (test_thread_flag(TIF_SYSCALL_TRACE) &&
tracehook_report_syscall_entry(regs))
/*
-@@ -1829,6 +1838,11 @@ void do_syscall_trace_leave(struct pt_regs *regs)
+@@ -1807,6 +1816,11 @@ void do_syscall_trace_leave(struct pt_regs *regs)
{
int step;
@@ -8188,10 +8177,10 @@ index 64f7bd5..8dd550f 100644
if (unlikely(test_thread_flag(TIF_SYSCALL_TRACEPOINT)))
diff --git a/arch/powerpc/kernel/signal_32.c b/arch/powerpc/kernel/signal_32.c
-index 7e9dff8..b63e4b5 100644
+index fea2dba..a779f6b 100644
--- a/arch/powerpc/kernel/signal_32.c
+++ b/arch/powerpc/kernel/signal_32.c
-@@ -993,7 +993,7 @@ int handle_rt_signal32(unsigned long sig, struct k_sigaction *ka,
+@@ -1002,7 +1002,7 @@ int handle_rt_signal32(unsigned long sig, struct k_sigaction *ka,
/* Save user registers on the stack */
frame = &rt_sf->uc.uc_mcontext;
addr = frame;
@@ -8201,10 +8190,10 @@ index 7e9dff8..b63e4b5 100644
tramp = current->mm->context.vdso_base + vdso32_rt_sigtramp;
} else {
diff --git a/arch/powerpc/kernel/signal_64.c b/arch/powerpc/kernel/signal_64.c
-index 35c20a1..e4bf34c 100644
+index 1e7ba88..17afb1b 100644
--- a/arch/powerpc/kernel/signal_64.c
+++ b/arch/powerpc/kernel/signal_64.c
-@@ -757,7 +757,7 @@ int handle_rt_signal64(int signr, struct k_sigaction *ka, siginfo_t *info,
+@@ -763,7 +763,7 @@ int handle_rt_signal64(int signr, struct k_sigaction *ka, siginfo_t *info,
#endif
/* Set up to return from userspace. */
@@ -8213,24 +8202,11 @@ index 35c20a1..e4bf34c 100644
regs->link = current->mm->context.vdso_base + vdso64_rt_sigtramp;
} else {
err |= setup_trampoline(__NR_rt_sigreturn, &frame->tramp[0]);
-diff --git a/arch/powerpc/kernel/sysfs.c b/arch/powerpc/kernel/sysfs.c
-index a15fd1a..869d32c 100644
---- a/arch/powerpc/kernel/sysfs.c
-+++ b/arch/powerpc/kernel/sysfs.c
-@@ -536,7 +536,7 @@ static int __cpuinit sysfs_cpu_notify(struct notifier_block *self,
- return NOTIFY_OK;
- }
-
--static struct notifier_block __cpuinitdata sysfs_cpu_nb = {
-+static struct notifier_block sysfs_cpu_nb = {
- .notifier_call = sysfs_cpu_notify,
- };
-
diff --git a/arch/powerpc/kernel/traps.c b/arch/powerpc/kernel/traps.c
-index 88929b1..bece8f8 100644
+index f783c93..619baf1 100644
--- a/arch/powerpc/kernel/traps.c
+++ b/arch/powerpc/kernel/traps.c
-@@ -141,6 +141,8 @@ static unsigned __kprobes long oops_begin(struct pt_regs *regs)
+@@ -142,6 +142,8 @@ static unsigned __kprobes long oops_begin(struct pt_regs *regs)
return flags;
}
@@ -8239,7 +8215,7 @@ index 88929b1..bece8f8 100644
static void __kprobes oops_end(unsigned long flags, struct pt_regs *regs,
int signr)
{
-@@ -190,6 +192,9 @@ static void __kprobes oops_end(unsigned long flags, struct pt_regs *regs,
+@@ -191,6 +193,9 @@ static void __kprobes oops_end(unsigned long flags, struct pt_regs *regs,
panic("Fatal exception in interrupt");
if (panic_on_oops)
panic("Fatal exception");
@@ -8250,7 +8226,7 @@ index 88929b1..bece8f8 100644
}
diff --git a/arch/powerpc/kernel/vdso.c b/arch/powerpc/kernel/vdso.c
-index d4f463a..8fb7431 100644
+index 1d9c926..25f4741 100644
--- a/arch/powerpc/kernel/vdso.c
+++ b/arch/powerpc/kernel/vdso.c
@@ -34,6 +34,7 @@
@@ -8315,7 +8291,7 @@ index 5eea6f3..5d10396 100644
EXPORT_SYMBOL(copy_in_user);
diff --git a/arch/powerpc/mm/fault.c b/arch/powerpc/mm/fault.c
-index 8726779..a33c512 100644
+index 51ab9e7..7d3c78b 100644
--- a/arch/powerpc/mm/fault.c
+++ b/arch/powerpc/mm/fault.c
@@ -33,6 +33,10 @@
@@ -8372,7 +8348,7 @@ index 8726779..a33c512 100644
else
is_write = error_code & DSISR_ISSTORE;
#else
-@@ -371,7 +402,7 @@ good_area:
+@@ -378,7 +409,7 @@ good_area:
* "undefined". Of those that can be set, this is the only
* one which seems bad.
*/
@@ -8381,7 +8357,7 @@ index 8726779..a33c512 100644
/* Guarded storage error. */
goto bad_area;
#endif /* CONFIG_8xx */
-@@ -386,7 +417,7 @@ good_area:
+@@ -393,7 +424,7 @@ good_area:
* processors use the same I/D cache coherency mechanism
* as embedded.
*/
@@ -8390,7 +8366,7 @@ index 8726779..a33c512 100644
goto bad_area;
#endif /* CONFIG_PPC_STD_MMU */
-@@ -471,6 +502,23 @@ bad_area:
+@@ -483,6 +514,23 @@ bad_area:
bad_area_nosemaphore:
/* User mode accesses cause a SIGSEGV */
if (user_mode(regs)) {
@@ -8414,10 +8390,10 @@ index 8726779..a33c512 100644
_exception(SIGSEGV, regs, code, address);
goto bail;
}
-diff --git a/arch/powerpc/mm/mmap_64.c b/arch/powerpc/mm/mmap_64.c
-index 67a42ed..cd463e0 100644
---- a/arch/powerpc/mm/mmap_64.c
-+++ b/arch/powerpc/mm/mmap_64.c
+diff --git a/arch/powerpc/mm/mmap.c b/arch/powerpc/mm/mmap.c
+index cb8bdbe..d770680 100644
+--- a/arch/powerpc/mm/mmap.c
++++ b/arch/powerpc/mm/mmap.c
@@ -57,6 +57,10 @@ static unsigned long mmap_rnd(void)
{
unsigned long rnd = 0;
@@ -8429,7 +8405,7 @@ index 67a42ed..cd463e0 100644
if (current->flags & PF_RANDOMIZE) {
/* 8MB for 32bit, 1GB for 64bit */
if (is_32bit_task())
-@@ -91,10 +95,22 @@ void arch_pick_mmap_layout(struct mm_struct *mm)
+@@ -91,9 +95,21 @@ void arch_pick_mmap_layout(struct mm_struct *mm)
*/
if (mmap_is_legacy()) {
mm->mmap_base = TASK_UNMAPPED_BASE;
@@ -8440,7 +8416,6 @@ index 67a42ed..cd463e0 100644
+#endif
+
mm->get_unmapped_area = arch_get_unmapped_area;
- mm->unmap_area = arch_unmap_area;
} else {
mm->mmap_base = mmap_base();
+
@@ -8450,34 +8425,8 @@ index 67a42ed..cd463e0 100644
+#endif
+
mm->get_unmapped_area = arch_get_unmapped_area_topdown;
- mm->unmap_area = arch_unmap_area_topdown;
}
-diff --git a/arch/powerpc/mm/mmu_context_nohash.c b/arch/powerpc/mm/mmu_context_nohash.c
-index e779642..e5bb889 100644
---- a/arch/powerpc/mm/mmu_context_nohash.c
-+++ b/arch/powerpc/mm/mmu_context_nohash.c
-@@ -363,7 +363,7 @@ static int __cpuinit mmu_context_cpu_notify(struct notifier_block *self,
- return NOTIFY_OK;
- }
-
--static struct notifier_block __cpuinitdata mmu_context_cpu_nb = {
-+static struct notifier_block mmu_context_cpu_nb = {
- .notifier_call = mmu_context_cpu_notify,
- };
-
-diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c
-index cafad40..9cbc0fc 100644
---- a/arch/powerpc/mm/numa.c
-+++ b/arch/powerpc/mm/numa.c
-@@ -920,7 +920,7 @@ static void __init *careful_zallocation(int nid, unsigned long size,
- return ret;
}
-
--static struct notifier_block __cpuinitdata ppc64_numa_nb = {
-+static struct notifier_block ppc64_numa_nb = {
- .notifier_call = cpu_numa_callback,
- .priority = 1 /* Must run before sched domains notifier. */
- };
diff --git a/arch/powerpc/mm/slice.c b/arch/powerpc/mm/slice.c
index 7ce9cf3..a964087 100644
--- a/arch/powerpc/mm/slice.c
@@ -8532,19 +8481,6 @@ index 9098692..3d54cd1 100644
{
struct spu_context *ctx = vma->vm_file->private_data;
unsigned long offset = address - vma->vm_start;
-diff --git a/arch/powerpc/platforms/powermac/smp.c b/arch/powerpc/platforms/powermac/smp.c
-index bdb738a..49c9f95 100644
---- a/arch/powerpc/platforms/powermac/smp.c
-+++ b/arch/powerpc/platforms/powermac/smp.c
-@@ -885,7 +885,7 @@ static int smp_core99_cpu_notify(struct notifier_block *self,
- return NOTIFY_OK;
- }
-
--static struct notifier_block __cpuinitdata smp_core99_cpu_nb = {
-+static struct notifier_block smp_core99_cpu_nb = {
- .notifier_call = smp_core99_cpu_notify,
- };
- #endif /* CONFIG_HOTPLUG_CPU */
diff --git a/arch/s390/include/asm/atomic.h b/arch/s390/include/asm/atomic.h
index c797832..ce575c8 100644
--- a/arch/s390/include/asm/atomic.h
@@ -8743,10 +8679,10 @@ index 7845e15..59c4353 100644
if (r_type == R_390_GOTPC)
rc = apply_rela_bits(loc, val, 1, 32, 0);
diff --git a/arch/s390/kernel/process.c b/arch/s390/kernel/process.c
-index 2bc3edd..ab9d598 100644
+index c5dbb33..b41f4ee 100644
--- a/arch/s390/kernel/process.c
+++ b/arch/s390/kernel/process.c
-@@ -236,39 +236,3 @@ unsigned long get_wchan(struct task_struct *p)
+@@ -237,39 +237,3 @@ unsigned long get_wchan(struct task_struct *p)
}
return 0;
}
@@ -8787,10 +8723,10 @@ index 2bc3edd..ab9d598 100644
- return ret;
-}
diff --git a/arch/s390/mm/mmap.c b/arch/s390/mm/mmap.c
-index 06bafec..2bca531 100644
+index 4002329..99b67cb 100644
--- a/arch/s390/mm/mmap.c
+++ b/arch/s390/mm/mmap.c
-@@ -90,10 +90,22 @@ void arch_pick_mmap_layout(struct mm_struct *mm)
+@@ -90,9 +90,21 @@ void arch_pick_mmap_layout(struct mm_struct *mm)
*/
if (mmap_is_legacy()) {
mm->mmap_base = TASK_UNMAPPED_BASE;
@@ -8801,7 +8737,6 @@ index 06bafec..2bca531 100644
+#endif
+
mm->get_unmapped_area = arch_get_unmapped_area;
- mm->unmap_area = arch_unmap_area;
} else {
mm->mmap_base = mmap_base();
+
@@ -8811,9 +8746,9 @@ index 06bafec..2bca531 100644
+#endif
+
mm->get_unmapped_area = arch_get_unmapped_area_topdown;
- mm->unmap_area = arch_unmap_area_topdown;
}
-@@ -175,10 +187,22 @@ void arch_pick_mmap_layout(struct mm_struct *mm)
+ }
+@@ -173,9 +185,21 @@ void arch_pick_mmap_layout(struct mm_struct *mm)
*/
if (mmap_is_legacy()) {
mm->mmap_base = TASK_UNMAPPED_BASE;
@@ -8824,7 +8759,6 @@ index 06bafec..2bca531 100644
+#endif
+
mm->get_unmapped_area = s390_get_unmapped_area;
- mm->unmap_area = arch_unmap_area;
} else {
mm->mmap_base = mmap_base();
+
@@ -8834,8 +8768,8 @@ index 06bafec..2bca531 100644
+#endif
+
mm->get_unmapped_area = s390_get_unmapped_area_topdown;
- mm->unmap_area = arch_unmap_area_topdown;
}
+ }
diff --git a/arch/score/include/asm/cache.h b/arch/score/include/asm/cache.h
index ae3d59f..f65f075 100644
--- a/arch/score/include/asm/cache.h
@@ -8864,7 +8798,7 @@ index f9f3cd5..58ff438 100644
#endif /* _ASM_SCORE_EXEC_H */
diff --git a/arch/score/kernel/process.c b/arch/score/kernel/process.c
-index f4c6d02..e9355c3 100644
+index a1519ad3..e8ac1ff 100644
--- a/arch/score/kernel/process.c
+++ b/arch/score/kernel/process.c
@@ -116,8 +116,3 @@ unsigned long get_wchan(struct task_struct *task)
@@ -8893,19 +8827,6 @@ index ef9e555..331bd29 100644
#define __read_mostly __attribute__((__section__(".data..read_mostly")))
-diff --git a/arch/sh/kernel/cpu/sh4a/smp-shx3.c b/arch/sh/kernel/cpu/sh4a/smp-shx3.c
-index 03f2b55..b0270327 100644
---- a/arch/sh/kernel/cpu/sh4a/smp-shx3.c
-+++ b/arch/sh/kernel/cpu/sh4a/smp-shx3.c
-@@ -143,7 +143,7 @@ shx3_cpu_callback(struct notifier_block *nfb, unsigned long action, void *hcpu)
- return NOTIFY_OK;
- }
-
--static struct notifier_block __cpuinitdata shx3_cpu_notifier = {
-+static struct notifier_block shx3_cpu_notifier = {
- .notifier_call = shx3_cpu_callback,
- };
-
diff --git a/arch/sh/mm/mmap.c b/arch/sh/mm/mmap.c
index 6777177..cb5e44f 100644
--- a/arch/sh/mm/mmap.c
@@ -9257,7 +9178,7 @@ index bcfe063..b333142 100644
static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long addr)
{
diff --git a/arch/sparc/include/asm/pgtable_32.h b/arch/sparc/include/asm/pgtable_32.h
-index 6fc1348..390c50a 100644
+index 502f632..da1917f 100644
--- a/arch/sparc/include/asm/pgtable_32.h
+++ b/arch/sparc/include/asm/pgtable_32.h
@@ -50,6 +50,9 @@ extern unsigned long calc_highpages(void);
@@ -9571,22 +9492,22 @@ index e562d3c..191f176 100644
{
- unsigned long ret = ___copy_to_user(to, from, size);
+ unsigned long ret;
-+
+
+ if ((long)size < 0 || size > INT_MAX)
+ return size;
+
+ if (!__builtin_constant_p(size))
+ check_object_size(from, size, true);
-
++
+ ret = ___copy_to_user(to, from, size);
if (unlikely(ret))
ret = copy_to_user_fixup(to, from, size);
return ret;
diff --git a/arch/sparc/kernel/Makefile b/arch/sparc/kernel/Makefile
-index d432fb2..6056af1 100644
+index d15cc17..d0ae796 100644
--- a/arch/sparc/kernel/Makefile
+++ b/arch/sparc/kernel/Makefile
-@@ -3,7 +3,7 @@
+@@ -4,7 +4,7 @@
#
asflags-y := -ansi
@@ -9595,27 +9516,6 @@ index d432fb2..6056af1 100644
extra-y := head_$(BITS).o
-diff --git a/arch/sparc/kernel/ds.c b/arch/sparc/kernel/ds.c
-index 252f876..2656fdd 100644
---- a/arch/sparc/kernel/ds.c
-+++ b/arch/sparc/kernel/ds.c
-@@ -783,6 +783,16 @@ void ldom_set_var(const char *var, const char *value)
- char *base, *p;
- int msg_len, loops;
-
-+ if (strlen(var) + strlen(value) + 2 >
-+ sizeof(pkt) - sizeof(pkt.header)) {
-+ printk(KERN_ERR PFX
-+ "contents length: %zu, which more than max: %lu,"
-+ "so could not set (%s) variable to (%s).\n",
-+ strlen(var) + strlen(value) + 2,
-+ sizeof(pkt) - sizeof(pkt.header), var, value);
-+ return;
-+ }
-+
- memset(&pkt, 0, sizeof(pkt));
- pkt.header.data.tag.type = DS_DATA;
- pkt.header.data.handle = cp->handle;
diff --git a/arch/sparc/kernel/process_32.c b/arch/sparc/kernel/process_32.c
index fdd819d..5af08c8 100644
--- a/arch/sparc/kernel/process_32.c
@@ -9700,10 +9600,10 @@ index 79cc0d1..ec62734 100644
.getproplen = prom_getproplen,
.getproperty = prom_getproperty,
diff --git a/arch/sparc/kernel/ptrace_64.c b/arch/sparc/kernel/ptrace_64.c
-index 7ff45e4..a58f271 100644
+index 773c1f2..a8bdd87 100644
--- a/arch/sparc/kernel/ptrace_64.c
+++ b/arch/sparc/kernel/ptrace_64.c
-@@ -1057,6 +1057,10 @@ long arch_ptrace(struct task_struct *child, long request,
+@@ -1059,6 +1059,10 @@ long arch_ptrace(struct task_struct *child, long request,
return ret;
}
@@ -9714,7 +9614,7 @@ index 7ff45e4..a58f271 100644
asmlinkage int syscall_trace_enter(struct pt_regs *regs)
{
int ret = 0;
-@@ -1064,6 +1068,11 @@ asmlinkage int syscall_trace_enter(struct pt_regs *regs)
+@@ -1066,6 +1070,11 @@ asmlinkage int syscall_trace_enter(struct pt_regs *regs)
/* do the secure computing check first */
secure_computing_strict(regs->u_regs[UREG_G1]);
@@ -9726,7 +9626,7 @@ index 7ff45e4..a58f271 100644
if (test_thread_flag(TIF_SYSCALL_TRACE))
ret = tracehook_report_syscall_entry(regs);
-@@ -1084,6 +1093,11 @@ asmlinkage int syscall_trace_enter(struct pt_regs *regs)
+@@ -1086,6 +1095,11 @@ asmlinkage int syscall_trace_enter(struct pt_regs *regs)
asmlinkage void syscall_trace_leave(struct pt_regs *regs)
{
@@ -9739,10 +9639,10 @@ index 7ff45e4..a58f271 100644
if (unlikely(test_thread_flag(TIF_SYSCALL_TRACEPOINT)))
diff --git a/arch/sparc/kernel/smp_64.c b/arch/sparc/kernel/smp_64.c
-index 77539ed..3ffffe7 100644
+index e142545..fd29654 100644
--- a/arch/sparc/kernel/smp_64.c
+++ b/arch/sparc/kernel/smp_64.c
-@@ -868,8 +868,8 @@ extern unsigned long xcall_flush_dcache_page_cheetah;
+@@ -869,8 +869,8 @@ extern unsigned long xcall_flush_dcache_page_cheetah;
extern unsigned long xcall_flush_dcache_page_spitfire;
#ifdef CONFIG_DEBUG_DCFLUSH
@@ -9753,7 +9653,7 @@ index 77539ed..3ffffe7 100644
#endif
static inline void __local_flush_dcache_page(struct page *page)
-@@ -893,7 +893,7 @@ void smp_flush_dcache_page_impl(struct page *page, int cpu)
+@@ -894,7 +894,7 @@ void smp_flush_dcache_page_impl(struct page *page, int cpu)
return;
#ifdef CONFIG_DEBUG_DCFLUSH
@@ -9762,7 +9662,7 @@ index 77539ed..3ffffe7 100644
#endif
this_cpu = get_cpu();
-@@ -917,7 +917,7 @@ void smp_flush_dcache_page_impl(struct page *page, int cpu)
+@@ -918,7 +918,7 @@ void smp_flush_dcache_page_impl(struct page *page, int cpu)
xcall_deliver(data0, __pa(pg_addr),
(u64) pg_addr, cpumask_of(cpu));
#ifdef CONFIG_DEBUG_DCFLUSH
@@ -9771,7 +9671,7 @@ index 77539ed..3ffffe7 100644
#endif
}
}
-@@ -936,7 +936,7 @@ void flush_dcache_page_all(struct mm_struct *mm, struct page *page)
+@@ -937,7 +937,7 @@ void flush_dcache_page_all(struct mm_struct *mm, struct page *page)
preempt_disable();
#ifdef CONFIG_DEBUG_DCFLUSH
@@ -9780,7 +9680,7 @@ index 77539ed..3ffffe7 100644
#endif
data0 = 0;
pg_addr = page_address(page);
-@@ -953,7 +953,7 @@ void flush_dcache_page_all(struct mm_struct *mm, struct page *page)
+@@ -954,7 +954,7 @@ void flush_dcache_page_all(struct mm_struct *mm, struct page *page)
xcall_deliver(data0, __pa(pg_addr),
(u64) pg_addr, cpu_online_mask);
#ifdef CONFIG_DEBUG_DCFLUSH
@@ -9803,7 +9703,7 @@ index 3a8d184..49498a8 100644
info.flags = 0;
info.length = len;
diff --git a/arch/sparc/kernel/sys_sparc_64.c b/arch/sparc/kernel/sys_sparc_64.c
-index 2daaaa6..4fb84dc 100644
+index 51561b8..8256764 100644
--- a/arch/sparc/kernel/sys_sparc_64.c
+++ b/arch/sparc/kernel/sys_sparc_64.c
@@ -90,13 +90,14 @@ unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr, unsi
@@ -9960,9 +9860,9 @@ index 2daaaa6..4fb84dc 100644
+#endif
+
mm->get_unmapped_area = arch_get_unmapped_area;
- mm->unmap_area = arch_unmap_area;
} else {
-@@ -301,6 +333,12 @@ void arch_pick_mmap_layout(struct mm_struct *mm)
+ /* We know it's 32-bit */
+@@ -300,6 +332,12 @@ void arch_pick_mmap_layout(struct mm_struct *mm)
gap = (task_size / 6 * 5);
mm->mmap_base = PAGE_ALIGN(task_size - gap - random_factor);
@@ -9973,10 +9873,10 @@ index 2daaaa6..4fb84dc 100644
+#endif
+
mm->get_unmapped_area = arch_get_unmapped_area_topdown;
- mm->unmap_area = arch_unmap_area_topdown;
}
+ }
diff --git a/arch/sparc/kernel/syscalls.S b/arch/sparc/kernel/syscalls.S
-index 73ec8a7..4611979 100644
+index d950197..192f9d8 100644
--- a/arch/sparc/kernel/syscalls.S
+++ b/arch/sparc/kernel/syscalls.S
@@ -52,7 +52,7 @@ sys32_rt_sigreturn:
@@ -10015,19 +9915,6 @@ index 73ec8a7..4611979 100644
ldx [%sp + PTREGS_OFF + PT_V9_TNPC], %l1 ! pc = npc
2:
-diff --git a/arch/sparc/kernel/sysfs.c b/arch/sparc/kernel/sysfs.c
-index 654e8aa..45f431b 100644
---- a/arch/sparc/kernel/sysfs.c
-+++ b/arch/sparc/kernel/sysfs.c
-@@ -266,7 +266,7 @@ static int __cpuinit sysfs_cpu_notify(struct notifier_block *self,
- return NOTIFY_OK;
- }
-
--static struct notifier_block __cpuinitdata sysfs_cpu_nb = {
-+static struct notifier_block sysfs_cpu_nb = {
- .notifier_call = sysfs_cpu_notify,
- };
-
diff --git a/arch/sparc/kernel/traps_32.c b/arch/sparc/kernel/traps_32.c
index 6629829..036032d 100644
--- a/arch/sparc/kernel/traps_32.c
@@ -10528,7 +10415,7 @@ index 30c3ecc..736f015 100644
obj-$(CONFIG_SPARC64) += ultra.o tlb.o tsb.o gup.o
obj-y += fault_$(BITS).o
diff --git a/arch/sparc/mm/fault_32.c b/arch/sparc/mm/fault_32.c
-index e98bfda..ea8d221 100644
+index 59dbd46..1dd7f5e 100644
--- a/arch/sparc/mm/fault_32.c
+++ b/arch/sparc/mm/fault_32.c
@@ -21,6 +21,9 @@
@@ -10819,7 +10706,7 @@ index e98bfda..ea8d221 100644
static noinline void do_fault_siginfo(int code, int sig, struct pt_regs *regs,
int text_fault)
{
-@@ -230,6 +504,24 @@ good_area:
+@@ -229,6 +503,24 @@ good_area:
if (!(vma->vm_flags & VM_WRITE))
goto bad_area;
} else {
@@ -10845,7 +10732,7 @@ index e98bfda..ea8d221 100644
if (!(vma->vm_flags & (VM_READ | VM_EXEC)))
goto bad_area;
diff --git a/arch/sparc/mm/fault_64.c b/arch/sparc/mm/fault_64.c
-index 5062ff3..e0b75f3 100644
+index 2ebec26..b212598 100644
--- a/arch/sparc/mm/fault_64.c
+++ b/arch/sparc/mm/fault_64.c
@@ -21,6 +21,9 @@
@@ -11334,7 +11221,7 @@ index 5062ff3..e0b75f3 100644
asmlinkage void __kprobes do_sparc64_fault(struct pt_regs *regs)
{
struct mm_struct *mm = current->mm;
-@@ -341,6 +804,29 @@ retry:
+@@ -342,6 +805,29 @@ retry:
if (!vma)
goto bad_area;
@@ -11365,7 +11252,7 @@ index 5062ff3..e0b75f3 100644
* load/store/atomic was a write or not, it only says that there
* was no match. So in such a case we (carefully) read the
diff --git a/arch/sparc/mm/hugetlbpage.c b/arch/sparc/mm/hugetlbpage.c
-index d2b5944..d878f3c 100644
+index 9639964..806cd0c 100644
--- a/arch/sparc/mm/hugetlbpage.c
+++ b/arch/sparc/mm/hugetlbpage.c
@@ -28,7 +28,8 @@ static unsigned long hugetlb_get_unmapped_area_bottomup(struct file *filp,
@@ -11469,7 +11356,7 @@ index d2b5944..d878f3c 100644
pte_t *huge_pte_alloc(struct mm_struct *mm,
diff --git a/arch/sparc/mm/init_64.c b/arch/sparc/mm/init_64.c
-index 04fd55a..4ede686 100644
+index ed82eda..0d80e77 100644
--- a/arch/sparc/mm/init_64.c
+++ b/arch/sparc/mm/init_64.c
@@ -188,9 +188,9 @@ unsigned long sparc64_kern_sec_context __read_mostly;
@@ -11506,11 +11393,23 @@ index 04fd55a..4ede686 100644
#endif /* CONFIG_SMP */
#endif /* CONFIG_DEBUG_DCFLUSH */
}
+diff --git a/arch/tile/Kconfig b/arch/tile/Kconfig
+index d45a2c4..3c05a78 100644
+--- a/arch/tile/Kconfig
++++ b/arch/tile/Kconfig
+@@ -185,6 +185,7 @@ source "kernel/Kconfig.hz"
+
+ config KEXEC
+ bool "kexec system call"
++ depends on !GRKERNSEC_KMEM
+ ---help---
+ kexec is a system call that implements the ability to shutdown your
+ current kernel, and to start another kernel. It is like a reboot
diff --git a/arch/tile/include/asm/atomic_64.h b/arch/tile/include/asm/atomic_64.h
-index f4500c6..889656c 100644
+index ad220ee..2f537b3 100644
--- a/arch/tile/include/asm/atomic_64.h
+++ b/arch/tile/include/asm/atomic_64.h
-@@ -143,6 +143,16 @@ static inline long atomic64_add_unless(atomic64_t *v, long a, long u)
+@@ -105,6 +105,16 @@ static inline long atomic64_add_unless(atomic64_t *v, long a, long u)
#define atomic64_inc_not_zero(v) atomic64_add_unless((v), 1, 0)
@@ -11528,7 +11427,7 @@ index f4500c6..889656c 100644
#define smp_mb__before_atomic_dec() smp_mb()
#define smp_mb__after_atomic_dec() smp_mb()
diff --git a/arch/tile/include/asm/cache.h b/arch/tile/include/asm/cache.h
-index a9a5299..0fce79e 100644
+index 6160761..00cac88 100644
--- a/arch/tile/include/asm/cache.h
+++ b/arch/tile/include/asm/cache.h
@@ -15,11 +15,12 @@
@@ -11546,10 +11445,10 @@ index a9a5299..0fce79e 100644
/* bytes per L2 cache line */
#define L2_CACHE_SHIFT CHIP_L2_LOG_LINE_SIZE()
diff --git a/arch/tile/include/asm/uaccess.h b/arch/tile/include/asm/uaccess.h
-index 8a082bc..7a6bf87 100644
+index b6cde32..c0cb736 100644
--- a/arch/tile/include/asm/uaccess.h
+++ b/arch/tile/include/asm/uaccess.h
-@@ -408,9 +408,9 @@ static inline unsigned long __must_check copy_from_user(void *to,
+@@ -414,9 +414,9 @@ static inline unsigned long __must_check copy_from_user(void *to,
const void __user *from,
unsigned long n)
{
@@ -11562,10 +11461,10 @@ index 8a082bc..7a6bf87 100644
else
copy_from_user_overflow();
diff --git a/arch/tile/mm/hugetlbpage.c b/arch/tile/mm/hugetlbpage.c
-index 650ccff..45fe2d6 100644
+index 0cb3bba..7338b2d 100644
--- a/arch/tile/mm/hugetlbpage.c
+++ b/arch/tile/mm/hugetlbpage.c
-@@ -239,6 +239,7 @@ static unsigned long hugetlb_get_unmapped_area_bottomup(struct file *file,
+@@ -212,6 +212,7 @@ static unsigned long hugetlb_get_unmapped_area_bottomup(struct file *file,
info.high_limit = TASK_SIZE;
info.align_mask = PAGE_MASK & ~huge_page_mask(h);
info.align_offset = 0;
@@ -11573,7 +11472,7 @@ index 650ccff..45fe2d6 100644
return vm_unmapped_area(&info);
}
-@@ -256,6 +257,7 @@ static unsigned long hugetlb_get_unmapped_area_topdown(struct file *file,
+@@ -229,6 +230,7 @@ static unsigned long hugetlb_get_unmapped_area_topdown(struct file *file,
info.high_limit = current->mm->mmap_base;
info.align_mask = PAGE_MASK & ~huge_page_mask(h);
info.align_offset = 0;
@@ -11597,7 +11496,7 @@ index 133f7de..1d6f2f1 100644
include $(srctree)/$(ARCH_DIR)/Makefile-os-$(OS)
diff --git a/arch/um/defconfig b/arch/um/defconfig
-index 08107a7..ab22afe 100644
+index 2665e6b..3e3822b 100644
--- a/arch/um/defconfig
+++ b/arch/um/defconfig
@@ -51,7 +51,6 @@ CONFIG_X86_CMPXCHG=y
@@ -11711,10 +11610,10 @@ index ad8f795..2c7eec6 100644
/*
* Memory returned by kmalloc() may be used for DMA, so we must make
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
-index fe120da..24177f7 100644
+index f67e839..bfd4748 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
-@@ -239,7 +239,7 @@ config X86_HT
+@@ -247,7 +247,7 @@ config X86_HT
config X86_32_LAZY_GS
def_bool y
@@ -11723,7 +11622,7 @@ index fe120da..24177f7 100644
config ARCH_HWEIGHT_CFLAGS
string
-@@ -1073,6 +1073,7 @@ config MICROCODE_EARLY
+@@ -1099,6 +1099,7 @@ config MICROCODE_EARLY
config X86_MSR
tristate "/dev/cpu/*/msr - Model-specific register support"
@@ -11731,7 +11630,7 @@ index fe120da..24177f7 100644
---help---
This device gives privileged processes access to the x86
Model-Specific Registers (MSRs). It is a character device with
-@@ -1096,7 +1097,7 @@ choice
+@@ -1122,7 +1123,7 @@ choice
config NOHIGHMEM
bool "off"
@@ -11740,7 +11639,7 @@ index fe120da..24177f7 100644
---help---
Linux can use up to 64 Gigabytes of physical memory on x86 systems.
However, the address space of 32-bit x86 processors is only 4
-@@ -1133,7 +1134,7 @@ config NOHIGHMEM
+@@ -1159,7 +1160,7 @@ config NOHIGHMEM
config HIGHMEM4G
bool "4GB"
@@ -11749,7 +11648,7 @@ index fe120da..24177f7 100644
---help---
Select this if you have a 32-bit processor and between 1 and 4
gigabytes of physical RAM.
-@@ -1186,7 +1187,7 @@ config PAGE_OFFSET
+@@ -1212,7 +1213,7 @@ config PAGE_OFFSET
hex
default 0xB0000000 if VMSPLIT_3G_OPT
default 0x80000000 if VMSPLIT_2G
@@ -11758,7 +11657,7 @@ index fe120da..24177f7 100644
default 0x40000000 if VMSPLIT_1G
default 0xC0000000
depends on X86_32
-@@ -1584,6 +1585,7 @@ config SECCOMP
+@@ -1614,6 +1615,7 @@ config SECCOMP
config CC_STACKPROTECTOR
bool "Enable -fstack-protector buffer overflow detection"
@@ -11766,16 +11665,24 @@ index fe120da..24177f7 100644
---help---
This option turns on the -fstack-protector GCC feature. This
feature puts, at the beginning of functions, a canary value on
-@@ -1703,6 +1705,8 @@ config X86_NEED_RELOCS
+@@ -1632,6 +1634,7 @@ source kernel/Kconfig.hz
+
+ config KEXEC
+ bool "kexec system call"
++ depends on !GRKERNSEC_KMEM
+ ---help---
+ kexec is a system call that implements the ability to shutdown your
+ current kernel, and to start another kernel. It is like a reboot
+@@ -1733,6 +1736,8 @@ config X86_NEED_RELOCS
config PHYSICAL_ALIGN
- hex "Alignment value to which kernel should be aligned" if X86_32
+ hex "Alignment value to which kernel should be aligned"
default "0x1000000"
+ range 0x200000 0x1000000 if PAX_KERNEXEC && X86_PAE
+ range 0x400000 0x1000000 if PAX_KERNEXEC && !X86_PAE
- range 0x2000 0x1000000
+ range 0x2000 0x1000000 if X86_32
+ range 0x200000 0x1000000 if X86_64
---help---
- This value puts the alignment restrictions on physical address
-@@ -1778,9 +1782,10 @@ config DEBUG_HOTPLUG_CPU0
+@@ -1812,9 +1817,10 @@ config DEBUG_HOTPLUG_CPU0
If unsure, say N.
config COMPAT_VDSO
@@ -11819,10 +11726,10 @@ index c026cca..14657ae 100644
config X86_MINIMUM_CPU_FAMILY
int
diff --git a/arch/x86/Kconfig.debug b/arch/x86/Kconfig.debug
-index c198b7e..63eea60 100644
+index 78d91af..8ceb94b 100644
--- a/arch/x86/Kconfig.debug
+++ b/arch/x86/Kconfig.debug
-@@ -84,7 +84,7 @@ config X86_PTDUMP
+@@ -74,7 +74,7 @@ config X86_PTDUMP
config DEBUG_RODATA
bool "Write protect kernel read-only data structures"
default y
@@ -11831,7 +11738,7 @@ index c198b7e..63eea60 100644
---help---
Mark the kernel read-only data as write-protected in the pagetables,
in order to catch accidental (and incorrect) writes to such const
-@@ -102,7 +102,7 @@ config DEBUG_RODATA_TEST
+@@ -92,7 +92,7 @@ config DEBUG_RODATA_TEST
config DEBUG_SET_MODULE_RONX
bool "Set loadable kernel module data as NX and text as RO"
@@ -11841,10 +11748,18 @@ index c198b7e..63eea60 100644
This option helps catch unintended modifications to loadable
kernel module's text and read-only data. It also prevents execution
diff --git a/arch/x86/Makefile b/arch/x86/Makefile
-index 5c47726..8c4fa67 100644
+index 41250fb..863762e 100644
--- a/arch/x86/Makefile
+++ b/arch/x86/Makefile
-@@ -54,6 +54,7 @@ else
+@@ -46,14 +46,12 @@ ifeq ($(CONFIG_X86_32),y)
+ # CPU-specific tuning. Anything which can be shared with UML should go here.
+ include $(srctree)/arch/x86/Makefile_32.cpu
+ KBUILD_CFLAGS += $(cflags-y)
+-
+- # temporary until string.h is fixed
+- KBUILD_CFLAGS += -ffreestanding
+ else
+ BITS := 64
UTS_MACHINE := x86_64
CHECKFLAGS += -D__x86_64__ -m64
@@ -11852,9 +11767,19 @@ index 5c47726..8c4fa67 100644
KBUILD_AFLAGS += -m64
KBUILD_CFLAGS += -m64
-@@ -234,3 +235,12 @@ define archhelp
- echo ' FDARGS="..." arguments for the booted kernel'
+@@ -83,6 +81,9 @@ else
+ KBUILD_CFLAGS += -maccumulate-outgoing-args
+ endif
+
++# temporary until string.h is fixed
++KBUILD_CFLAGS += -ffreestanding
++
+ ifdef CONFIG_CC_STACKPROTECTOR
+ cc_has_sp := $(srctree)/scripts/gcc-x86_$(BITS)-has-stack-protector.sh
+ ifeq ($(shell $(CONFIG_SHELL) $(cc_has_sp) $(CC) $(KBUILD_CPPFLAGS) $(biarch)),y)
+@@ -241,3 +242,12 @@ define archhelp
echo ' FDINITRD=file initrd for the booted kernel'
+ echo ' kvmconfig - Enable additional options for guest kernel support'
endef
+
+define OLD_LD
@@ -11902,7 +11827,7 @@ index 878e4b9..20537ab 100644
#endif /* BOOT_BITOPS_H */
diff --git a/arch/x86/boot/boot.h b/arch/x86/boot/boot.h
-index 5b75319..331a4ca 100644
+index ef72bae..353a184 100644
--- a/arch/x86/boot/boot.h
+++ b/arch/x86/boot/boot.h
@@ -85,7 +85,7 @@ static inline void io_delay(void)
@@ -11924,10 +11849,10 @@ index 5b75319..331a4ca 100644
return diff;
}
diff --git a/arch/x86/boot/compressed/Makefile b/arch/x86/boot/compressed/Makefile
-index 5ef205c..342191d 100644
+index dcd90df..c830d7d 100644
--- a/arch/x86/boot/compressed/Makefile
+++ b/arch/x86/boot/compressed/Makefile
-@@ -14,6 +14,9 @@ cflags-$(CONFIG_X86_64) := -mcmodel=small
+@@ -15,6 +15,9 @@ cflags-$(CONFIG_X86_64) := -mcmodel=small
KBUILD_CFLAGS += $(cflags-y)
KBUILD_CFLAGS += $(call cc-option,-ffreestanding)
KBUILD_CFLAGS += $(call cc-option,-fno-stack-protector)
@@ -11938,7 +11863,7 @@ index 5ef205c..342191d 100644
KBUILD_AFLAGS := $(KBUILD_CFLAGS) -D__ASSEMBLY__
GCOV_PROFILE := n
diff --git a/arch/x86/boot/compressed/eboot.c b/arch/x86/boot/compressed/eboot.c
-index d606463..b887794 100644
+index b7388a4..03844ec 100644
--- a/arch/x86/boot/compressed/eboot.c
+++ b/arch/x86/boot/compressed/eboot.c
@@ -150,7 +150,6 @@ again:
@@ -12000,7 +11925,7 @@ index a53440e..c3dbf1e 100644
.previous
diff --git a/arch/x86/boot/compressed/head_32.S b/arch/x86/boot/compressed/head_32.S
-index 1e3184f..0d11e2e 100644
+index 5d6f689..9d06730 100644
--- a/arch/x86/boot/compressed/head_32.S
+++ b/arch/x86/boot/compressed/head_32.S
@@ -118,7 +118,7 @@ preferred_addr:
@@ -12012,30 +11937,11 @@ index 1e3184f..0d11e2e 100644
#endif
/* Target address to relocate to for decompression */
-@@ -204,7 +204,7 @@ relocated:
- * and where it was actually loaded.
- */
- movl %ebp, %ebx
-- subl $LOAD_PHYSICAL_ADDR, %ebx
-+ subl $____LOAD_PHYSICAL_ADDR, %ebx
- jz 2f /* Nothing to be done if loaded at compiled addr. */
- /*
- * Process relocations.
-@@ -212,8 +212,7 @@ relocated:
-
- 1: subl $4, %edi
- movl (%edi), %ecx
-- testl %ecx, %ecx
-- jz 2f
-+ jecxz 2f
- addl %ebx, -__PAGE_OFFSET(%ebx, %ecx)
- jmp 1b
- 2:
diff --git a/arch/x86/boot/compressed/head_64.S b/arch/x86/boot/compressed/head_64.S
-index 16f24e6..47491a3 100644
+index c337422..2c5be72 100644
--- a/arch/x86/boot/compressed/head_64.S
+++ b/arch/x86/boot/compressed/head_64.S
-@@ -97,7 +97,7 @@ ENTRY(startup_32)
+@@ -95,7 +95,7 @@ ENTRY(startup_32)
notl %eax
andl %eax, %ebx
#else
@@ -12044,7 +11950,7 @@ index 16f24e6..47491a3 100644
#endif
/* Target address to relocate to for decompression */
-@@ -272,7 +272,7 @@ preferred_addr:
+@@ -270,7 +270,7 @@ preferred_addr:
notq %rax
andq %rax, %rbp
#else
@@ -12053,7 +11959,7 @@ index 16f24e6..47491a3 100644
#endif
/* Target address to relocate to for decompression */
-@@ -363,8 +363,8 @@ gdt:
+@@ -362,8 +362,8 @@ gdt:
.long gdt
.word 0
.quad 0x0000000000000000 /* NULL descriptor */
@@ -12065,10 +11971,19 @@ index 16f24e6..47491a3 100644
.quad 0x0000000000000000 /* TS continued */
gdt_end:
diff --git a/arch/x86/boot/compressed/misc.c b/arch/x86/boot/compressed/misc.c
-index 7cb56c6..d382d84 100644
+index 434f077..b6b4b38 100644
--- a/arch/x86/boot/compressed/misc.c
+++ b/arch/x86/boot/compressed/misc.c
-@@ -303,7 +303,7 @@ static void parse_elf(void *output)
+@@ -283,7 +283,7 @@ static void handle_relocations(void *output, unsigned long output_len)
+ * Calculate the delta between where vmlinux was linked to load
+ * and where it was actually loaded.
+ */
+- delta = min_addr - LOAD_PHYSICAL_ADDR;
++ delta = min_addr - ____LOAD_PHYSICAL_ADDR;
+ if (!delta) {
+ debug_putstr("No relocation needed... ");
+ return;
+@@ -380,7 +380,7 @@ static void parse_elf(void *output)
case PT_LOAD:
#ifdef CONFIG_RELOCATABLE
dest = output;
@@ -12077,7 +11992,7 @@ index 7cb56c6..d382d84 100644
#else
dest = (void *)(phdr->p_paddr);
#endif
-@@ -354,7 +354,7 @@ asmlinkage void decompress_kernel(void *rmode, memptr heap,
+@@ -432,7 +432,7 @@ asmlinkage void decompress_kernel(void *rmode, memptr heap,
error("Destination address too large");
#endif
#ifndef CONFIG_RELOCATABLE
@@ -12445,57 +12360,6 @@ index 477e9d7..3ab339f 100644
ret
ENDPROC(aesni_xts_crypt8)
-diff --git a/arch/x86/crypto/blowfish-avx2-asm_64.S b/arch/x86/crypto/blowfish-avx2-asm_64.S
-index 784452e..46982c7 100644
---- a/arch/x86/crypto/blowfish-avx2-asm_64.S
-+++ b/arch/x86/crypto/blowfish-avx2-asm_64.S
-@@ -221,6 +221,7 @@ __blowfish_enc_blk32:
-
- write_block(RXl, RXr);
-
-+ pax_force_retaddr 0, 1
- ret;
- ENDPROC(__blowfish_enc_blk32)
-
-@@ -250,6 +251,7 @@ __blowfish_dec_blk32:
-
- write_block(RXl, RXr);
-
-+ pax_force_retaddr 0, 1
- ret;
- ENDPROC(__blowfish_dec_blk32)
-
-@@ -284,6 +286,7 @@ ENTRY(blowfish_ecb_enc_32way)
-
- vzeroupper;
-
-+ pax_force_retaddr 0, 1
- ret;
- ENDPROC(blowfish_ecb_enc_32way)
-
-@@ -318,6 +321,7 @@ ENTRY(blowfish_ecb_dec_32way)
-
- vzeroupper;
-
-+ pax_force_retaddr 0, 1
- ret;
- ENDPROC(blowfish_ecb_dec_32way)
-
-@@ -365,6 +369,7 @@ ENTRY(blowfish_cbc_dec_32way)
-
- vzeroupper;
-
-+ pax_force_retaddr 0, 1
- ret;
- ENDPROC(blowfish_cbc_dec_32way)
-
-@@ -445,5 +450,6 @@ ENTRY(blowfish_ctr_32way)
-
- vzeroupper;
-
-+ pax_force_retaddr 0, 1
- ret;
- ENDPROC(blowfish_ctr_32way)
diff --git a/arch/x86/crypto/blowfish-x86_64-asm_64.S b/arch/x86/crypto/blowfish-x86_64-asm_64.S
index 246c670..4d1ed00 100644
--- a/arch/x86/crypto/blowfish-x86_64-asm_64.S
@@ -12636,7 +12500,7 @@ index ce71f92..2dd5b1e 100644
ENDPROC(camellia_xts_crypt_16way)
diff --git a/arch/x86/crypto/camellia-aesni-avx2-asm_64.S b/arch/x86/crypto/camellia-aesni-avx2-asm_64.S
-index 91a1878..bcf340a 100644
+index 0e0b886..8fc756a 100644
--- a/arch/x86/crypto/camellia-aesni-avx2-asm_64.S
+++ b/arch/x86/crypto/camellia-aesni-avx2-asm_64.S
@@ -11,6 +11,7 @@
@@ -12647,7 +12511,7 @@ index 91a1878..bcf340a 100644
#define CAMELLIA_TABLE_BYTE_LEN 272
-@@ -212,6 +213,7 @@ roundsm32_x0_x1_x2_x3_x4_x5_x6_x7_y0_y1_y2_y3_y4_y5_y6_y7_cd:
+@@ -230,6 +231,7 @@ roundsm32_x0_x1_x2_x3_x4_x5_x6_x7_y0_y1_y2_y3_y4_y5_y6_y7_cd:
roundsm32(%ymm0, %ymm1, %ymm2, %ymm3, %ymm4, %ymm5, %ymm6, %ymm7,
%ymm8, %ymm9, %ymm10, %ymm11, %ymm12, %ymm13, %ymm14, %ymm15,
%rcx, (%r9));
@@ -12655,7 +12519,7 @@ index 91a1878..bcf340a 100644
ret;
ENDPROC(roundsm32_x0_x1_x2_x3_x4_x5_x6_x7_y0_y1_y2_y3_y4_y5_y6_y7_cd)
-@@ -220,6 +222,7 @@ roundsm32_x4_x5_x6_x7_x0_x1_x2_x3_y4_y5_y6_y7_y0_y1_y2_y3_ab:
+@@ -238,6 +240,7 @@ roundsm32_x4_x5_x6_x7_x0_x1_x2_x3_y4_y5_y6_y7_y0_y1_y2_y3_ab:
roundsm32(%ymm4, %ymm5, %ymm6, %ymm7, %ymm0, %ymm1, %ymm2, %ymm3,
%ymm12, %ymm13, %ymm14, %ymm15, %ymm8, %ymm9, %ymm10, %ymm11,
%rax, (%r9));
@@ -12663,7 +12527,7 @@ index 91a1878..bcf340a 100644
ret;
ENDPROC(roundsm32_x4_x5_x6_x7_x0_x1_x2_x3_y4_y5_y6_y7_y0_y1_y2_y3_ab)
-@@ -802,6 +805,7 @@ __camellia_enc_blk32:
+@@ -820,6 +823,7 @@ __camellia_enc_blk32:
%ymm8, %ymm9, %ymm10, %ymm11, %ymm12, %ymm13, %ymm14,
%ymm15, (key_table)(CTX, %r8, 8), (%rax), 1 * 32(%rax));
@@ -12671,7 +12535,7 @@ index 91a1878..bcf340a 100644
ret;
.align 8
-@@ -887,6 +891,7 @@ __camellia_dec_blk32:
+@@ -905,6 +909,7 @@ __camellia_dec_blk32:
%ymm8, %ymm9, %ymm10, %ymm11, %ymm12, %ymm13, %ymm14,
%ymm15, (key_table)(CTX), (%rax), 1 * 32(%rax));
@@ -12679,7 +12543,7 @@ index 91a1878..bcf340a 100644
ret;
.align 8
-@@ -930,6 +935,7 @@ ENTRY(camellia_ecb_enc_32way)
+@@ -948,6 +953,7 @@ ENTRY(camellia_ecb_enc_32way)
vzeroupper;
@@ -12687,7 +12551,7 @@ index 91a1878..bcf340a 100644
ret;
ENDPROC(camellia_ecb_enc_32way)
-@@ -962,6 +968,7 @@ ENTRY(camellia_ecb_dec_32way)
+@@ -980,6 +986,7 @@ ENTRY(camellia_ecb_dec_32way)
vzeroupper;
@@ -12695,7 +12559,7 @@ index 91a1878..bcf340a 100644
ret;
ENDPROC(camellia_ecb_dec_32way)
-@@ -1028,6 +1035,7 @@ ENTRY(camellia_cbc_dec_32way)
+@@ -1046,6 +1053,7 @@ ENTRY(camellia_cbc_dec_32way)
vzeroupper;
@@ -12703,7 +12567,7 @@ index 91a1878..bcf340a 100644
ret;
ENDPROC(camellia_cbc_dec_32way)
-@@ -1166,6 +1174,7 @@ ENTRY(camellia_ctr_32way)
+@@ -1184,6 +1192,7 @@ ENTRY(camellia_ctr_32way)
vzeroupper;
@@ -12711,7 +12575,7 @@ index 91a1878..bcf340a 100644
ret;
ENDPROC(camellia_ctr_32way)
-@@ -1331,6 +1340,7 @@ camellia_xts_crypt_32way:
+@@ -1349,6 +1358,7 @@ camellia_xts_crypt_32way:
vzeroupper;
@@ -13406,74 +13270,6 @@ index 0505813..63b1d00 100644
+ pax_force_retaddr 0, 1
ret;
ENDPROC(twofish_xts_dec_8way)
-diff --git a/arch/x86/crypto/twofish-avx2-asm_64.S b/arch/x86/crypto/twofish-avx2-asm_64.S
-index e1a83b9..33006b9 100644
---- a/arch/x86/crypto/twofish-avx2-asm_64.S
-+++ b/arch/x86/crypto/twofish-avx2-asm_64.S
-@@ -11,6 +11,7 @@
- */
-
- #include <linux/linkage.h>
-+#include <asm/alternative-asm.h>
- #include "glue_helper-asm-avx2.S"
-
- .file "twofish-avx2-asm_64.S"
-@@ -422,6 +423,7 @@ __twofish_enc_blk16:
- outunpack_enc16(RA, RB, RC, RD);
- write_blocks16(RA, RB, RC, RD);
-
-+ pax_force_retaddr_bts
- ret;
- ENDPROC(__twofish_enc_blk16)
-
-@@ -454,6 +456,7 @@ __twofish_dec_blk16:
- outunpack_dec16(RA, RB, RC, RD);
- write_blocks16(RA, RB, RC, RD);
-
-+ pax_force_retaddr_bts
- ret;
- ENDPROC(__twofish_dec_blk16)
-
-@@ -476,6 +479,7 @@ ENTRY(twofish_ecb_enc_16way)
- popq %r12;
- vzeroupper;
-
-+ pax_force_retaddr 0, 1
- ret;
- ENDPROC(twofish_ecb_enc_16way)
-
-@@ -498,6 +502,7 @@ ENTRY(twofish_ecb_dec_16way)
- popq %r12;
- vzeroupper;
-
-+ pax_force_retaddr 0, 1
- ret;
- ENDPROC(twofish_ecb_dec_16way)
-
-@@ -521,6 +526,7 @@ ENTRY(twofish_cbc_dec_16way)
- popq %r12;
- vzeroupper;
-
-+ pax_force_retaddr 0, 1
- ret;
- ENDPROC(twofish_cbc_dec_16way)
-
-@@ -546,6 +552,7 @@ ENTRY(twofish_ctr_16way)
- popq %r12;
- vzeroupper;
-
-+ pax_force_retaddr 0, 1
- ret;
- ENDPROC(twofish_ctr_16way)
-
-@@ -574,6 +581,7 @@ twofish_xts_crypt_16way:
- popq %r12;
- vzeroupper;
-
-+ pax_force_retaddr 0, 1
- ret;
- ENDPROC(twofish_xts_crypt_16way)
-
diff --git a/arch/x86/crypto/twofish-x86_64-asm_64-3way.S b/arch/x86/crypto/twofish-x86_64-asm_64-3way.S
index 1c3b7ce..b365c5e 100644
--- a/arch/x86/crypto/twofish-x86_64-asm_64-3way.S
@@ -13537,7 +13333,7 @@ index a039d21..29e7615 100644
ret
ENDPROC(twofish_dec_blk)
diff --git a/arch/x86/ia32/ia32_aout.c b/arch/x86/ia32/ia32_aout.c
-index 52ff81c..98af645 100644
+index bae3aba..c1788c1 100644
--- a/arch/x86/ia32/ia32_aout.c
+++ b/arch/x86/ia32/ia32_aout.c
@@ -159,6 +159,8 @@ static int aout_core_dump(long signr, struct pt_regs *regs, struct file *file,
@@ -13550,10 +13346,10 @@ index 52ff81c..98af645 100644
set_fs(KERNEL_DS);
has_dumped = 1;
diff --git a/arch/x86/ia32/ia32_signal.c b/arch/x86/ia32/ia32_signal.c
-index 10adb41..95ea4c2 100644
+index 665a730..8e7a67a 100644
--- a/arch/x86/ia32/ia32_signal.c
+++ b/arch/x86/ia32/ia32_signal.c
-@@ -340,7 +340,7 @@ static void __user *get_sigframe(struct ksignal *ksig, struct pt_regs *regs,
+@@ -338,7 +338,7 @@ static void __user *get_sigframe(struct ksignal *ksig, struct pt_regs *regs,
sp -= frame_size;
/* Align the stack pointer according to the i386 ABI,
* i.e. so that on function entry ((sp + 4) & 15) == 0. */
@@ -13562,7 +13358,7 @@ index 10adb41..95ea4c2 100644
return (void __user *) sp;
}
-@@ -398,7 +398,7 @@ int ia32_setup_frame(int sig, struct ksignal *ksig,
+@@ -396,7 +396,7 @@ int ia32_setup_frame(int sig, struct ksignal *ksig,
* These are actually not used anymore, but left because some
* gdb versions depend on them as a marker.
*/
@@ -13571,7 +13367,7 @@ index 10adb41..95ea4c2 100644
} put_user_catch(err);
if (err)
-@@ -440,7 +440,7 @@ int ia32_setup_rt_frame(int sig, struct ksignal *ksig,
+@@ -438,7 +438,7 @@ int ia32_setup_rt_frame(int sig, struct ksignal *ksig,
0xb8,
__NR_ia32_rt_sigreturn,
0x80cd,
@@ -13580,7 +13376,7 @@ index 10adb41..95ea4c2 100644
};
frame = get_sigframe(ksig, regs, sizeof(*frame), &fpstate);
-@@ -463,16 +463,18 @@ int ia32_setup_rt_frame(int sig, struct ksignal *ksig,
+@@ -461,16 +461,18 @@ int ia32_setup_rt_frame(int sig, struct ksignal *ksig,
if (ksig->ka.sa.sa_flags & SA_RESTORER)
restorer = ksig->ka.sa.sa_restorer;
@@ -13603,7 +13399,7 @@ index 10adb41..95ea4c2 100644
err |= copy_siginfo_to_user32(&frame->info, &ksig->info);
diff --git a/arch/x86/ia32/ia32entry.S b/arch/x86/ia32/ia32entry.S
-index 474dc1b..9297c58 100644
+index 4299eb0..904b82a 100644
--- a/arch/x86/ia32/ia32entry.S
+++ b/arch/x86/ia32/ia32entry.S
@@ -15,8 +15,10 @@
@@ -14001,10 +13797,10 @@ index 372231c..a5aa1a1 100644
.long \orig - .
.long \alt - .
diff --git a/arch/x86/include/asm/alternative.h b/arch/x86/include/asm/alternative.h
-index 58ed6d9..f1cbe58 100644
+index 0a3f9c9..c9d081d 100644
--- a/arch/x86/include/asm/alternative.h
+++ b/arch/x86/include/asm/alternative.h
-@@ -105,7 +105,7 @@ static inline int alternatives_text_reserved(void *start, void *end)
+@@ -106,7 +106,7 @@ static inline int alternatives_text_reserved(void *start, void *end)
".pushsection .discard,\"aw\",@progbits\n" \
DISCARD_ENTRY(1) \
".popsection\n" \
@@ -14013,7 +13809,7 @@ index 58ed6d9..f1cbe58 100644
ALTINSTR_REPLACEMENT(newinstr, feature, 1) \
".popsection"
-@@ -119,7 +119,7 @@ static inline int alternatives_text_reserved(void *start, void *end)
+@@ -120,7 +120,7 @@ static inline int alternatives_text_reserved(void *start, void *end)
DISCARD_ENTRY(1) \
DISCARD_ENTRY(2) \
".popsection\n" \
@@ -14023,10 +13819,10 @@ index 58ed6d9..f1cbe58 100644
ALTINSTR_REPLACEMENT(newinstr2, feature2, 2) \
".popsection"
diff --git a/arch/x86/include/asm/apic.h b/arch/x86/include/asm/apic.h
-index 3388034..050f0b9 100644
+index 1d2091a..f5074c1 100644
--- a/arch/x86/include/asm/apic.h
+++ b/arch/x86/include/asm/apic.h
-@@ -44,7 +44,7 @@ static inline void generic_apic_probe(void)
+@@ -45,7 +45,7 @@ static inline void generic_apic_probe(void)
#ifdef CONFIG_X86_LOCAL_APIC
@@ -14449,11 +14245,6 @@ index 722aa3b..3a0bb27 100644
-#define atomic_clear_mask(mask, addr) \
- asm volatile(LOCK_PREFIX "andl %0,%1" \
- : : "r" (~(mask)), "m" (*(addr)) : "memory")
--
--#define atomic_set_mask(mask, addr) \
-- asm volatile(LOCK_PREFIX "orl %0,%1" \
-- : : "r" ((unsigned)(mask)), "m" (*(addr)) \
-- : "memory")
+static inline void atomic_clear_mask(unsigned int mask, atomic_t *v)
+{
+ asm volatile(LOCK_PREFIX "andl %1,%0"
@@ -14461,7 +14252,11 @@ index 722aa3b..3a0bb27 100644
+ : "r" (~(mask))
+ : "memory");
+}
-+
+
+-#define atomic_set_mask(mask, addr) \
+- asm volatile(LOCK_PREFIX "orl %0,%1" \
+- : : "r" ((unsigned)(mask)), "m" (*(addr)) \
+- : "memory")
+static inline void atomic_clear_mask_unchecked(unsigned int mask, atomic_unchecked_t *v)
+{
+ asm volatile(LOCK_PREFIX "andl %1,%0"
@@ -14975,10 +14770,10 @@ index 0e1cbfc..5623683 100644
#define atomic64_inc_not_zero(v) atomic64_add_unless((v), 1, 0)
diff --git a/arch/x86/include/asm/bitops.h b/arch/x86/include/asm/bitops.h
-index 6dfd019..28e188d 100644
+index 41639ce..ebce552 100644
--- a/arch/x86/include/asm/bitops.h
+++ b/arch/x86/include/asm/bitops.h
-@@ -40,7 +40,7 @@
+@@ -48,7 +48,7 @@
* a mask operation on a byte.
*/
#define IS_IMMEDIATE(nr) (__builtin_constant_p(nr))
@@ -14987,7 +14782,43 @@ index 6dfd019..28e188d 100644
#define CONST_MASK(nr) (1 << ((nr) & 7))
/**
-@@ -486,7 +486,7 @@ static inline int fls(int x)
+@@ -361,7 +361,7 @@ static int test_bit(int nr, const volatile unsigned long *addr);
+ *
+ * Undefined if no bit exists, so code should check against 0 first.
+ */
+-static inline unsigned long __ffs(unsigned long word)
++static inline unsigned long __intentional_overflow(-1) __ffs(unsigned long word)
+ {
+ asm("rep; bsf %1,%0"
+ : "=r" (word)
+@@ -375,7 +375,7 @@ static inline unsigned long __ffs(unsigned long word)
+ *
+ * Undefined if no zero exists, so code should check against ~0UL first.
+ */
+-static inline unsigned long ffz(unsigned long word)
++static inline unsigned long __intentional_overflow(-1) ffz(unsigned long word)
+ {
+ asm("rep; bsf %1,%0"
+ : "=r" (word)
+@@ -389,7 +389,7 @@ static inline unsigned long ffz(unsigned long word)
+ *
+ * Undefined if no set bit exists, so code should check against 0 first.
+ */
+-static inline unsigned long __fls(unsigned long word)
++static inline unsigned long __intentional_overflow(-1) __fls(unsigned long word)
+ {
+ asm("bsr %1,%0"
+ : "=r" (word)
+@@ -452,7 +452,7 @@ static inline int ffs(int x)
+ * set bit if value is nonzero. The last (most significant) bit is
+ * at position 32.
+ */
+-static inline int fls(int x)
++static inline int __intentional_overflow(-1) fls(int x)
+ {
+ int r;
+
+@@ -494,7 +494,7 @@ static inline int fls(int x)
* at position 64.
*/
#ifdef CONFIG_X86_64
@@ -15163,7 +14994,7 @@ index 59c6c40..5e0b22c 100644
struct compat_timespec {
compat_time_t tv_sec;
diff --git a/arch/x86/include/asm/cpufeature.h b/arch/x86/include/asm/cpufeature.h
-index 4af181d..eb8011f 100644
+index 89270b4..f0abf8e 100644
--- a/arch/x86/include/asm/cpufeature.h
+++ b/arch/x86/include/asm/cpufeature.h
@@ -203,7 +203,7 @@
@@ -15192,7 +15023,17 @@ index 4af181d..eb8011f 100644
#endif /* CONFIG_X86_64 */
#if __GNUC__ >= 4
-@@ -394,7 +395,7 @@ static __always_inline __pure bool __static_cpu_has(u16 bit)
+@@ -405,7 +406,8 @@ static __always_inline __pure bool __static_cpu_has(u16 bit)
+
+ #ifdef CONFIG_X86_DEBUG_STATIC_CPU_HAS
+ t_warn:
+- warn_pre_alternatives();
++ if (bit != X86_FEATURE_PCID && bit != X86_FEATURE_INVPCID)
++ warn_pre_alternatives();
+ return false;
+ #endif
+
+@@ -425,7 +427,7 @@ static __always_inline __pure bool __static_cpu_has(u16 bit)
".section .discard,\"aw\",@progbits\n"
" .byte 0xff + (4f-3f) - (2b-1b)\n" /* size check */
".previous\n"
@@ -15201,8 +15042,35 @@ index 4af181d..eb8011f 100644
"3: movb $1,%0\n"
"4:\n"
".previous\n"
+@@ -462,7 +464,7 @@ static __always_inline __pure bool _static_cpu_has_safe(u16 bit)
+ " .byte 2b - 1b\n" /* src len */
+ " .byte 4f - 3f\n" /* repl len */
+ ".previous\n"
+- ".section .altinstr_replacement,\"ax\"\n"
++ ".section .altinstr_replacement,\"a\"\n"
+ "3: .byte 0xe9\n .long %l[t_no] - 2b\n"
+ "4:\n"
+ ".previous\n"
+@@ -495,7 +497,7 @@ static __always_inline __pure bool _static_cpu_has_safe(u16 bit)
+ ".section .discard,\"aw\",@progbits\n"
+ " .byte 0xff + (4f-3f) - (2b-1b)\n" /* size check */
+ ".previous\n"
+- ".section .altinstr_replacement,\"ax\"\n"
++ ".section .altinstr_replacement,\"a\"\n"
+ "3: movb $0,%0\n"
+ "4:\n"
+ ".previous\n"
+@@ -509,7 +511,7 @@ static __always_inline __pure bool _static_cpu_has_safe(u16 bit)
+ ".section .discard,\"aw\",@progbits\n"
+ " .byte 0xff + (6f-5f) - (4b-3b)\n" /* size check */
+ ".previous\n"
+- ".section .altinstr_replacement,\"ax\"\n"
++ ".section .altinstr_replacement,\"a\"\n"
+ "5: movb $1,%0\n"
+ "6:\n"
+ ".previous\n"
diff --git a/arch/x86/include/asm/desc.h b/arch/x86/include/asm/desc.h
-index 8bf1c06..b6ae785 100644
+index b90e5df..b462c91 100644
--- a/arch/x86/include/asm/desc.h
+++ b/arch/x86/include/asm/desc.h
@@ -4,6 +4,7 @@
@@ -15226,16 +15094,17 @@ index 8bf1c06..b6ae785 100644
extern struct desc_ptr idt_descr;
-extern gate_desc idt_table[];
- extern struct desc_ptr nmi_idt_descr;
--extern gate_desc nmi_idt_table[];
+-extern struct desc_ptr debug_idt_descr;
+-extern gate_desc debug_idt_table[];
-
-struct gdt_page {
- struct desc_struct gdt[GDT_ENTRIES];
-} __attribute__((aligned(PAGE_SIZE)));
-
-DECLARE_PER_CPU_PAGE_ALIGNED(struct gdt_page, gdt_page);
-+extern gate_desc idt_table[256];
-+extern gate_desc nmi_idt_table[256];
++extern gate_desc idt_table[IDT_ENTRIES];
++extern const struct desc_ptr debug_idt_descr;
++extern gate_desc debug_idt_table[IDT_ENTRIES];
+extern struct desc_struct cpu_gdt_table[NR_CPUS][PAGE_SIZE / sizeof(struct desc_struct)];
static inline struct desc_struct *get_cpu_gdt_table(unsigned int cpu)
@@ -15328,7 +15197,18 @@ index 8bf1c06..b6ae785 100644
{
gate_desc s;
-@@ -320,7 +333,7 @@ static inline void set_nmi_gate(int gate, void *addr)
+@@ -321,8 +334,8 @@ static inline void set_nmi_gate(int gate, void *addr)
+ #endif
+
+ #ifdef CONFIG_TRACING
+-extern struct desc_ptr trace_idt_descr;
+-extern gate_desc trace_idt_table[];
++extern const struct desc_ptr trace_idt_descr;
++extern gate_desc trace_idt_table[IDT_ENTRIES];
+ static inline void write_trace_idt_entry(int entry, const gate_desc *gate)
+ {
+ write_idt_entry(trace_idt_table, entry, gate);
+@@ -333,7 +346,7 @@ static inline void write_trace_idt_entry(int entry, const gate_desc *gate)
}
#endif
@@ -15337,7 +15217,7 @@ index 8bf1c06..b6ae785 100644
unsigned dpl, unsigned ist, unsigned seg)
{
gate_desc s;
-@@ -339,7 +352,7 @@ static inline void _set_gate(int gate, unsigned type, void *addr,
+@@ -353,7 +366,7 @@ static inline void _set_gate(int gate, unsigned type, void *addr,
* Pentium F0 0F bugfix can have resulted in the mapped
* IDT being write-protected.
*/
@@ -15346,7 +15226,7 @@ index 8bf1c06..b6ae785 100644
{
BUG_ON((unsigned)n > 0xFF);
_set_gate(n, GATE_INTERRUPT, addr, 0, 0, __KERNEL_CS);
-@@ -369,19 +382,19 @@ static inline void alloc_intr_gate(unsigned int n, void *addr)
+@@ -410,19 +423,19 @@ static inline void __alloc_intr_gate(unsigned int n, void *addr)
/*
* This routine sets up an interrupt gate at directory privilege level 3.
*/
@@ -15369,7 +15249,7 @@ index 8bf1c06..b6ae785 100644
{
BUG_ON((unsigned)n > 0xFF);
_set_gate(n, GATE_TRAP, addr, 0, 0, __KERNEL_CS);
-@@ -390,19 +403,31 @@ static inline void set_trap_gate(unsigned int n, void *addr)
+@@ -431,16 +444,16 @@ static inline void set_trap_gate(unsigned int n, void *addr)
static inline void set_task_gate(unsigned int n, unsigned int gdt_entry)
{
BUG_ON((unsigned)n > 0xFF);
@@ -15389,8 +15269,11 @@ index 8bf1c06..b6ae785 100644
{
BUG_ON((unsigned)n > 0xFF);
_set_gate(n, GATE_INTERRUPT, addr, 0x3, ist, __KERNEL_CS);
+@@ -512,4 +525,17 @@ static inline void load_current_idt(void)
+ else
+ load_idt((const struct desc_ptr *)&idt_descr);
}
-
++
+#ifdef CONFIG_X86_32
+static inline void set_user_cs(unsigned long base, unsigned long limit, int cpu)
+{
@@ -15503,22 +15386,22 @@ index 9c999c1..3860cb8 100644
* True on X86_32 or when emulating IA32 on X86_64
*/
diff --git a/arch/x86/include/asm/emergency-restart.h b/arch/x86/include/asm/emergency-restart.h
-index 75ce3f4..882e801 100644
+index 77a99ac..39ff7f5 100644
--- a/arch/x86/include/asm/emergency-restart.h
+++ b/arch/x86/include/asm/emergency-restart.h
-@@ -13,6 +13,6 @@ enum reboot_type {
-
- extern enum reboot_type reboot_type;
+@@ -1,6 +1,6 @@
+ #ifndef _ASM_X86_EMERGENCY_RESTART_H
+ #define _ASM_X86_EMERGENCY_RESTART_H
-extern void machine_emergency_restart(void);
+extern void machine_emergency_restart(void) __noreturn;
#endif /* _ASM_X86_EMERGENCY_RESTART_H */
diff --git a/arch/x86/include/asm/fpu-internal.h b/arch/x86/include/asm/fpu-internal.h
-index e25cc33..7d3ec01 100644
+index 4d0bda7..221da4d 100644
--- a/arch/x86/include/asm/fpu-internal.h
+++ b/arch/x86/include/asm/fpu-internal.h
-@@ -126,8 +126,11 @@ static inline void sanitize_i387_state(struct task_struct *tsk)
+@@ -124,8 +124,11 @@ static inline void sanitize_i387_state(struct task_struct *tsk)
#define user_insn(insn, output, input...) \
({ \
int err; \
@@ -15531,7 +15414,7 @@ index e25cc33..7d3ec01 100644
"2: " ASM_CLAC "\n" \
".section .fixup,\"ax\"\n" \
"3: movl $-1,%[err]\n" \
-@@ -136,6 +139,7 @@ static inline void sanitize_i387_state(struct task_struct *tsk)
+@@ -134,6 +137,7 @@ static inline void sanitize_i387_state(struct task_struct *tsk)
_ASM_EXTABLE(1b, 3b) \
: [err] "=r" (err), output \
: "0"(0), input); \
@@ -15539,7 +15422,7 @@ index e25cc33..7d3ec01 100644
err; \
})
-@@ -300,7 +304,7 @@ static inline int restore_fpu_checking(struct task_struct *tsk)
+@@ -298,7 +302,7 @@ static inline int restore_fpu_checking(struct task_struct *tsk)
"emms\n\t" /* clear stack tags */
"fildl %P[addr]", /* set F?P to defined value */
X86_FEATURE_FXSAVE_LEAK,
@@ -15636,10 +15519,10 @@ index be27ba1..04a8801 100644
*uval = oldval;
return ret;
diff --git a/arch/x86/include/asm/hw_irq.h b/arch/x86/include/asm/hw_irq.h
-index 1da97ef..9c2ebff 100644
+index 92b3bae..3866449 100644
--- a/arch/x86/include/asm/hw_irq.h
+++ b/arch/x86/include/asm/hw_irq.h
-@@ -148,8 +148,8 @@ extern void setup_ioapic_dest(void);
+@@ -165,8 +165,8 @@ extern void setup_ioapic_dest(void);
extern void enable_IO_APIC(void);
/* Statistics */
@@ -15664,7 +15547,7 @@ index a203659..9889f1c 100644
extern struct legacy_pic *legacy_pic;
extern struct legacy_pic null_legacy_pic;
diff --git a/arch/x86/include/asm/io.h b/arch/x86/include/asm/io.h
-index d8e8eef..1765f78 100644
+index 34f69cb..6d95446 100644
--- a/arch/x86/include/asm/io.h
+++ b/arch/x86/include/asm/io.h
@@ -51,12 +51,12 @@ static inline void name(type val, volatile void __iomem *addr) \
@@ -15728,7 +15611,7 @@ index bba3cf8..06bc8da 100644
#define INTERRUPT_RETURN iret
#define ENABLE_INTERRUPTS_SYSEXIT sti; sysexit
diff --git a/arch/x86/include/asm/kprobes.h b/arch/x86/include/asm/kprobes.h
-index 5a6d287..f815789 100644
+index 9454c16..e4100e3 100644
--- a/arch/x86/include/asm/kprobes.h
+++ b/arch/x86/include/asm/kprobes.h
@@ -38,13 +38,8 @@ typedef u8 kprobe_opcode_t;
@@ -16021,7 +15904,7 @@ index 5f55e69..e20bfb1 100644
#ifdef CONFIG_SMP
diff --git a/arch/x86/include/asm/mmu_context.h b/arch/x86/include/asm/mmu_context.h
-index be12c53..7430027 100644
+index be12c53..4d24039 100644
--- a/arch/x86/include/asm/mmu_context.h
+++ b/arch/x86/include/asm/mmu_context.h
@@ -24,6 +24,20 @@ void destroy_context(struct mm_struct *mm);
@@ -16045,7 +15928,7 @@ index be12c53..7430027 100644
#ifdef CONFIG_SMP
if (this_cpu_read(cpu_tlbstate.state) == TLBSTATE_OK)
this_cpu_write(cpu_tlbstate.state, TLBSTATE_LAZY);
-@@ -34,16 +48,55 @@ static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next,
+@@ -34,16 +48,59 @@ static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next,
struct task_struct *tsk)
{
unsigned cpu = smp_processor_id();
@@ -16081,9 +15964,13 @@ index be12c53..7430027 100644
+#if defined(CONFIG_X86_64) && defined(CONFIG_PAX_MEMORY_UDEREF)
+ if (static_cpu_has(X86_FEATURE_PCID)) {
+ if (static_cpu_has(X86_FEATURE_INVPCID)) {
-+ unsigned long descriptor[2];
++ u64 descriptor[2];
+ descriptor[0] = PCID_USER;
+ asm volatile(__ASM_INVPCID : : "d"(&descriptor), "a"(INVPCID_SINGLE_CONTEXT) : "memory");
++ if (!static_cpu_has(X86_FEATURE_STRONGUDEREF)) {
++ descriptor[0] = PCID_KERNEL;
++ asm volatile(__ASM_INVPCID : : "d"(&descriptor), "a"(INVPCID_SINGLE_CONTEXT) : "memory");
++ }
+ } else {
+ write_cr3(__pa(get_cpu_pgd(cpu, user)) | PCID_USER);
+ if (static_cpu_has(X86_FEATURE_STRONGUDEREF))
@@ -16101,7 +15988,7 @@ index be12c53..7430027 100644
/* Stop flush ipis for the previous mm */
cpumask_clear_cpu(cpu, mm_cpumask(prev));
-@@ -51,9 +104,63 @@ static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next,
+@@ -51,9 +108,67 @@ static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next,
/* Load the LDT, if the LDT is different: */
if (unlikely(prev->context.ldt != next->context.ldt))
load_LDT_nolock(&next->context);
@@ -16145,9 +16032,13 @@ index be12c53..7430027 100644
+#if defined(CONFIG_X86_64) && defined(CONFIG_PAX_MEMORY_UDEREF)
+ if (static_cpu_has(X86_FEATURE_PCID)) {
+ if (static_cpu_has(X86_FEATURE_INVPCID)) {
-+ unsigned long descriptor[2];
++ u64 descriptor[2];
+ descriptor[0] = PCID_USER;
+ asm volatile(__ASM_INVPCID : : "d"(&descriptor), "a"(INVPCID_SINGLE_CONTEXT) : "memory");
++ if (!static_cpu_has(X86_FEATURE_STRONGUDEREF)) {
++ descriptor[0] = PCID_KERNEL;
++ asm volatile(__ASM_INVPCID : : "d"(&descriptor), "a"(INVPCID_SINGLE_CONTEXT) : "memory");
++ }
+ } else {
+ write_cr3(__pa(get_cpu_pgd(cpu, user)) | PCID_USER);
+ if (static_cpu_has(X86_FEATURE_STRONGUDEREF))
@@ -16166,7 +16057,7 @@ index be12c53..7430027 100644
this_cpu_write(cpu_tlbstate.state, TLBSTATE_OK);
BUG_ON(this_cpu_read(cpu_tlbstate.active_mm) != next);
-@@ -70,11 +177,28 @@ static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next,
+@@ -70,11 +185,28 @@ static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next,
* tlb flush IPI delivery. We must reload CR3
* to make sure to use no freed page tables.
*/
@@ -16190,9 +16081,9 @@ index be12c53..7430027 100644
+#endif
+
}
-- }
- #endif
-+ }
++#endif
+ }
+-#endif
}
#define activate_mm(prev, next) \
@@ -16287,7 +16178,7 @@ index 0f1ddee..e2fc3d1 100644
unsigned long y = x - __START_KERNEL_map;
diff --git a/arch/x86/include/asm/paravirt.h b/arch/x86/include/asm/paravirt.h
-index cfdc9ee..3f7b5d6 100644
+index 401f350..dee5d13 100644
--- a/arch/x86/include/asm/paravirt.h
+++ b/arch/x86/include/asm/paravirt.h
@@ -560,7 +560,7 @@ static inline pmd_t __pmd(pmdval_t val)
@@ -16339,8 +16230,8 @@ index cfdc9ee..3f7b5d6 100644
+
#if defined(CONFIG_SMP) && defined(CONFIG_PARAVIRT_SPINLOCKS)
- static inline int arch_spin_is_locked(struct arch_spinlock *lock)
-@@ -926,7 +953,7 @@ extern void default_banner(void);
+ static __always_inline void __ticket_lock_spinning(struct arch_spinlock *lock,
+@@ -906,7 +933,7 @@ extern void default_banner(void);
#define PARA_PATCH(struct, off) ((PARAVIRT_PATCH_##struct + (off)) / 4)
#define PARA_SITE(ptype, clobbers, ops) _PVSITE(ptype, clobbers, ops, .long, 4)
@@ -16349,7 +16240,7 @@ index cfdc9ee..3f7b5d6 100644
#endif
#define INTERRUPT_RETURN \
-@@ -1001,6 +1028,21 @@ extern void default_banner(void);
+@@ -981,6 +1008,21 @@ extern void default_banner(void);
PARA_SITE(PARA_PATCH(pv_cpu_ops, PV_CPU_irq_enable_sysexit), \
CLBR_NONE, \
jmp PARA_INDIRECT(pv_cpu_ops+PV_CPU_irq_enable_sysexit))
@@ -16372,7 +16263,7 @@ index cfdc9ee..3f7b5d6 100644
#endif /* __ASSEMBLY__ */
diff --git a/arch/x86/include/asm/paravirt_types.h b/arch/x86/include/asm/paravirt_types.h
-index 0db1fca..52310cc 100644
+index aab8f67..2531748 100644
--- a/arch/x86/include/asm/paravirt_types.h
+++ b/arch/x86/include/asm/paravirt_types.h
@@ -84,7 +84,7 @@ struct pv_init_ops {
@@ -16432,15 +16323,6 @@ index 0db1fca..52310cc 100644
};
struct arch_spinlock;
-@@ -334,7 +341,7 @@ struct pv_lock_ops {
- void (*spin_lock_flags)(struct arch_spinlock *lock, unsigned long flags);
- int (*spin_trylock)(struct arch_spinlock *lock);
- void (*spin_unlock)(struct arch_spinlock *lock);
--};
-+} __no_const;
-
- /* This contains all the paravirt structures: we get a convenient
- * number for each function using the offset which we use to indicate
diff --git a/arch/x86/include/asm/pgalloc.h b/arch/x86/include/asm/pgalloc.h
index b4389a4..7024269 100644
--- a/arch/x86/include/asm/pgalloc.h
@@ -16496,7 +16378,7 @@ index b4389a4..7024269 100644
{
return (pud_t *)get_zeroed_page(GFP_KERNEL|__GFP_REPEAT);
diff --git a/arch/x86/include/asm/pgtable-2level.h b/arch/x86/include/asm/pgtable-2level.h
-index f2b489c..4f7e2e5 100644
+index 3bf2dd0..23d2a9f 100644
--- a/arch/x86/include/asm/pgtable-2level.h
+++ b/arch/x86/include/asm/pgtable-2level.h
@@ -18,7 +18,9 @@ static inline void native_set_pte(pte_t *ptep , pte_t pte)
@@ -16510,7 +16392,7 @@ index f2b489c..4f7e2e5 100644
static inline void native_set_pte_atomic(pte_t *ptep, pte_t pte)
diff --git a/arch/x86/include/asm/pgtable-3level.h b/arch/x86/include/asm/pgtable-3level.h
-index 4cc9f2b..5fd9226 100644
+index 81bb91b..9392125 100644
--- a/arch/x86/include/asm/pgtable-3level.h
+++ b/arch/x86/include/asm/pgtable-3level.h
@@ -92,12 +92,16 @@ static inline void native_set_pte_atomic(pte_t *ptep, pte_t pte)
@@ -16531,10 +16413,10 @@ index 4cc9f2b..5fd9226 100644
/*
diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtable.h
-index 1e67223..92a9585 100644
+index 3d19994..732a48c 100644
--- a/arch/x86/include/asm/pgtable.h
+++ b/arch/x86/include/asm/pgtable.h
-@@ -44,6 +44,7 @@ extern struct mm_struct *pgd_page_get_mm(struct page *page);
+@@ -45,6 +45,7 @@ extern struct mm_struct *pgd_page_get_mm(struct page *page);
#ifndef __PAGETABLE_PUD_FOLDED
#define set_pgd(pgdp, pgd) native_set_pgd(pgdp, pgd)
@@ -16542,7 +16424,7 @@ index 1e67223..92a9585 100644
#define pgd_clear(pgd) native_pgd_clear(pgd)
#endif
-@@ -81,12 +82,51 @@ extern struct mm_struct *pgd_page_get_mm(struct page *page);
+@@ -82,12 +83,51 @@ extern struct mm_struct *pgd_page_get_mm(struct page *page);
#define arch_end_context_switch(prev) do {} while(0)
@@ -16594,7 +16476,7 @@ index 1e67223..92a9585 100644
static inline int pte_dirty(pte_t pte)
{
return pte_flags(pte) & _PAGE_DIRTY;
-@@ -147,6 +187,11 @@ static inline unsigned long pud_pfn(pud_t pud)
+@@ -148,6 +188,11 @@ static inline unsigned long pud_pfn(pud_t pud)
return (pud_val(pud) & PTE_PFN_MASK) >> PAGE_SHIFT;
}
@@ -16606,7 +16488,7 @@ index 1e67223..92a9585 100644
#define pte_page(pte) pfn_to_page(pte_pfn(pte))
static inline int pmd_large(pmd_t pte)
-@@ -200,9 +245,29 @@ static inline pte_t pte_wrprotect(pte_t pte)
+@@ -201,9 +246,29 @@ static inline pte_t pte_wrprotect(pte_t pte)
return pte_clear_flags(pte, _PAGE_RW);
}
@@ -16637,7 +16519,7 @@ index 1e67223..92a9585 100644
}
static inline pte_t pte_mkdirty(pte_t pte)
-@@ -394,6 +459,16 @@ pte_t *populate_extra_pte(unsigned long vaddr);
+@@ -430,6 +495,16 @@ pte_t *populate_extra_pte(unsigned long vaddr);
#endif
#ifndef __ASSEMBLY__
@@ -16652,9 +16534,9 @@ index 1e67223..92a9585 100644
+#endif
+
#include <linux/mm_types.h>
+ #include <linux/mmdebug.h>
#include <linux/log2.h>
-
-@@ -529,7 +604,7 @@ static inline unsigned long pud_page_vaddr(pud_t pud)
+@@ -563,7 +638,7 @@ static inline unsigned long pud_page_vaddr(pud_t pud)
* Currently stuck as a macro due to indirect forward reference to
* linux/mmzone.h's __section_mem_map_addr() definition:
*/
@@ -16663,7 +16545,7 @@ index 1e67223..92a9585 100644
/* Find an entry in the second-level page table.. */
static inline pmd_t *pmd_offset(pud_t *pud, unsigned long address)
-@@ -569,7 +644,7 @@ static inline unsigned long pgd_page_vaddr(pgd_t pgd)
+@@ -603,7 +678,7 @@ static inline unsigned long pgd_page_vaddr(pgd_t pgd)
* Currently stuck as a macro due to indirect forward reference to
* linux/mmzone.h's __section_mem_map_addr() definition:
*/
@@ -16672,7 +16554,7 @@ index 1e67223..92a9585 100644
/* to find an entry in a page-table-directory. */
static inline unsigned long pud_index(unsigned long address)
-@@ -584,7 +659,7 @@ static inline pud_t *pud_offset(pgd_t *pgd, unsigned long address)
+@@ -618,7 +693,7 @@ static inline pud_t *pud_offset(pgd_t *pgd, unsigned long address)
static inline int pgd_bad(pgd_t pgd)
{
@@ -16681,7 +16563,7 @@ index 1e67223..92a9585 100644
}
static inline int pgd_none(pgd_t pgd)
-@@ -607,7 +682,12 @@ static inline int pgd_none(pgd_t pgd)
+@@ -641,7 +716,12 @@ static inline int pgd_none(pgd_t pgd)
* pgd_offset() returns a (pgd_t *)
* pgd_index() is used get the offset into the pgd page's array of pgd_t's;
*/
@@ -16695,7 +16577,7 @@ index 1e67223..92a9585 100644
/*
* a shortcut which implies the use of the kernel's pgd, instead
* of a process's
-@@ -618,6 +698,23 @@ static inline int pgd_none(pgd_t pgd)
+@@ -652,6 +732,23 @@ static inline int pgd_none(pgd_t pgd)
#define KERNEL_PGD_BOUNDARY pgd_index(PAGE_OFFSET)
#define KERNEL_PGD_PTRS (PTRS_PER_PGD - KERNEL_PGD_BOUNDARY)
@@ -16719,7 +16601,7 @@ index 1e67223..92a9585 100644
#ifndef __ASSEMBLY__
extern int direct_gbpages;
-@@ -784,11 +881,24 @@ static inline void pmdp_set_wrprotect(struct mm_struct *mm,
+@@ -818,11 +915,24 @@ static inline void pmdp_set_wrprotect(struct mm_struct *mm,
* dst and src can be on the same page, but the range must not overlap,
* and must not cross a page boundary.
*/
@@ -16896,7 +16778,7 @@ index 2d88344..4679fc3 100644
#define EARLY_DYNAMIC_PAGE_TABLES 64
diff --git a/arch/x86/include/asm/pgtable_types.h b/arch/x86/include/asm/pgtable_types.h
-index e642300..0ef8f31 100644
+index 0ecac25..306c276 100644
--- a/arch/x86/include/asm/pgtable_types.h
+++ b/arch/x86/include/asm/pgtable_types.h
@@ -16,13 +16,12 @@
@@ -16924,7 +16806,7 @@ index e642300..0ef8f31 100644
#define _PAGE_IOMAP (_AT(pteval_t, 1) << _PAGE_BIT_IOMAP)
#define _PAGE_PAT (_AT(pteval_t, 1) << _PAGE_BIT_PAT)
#define _PAGE_PAT_LARGE (_AT(pteval_t, 1) << _PAGE_BIT_PAT_LARGE)
-@@ -57,8 +55,10 @@
+@@ -87,8 +85,10 @@
#if defined(CONFIG_X86_64) || defined(CONFIG_X86_PAE)
#define _PAGE_NX (_AT(pteval_t, 1) << _PAGE_BIT_NX)
@@ -16936,7 +16818,7 @@ index e642300..0ef8f31 100644
#endif
#define _PAGE_FILE (_AT(pteval_t, 1) << _PAGE_BIT_FILE)
-@@ -116,6 +116,9 @@
+@@ -146,6 +146,9 @@
#define PAGE_READONLY_EXEC __pgprot(_PAGE_PRESENT | _PAGE_USER | \
_PAGE_ACCESSED)
@@ -16946,7 +16828,7 @@ index e642300..0ef8f31 100644
#define __PAGE_KERNEL_EXEC \
(_PAGE_PRESENT | _PAGE_RW | _PAGE_DIRTY | _PAGE_ACCESSED | _PAGE_GLOBAL)
#define __PAGE_KERNEL (__PAGE_KERNEL_EXEC | _PAGE_NX)
-@@ -126,7 +129,7 @@
+@@ -156,7 +159,7 @@
#define __PAGE_KERNEL_WC (__PAGE_KERNEL | _PAGE_CACHE_WC)
#define __PAGE_KERNEL_NOCACHE (__PAGE_KERNEL | _PAGE_PCD | _PAGE_PWT)
#define __PAGE_KERNEL_UC_MINUS (__PAGE_KERNEL | _PAGE_PCD)
@@ -16955,7 +16837,7 @@ index e642300..0ef8f31 100644
#define __PAGE_KERNEL_VVAR (__PAGE_KERNEL_RO | _PAGE_USER)
#define __PAGE_KERNEL_VVAR_NOCACHE (__PAGE_KERNEL_VVAR | _PAGE_PCD | _PAGE_PWT)
#define __PAGE_KERNEL_LARGE (__PAGE_KERNEL | _PAGE_PSE)
-@@ -188,8 +191,8 @@
+@@ -218,8 +221,8 @@
* bits are combined, this will alow user to access the high address mapped
* VDSO in the presence of CONFIG_COMPAT_VDSO
*/
@@ -16966,7 +16848,7 @@ index e642300..0ef8f31 100644
#define PGD_IDENT_ATTR 0x001 /* PRESENT (no other attributes) */
#endif
-@@ -227,7 +230,17 @@ static inline pgdval_t pgd_flags(pgd_t pgd)
+@@ -257,7 +260,17 @@ static inline pgdval_t pgd_flags(pgd_t pgd)
{
return native_pgd_val(pgd) & PTE_FLAGS_MASK;
}
@@ -16984,7 +16866,7 @@ index e642300..0ef8f31 100644
#if PAGETABLE_LEVELS > 3
typedef struct { pudval_t pud; } pud_t;
-@@ -241,8 +254,6 @@ static inline pudval_t native_pud_val(pud_t pud)
+@@ -271,8 +284,6 @@ static inline pudval_t native_pud_val(pud_t pud)
return pud.pud;
}
#else
@@ -16993,7 +16875,7 @@ index e642300..0ef8f31 100644
static inline pudval_t native_pud_val(pud_t pud)
{
return native_pgd_val(pud.pgd);
-@@ -262,8 +273,6 @@ static inline pmdval_t native_pmd_val(pmd_t pmd)
+@@ -292,8 +303,6 @@ static inline pmdval_t native_pmd_val(pmd_t pmd)
return pmd.pmd;
}
#else
@@ -17002,7 +16884,7 @@ index e642300..0ef8f31 100644
static inline pmdval_t native_pmd_val(pmd_t pmd)
{
return native_pgd_val(pmd.pud.pgd);
-@@ -303,7 +312,6 @@ typedef struct page *pgtable_t;
+@@ -333,7 +342,6 @@ typedef struct page *pgtable_t;
extern pteval_t __supported_pte_mask;
extern void set_nx(void);
@@ -17011,10 +16893,10 @@ index e642300..0ef8f31 100644
#define pgprot_writecombine pgprot_writecombine
extern pgprot_t pgprot_writecombine(pgprot_t prot);
diff --git a/arch/x86/include/asm/processor.h b/arch/x86/include/asm/processor.h
-index 22224b3..b3a2f90 100644
+index 987c75e..2723054 100644
--- a/arch/x86/include/asm/processor.h
+++ b/arch/x86/include/asm/processor.h
-@@ -198,9 +198,21 @@ static inline void native_cpuid(unsigned int *eax, unsigned int *ebx,
+@@ -199,9 +199,21 @@ static inline void native_cpuid(unsigned int *eax, unsigned int *ebx,
: "memory");
}
@@ -17037,7 +16919,7 @@ index 22224b3..b3a2f90 100644
}
#ifdef CONFIG_X86_32
-@@ -282,7 +294,7 @@ struct tss_struct {
+@@ -283,7 +295,7 @@ struct tss_struct {
} ____cacheline_aligned;
@@ -17046,7 +16928,7 @@ index 22224b3..b3a2f90 100644
/*
* Save the original ist values for checking stack pointers during debugging
-@@ -452,6 +464,7 @@ struct thread_struct {
+@@ -453,6 +465,7 @@ struct thread_struct {
unsigned short ds;
unsigned short fsindex;
unsigned short gsindex;
@@ -17054,7 +16936,7 @@ index 22224b3..b3a2f90 100644
#endif
#ifdef CONFIG_X86_32
unsigned long ip;
-@@ -552,29 +565,8 @@ static inline void load_sp0(struct tss_struct *tss,
+@@ -553,29 +566,8 @@ static inline void load_sp0(struct tss_struct *tss,
extern unsigned long mmu_cr4_features;
extern u32 *trampoline_cr4_features;
@@ -17086,7 +16968,7 @@ index 22224b3..b3a2f90 100644
typedef struct {
unsigned long seg;
-@@ -823,11 +815,18 @@ static inline void spin_lock_prefetch(const void *x)
+@@ -824,11 +816,18 @@ static inline void spin_lock_prefetch(const void *x)
*/
#define TASK_SIZE PAGE_OFFSET
#define TASK_SIZE_MAX TASK_SIZE
@@ -17107,7 +16989,7 @@ index 22224b3..b3a2f90 100644
.vm86_info = NULL, \
.sysenter_cs = __KERNEL_CS, \
.io_bitmap_ptr = NULL, \
-@@ -841,7 +840,7 @@ static inline void spin_lock_prefetch(const void *x)
+@@ -842,7 +841,7 @@ static inline void spin_lock_prefetch(const void *x)
*/
#define INIT_TSS { \
.x86_tss = { \
@@ -17116,7 +16998,7 @@ index 22224b3..b3a2f90 100644
.ss0 = __KERNEL_DS, \
.ss1 = __KERNEL_CS, \
.io_bitmap_base = INVALID_IO_BITMAP_OFFSET, \
-@@ -852,11 +851,7 @@ static inline void spin_lock_prefetch(const void *x)
+@@ -853,11 +852,7 @@ static inline void spin_lock_prefetch(const void *x)
extern unsigned long thread_saved_pc(struct task_struct *tsk);
#define THREAD_SIZE_LONGS (THREAD_SIZE/sizeof(unsigned long))
@@ -17129,7 +17011,7 @@ index 22224b3..b3a2f90 100644
/*
* The below -8 is to reserve 8 bytes on top of the ring0 stack.
-@@ -871,7 +866,7 @@ extern unsigned long thread_saved_pc(struct task_struct *tsk);
+@@ -872,7 +867,7 @@ extern unsigned long thread_saved_pc(struct task_struct *tsk);
#define task_pt_regs(task) \
({ \
struct pt_regs *__regs__; \
@@ -17138,7 +17020,7 @@ index 22224b3..b3a2f90 100644
__regs__ - 1; \
})
-@@ -881,13 +876,13 @@ extern unsigned long thread_saved_pc(struct task_struct *tsk);
+@@ -882,13 +877,13 @@ extern unsigned long thread_saved_pc(struct task_struct *tsk);
/*
* User space process size. 47bits minus one guard page.
*/
@@ -17154,7 +17036,7 @@ index 22224b3..b3a2f90 100644
#define TASK_SIZE (test_thread_flag(TIF_ADDR32) ? \
IA32_PAGE_OFFSET : TASK_SIZE_MAX)
-@@ -898,11 +893,11 @@ extern unsigned long thread_saved_pc(struct task_struct *tsk);
+@@ -899,11 +894,11 @@ extern unsigned long thread_saved_pc(struct task_struct *tsk);
#define STACK_TOP_MAX TASK_SIZE_MAX
#define INIT_THREAD { \
@@ -17168,7 +17050,7 @@ index 22224b3..b3a2f90 100644
}
/*
-@@ -930,6 +925,10 @@ extern void start_thread(struct pt_regs *regs, unsigned long new_ip,
+@@ -931,6 +926,10 @@ extern void start_thread(struct pt_regs *regs, unsigned long new_ip,
*/
#define TASK_UNMAPPED_BASE (PAGE_ALIGN(TASK_SIZE / 3))
@@ -17179,18 +17061,8 @@ index 22224b3..b3a2f90 100644
#define KSTK_EIP(task) (task_pt_regs(task)->ip)
/* Get/set a process' ability to use the timestamp counter instruction */
-@@ -942,7 +941,8 @@ extern int set_tsc_mode(unsigned int val);
- extern u16 amd_get_nb_id(int cpu);
-
- struct aperfmperf {
-- u64 aperf, mperf;
-+ u64 aperf __intentional_overflow(0);
-+ u64 mperf __intentional_overflow(0);
- };
-
- static inline void get_aperfmperf(struct aperfmperf *am)
-@@ -970,7 +970,7 @@ unsigned long calc_aperfmperf_ratio(struct aperfmperf *old,
- return ratio;
+@@ -957,7 +956,7 @@ static inline uint32_t hypervisor_cpuid_base(const char *sig, uint32_t leaves)
+ return 0;
}
-extern unsigned long arch_align_stack(unsigned long sp);
@@ -17198,13 +17070,13 @@ index 22224b3..b3a2f90 100644
extern void free_init_pages(char *what, unsigned long begin, unsigned long end);
void default_idle(void);
-@@ -980,6 +980,6 @@ bool xen_set_default_idle(void);
+@@ -967,6 +966,6 @@ bool xen_set_default_idle(void);
#define xen_set_default_idle 0
#endif
-void stop_this_cpu(void *dummy);
+void stop_this_cpu(void *dummy) __noreturn;
-
+ void df_debug(struct pt_regs *regs, long error_code);
#endif /* _ASM_X86_PROCESSOR_H */
diff --git a/arch/x86/include/asm/ptrace.h b/arch/x86/include/asm/ptrace.h
index 942a086..6c26446 100644
@@ -17635,7 +17507,7 @@ index 8d3120f..352b440 100644
static __always_inline void clac(void)
diff --git a/arch/x86/include/asm/smp.h b/arch/x86/include/asm/smp.h
-index b073aae..39f9bdd 100644
+index 4137890..03fa172 100644
--- a/arch/x86/include/asm/smp.h
+++ b/arch/x86/include/asm/smp.h
@@ -36,7 +36,7 @@ DECLARE_PER_CPU_READ_MOSTLY(cpumask_var_t, cpu_core_map);
@@ -17656,7 +17528,7 @@ index b073aae..39f9bdd 100644
/* Globals due to paravirt */
extern void set_cpu_sibling_map(int cpu);
-@@ -191,14 +191,8 @@ extern unsigned disabled_cpus __cpuinitdata;
+@@ -191,14 +191,8 @@ extern unsigned disabled_cpus;
extern int safe_smp_processor_id(void);
#elif defined(CONFIG_X86_64_SMP)
@@ -17674,10 +17546,10 @@ index b073aae..39f9bdd 100644
#endif
diff --git a/arch/x86/include/asm/spinlock.h b/arch/x86/include/asm/spinlock.h
-index 33692ea..350a534 100644
+index bf156de..1a782ab 100644
--- a/arch/x86/include/asm/spinlock.h
+++ b/arch/x86/include/asm/spinlock.h
-@@ -172,6 +172,14 @@ static inline int arch_write_can_lock(arch_rwlock_t *lock)
+@@ -223,6 +223,14 @@ static inline int arch_write_can_lock(arch_rwlock_t *lock)
static inline void arch_read_lock(arch_rwlock_t *rw)
{
asm volatile(LOCK_PREFIX READ_LOCK_SIZE(dec) " (%0)\n\t"
@@ -17692,7 +17564,7 @@ index 33692ea..350a534 100644
"jns 1f\n"
"call __read_lock_failed\n\t"
"1:\n"
-@@ -181,6 +189,14 @@ static inline void arch_read_lock(arch_rwlock_t *rw)
+@@ -232,6 +240,14 @@ static inline void arch_read_lock(arch_rwlock_t *rw)
static inline void arch_write_lock(arch_rwlock_t *rw)
{
asm volatile(LOCK_PREFIX WRITE_LOCK_SUB(%1) "(%0)\n\t"
@@ -17707,7 +17579,7 @@ index 33692ea..350a534 100644
"jz 1f\n"
"call __write_lock_failed\n\t"
"1:\n"
-@@ -210,13 +226,29 @@ static inline int arch_write_trylock(arch_rwlock_t *lock)
+@@ -261,13 +277,29 @@ static inline int arch_write_trylock(arch_rwlock_t *lock)
static inline void arch_read_unlock(arch_rwlock_t *rw)
{
@@ -17780,7 +17652,15 @@ index 70bbe39..4ae2bd4 100644
- void *data,
- unsigned long *end,
- int *graph);
--
++typedef unsigned long walk_stack_t(struct task_struct *task,
++ void *stack_start,
++ unsigned long *stack,
++ unsigned long bp,
++ const struct stacktrace_ops *ops,
++ void *data,
++ unsigned long *end,
++ int *graph);
+
-extern unsigned long
-print_context_stack(struct thread_info *tinfo,
- unsigned long *stack, unsigned long bp,
@@ -17792,15 +17672,6 @@ index 70bbe39..4ae2bd4 100644
- unsigned long *stack, unsigned long bp,
- const struct stacktrace_ops *ops, void *data,
- unsigned long *end, int *graph);
-+typedef unsigned long walk_stack_t(struct task_struct *task,
-+ void *stack_start,
-+ unsigned long *stack,
-+ unsigned long bp,
-+ const struct stacktrace_ops *ops,
-+ void *data,
-+ unsigned long *end,
-+ int *graph);
-+
+extern walk_stack_t print_context_stack;
+extern walk_stack_t print_context_stack_bp;
@@ -17816,7 +17687,7 @@ index 70bbe39..4ae2bd4 100644
void dump_trace(struct task_struct *tsk, struct pt_regs *regs,
diff --git a/arch/x86/include/asm/switch_to.h b/arch/x86/include/asm/switch_to.h
-index 4ec45b3..a4f0a8a 100644
+index d7f3b3b..3cc39f1 100644
--- a/arch/x86/include/asm/switch_to.h
+++ b/arch/x86/include/asm/switch_to.h
@@ -108,7 +108,7 @@ do { \
@@ -17838,7 +17709,7 @@ index 4ec45b3..a4f0a8a 100644
__switch_canary_iparam \
: "memory", "cc" __EXTRA_CLOBBER)
diff --git a/arch/x86/include/asm/thread_info.h b/arch/x86/include/asm/thread_info.h
-index a1df6e8..e002940 100644
+index 2781119..618b59b 100644
--- a/arch/x86/include/asm/thread_info.h
+++ b/arch/x86/include/asm/thread_info.h
@@ -10,6 +10,7 @@
@@ -17888,7 +17759,7 @@ index a1df6e8..e002940 100644
#define init_stack (init_thread_union.stack)
#else /* !__ASSEMBLY__ */
-@@ -97,6 +91,7 @@ struct thread_info {
+@@ -96,6 +90,7 @@ struct thread_info {
#define TIF_SYSCALL_TRACEPOINT 28 /* syscall tracepoint instrumentation */
#define TIF_ADDR32 29 /* 32-bit address space on 64 bits */
#define TIF_X32 30 /* 32-bit native x86-64 binary */
@@ -17896,7 +17767,7 @@ index a1df6e8..e002940 100644
#define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE)
#define _TIF_NOTIFY_RESUME (1 << TIF_NOTIFY_RESUME)
-@@ -121,17 +116,18 @@ struct thread_info {
+@@ -119,17 +114,18 @@ struct thread_info {
#define _TIF_SYSCALL_TRACEPOINT (1 << TIF_SYSCALL_TRACEPOINT)
#define _TIF_ADDR32 (1 << TIF_ADDR32)
#define _TIF_X32 (1 << TIF_X32)
@@ -17917,7 +17788,7 @@ index a1df6e8..e002940 100644
/* work to do on interrupt/exception return */
#define _TIF_WORK_MASK \
-@@ -142,7 +138,7 @@ struct thread_info {
+@@ -140,7 +136,7 @@ struct thread_info {
/* work to do on any return to user space */
#define _TIF_ALLWORK_MASK \
((0x0000FFFF & ~_TIF_SECCOMP) | _TIF_SYSCALL_TRACEPOINT | \
@@ -17926,38 +17797,24 @@ index a1df6e8..e002940 100644
/* Only used for 64 bit */
#define _TIF_DO_NOTIFY_MASK \
-@@ -158,6 +154,23 @@ struct thread_info {
+@@ -156,45 +152,40 @@ struct thread_info {
#define PREEMPT_ACTIVE 0x10000000
-+#ifdef __ASSEMBLY__
-+/* how to get the thread information struct from ASM */
-+#define GET_THREAD_INFO(reg) \
-+ mov PER_CPU_VAR(current_tinfo), reg
-+
-+/* use this one if reg already contains %esp */
-+#define GET_THREAD_INFO_WITH_ESP(reg) GET_THREAD_INFO(reg)
-+#else
-+/* how to get the thread information struct from C */
-+DECLARE_PER_CPU(struct thread_info *, current_tinfo);
-+
-+static __always_inline struct thread_info *current_thread_info(void)
-+{
-+ return this_cpu_read_stable(current_tinfo);
-+}
-+#endif
-+
- #ifdef CONFIG_X86_32
-
- #define STACK_WARN (THREAD_SIZE/8)
-@@ -168,35 +181,13 @@ struct thread_info {
- */
- #ifndef __ASSEMBLY__
-
+-#ifdef CONFIG_X86_32
+-
+-#define STACK_WARN (THREAD_SIZE/8)
+-/*
+- * macros/functions for gaining access to the thread information structure
+- *
+- * preempt_count needs to be 1 initially, until the scheduler is functional.
+- */
+-#ifndef __ASSEMBLY__
+-
+-
+-/* how to get the current stack pointer from C */
+-register unsigned long current_stack_pointer asm("esp") __used;
-
- /* how to get the current stack pointer from C */
- register unsigned long current_stack_pointer asm("esp") __used;
-
-/* how to get the thread information struct from C */
-static inline struct thread_info *current_thread_info(void)
-{
@@ -17967,15 +17824,40 @@ index a1df6e8..e002940 100644
-
-#else /* !__ASSEMBLY__ */
-
--/* how to get the thread information struct from ASM */
--#define GET_THREAD_INFO(reg) \
++#ifdef __ASSEMBLY__
+ /* how to get the thread information struct from ASM */
+ #define GET_THREAD_INFO(reg) \
- movl $-THREAD_SIZE, reg; \
- andl %esp, reg
--
--/* use this one if reg already contains %esp */
++ mov PER_CPU_VAR(current_tinfo), reg
+
+ /* use this one if reg already contains %esp */
-#define GET_THREAD_INFO_WITH_ESP(reg) \
- andl $-THREAD_SIZE, reg
--
++#define GET_THREAD_INFO_WITH_ESP(reg) GET_THREAD_INFO(reg)
++#else
++/* how to get the thread information struct from C */
++DECLARE_PER_CPU(struct thread_info *, current_tinfo);
++
++static __always_inline struct thread_info *current_thread_info(void)
++{
++ return this_cpu_read_stable(current_tinfo);
++}
++#endif
++
++#ifdef CONFIG_X86_32
++
++#define STACK_WARN (THREAD_SIZE/8)
++/*
++ * macros/functions for gaining access to the thread information structure
++ *
++ * preempt_count needs to be 1 initially, until the scheduler is functional.
++ */
++#ifndef __ASSEMBLY__
++
++/* how to get the current stack pointer from C */
++register unsigned long current_stack_pointer asm("esp") __used;
+
#endif
#else /* X86_32 */
@@ -17986,7 +17868,7 @@ index a1df6e8..e002940 100644
/*
* macros/functions for gaining access to the thread information structure
* preempt_count needs to be 1 initially, until the scheduler is functional.
-@@ -204,27 +195,8 @@ static inline struct thread_info *current_thread_info(void)
+@@ -202,27 +193,8 @@ static inline struct thread_info *current_thread_info(void)
#ifndef __ASSEMBLY__
DECLARE_PER_CPU(unsigned long, kernel_stack);
@@ -18016,7 +17898,7 @@ index a1df6e8..e002940 100644
#endif
#endif /* !X86_32 */
-@@ -283,5 +255,12 @@ static inline bool is_ia32_task(void)
+@@ -281,5 +253,12 @@ static inline bool is_ia32_task(void)
extern void arch_task_cache_init(void);
extern int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src);
extern void arch_release_task_struct(struct task_struct *tsk);
@@ -18030,7 +17912,7 @@ index a1df6e8..e002940 100644
#endif
#endif /* _ASM_X86_THREAD_INFO_H */
diff --git a/arch/x86/include/asm/tlbflush.h b/arch/x86/include/asm/tlbflush.h
-index 50a7fc0..45844c0 100644
+index e6d90ba..0897f44 100644
--- a/arch/x86/include/asm/tlbflush.h
+++ b/arch/x86/include/asm/tlbflush.h
@@ -17,18 +17,44 @@
@@ -18038,7 +17920,7 @@ index 50a7fc0..45844c0 100644
static inline void __native_flush_tlb(void)
{
+ if (static_cpu_has(X86_FEATURE_INVPCID)) {
-+ unsigned long descriptor[2];
++ u64 descriptor[2];
+
+ descriptor[0] = PCID_KERNEL;
+ asm volatile(__ASM_INVPCID : : "d"(&descriptor), "a"(INVPCID_ALL_MONGLOBAL) : "memory");
@@ -18062,15 +17944,14 @@ index 50a7fc0..45844c0 100644
static inline void __native_flush_tlb_global_irq_disabled(void)
{
- unsigned long cr4;
--
++ if (static_cpu_has(X86_FEATURE_INVPCID)) {
++ u64 descriptor[2];
+
- cr4 = native_read_cr4();
- /* clear PGE */
- native_write_cr4(cr4 & ~X86_CR4_PGE);
- /* write old PGE again and flush TLBs */
- native_write_cr4(cr4);
-+ if (static_cpu_has(X86_FEATURE_INVPCID)) {
-+ unsigned long descriptor[2];
-+
+ descriptor[0] = PCID_KERNEL;
+ asm volatile(__ASM_INVPCID : : "d"(&descriptor), "a"(INVPCID_ALL_GLOBAL) : "memory");
+ } else {
@@ -18091,7 +17972,7 @@ index 50a7fc0..45844c0 100644
{
+
+ if (static_cpu_has(X86_FEATURE_INVPCID)) {
-+ unsigned long descriptor[2];
++ u64 descriptor[2];
+
+ descriptor[0] = PCID_KERNEL;
+ descriptor[1] = addr;
@@ -18129,7 +18010,7 @@ index 50a7fc0..45844c0 100644
}
diff --git a/arch/x86/include/asm/uaccess.h b/arch/x86/include/asm/uaccess.h
-index 5ee2687..74590b9 100644
+index 5838fa9..f7ae572 100644
--- a/arch/x86/include/asm/uaccess.h
+++ b/arch/x86/include/asm/uaccess.h
@@ -7,6 +7,7 @@
@@ -18189,8 +18070,8 @@ index 5ee2687..74590b9 100644
/*
* The exception table consists of pairs of addresses relative to the
-@@ -165,10 +196,12 @@ __typeof__(__builtin_choose_expr(sizeof(x) > sizeof(0UL), 0ULL, 0UL))
- register __inttype(*(ptr)) __val_gu asm("%edx"); \
+@@ -168,10 +199,12 @@ __typeof__(__builtin_choose_expr(sizeof(x) > sizeof(0UL), 0ULL, 0UL))
+ register __inttype(*(ptr)) __val_gu asm("%"_ASM_DX); \
__chk_user_ptr(ptr); \
might_fault(); \
+ pax_open_userland(); \
@@ -18202,7 +18083,7 @@ index 5ee2687..74590b9 100644
__ret_gu; \
})
-@@ -176,13 +209,21 @@ __typeof__(__builtin_choose_expr(sizeof(x) > sizeof(0UL), 0ULL, 0UL))
+@@ -179,13 +212,21 @@ __typeof__(__builtin_choose_expr(sizeof(x) > sizeof(0UL), 0ULL, 0UL))
asm volatile("call __put_user_" #size : "=a" (__ret_pu) \
: "0" ((typeof(*(ptr)))(x)), "c" (ptr) : "ebx")
@@ -18227,7 +18108,7 @@ index 5ee2687..74590b9 100644
"3: " ASM_CLAC "\n" \
".section .fixup,\"ax\"\n" \
"4: movl %3,%0\n" \
-@@ -195,8 +236,8 @@ __typeof__(__builtin_choose_expr(sizeof(x) > sizeof(0UL), 0ULL, 0UL))
+@@ -198,8 +239,8 @@ __typeof__(__builtin_choose_expr(sizeof(x) > sizeof(0UL), 0ULL, 0UL))
#define __put_user_asm_ex_u64(x, addr) \
asm volatile(ASM_STAC "\n" \
@@ -18238,7 +18119,7 @@ index 5ee2687..74590b9 100644
"3: " ASM_CLAC "\n" \
_ASM_EXTABLE_EX(1b, 2b) \
_ASM_EXTABLE_EX(2b, 3b) \
-@@ -246,7 +287,8 @@ extern void __put_user_8(void);
+@@ -249,7 +290,8 @@ extern void __put_user_8(void);
__typeof__(*(ptr)) __pu_val; \
__chk_user_ptr(ptr); \
might_fault(); \
@@ -18248,7 +18129,7 @@ index 5ee2687..74590b9 100644
switch (sizeof(*(ptr))) { \
case 1: \
__put_user_x(1, __pu_val, ptr, __ret_pu); \
-@@ -264,6 +306,7 @@ extern void __put_user_8(void);
+@@ -267,6 +309,7 @@ extern void __put_user_8(void);
__put_user_x(X, __pu_val, ptr, __ret_pu); \
break; \
} \
@@ -18256,7 +18137,7 @@ index 5ee2687..74590b9 100644
__ret_pu; \
})
-@@ -344,8 +387,10 @@ do { \
+@@ -347,8 +390,10 @@ do { \
} while (0)
#define __get_user_asm(x, addr, err, itype, rtype, ltype, errret) \
@@ -18268,7 +18149,7 @@ index 5ee2687..74590b9 100644
"2: " ASM_CLAC "\n" \
".section .fixup,\"ax\"\n" \
"3: mov %3,%0\n" \
-@@ -353,8 +398,10 @@ do { \
+@@ -356,8 +401,10 @@ do { \
" jmp 2b\n" \
".previous\n" \
_ASM_EXTABLE(1b, 3b) \
@@ -18281,7 +18162,7 @@ index 5ee2687..74590b9 100644
#define __get_user_size_ex(x, ptr, size) \
do { \
-@@ -378,7 +425,7 @@ do { \
+@@ -381,7 +428,7 @@ do { \
} while (0)
#define __get_user_asm_ex(x, addr, itype, rtype, ltype) \
@@ -18290,7 +18171,7 @@ index 5ee2687..74590b9 100644
"2:\n" \
_ASM_EXTABLE_EX(1b, 2b) \
: ltype(x) : "m" (__m(addr)))
-@@ -395,13 +442,24 @@ do { \
+@@ -398,13 +445,24 @@ do { \
int __gu_err; \
unsigned long __gu_val; \
__get_user_size(__gu_val, (ptr), (size), __gu_err, -EFAULT); \
@@ -18317,7 +18198,7 @@ index 5ee2687..74590b9 100644
/*
* Tell gcc we read from memory instead of writing: this is because
-@@ -409,8 +467,10 @@ struct __large_struct { unsigned long buf[100]; };
+@@ -412,8 +470,10 @@ struct __large_struct { unsigned long buf[100]; };
* aliasing issues.
*/
#define __put_user_asm(x, addr, err, itype, rtype, ltype, errret) \
@@ -18329,7 +18210,7 @@ index 5ee2687..74590b9 100644
"2: " ASM_CLAC "\n" \
".section .fixup,\"ax\"\n" \
"3: mov %3,%0\n" \
-@@ -418,10 +478,12 @@ struct __large_struct { unsigned long buf[100]; };
+@@ -421,10 +481,12 @@ struct __large_struct { unsigned long buf[100]; };
".previous\n" \
_ASM_EXTABLE(1b, 3b) \
: "=r"(err) \
@@ -18344,7 +18225,7 @@ index 5ee2687..74590b9 100644
"2:\n" \
_ASM_EXTABLE_EX(1b, 2b) \
: : ltype(x), "m" (__m(addr)))
-@@ -431,11 +493,13 @@ struct __large_struct { unsigned long buf[100]; };
+@@ -434,11 +496,13 @@ struct __large_struct { unsigned long buf[100]; };
*/
#define uaccess_try do { \
current_thread_info()->uaccess_err = 0; \
@@ -18358,7 +18239,7 @@ index 5ee2687..74590b9 100644
(err) |= (current_thread_info()->uaccess_err ? -EFAULT : 0); \
} while (0)
-@@ -460,8 +524,12 @@ struct __large_struct { unsigned long buf[100]; };
+@@ -463,8 +527,12 @@ struct __large_struct { unsigned long buf[100]; };
* On error, the variable @x is set to zero.
*/
@@ -18371,7 +18252,7 @@ index 5ee2687..74590b9 100644
/**
* __put_user: - Write a simple value into user space, with less checking.
-@@ -483,8 +551,12 @@ struct __large_struct { unsigned long buf[100]; };
+@@ -486,8 +554,12 @@ struct __large_struct { unsigned long buf[100]; };
* Returns zero on success, or -EFAULT on error.
*/
@@ -18384,7 +18265,7 @@ index 5ee2687..74590b9 100644
#define __get_user_unaligned __get_user
#define __put_user_unaligned __put_user
-@@ -502,7 +574,7 @@ struct __large_struct { unsigned long buf[100]; };
+@@ -505,7 +577,7 @@ struct __large_struct { unsigned long buf[100]; };
#define get_user_ex(x, ptr) do { \
unsigned long __gue_val; \
__get_user_size_ex((__gue_val), (ptr), (sizeof(*(ptr)))); \
@@ -18393,42 +18274,10 @@ index 5ee2687..74590b9 100644
} while (0)
#define put_user_try uaccess_try
-@@ -519,8 +591,8 @@ strncpy_from_user(char *dst, const char __user *src, long count);
- extern __must_check long strlen_user(const char __user *str);
- extern __must_check long strnlen_user(const char __user *str, long n);
-
--unsigned long __must_check clear_user(void __user *mem, unsigned long len);
--unsigned long __must_check __clear_user(void __user *mem, unsigned long len);
-+unsigned long __must_check clear_user(void __user *mem, unsigned long len) __size_overflow(2);
-+unsigned long __must_check __clear_user(void __user *mem, unsigned long len) __size_overflow(2);
-
- /*
- * movsl can be slow when source and dest are not both 8-byte aligned
diff --git a/arch/x86/include/asm/uaccess_32.h b/arch/x86/include/asm/uaccess_32.h
-index 7f760a9..04b1c65 100644
+index 7f760a9..b596b9a 100644
--- a/arch/x86/include/asm/uaccess_32.h
+++ b/arch/x86/include/asm/uaccess_32.h
-@@ -11,15 +11,15 @@
- #include <asm/page.h>
-
- unsigned long __must_check __copy_to_user_ll
-- (void __user *to, const void *from, unsigned long n);
-+ (void __user *to, const void *from, unsigned long n) __size_overflow(3);
- unsigned long __must_check __copy_from_user_ll
-- (void *to, const void __user *from, unsigned long n);
-+ (void *to, const void __user *from, unsigned long n) __size_overflow(3);
- unsigned long __must_check __copy_from_user_ll_nozero
-- (void *to, const void __user *from, unsigned long n);
-+ (void *to, const void __user *from, unsigned long n) __size_overflow(3);
- unsigned long __must_check __copy_from_user_ll_nocache
-- (void *to, const void __user *from, unsigned long n);
-+ (void *to, const void __user *from, unsigned long n) __size_overflow(3);
- unsigned long __must_check __copy_from_user_ll_nocache_nozero
-- (void *to, const void __user *from, unsigned long n);
-+ (void *to, const void __user *from, unsigned long n) __size_overflow(3);
-
- /**
- * __copy_to_user_inatomic: - Copy a block of data into user space, with less checking.
@@ -43,6 +43,11 @@ unsigned long __must_check __copy_from_user_ll_nocache_nozero
static __always_inline unsigned long __must_check
__copy_to_user_inatomic(void __user *to, const void *from, unsigned long n)
@@ -18487,18 +18336,18 @@ index 7f760a9..04b1c65 100644
unsigned long n)
{
- return __copy_from_user_ll_nocache_nozero(to, from, n);
--}
+ if ((long)n < 0)
+ return n;
++
++ return __copy_from_user_ll_nocache_nozero(to, from, n);
+ }
-unsigned long __must_check copy_to_user(void __user *to,
- const void *from, unsigned long n);
-unsigned long __must_check _copy_from_user(void *to,
- const void __user *from,
- unsigned long n);
-+ return __copy_from_user_ll_nocache_nozero(to, from, n);
-+}
-
+-
+extern void copy_to_user_overflow(void)
+#ifdef CONFIG_DEBUG_STRICT_USER_COPY_CHECKS
+ __compiletime_error("copy_to_user() buffer size is not provably correct")
@@ -18538,14 +18387,13 @@ index 7f760a9..04b1c65 100644
- if (likely(sz == -1 || sz >= n))
- n = _copy_from_user(to, from, n);
- else
-- copy_from_user_overflow();
+ if (unlikely(sz != (size_t)-1 && sz < n))
+ copy_to_user_overflow();
+ else if (access_ok(VERIFY_WRITE, to, n))
+ n = __copy_to_user(to, from, n);
+ return n;
+}
-
++
+/**
+ * copy_from_user: - Copy a block of data from user space.
+ * @to: Destination address, in kernel space.
@@ -18570,7 +18418,8 @@ index 7f760a9..04b1c65 100644
+ check_object_size(to, n, false);
+
+ if (unlikely(sz != (size_t)-1 && sz < n))
-+ copy_from_user_overflow();
+ copy_from_user_overflow();
+-
+ else if (access_ok(VERIFY_READ, from, n))
+ n = __copy_from_user(to, from, n);
+ else if ((long)n > 0)
@@ -18579,7 +18428,7 @@ index 7f760a9..04b1c65 100644
}
diff --git a/arch/x86/include/asm/uaccess_64.h b/arch/x86/include/asm/uaccess_64.h
-index 142810c..9d398f4 100644
+index 4f7923d..201b58d 100644
--- a/arch/x86/include/asm/uaccess_64.h
+++ b/arch/x86/include/asm/uaccess_64.h
@@ -10,6 +10,9 @@
@@ -18592,7 +18441,7 @@ index 142810c..9d398f4 100644
/*
* Copy To/From Userspace
-@@ -17,13 +20,13 @@
+@@ -17,14 +20,14 @@
/* Handles exceptions in both to and from, but doesn't do access_ok */
__must_check unsigned long
@@ -18606,10 +18455,12 @@ index 142810c..9d398f4 100644
+copy_user_generic_unrolled(void *to, const void *from, unsigned len) __size_overflow(3);
-static __always_inline __must_check unsigned long
-+static __always_inline __must_check __size_overflow(3) unsigned long
- copy_user_generic(void *to, const void *from, unsigned len)
+-copy_user_generic(void *to, const void *from, unsigned len)
++static __always_inline __must_check unsigned long
++copy_user_generic(void *to, const void *from, unsigned long len)
{
unsigned ret;
+
@@ -45,138 +48,200 @@ copy_user_generic(void *to, const void *from, unsigned len)
return ret;
}
@@ -18882,7 +18733,7 @@ index 142810c..9d398f4 100644
ret, "q", "", "=r", 8);
if (likely(!ret))
__put_user_asm(tmp, (u64 __user *)dst,
-@@ -212,41 +277,72 @@ int __copy_in_user(void __user *dst, const void __user *src, unsigned size)
+@@ -212,41 +277,74 @@ int __copy_in_user(void __user *dst, const void __user *src, unsigned size)
return ret;
}
default:
@@ -18930,13 +18781,14 @@ index 142810c..9d398f4 100644
-extern long __copy_user_nocache(void *dst, const void __user *src,
- unsigned size, int zerorest);
+extern unsigned long __copy_user_nocache(void *dst, const void __user *src,
-+ unsigned long size, int zerorest) __size_overflow(3);
++ unsigned long size, int zerorest);
-static inline int
-__copy_from_user_nocache(void *dst, const void __user *src, unsigned size)
-+static inline unsigned long __copy_from_user_nocache(void *dst, const void __user *src, unsigned long size)
++static inline unsigned long
++__copy_from_user_nocache(void *dst, const void __user *src, unsigned long size)
{
- might_sleep();
+ might_fault();
+
+ if (size > INT_MAX)
+ return size;
@@ -18950,9 +18802,9 @@ index 142810c..9d398f4 100644
}
-static inline int
--__copy_from_user_inatomic_nocache(void *dst, const void __user *src,
++static inline unsigned long
+ __copy_from_user_inatomic_nocache(void *dst, const void __user *src,
- unsigned size)
-+static inline unsigned long __copy_from_user_inatomic_nocache(void *dst, const void __user *src,
+ unsigned long size)
{
+ if (size > INT_MAX)
@@ -18966,9 +18818,8 @@ index 142810c..9d398f4 100644
return __copy_user_nocache(dst, src, size, 0);
}
--unsigned long
+ unsigned long
-copy_user_handle_tail(char *to, char *from, unsigned len, unsigned zerorest);
-+extern unsigned long
+copy_user_handle_tail(char __user *to, char __user *from, unsigned long len, unsigned zerorest) __size_overflow(3);
#endif /* _ASM_X86_UACCESS_64_H */
@@ -18986,7 +18837,7 @@ index 5b238981..77fdd78 100644
#define WORD_AT_A_TIME_CONSTANTS { REPEAT_BYTE(0x01), REPEAT_BYTE(0x80) }
diff --git a/arch/x86/include/asm/x86_init.h b/arch/x86/include/asm/x86_init.h
-index d8d9922..bf6cecb 100644
+index 828a156..650e625 100644
--- a/arch/x86/include/asm/x86_init.h
+++ b/arch/x86/include/asm/x86_init.h
@@ -129,7 +129,7 @@ struct x86_init_ops {
@@ -19005,9 +18856,9 @@ index d8d9922..bf6cecb 100644
-};
+} __no_const;
- /**
- * struct x86_platform_ops - platform specific runtime functions
-@@ -166,7 +166,7 @@ struct x86_platform_ops {
+ struct timespec;
+
+@@ -168,7 +168,7 @@ struct x86_platform_ops {
void (*save_sched_clock_state)(void);
void (*restore_sched_clock_state)(void);
void (*apic_post_init)(void);
@@ -19016,7 +18867,7 @@ index d8d9922..bf6cecb 100644
struct pci_dev;
struct msi_msg;
-@@ -180,7 +180,7 @@ struct x86_msi_ops {
+@@ -182,7 +182,7 @@ struct x86_msi_ops {
void (*teardown_msi_irqs)(struct pci_dev *dev);
void (*restore_msi_irqs)(struct pci_dev *dev, int irq);
int (*setup_hpet_msi)(unsigned int irq, unsigned int id);
@@ -19025,7 +18876,7 @@ index d8d9922..bf6cecb 100644
struct IO_APIC_route_entry;
struct io_apic_irq_attr;
-@@ -201,7 +201,7 @@ struct x86_io_apic_ops {
+@@ -203,7 +203,7 @@ struct x86_io_apic_ops {
unsigned int destination, int vector,
struct io_apic_irq_attr *attr);
void (*eoi_ioapic_pin)(int apic, int pin, int vector);
@@ -19034,6 +18885,19 @@ index d8d9922..bf6cecb 100644
extern struct x86_init_ops x86_init;
extern struct x86_cpuinit_ops x86_cpuinit;
+diff --git a/arch/x86/include/asm/xen/page.h b/arch/x86/include/asm/xen/page.h
+index b913915..4f5a581 100644
+--- a/arch/x86/include/asm/xen/page.h
++++ b/arch/x86/include/asm/xen/page.h
+@@ -56,7 +56,7 @@ extern int m2p_remove_override(struct page *page,
+ extern struct page *m2p_find_override(unsigned long mfn);
+ extern unsigned long m2p_find_override_pfn(unsigned long mfn, unsigned long pfn);
+
+-static inline unsigned long pfn_to_mfn(unsigned long pfn)
++static inline unsigned long __intentional_overflow(-1) pfn_to_mfn(unsigned long pfn)
+ {
+ unsigned long mfn;
+
diff --git a/arch/x86/include/asm/xsave.h b/arch/x86/include/asm/xsave.h
index 0415cda..3b22adc 100644
--- a/arch/x86/include/asm/xsave.h
@@ -19098,10 +18962,10 @@ index bbae024..e1528f9 100644
#define BIOS_ROM_BASE 0xffe00000
diff --git a/arch/x86/kernel/Makefile b/arch/x86/kernel/Makefile
-index 7bd3bd3..5dac791 100644
+index a5408b9..5133813 100644
--- a/arch/x86/kernel/Makefile
+++ b/arch/x86/kernel/Makefile
-@@ -22,7 +22,7 @@ obj-y += time.o ioport.o ldt.o dumpstack.o nmi.o
+@@ -24,7 +24,7 @@ obj-y += time.o ioport.o ldt.o dumpstack.o nmi.o
obj-y += setup.o x86_init.o i8259.o irqinit.o jump_label.o
obj-$(CONFIG_IRQ_WORK) += irq_work.o
obj-y += probe_roms.o
@@ -19111,10 +18975,10 @@ index 7bd3bd3..5dac791 100644
obj-y += syscall_$(BITS).o
obj-$(CONFIG_X86_64) += vsyscall_64.o
diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c
-index 230c8ea..f915130 100644
+index 40c7660..f709f4b 100644
--- a/arch/x86/kernel/acpi/boot.c
+++ b/arch/x86/kernel/acpi/boot.c
-@@ -1361,7 +1361,7 @@ static int __init dmi_ignore_irq0_timer_override(const struct dmi_system_id *d)
+@@ -1365,7 +1365,7 @@ static int __init dmi_ignore_irq0_timer_override(const struct dmi_system_id *d)
* If your system is blacklisted here, but you find that acpi=force
* works for you, please contact linux-acpi@vger.kernel.org
*/
@@ -19123,7 +18987,7 @@ index 230c8ea..f915130 100644
/*
* Boxes that need ACPI disabled
*/
-@@ -1436,7 +1436,7 @@ static struct dmi_system_id __initdata acpi_dmi_table[] = {
+@@ -1440,7 +1440,7 @@ static struct dmi_system_id __initdata acpi_dmi_table[] = {
};
/* second table for DMI checks that should run after early-quirks */
@@ -19133,10 +18997,10 @@ index 230c8ea..f915130 100644
* HP laptops which use a DSDT reporting as HP/SB400/10000,
* which includes some code which overrides all temperature
diff --git a/arch/x86/kernel/acpi/sleep.c b/arch/x86/kernel/acpi/sleep.c
-index ec94e11..7fbbec0 100644
+index 3312010..a65ca7b 100644
--- a/arch/x86/kernel/acpi/sleep.c
+++ b/arch/x86/kernel/acpi/sleep.c
-@@ -88,8 +88,12 @@ int acpi_suspend_lowlevel(void)
+@@ -88,8 +88,12 @@ int x86_acpi_suspend_lowlevel(void)
#else /* CONFIG_64BIT */
#ifdef CONFIG_SMP
stack_start = (unsigned long)temp_stack + sizeof(temp_stack);
@@ -19170,10 +19034,10 @@ index d1daa66..59fecba 100644
bogus_magic:
jmp bogus_magic
diff --git a/arch/x86/kernel/alternative.c b/arch/x86/kernel/alternative.c
-index c15cf9a..0e63558 100644
+index 15e8563..323cbe1 100644
--- a/arch/x86/kernel/alternative.c
+++ b/arch/x86/kernel/alternative.c
-@@ -268,6 +268,13 @@ void __init_or_module apply_alternatives(struct alt_instr *start,
+@@ -269,6 +269,13 @@ void __init_or_module apply_alternatives(struct alt_instr *start,
*/
for (a = start; a < end; a++) {
instr = (u8 *)&a->instr_offset + a->instr_offset;
@@ -19187,7 +19051,7 @@ index c15cf9a..0e63558 100644
replacement = (u8 *)&a->repl_offset + a->repl_offset;
BUG_ON(a->replacementlen > a->instrlen);
BUG_ON(a->instrlen > sizeof(insnbuf));
-@@ -299,10 +306,16 @@ static void alternatives_smp_lock(const s32 *start, const s32 *end,
+@@ -300,10 +307,16 @@ static void alternatives_smp_lock(const s32 *start, const s32 *end,
for (poff = start; poff < end; poff++) {
u8 *ptr = (u8 *)poff + *poff;
@@ -19205,7 +19069,7 @@ index c15cf9a..0e63558 100644
text_poke(ptr, ((unsigned char []){0xf0}), 1);
}
mutex_unlock(&text_mutex);
-@@ -317,10 +330,16 @@ static void alternatives_smp_unlock(const s32 *start, const s32 *end,
+@@ -318,10 +331,16 @@ static void alternatives_smp_unlock(const s32 *start, const s32 *end,
for (poff = start; poff < end; poff++) {
u8 *ptr = (u8 *)poff + *poff;
@@ -19223,7 +19087,7 @@ index c15cf9a..0e63558 100644
text_poke(ptr, ((unsigned char []){0x3E}), 1);
}
mutex_unlock(&text_mutex);
-@@ -468,7 +487,7 @@ void __init_or_module apply_paravirt(struct paravirt_patch_site *start,
+@@ -469,7 +488,7 @@ void __init_or_module apply_paravirt(struct paravirt_patch_site *start,
BUG_ON(p->len > MAX_PATCH_LEN);
/* prep the buffer with the original instructions */
@@ -19232,7 +19096,7 @@ index c15cf9a..0e63558 100644
used = pv_init_ops.patch(p->instrtype, p->clobbers, insnbuf,
(unsigned long)p->instr, p->len);
-@@ -515,7 +534,7 @@ void __init alternative_instructions(void)
+@@ -516,7 +535,7 @@ void __init alternative_instructions(void)
if (!uniproc_patched || num_possible_cpus() == 1)
free_init_pages("SMP alternatives",
(unsigned long)__smp_locks,
@@ -19241,7 +19105,7 @@ index c15cf9a..0e63558 100644
#endif
apply_paravirt(__parainstructions, __parainstructions_end);
-@@ -535,13 +554,17 @@ void __init alternative_instructions(void)
+@@ -536,13 +555,17 @@ void __init alternative_instructions(void)
* instructions. And on the local CPU you need to be protected again NMI or MCE
* handlers seeing an inconsistent instruction while you patch.
*/
@@ -19261,7 +19125,7 @@ index c15cf9a..0e63558 100644
local_irq_restore(flags);
/* Could also do a CLFLUSH here to speed up CPU recovery; but
that causes hangs on some VIA CPUs. */
-@@ -563,36 +586,22 @@ void *__init_or_module text_poke_early(void *addr, const void *opcode,
+@@ -564,36 +587,22 @@ void *__init_or_module text_poke_early(void *addr, const void *opcode,
*/
void *__kprobes text_poke(void *addr, const void *opcode, size_t len)
{
@@ -19306,11 +19170,29 @@ index c15cf9a..0e63558 100644
return addr;
}
+@@ -613,7 +622,7 @@ int poke_int3_handler(struct pt_regs *regs)
+ if (likely(!bp_patching_in_progress))
+ return 0;
+
+- if (user_mode_vm(regs) || regs->ip != (unsigned long)bp_int3_addr)
++ if (user_mode(regs) || regs->ip != (unsigned long)bp_int3_addr)
+ return 0;
+
+ /* set up the specified breakpoint handler */
+@@ -647,7 +656,7 @@ int poke_int3_handler(struct pt_regs *regs)
+ */
+ void *text_poke_bp(void *addr, const void *opcode, size_t len, void *handler)
+ {
+- unsigned char int3 = 0xcc;
++ const unsigned char int3 = 0xcc;
+
+ bp_int3_handler = handler;
+ bp_int3_addr = (u8 *)addr + sizeof(int3);
diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c
-index 904611b..004dde6 100644
+index a7eb82d..f6e52d4 100644
--- a/arch/x86/kernel/apic/apic.c
+++ b/arch/x86/kernel/apic/apic.c
-@@ -189,7 +189,7 @@ int first_system_vector = 0xfe;
+@@ -190,7 +190,7 @@ int first_system_vector = 0xfe;
/*
* Debug level, exported for io_apic.c
*/
@@ -19319,7 +19201,7 @@ index 904611b..004dde6 100644
int pic_mode;
-@@ -1955,7 +1955,7 @@ void smp_error_interrupt(struct pt_regs *regs)
+@@ -1985,7 +1985,7 @@ static inline void __smp_error_interrupt(struct pt_regs *regs)
apic_write(APIC_ESR, 0);
v1 = apic_read(APIC_ESR);
ack_APIC_irq();
@@ -19377,7 +19259,7 @@ index d50e364..543bee3 100644
.name = "bigsmp",
.probe = probe_bigsmp,
diff --git a/arch/x86/kernel/apic/es7000_32.c b/arch/x86/kernel/apic/es7000_32.c
-index 0874799..a7a7892 100644
+index c552247..587a316 100644
--- a/arch/x86/kernel/apic/es7000_32.c
+++ b/arch/x86/kernel/apic/es7000_32.c
@@ -608,8 +608,7 @@ static int es7000_mps_oem_check_cluster(struct mpc_table *mpc, char *oem,
@@ -19400,7 +19282,7 @@ index 0874799..a7a7892 100644
.name = "es7000",
.probe = probe_es7000,
diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c
-index 9ed796c..e930fe4 100644
+index e63a5bd..c0babf8 100644
--- a/arch/x86/kernel/apic/io_apic.c
+++ b/arch/x86/kernel/apic/io_apic.c
@@ -1060,7 +1060,7 @@ int IO_APIC_get_PCI_irq_vector(int bus, int slot, int pin,
@@ -19421,7 +19303,7 @@ index 9ed796c..e930fe4 100644
{
raw_spin_unlock(&vector_lock);
}
-@@ -2362,7 +2362,7 @@ static void ack_apic_edge(struct irq_data *data)
+@@ -2367,7 +2367,7 @@ static void ack_apic_edge(struct irq_data *data)
ack_APIC_irq();
}
@@ -19430,7 +19312,7 @@ index 9ed796c..e930fe4 100644
#ifdef CONFIG_GENERIC_PENDING_IRQ
static bool io_apic_level_ack_pending(struct irq_cfg *cfg)
-@@ -2503,7 +2503,7 @@ static void ack_apic_level(struct irq_data *data)
+@@ -2508,7 +2508,7 @@ static void ack_apic_level(struct irq_data *data)
* at the cpu.
*/
if (!(v & (1 << (i & 0x1f)))) {
@@ -19440,7 +19322,7 @@ index 9ed796c..e930fe4 100644
eoi_ioapic_irq(irq, cfg);
}
diff --git a/arch/x86/kernel/apic/numaq_32.c b/arch/x86/kernel/apic/numaq_32.c
-index d661ee9..791fd33 100644
+index 1e42e8f..daacf44 100644
--- a/arch/x86/kernel/apic/numaq_32.c
+++ b/arch/x86/kernel/apic/numaq_32.c
@@ -455,8 +455,7 @@ static void numaq_setup_portio_remap(void)
@@ -19480,7 +19362,7 @@ index 77c95c0..434f8a4 100644
.name = "summit",
.probe = probe_summit,
diff --git a/arch/x86/kernel/apic/x2apic_cluster.c b/arch/x86/kernel/apic/x2apic_cluster.c
-index c88baa4..757aee1 100644
+index 140e29d..d88bc95 100644
--- a/arch/x86/kernel/apic/x2apic_cluster.c
+++ b/arch/x86/kernel/apic/x2apic_cluster.c
@@ -183,7 +183,7 @@ update_clusterinfo(struct notifier_block *nfb, unsigned long action, void *hcpu)
@@ -19515,10 +19397,10 @@ index 562a76d..a003c0f 100644
.name = "physical x2apic",
.probe = x2apic_phys_probe,
diff --git a/arch/x86/kernel/apic/x2apic_uv_x.c b/arch/x86/kernel/apic/x2apic_uv_x.c
-index b32dbb4..6d66648 100644
+index a419814..1dd34a0 100644
--- a/arch/x86/kernel/apic/x2apic_uv_x.c
+++ b/arch/x86/kernel/apic/x2apic_uv_x.c
-@@ -342,7 +342,7 @@ static int uv_probe(void)
+@@ -357,7 +357,7 @@ static int uv_probe(void)
return apic == &apic_x2apic_uv_x;
}
@@ -19528,7 +19410,7 @@ index b32dbb4..6d66648 100644
.name = "UV large system",
.probe = uv_probe,
diff --git a/arch/x86/kernel/apm_32.c b/arch/x86/kernel/apm_32.c
-index 53a4e27..038760a 100644
+index 3ab0343..814c4787 100644
--- a/arch/x86/kernel/apm_32.c
+++ b/arch/x86/kernel/apm_32.c
@@ -433,7 +433,7 @@ static DEFINE_MUTEX(apm_mutex);
@@ -19622,16 +19504,16 @@ index 2861082..6d4718e 100644
+
+#ifdef CONFIG_PAX_KERNEXEC
+ OFFSET(PV_CPU_write_cr0, pv_cpu_ops, write_cr0);
-+#endif
-+
+ #endif
+
+#ifdef CONFIG_PAX_MEMORY_UDEREF
+ OFFSET(PV_MMU_read_cr3, pv_mmu_ops, read_cr3);
+ OFFSET(PV_MMU_write_cr3, pv_mmu_ops, write_cr3);
+#ifdef CONFIG_X86_64
+ OFFSET(PV_MMU_set_pgd_batched, pv_mmu_ops, set_pgd_batched);
+#endif
- #endif
-
++#endif
++
+#endif
+
+ BLANK();
@@ -19655,7 +19537,7 @@ index e7c798b..2b2019b 100644
BLANK();
diff --git a/arch/x86/kernel/cpu/Makefile b/arch/x86/kernel/cpu/Makefile
-index b0684e4..22ccfd7 100644
+index 47b56a7..efc2bc6 100644
--- a/arch/x86/kernel/cpu/Makefile
+++ b/arch/x86/kernel/cpu/Makefile
@@ -8,10 +8,6 @@ CFLAGS_REMOVE_common.o = -pg
@@ -19670,11 +19552,11 @@ index b0684e4..22ccfd7 100644
obj-y += proc.o capflags.o powerflags.o common.o
obj-y += rdrand.o
diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c
-index 5013a48..0782c53 100644
+index 903a264..fc955f3 100644
--- a/arch/x86/kernel/cpu/amd.c
+++ b/arch/x86/kernel/cpu/amd.c
-@@ -744,7 +744,7 @@ static unsigned int __cpuinit amd_size_cache(struct cpuinfo_x86 *c,
- unsigned int size)
+@@ -743,7 +743,7 @@ static void init_amd(struct cpuinfo_x86 *c)
+ static unsigned int amd_size_cache(struct cpuinfo_x86 *c, unsigned int size)
{
/* AMD errata T13 (order #21922) */
- if ((c->x86 == 6)) {
@@ -19683,12 +19565,12 @@ index 5013a48..0782c53 100644
if (c->x86_model == 3 && c->x86_mask == 0)
size = 64;
diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
-index 22018f7..df77e23 100644
+index 2793d1f..b4f313a 100644
--- a/arch/x86/kernel/cpu/common.c
+++ b/arch/x86/kernel/cpu/common.c
-@@ -88,60 +88,6 @@ static const struct cpu_dev __cpuinitconst default_cpu = {
+@@ -88,60 +88,6 @@ static const struct cpu_dev default_cpu = {
- static const struct cpu_dev *this_cpu __cpuinitdata = &default_cpu;
+ static const struct cpu_dev *this_cpu = &default_cpu;
-DEFINE_PER_CPU_PAGE_ALIGNED(struct gdt_page, gdt_page) = { .gdt = {
-#ifdef CONFIG_X86_64
@@ -19747,7 +19629,7 @@ index 22018f7..df77e23 100644
static int __init x86_xsave_setup(char *s)
{
setup_clear_cpu_cap(X86_FEATURE_XSAVE);
-@@ -288,6 +234,57 @@ static __always_inline void setup_smap(struct cpuinfo_x86 *c)
+@@ -288,6 +234,59 @@ static __always_inline void setup_smap(struct cpuinfo_x86 *c)
set_in_cr4(X86_CR4_SMAP);
}
@@ -19755,6 +19637,7 @@ index 22018f7..df77e23 100644
+static __init int setup_disable_pcid(char *arg)
+{
+ setup_clear_cpu_cap(X86_FEATURE_PCID);
++ setup_clear_cpu_cap(X86_FEATURE_INVPCID);
+
+#ifdef CONFIG_PAX_MEMORY_UDEREF
+ if (clone_pgd_mask != ~(pgdval_t)0UL)
@@ -19768,6 +19651,7 @@ index 22018f7..df77e23 100644
+static void setup_pcid(struct cpuinfo_x86 *c)
+{
+ if (!cpu_has(c, X86_FEATURE_PCID)) {
++ clear_cpu_cap(c, X86_FEATURE_INVPCID);
+
+#ifdef CONFIG_PAX_MEMORY_UDEREF
+ if (clone_pgd_mask != ~(pgdval_t)0UL) {
@@ -19805,7 +19689,7 @@ index 22018f7..df77e23 100644
/*
* Some CPU features depend on higher CPUID levels, which may not always
* be available due to CPUID level capping or broken virtualization
-@@ -386,7 +383,7 @@ void switch_to_new_gdt(int cpu)
+@@ -386,7 +385,7 @@ void switch_to_new_gdt(int cpu)
{
struct desc_ptr gdt_descr;
@@ -19814,7 +19698,7 @@ index 22018f7..df77e23 100644
gdt_descr.size = GDT_SIZE - 1;
load_gdt(&gdt_descr);
/* Reload the per-cpu base */
-@@ -874,6 +871,10 @@ static void __cpuinit identify_cpu(struct cpuinfo_x86 *c)
+@@ -875,6 +874,10 @@ static void identify_cpu(struct cpuinfo_x86 *c)
setup_smep(c);
setup_smap(c);
@@ -19825,7 +19709,7 @@ index 22018f7..df77e23 100644
/*
* The vendor-specific functions might have changed features.
* Now we do "generic changes."
-@@ -882,6 +883,10 @@ static void __cpuinit identify_cpu(struct cpuinfo_x86 *c)
+@@ -883,6 +886,10 @@ static void identify_cpu(struct cpuinfo_x86 *c)
/* Filter out anything that depends on CPUID levels we don't have */
filter_cpuid_features(c, true);
@@ -19836,7 +19720,7 @@ index 22018f7..df77e23 100644
/* If the model name is still unset, do table lookup. */
if (!c->x86_model_id[0]) {
const char *p;
-@@ -1069,10 +1074,12 @@ static __init int setup_disablecpuid(char *arg)
+@@ -1070,10 +1077,12 @@ static __init int setup_disablecpuid(char *arg)
}
__setup("clearcpuid=", setup_disablecpuid);
@@ -19844,14 +19728,15 @@ index 22018f7..df77e23 100644
+EXPORT_PER_CPU_SYMBOL(current_tinfo);
+
#ifdef CONFIG_X86_64
- struct desc_ptr idt_descr = { NR_VECTORS * 16 - 1, (unsigned long) idt_table };
--struct desc_ptr nmi_idt_descr = { NR_VECTORS * 16 - 1,
-- (unsigned long) nmi_idt_table };
-+struct desc_ptr nmi_idt_descr = { NR_VECTORS * 16 - 1, (unsigned long) nmi_idt_table };
+-struct desc_ptr idt_descr = { NR_VECTORS * 16 - 1, (unsigned long) idt_table };
+-struct desc_ptr debug_idt_descr = { NR_VECTORS * 16 - 1,
+- (unsigned long) debug_idt_table };
++struct desc_ptr idt_descr __read_only = { NR_VECTORS * 16 - 1, (unsigned long) idt_table };
++const struct desc_ptr debug_idt_descr = { NR_VECTORS * 16 - 1, (unsigned long) debug_idt_table };
DEFINE_PER_CPU_FIRST(union irq_stack_union,
- irq_stack_union) __aligned(PAGE_SIZE);
-@@ -1086,7 +1093,7 @@ DEFINE_PER_CPU(struct task_struct *, current_task) ____cacheline_aligned =
+ irq_stack_union) __aligned(PAGE_SIZE) __visible;
+@@ -1087,7 +1096,7 @@ DEFINE_PER_CPU(struct task_struct *, current_task) ____cacheline_aligned =
EXPORT_PER_CPU_SYMBOL(current_task);
DEFINE_PER_CPU(unsigned long, kernel_stack) =
@@ -19860,7 +19745,7 @@ index 22018f7..df77e23 100644
EXPORT_PER_CPU_SYMBOL(kernel_stack);
DEFINE_PER_CPU(char *, irq_stack_ptr) =
-@@ -1231,7 +1238,7 @@ void __cpuinit cpu_init(void)
+@@ -1232,7 +1241,7 @@ void cpu_init(void)
load_ucode_ap();
cpu = stack_smp_processor_id();
@@ -19869,16 +19754,7 @@ index 22018f7..df77e23 100644
oist = &per_cpu(orig_ist, cpu);
#ifdef CONFIG_NUMA
-@@ -1257,7 +1264,7 @@ void __cpuinit cpu_init(void)
- switch_to_new_gdt(cpu);
- loadsegment(fs, 0);
-
-- load_idt((const struct desc_ptr *)&idt_descr);
-+ load_idt(&idt_descr);
-
- memset(me->thread.tls_array, 0, GDT_ENTRY_TLS_ENTRIES * 8);
- syscall_init();
-@@ -1266,7 +1273,6 @@ void __cpuinit cpu_init(void)
+@@ -1267,7 +1276,6 @@ void cpu_init(void)
wrmsrl(MSR_KERNEL_GS_BASE, 0);
barrier();
@@ -19886,7 +19762,7 @@ index 22018f7..df77e23 100644
enable_x2apic();
/*
-@@ -1318,7 +1324,7 @@ void __cpuinit cpu_init(void)
+@@ -1319,7 +1327,7 @@ void cpu_init(void)
{
int cpu = smp_processor_id();
struct task_struct *curr = current;
@@ -19896,10 +19772,10 @@ index 22018f7..df77e23 100644
show_ucode_info_early();
diff --git a/arch/x86/kernel/cpu/intel_cacheinfo.c b/arch/x86/kernel/cpu/intel_cacheinfo.c
-index 7c6f7d5..8cac382 100644
+index 1414c90..1159406 100644
--- a/arch/x86/kernel/cpu/intel_cacheinfo.c
+++ b/arch/x86/kernel/cpu/intel_cacheinfo.c
-@@ -1017,6 +1017,22 @@ static struct attribute *default_attrs[] = {
+@@ -1014,6 +1014,22 @@ static struct attribute *default_attrs[] = {
};
#ifdef CONFIG_AMD_NB
@@ -19919,10 +19795,10 @@ index 7c6f7d5..8cac382 100644
+ NULL
+};
+
- static struct attribute ** __cpuinit amd_l3_attrs(void)
+ static struct attribute **amd_l3_attrs(void)
{
static struct attribute **attrs;
-@@ -1027,18 +1043,7 @@ static struct attribute ** __cpuinit amd_l3_attrs(void)
+@@ -1024,18 +1040,7 @@ static struct attribute **amd_l3_attrs(void)
n = ARRAY_SIZE(default_attrs);
@@ -19942,7 +19818,7 @@ index 7c6f7d5..8cac382 100644
if (amd_nb_has_feature(AMD_NB_L3_INDEX_DISABLE)) {
attrs[n++] = &cache_disable_0.attr;
-@@ -1089,6 +1094,13 @@ static struct kobj_type ktype_cache = {
+@@ -1086,6 +1091,13 @@ static struct kobj_type ktype_cache = {
.default_attrs = default_attrs,
};
@@ -19956,7 +19832,7 @@ index 7c6f7d5..8cac382 100644
static struct kobj_type ktype_percpu_entry = {
.sysfs_ops = &sysfs_ops,
};
-@@ -1154,20 +1166,26 @@ static int __cpuinit cache_add_dev(struct device *dev)
+@@ -1151,20 +1163,26 @@ static int cache_add_dev(struct device *dev)
return retval;
}
@@ -19986,17 +19862,8 @@ index 7c6f7d5..8cac382 100644
per_cpu(ici_cache_kobject, cpu),
"index%1lu", i);
if (unlikely(retval)) {
-@@ -1222,7 +1240,7 @@ static int __cpuinit cacheinfo_cpu_callback(struct notifier_block *nfb,
- return NOTIFY_OK;
- }
-
--static struct notifier_block __cpuinitdata cacheinfo_cpu_notifier = {
-+static struct notifier_block cacheinfo_cpu_notifier = {
- .notifier_call = cacheinfo_cpu_callback,
- };
-
diff --git a/arch/x86/kernel/cpu/mcheck/mce.c b/arch/x86/kernel/cpu/mcheck/mce.c
-index 9239504..b2471ce 100644
+index b3218cd..99a75de 100644
--- a/arch/x86/kernel/cpu/mcheck/mce.c
+++ b/arch/x86/kernel/cpu/mcheck/mce.c
@@ -45,6 +45,7 @@
@@ -20007,7 +19874,7 @@ index 9239504..b2471ce 100644
#include "mce-internal.h"
-@@ -246,7 +247,7 @@ static void print_mce(struct mce *m)
+@@ -258,7 +259,7 @@ static void print_mce(struct mce *m)
!(m->mcgstatus & MCG_STATUS_EIPV) ? " !INEXACT!" : "",
m->cs, m->ip);
@@ -20016,7 +19883,7 @@ index 9239504..b2471ce 100644
print_symbol("{%s}", m->ip);
pr_cont("\n");
}
-@@ -279,10 +280,10 @@ static void print_mce(struct mce *m)
+@@ -291,10 +292,10 @@ static void print_mce(struct mce *m)
#define PANIC_TIMEOUT 5 /* 5 seconds */
@@ -20029,7 +19896,7 @@ index 9239504..b2471ce 100644
/* Panic in progress. Enable interrupts and wait for final IPI */
static void wait_for_panic(void)
-@@ -306,7 +307,7 @@ static void mce_panic(char *msg, struct mce *final, char *exp)
+@@ -318,7 +319,7 @@ static void mce_panic(char *msg, struct mce *final, char *exp)
/*
* Make sure only one CPU runs in machine check panic
*/
@@ -20038,7 +19905,7 @@ index 9239504..b2471ce 100644
wait_for_panic();
barrier();
-@@ -314,7 +315,7 @@ static void mce_panic(char *msg, struct mce *final, char *exp)
+@@ -326,7 +327,7 @@ static void mce_panic(char *msg, struct mce *final, char *exp)
console_verbose();
} else {
/* Don't log too much for fake panic */
@@ -20047,7 +19914,7 @@ index 9239504..b2471ce 100644
return;
}
/* First print corrected ones that are still unlogged */
-@@ -353,7 +354,7 @@ static void mce_panic(char *msg, struct mce *final, char *exp)
+@@ -365,7 +366,7 @@ static void mce_panic(char *msg, struct mce *final, char *exp)
if (!fake_panic) {
if (panic_timeout == 0)
panic_timeout = mca_cfg.panic_timeout;
@@ -20056,7 +19923,7 @@ index 9239504..b2471ce 100644
} else
pr_emerg(HW_ERR "Fake kernel panic: %s\n", msg);
}
-@@ -683,7 +684,7 @@ static int mce_timed_out(u64 *t)
+@@ -695,7 +696,7 @@ static int mce_timed_out(u64 *t)
* might have been modified by someone else.
*/
rmb();
@@ -20065,7 +19932,7 @@ index 9239504..b2471ce 100644
wait_for_panic();
if (!mca_cfg.monarch_timeout)
goto out;
-@@ -1654,7 +1655,7 @@ static void unexpected_machine_check(struct pt_regs *regs, long error_code)
+@@ -1666,7 +1667,7 @@ static void unexpected_machine_check(struct pt_regs *regs, long error_code)
}
/* Call the installed machine check handler for this CPU setup. */
@@ -20074,7 +19941,7 @@ index 9239504..b2471ce 100644
unexpected_machine_check;
/*
-@@ -1677,7 +1678,9 @@ void __cpuinit mcheck_cpu_init(struct cpuinfo_x86 *c)
+@@ -1689,7 +1690,9 @@ void mcheck_cpu_init(struct cpuinfo_x86 *c)
return;
}
@@ -20084,7 +19951,7 @@ index 9239504..b2471ce 100644
__mcheck_cpu_init_generic();
__mcheck_cpu_init_vendor(c);
-@@ -1691,7 +1694,7 @@ void __cpuinit mcheck_cpu_init(struct cpuinfo_x86 *c)
+@@ -1703,7 +1706,7 @@ void mcheck_cpu_init(struct cpuinfo_x86 *c)
*/
static DEFINE_SPINLOCK(mce_chrdev_state_lock);
@@ -20093,7 +19960,7 @@ index 9239504..b2471ce 100644
static int mce_chrdev_open_exclu; /* already open exclusive? */
static int mce_chrdev_open(struct inode *inode, struct file *file)
-@@ -1699,7 +1702,7 @@ static int mce_chrdev_open(struct inode *inode, struct file *file)
+@@ -1711,7 +1714,7 @@ static int mce_chrdev_open(struct inode *inode, struct file *file)
spin_lock(&mce_chrdev_state_lock);
if (mce_chrdev_open_exclu ||
@@ -20102,7 +19969,7 @@ index 9239504..b2471ce 100644
spin_unlock(&mce_chrdev_state_lock);
return -EBUSY;
-@@ -1707,7 +1710,7 @@ static int mce_chrdev_open(struct inode *inode, struct file *file)
+@@ -1719,7 +1722,7 @@ static int mce_chrdev_open(struct inode *inode, struct file *file)
if (file->f_flags & O_EXCL)
mce_chrdev_open_exclu = 1;
@@ -20111,7 +19978,7 @@ index 9239504..b2471ce 100644
spin_unlock(&mce_chrdev_state_lock);
-@@ -1718,7 +1721,7 @@ static int mce_chrdev_release(struct inode *inode, struct file *file)
+@@ -1730,7 +1733,7 @@ static int mce_chrdev_release(struct inode *inode, struct file *file)
{
spin_lock(&mce_chrdev_state_lock);
@@ -20120,16 +19987,7 @@ index 9239504..b2471ce 100644
mce_chrdev_open_exclu = 0;
spin_unlock(&mce_chrdev_state_lock);
-@@ -2364,7 +2367,7 @@ mce_cpu_callback(struct notifier_block *nfb, unsigned long action, void *hcpu)
- return NOTIFY_OK;
- }
-
--static struct notifier_block mce_cpu_notifier __cpuinitdata = {
-+static struct notifier_block mce_cpu_notifier = {
- .notifier_call = mce_cpu_callback,
- };
-
-@@ -2374,7 +2377,7 @@ static __init void mce_init_banks(void)
+@@ -2404,7 +2407,7 @@ static __init void mce_init_banks(void)
for (i = 0; i < mca_cfg.banks; i++) {
struct mce_bank *b = &mce_banks[i];
@@ -20138,7 +19996,7 @@ index 9239504..b2471ce 100644
sysfs_attr_init(&a->attr);
a->attr.name = b->attrname;
-@@ -2442,7 +2445,7 @@ struct dentry *mce_get_debugfs_dir(void)
+@@ -2472,7 +2475,7 @@ struct dentry *mce_get_debugfs_dir(void)
static void mce_reset(void)
{
cpu_missing = 0;
@@ -20169,19 +20027,6 @@ index 1c044b1..37a2a43 100644
/* Make sure the vector pointer is visible before we enable MCEs: */
wmb();
-diff --git a/arch/x86/kernel/cpu/mcheck/therm_throt.c b/arch/x86/kernel/cpu/mcheck/therm_throt.c
-index 47a1870..8c019a7 100644
---- a/arch/x86/kernel/cpu/mcheck/therm_throt.c
-+++ b/arch/x86/kernel/cpu/mcheck/therm_throt.c
-@@ -288,7 +288,7 @@ thermal_throttle_cpu_callback(struct notifier_block *nfb,
- return notifier_from_errno(err);
- }
-
--static struct notifier_block thermal_throttle_cpu_notifier __cpuinitdata =
-+static struct notifier_block thermal_throttle_cpu_notifier =
- {
- .notifier_call = thermal_throttle_cpu_callback,
- };
diff --git a/arch/x86/kernel/cpu/mcheck/winchip.c b/arch/x86/kernel/cpu/mcheck/winchip.c
index e9a701a..35317d6 100644
--- a/arch/x86/kernel/cpu/mcheck/winchip.c
@@ -20205,10 +20050,10 @@ index e9a701a..35317d6 100644
wmb();
diff --git a/arch/x86/kernel/cpu/mtrr/main.c b/arch/x86/kernel/cpu/mtrr/main.c
-index ca22b73..9987afe 100644
+index f961de9..8a9d332 100644
--- a/arch/x86/kernel/cpu/mtrr/main.c
+++ b/arch/x86/kernel/cpu/mtrr/main.c
-@@ -62,7 +62,7 @@ static DEFINE_MUTEX(mtrr_mutex);
+@@ -66,7 +66,7 @@ static DEFINE_MUTEX(mtrr_mutex);
u64 size_or_mask, size_and_mask;
static bool mtrr_aps_delayed_init;
@@ -20231,10 +20076,10 @@ index df5e41f..816c719 100644
extern int generic_get_free_region(unsigned long base, unsigned long size,
int replace_reg);
diff --git a/arch/x86/kernel/cpu/perf_event.c b/arch/x86/kernel/cpu/perf_event.c
-index 1025f3c..824f677 100644
+index 8a87a32..682a22a 100644
--- a/arch/x86/kernel/cpu/perf_event.c
+++ b/arch/x86/kernel/cpu/perf_event.c
-@@ -1311,7 +1311,7 @@ static void __init pmu_check_apic(void)
+@@ -1348,7 +1348,7 @@ static void __init pmu_check_apic(void)
pr_info("no hardware sampling interrupt available.\n");
}
@@ -20243,7 +20088,7 @@ index 1025f3c..824f677 100644
.name = "format",
.attrs = NULL,
};
-@@ -1410,7 +1410,7 @@ static struct attribute *events_attr[] = {
+@@ -1447,7 +1447,7 @@ static struct attribute *events_attr[] = {
NULL,
};
@@ -20252,7 +20097,7 @@ index 1025f3c..824f677 100644
.name = "events",
.attrs = events_attr,
};
-@@ -1920,7 +1920,7 @@ static unsigned long get_segment_base(unsigned int segment)
+@@ -1958,7 +1958,7 @@ static unsigned long get_segment_base(unsigned int segment)
if (idx > GDT_ENTRIES)
return 0;
@@ -20261,7 +20106,7 @@ index 1025f3c..824f677 100644
}
return get_desc_base(desc + idx);
-@@ -2010,7 +2010,7 @@ perf_callchain_user(struct perf_callchain_entry *entry, struct pt_regs *regs)
+@@ -2048,7 +2048,7 @@ perf_callchain_user(struct perf_callchain_entry *entry, struct pt_regs *regs)
break;
perf_callchain_store(entry, frame.return_address);
@@ -20270,11 +20115,24 @@ index 1025f3c..824f677 100644
}
}
+diff --git a/arch/x86/kernel/cpu/perf_event_amd_iommu.c b/arch/x86/kernel/cpu/perf_event_amd_iommu.c
+index 639d128..e92d7e5 100644
+--- a/arch/x86/kernel/cpu/perf_event_amd_iommu.c
++++ b/arch/x86/kernel/cpu/perf_event_amd_iommu.c
+@@ -405,7 +405,7 @@ static void perf_iommu_del(struct perf_event *event, int flags)
+ static __init int _init_events_attrs(struct perf_amd_iommu *perf_iommu)
+ {
+ struct attribute **attrs;
+- struct attribute_group *attr_group;
++ attribute_group_no_const *attr_group;
+ int i = 0, j;
+
+ while (amd_iommu_v2_event_descs[i].attr.attr.name)
diff --git a/arch/x86/kernel/cpu/perf_event_intel.c b/arch/x86/kernel/cpu/perf_event_intel.c
-index a9e2207..d70c83a 100644
+index f31a165..7b46cd8 100644
--- a/arch/x86/kernel/cpu/perf_event_intel.c
+++ b/arch/x86/kernel/cpu/perf_event_intel.c
-@@ -2022,10 +2022,10 @@ __init int intel_pmu_init(void)
+@@ -2247,10 +2247,10 @@ __init int intel_pmu_init(void)
* v2 and above have a perf capabilities MSR
*/
if (version > 1) {
@@ -20289,10 +20147,10 @@ index a9e2207..d70c83a 100644
intel_ds_init();
diff --git a/arch/x86/kernel/cpu/perf_event_intel_uncore.c b/arch/x86/kernel/cpu/perf_event_intel_uncore.c
-index 8aac56b..588fb13 100644
+index 4118f9f..f91d0ab 100644
--- a/arch/x86/kernel/cpu/perf_event_intel_uncore.c
+++ b/arch/x86/kernel/cpu/perf_event_intel_uncore.c
-@@ -3093,7 +3093,7 @@ static void __init uncore_types_exit(struct intel_uncore_type **types)
+@@ -3204,7 +3204,7 @@ static void __init uncore_types_exit(struct intel_uncore_type **types)
static int __init uncore_type_init(struct intel_uncore_type *type)
{
struct intel_uncore_pmu *pmus;
@@ -20301,20 +20159,11 @@ index 8aac56b..588fb13 100644
struct attribute **attrs;
int i, j;
-@@ -3518,7 +3518,7 @@ static int
- return NOTIFY_OK;
- }
-
--static struct notifier_block uncore_cpu_nb __cpuinitdata = {
-+static struct notifier_block uncore_cpu_nb = {
- .notifier_call = uncore_cpu_notifier,
- /*
- * to migrate uncore events, our notifier should be executed
diff --git a/arch/x86/kernel/cpu/perf_event_intel_uncore.h b/arch/x86/kernel/cpu/perf_event_intel_uncore.h
-index f952891..4722ad4 100644
+index a80ab71..4089da5 100644
--- a/arch/x86/kernel/cpu/perf_event_intel_uncore.h
+++ b/arch/x86/kernel/cpu/perf_event_intel_uncore.h
-@@ -488,7 +488,7 @@ struct intel_uncore_box {
+@@ -498,7 +498,7 @@ struct intel_uncore_box {
struct uncore_event_desc {
struct kobj_attribute attr;
const char *config;
@@ -20324,10 +20173,10 @@ index f952891..4722ad4 100644
#define INTEL_UNCORE_EVENT_DESC(_name, _config) \
{ \
diff --git a/arch/x86/kernel/cpuid.c b/arch/x86/kernel/cpuid.c
-index 1e4dbcf..b9a34c2 100644
+index 7d9481c..99c7e4b 100644
--- a/arch/x86/kernel/cpuid.c
+++ b/arch/x86/kernel/cpuid.c
-@@ -171,7 +171,7 @@ static int __cpuinit cpuid_class_cpu_callback(struct notifier_block *nfb,
+@@ -170,7 +170,7 @@ static int cpuid_class_cpu_callback(struct notifier_block *nfb,
return notifier_from_errno(err);
}
@@ -20337,7 +20186,7 @@ index 1e4dbcf..b9a34c2 100644
.notifier_call = cpuid_class_cpu_callback,
};
diff --git a/arch/x86/kernel/crash.c b/arch/x86/kernel/crash.c
-index 74467fe..18793d5 100644
+index 18677a9..f67c45b 100644
--- a/arch/x86/kernel/crash.c
+++ b/arch/x86/kernel/crash.c
@@ -58,10 +58,8 @@ static void kdump_nmi_callback(int cpu, struct pt_regs *regs)
@@ -20365,11 +20214,11 @@ index afa64ad..dce67dd 100644
iounmap(vaddr);
return -EFAULT;
}
-diff --git a/arch/x86/kernel/doublefault_32.c b/arch/x86/kernel/doublefault_32.c
-index 155a13f..1672b9b 100644
---- a/arch/x86/kernel/doublefault_32.c
-+++ b/arch/x86/kernel/doublefault_32.c
-@@ -11,7 +11,7 @@
+diff --git a/arch/x86/kernel/doublefault.c b/arch/x86/kernel/doublefault.c
+index 5d3fe8d..02e1429 100644
+--- a/arch/x86/kernel/doublefault.c
++++ b/arch/x86/kernel/doublefault.c
+@@ -13,7 +13,7 @@
#define DOUBLEFAULT_STACKSIZE (1024)
static unsigned long doublefault_stack[DOUBLEFAULT_STACKSIZE];
@@ -20378,7 +20227,7 @@ index 155a13f..1672b9b 100644
#define ptr_ok(x) ((x) > PAGE_OFFSET && (x) < PAGE_OFFSET + MAXMEM)
-@@ -21,7 +21,7 @@ static void doublefault_fn(void)
+@@ -23,7 +23,7 @@ static void doublefault_fn(void)
unsigned long gdt, tss;
native_store_gdt(&gdt_desc);
@@ -20387,7 +20236,7 @@ index 155a13f..1672b9b 100644
printk(KERN_EMERG "PANIC: double fault, gdt at %08lx [%d bytes]\n", gdt, gdt_desc.size);
-@@ -58,10 +58,10 @@ struct tss_struct doublefault_tss __cacheline_aligned = {
+@@ -60,10 +60,10 @@ struct tss_struct doublefault_tss __cacheline_aligned = {
/* 0x2 bit is always set */
.flags = X86_EFLAGS_SF | 0x2,
.sp = STACK_START,
@@ -20788,7 +20637,7 @@ index d15f575..d692043 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 8f3e2de..6b71e39 100644
+index f0dcb0c..9f39b80 100644
--- a/arch/x86/kernel/entry_32.S
+++ b/arch/x86/kernel/entry_32.S
@@ -177,13 +177,153 @@
@@ -21289,7 +21138,7 @@ index 8f3e2de..6b71e39 100644
.previous
END(interrupt)
-@@ -813,7 +1052,7 @@ ENTRY(coprocessor_error)
+@@ -823,7 +1062,7 @@ ENTRY(coprocessor_error)
pushl_cfi $do_coprocessor_error
jmp error_code
CFI_ENDPROC
@@ -21298,7 +21147,7 @@ index 8f3e2de..6b71e39 100644
ENTRY(simd_coprocessor_error)
RING0_INT_FRAME
-@@ -826,7 +1065,7 @@ ENTRY(simd_coprocessor_error)
+@@ -836,7 +1075,7 @@ ENTRY(simd_coprocessor_error)
.section .altinstructions,"a"
altinstruction_entry 661b, 663f, X86_FEATURE_XMM, 662b-661b, 664f-663f
.previous
@@ -21307,7 +21156,7 @@ index 8f3e2de..6b71e39 100644
663: pushl $do_simd_coprocessor_error
664:
.previous
-@@ -835,7 +1074,7 @@ ENTRY(simd_coprocessor_error)
+@@ -845,7 +1084,7 @@ ENTRY(simd_coprocessor_error)
#endif
jmp error_code
CFI_ENDPROC
@@ -21316,7 +21165,7 @@ index 8f3e2de..6b71e39 100644
ENTRY(device_not_available)
RING0_INT_FRAME
-@@ -844,18 +1083,18 @@ ENTRY(device_not_available)
+@@ -854,18 +1093,18 @@ ENTRY(device_not_available)
pushl_cfi $do_device_not_available
jmp error_code
CFI_ENDPROC
@@ -21338,7 +21187,7 @@ index 8f3e2de..6b71e39 100644
#endif
ENTRY(overflow)
-@@ -865,7 +1104,7 @@ ENTRY(overflow)
+@@ -875,7 +1114,7 @@ ENTRY(overflow)
pushl_cfi $do_overflow
jmp error_code
CFI_ENDPROC
@@ -21347,7 +21196,7 @@ index 8f3e2de..6b71e39 100644
ENTRY(bounds)
RING0_INT_FRAME
-@@ -874,7 +1113,7 @@ ENTRY(bounds)
+@@ -884,7 +1123,7 @@ ENTRY(bounds)
pushl_cfi $do_bounds
jmp error_code
CFI_ENDPROC
@@ -21356,7 +21205,7 @@ index 8f3e2de..6b71e39 100644
ENTRY(invalid_op)
RING0_INT_FRAME
-@@ -883,7 +1122,7 @@ ENTRY(invalid_op)
+@@ -893,7 +1132,7 @@ ENTRY(invalid_op)
pushl_cfi $do_invalid_op
jmp error_code
CFI_ENDPROC
@@ -21365,7 +21214,7 @@ index 8f3e2de..6b71e39 100644
ENTRY(coprocessor_segment_overrun)
RING0_INT_FRAME
-@@ -892,7 +1131,7 @@ ENTRY(coprocessor_segment_overrun)
+@@ -902,7 +1141,7 @@ ENTRY(coprocessor_segment_overrun)
pushl_cfi $do_coprocessor_segment_overrun
jmp error_code
CFI_ENDPROC
@@ -21374,7 +21223,7 @@ index 8f3e2de..6b71e39 100644
ENTRY(invalid_TSS)
RING0_EC_FRAME
-@@ -900,7 +1139,7 @@ ENTRY(invalid_TSS)
+@@ -910,7 +1149,7 @@ ENTRY(invalid_TSS)
pushl_cfi $do_invalid_TSS
jmp error_code
CFI_ENDPROC
@@ -21383,7 +21232,7 @@ index 8f3e2de..6b71e39 100644
ENTRY(segment_not_present)
RING0_EC_FRAME
-@@ -908,7 +1147,7 @@ ENTRY(segment_not_present)
+@@ -918,7 +1157,7 @@ ENTRY(segment_not_present)
pushl_cfi $do_segment_not_present
jmp error_code
CFI_ENDPROC
@@ -21392,7 +21241,7 @@ index 8f3e2de..6b71e39 100644
ENTRY(stack_segment)
RING0_EC_FRAME
-@@ -916,7 +1155,7 @@ ENTRY(stack_segment)
+@@ -926,7 +1165,7 @@ ENTRY(stack_segment)
pushl_cfi $do_stack_segment
jmp error_code
CFI_ENDPROC
@@ -21401,7 +21250,7 @@ index 8f3e2de..6b71e39 100644
ENTRY(alignment_check)
RING0_EC_FRAME
-@@ -924,7 +1163,7 @@ ENTRY(alignment_check)
+@@ -934,7 +1173,7 @@ ENTRY(alignment_check)
pushl_cfi $do_alignment_check
jmp error_code
CFI_ENDPROC
@@ -21410,7 +21259,7 @@ index 8f3e2de..6b71e39 100644
ENTRY(divide_error)
RING0_INT_FRAME
-@@ -933,7 +1172,7 @@ ENTRY(divide_error)
+@@ -943,7 +1182,7 @@ ENTRY(divide_error)
pushl_cfi $do_divide_error
jmp error_code
CFI_ENDPROC
@@ -21419,7 +21268,7 @@ index 8f3e2de..6b71e39 100644
#ifdef CONFIG_X86_MCE
ENTRY(machine_check)
-@@ -943,7 +1182,7 @@ ENTRY(machine_check)
+@@ -953,7 +1192,7 @@ ENTRY(machine_check)
pushl_cfi machine_check_vector
jmp error_code
CFI_ENDPROC
@@ -21428,7 +21277,7 @@ index 8f3e2de..6b71e39 100644
#endif
ENTRY(spurious_interrupt_bug)
-@@ -953,7 +1192,7 @@ ENTRY(spurious_interrupt_bug)
+@@ -963,7 +1202,7 @@ ENTRY(spurious_interrupt_bug)
pushl_cfi $do_spurious_interrupt_bug
jmp error_code
CFI_ENDPROC
@@ -21437,7 +21286,7 @@ index 8f3e2de..6b71e39 100644
/*
* End of kprobes section
*/
-@@ -1063,7 +1302,7 @@ BUILD_INTERRUPT3(hyperv_callback_vector, HYPERVISOR_CALLBACK_VECTOR,
+@@ -1073,7 +1312,7 @@ BUILD_INTERRUPT3(hyperv_callback_vector, HYPERVISOR_CALLBACK_VECTOR,
ENTRY(mcount)
ret
@@ -21446,7 +21295,7 @@ index 8f3e2de..6b71e39 100644
ENTRY(ftrace_caller)
cmpl $0, function_trace_stop
-@@ -1096,7 +1335,7 @@ ftrace_graph_call:
+@@ -1106,7 +1345,7 @@ ftrace_graph_call:
.globl ftrace_stub
ftrace_stub:
ret
@@ -21455,7 +21304,7 @@ index 8f3e2de..6b71e39 100644
ENTRY(ftrace_regs_caller)
pushf /* push flags before compare (in cs location) */
-@@ -1197,7 +1436,7 @@ trace:
+@@ -1210,7 +1449,7 @@ trace:
popl %ecx
popl %eax
jmp ftrace_stub
@@ -21464,7 +21313,7 @@ index 8f3e2de..6b71e39 100644
#endif /* CONFIG_DYNAMIC_FTRACE */
#endif /* CONFIG_FUNCTION_TRACER */
-@@ -1215,7 +1454,7 @@ ENTRY(ftrace_graph_caller)
+@@ -1228,7 +1467,7 @@ ENTRY(ftrace_graph_caller)
popl %ecx
popl %eax
ret
@@ -21473,7 +21322,7 @@ index 8f3e2de..6b71e39 100644
.globl return_to_handler
return_to_handler:
-@@ -1271,15 +1510,18 @@ error_code:
+@@ -1284,15 +1523,18 @@ error_code:
movl $-1, PT_ORIG_EAX(%esp) # no syscall to restart
REG_TO_PTGS %ecx
SET_KERNEL_GS %ecx
@@ -21494,7 +21343,7 @@ index 8f3e2de..6b71e39 100644
/*
* Debug traps and NMI can happen at the one SYSENTER instruction
-@@ -1322,7 +1564,7 @@ debug_stack_correct:
+@@ -1335,7 +1577,7 @@ debug_stack_correct:
call do_debug
jmp ret_from_exception
CFI_ENDPROC
@@ -21503,7 +21352,7 @@ index 8f3e2de..6b71e39 100644
/*
* NMI is doubly nasty. It can happen _while_ we're handling
-@@ -1360,6 +1602,9 @@ nmi_stack_correct:
+@@ -1373,6 +1615,9 @@ nmi_stack_correct:
xorl %edx,%edx # zero error code
movl %esp,%eax # pt_regs pointer
call do_nmi
@@ -21513,7 +21362,7 @@ index 8f3e2de..6b71e39 100644
jmp restore_all_notrace
CFI_ENDPROC
-@@ -1396,12 +1641,15 @@ nmi_espfix_stack:
+@@ -1409,12 +1654,15 @@ nmi_espfix_stack:
FIXUP_ESPFIX_STACK # %eax == %esp
xorl %edx,%edx # zero error code
call do_nmi
@@ -21530,7 +21379,7 @@ index 8f3e2de..6b71e39 100644
ENTRY(int3)
RING0_INT_FRAME
-@@ -1414,14 +1662,14 @@ ENTRY(int3)
+@@ -1427,14 +1675,14 @@ ENTRY(int3)
call do_int3
jmp ret_from_exception
CFI_ENDPROC
@@ -21547,7 +21396,7 @@ index 8f3e2de..6b71e39 100644
#ifdef CONFIG_KVM_GUEST
ENTRY(async_page_fault)
-@@ -1430,7 +1678,7 @@ ENTRY(async_page_fault)
+@@ -1443,7 +1691,7 @@ ENTRY(async_page_fault)
pushl_cfi $do_async_page_fault
jmp error_code
CFI_ENDPROC
@@ -21557,7 +21406,7 @@ index 8f3e2de..6b71e39 100644
/*
diff --git a/arch/x86/kernel/entry_64.S b/arch/x86/kernel/entry_64.S
-index 7272089..0b74104 100644
+index b077f4c..feb26c1 100644
--- a/arch/x86/kernel/entry_64.S
+++ b/arch/x86/kernel/entry_64.S
@@ -59,6 +59,8 @@
@@ -22095,19 +21944,7 @@ index 7272089..0b74104 100644
je 1f
SWAPGS
/*
-@@ -498,9 +931,10 @@ ENTRY(save_rest)
- movq_cfi r15, R15+16
- movq %r11, 8(%rsp) /* return address */
- FIXUP_TOP_OF_STACK %r11, 16
-+ pax_force_retaddr
- ret
- CFI_ENDPROC
--END(save_rest)
-+ENDPROC(save_rest)
-
- /* save complete stack frame */
- .pushsection .kprobes.text, "ax"
-@@ -529,9 +963,10 @@ ENTRY(save_paranoid)
+@@ -514,9 +947,10 @@ ENTRY(save_paranoid)
js 1f /* negative -> in kernel */
SWAPGS
xorl %ebx,%ebx
@@ -22120,7 +21957,7 @@ index 7272089..0b74104 100644
.popsection
/*
-@@ -553,7 +988,7 @@ ENTRY(ret_from_fork)
+@@ -538,7 +972,7 @@ ENTRY(ret_from_fork)
RESTORE_REST
@@ -22129,7 +21966,7 @@ index 7272089..0b74104 100644
jz 1f
testl $_TIF_IA32, TI_flags(%rcx) # 32-bit compat task needs IRET
-@@ -571,7 +1006,7 @@ ENTRY(ret_from_fork)
+@@ -556,7 +990,7 @@ ENTRY(ret_from_fork)
RESTORE_REST
jmp int_ret_from_sys_call
CFI_ENDPROC
@@ -22138,7 +21975,7 @@ index 7272089..0b74104 100644
/*
* System call entry. Up to 6 arguments in registers are supported.
-@@ -608,7 +1043,7 @@ END(ret_from_fork)
+@@ -593,7 +1027,7 @@ END(ret_from_fork)
ENTRY(system_call)
CFI_STARTPROC simple
CFI_SIGNAL_FRAME
@@ -22147,7 +21984,7 @@ index 7272089..0b74104 100644
CFI_REGISTER rip,rcx
/*CFI_REGISTER rflags,r11*/
SWAPGS_UNSAFE_STACK
-@@ -621,16 +1056,23 @@ GLOBAL(system_call_after_swapgs)
+@@ -606,16 +1040,23 @@ GLOBAL(system_call_after_swapgs)
movq %rsp,PER_CPU_VAR(old_rsp)
movq PER_CPU_VAR(kernel_stack),%rsp
@@ -22173,7 +22010,7 @@ index 7272089..0b74104 100644
jnz tracesys
system_call_fastpath:
#if __SYSCALL_MASK == ~0
-@@ -640,7 +1082,7 @@ system_call_fastpath:
+@@ -625,7 +1066,7 @@ system_call_fastpath:
cmpl $__NR_syscall_max,%eax
#endif
ja badsys
@@ -22182,7 +22019,7 @@ index 7272089..0b74104 100644
call *sys_call_table(,%rax,8) # XXX: rip relative
movq %rax,RAX-ARGOFFSET(%rsp)
/*
-@@ -654,10 +1096,13 @@ sysret_check:
+@@ -639,10 +1080,13 @@ sysret_check:
LOCKDEP_SYS_EXIT
DISABLE_INTERRUPTS(CLBR_NONE)
TRACE_IRQS_OFF
@@ -22197,7 +22034,7 @@ index 7272089..0b74104 100644
/*
* sysretq will re-enable interrupts:
*/
-@@ -709,14 +1154,18 @@ badsys:
+@@ -694,14 +1138,18 @@ badsys:
* jump back to the normal fast path.
*/
auditsys:
@@ -22217,7 +22054,7 @@ index 7272089..0b74104 100644
jmp system_call_fastpath
/*
-@@ -737,7 +1186,7 @@ sysret_audit:
+@@ -722,7 +1170,7 @@ sysret_audit:
/* Do syscall tracing */
tracesys:
#ifdef CONFIG_AUDITSYSCALL
@@ -22226,7 +22063,7 @@ index 7272089..0b74104 100644
jz auditsys
#endif
SAVE_REST
-@@ -745,12 +1194,16 @@ tracesys:
+@@ -730,12 +1178,16 @@ tracesys:
FIXUP_TOP_OF_STACK %rdi
movq %rsp,%rdi
call syscall_trace_enter
@@ -22243,7 +22080,7 @@ index 7272089..0b74104 100644
RESTORE_REST
#if __SYSCALL_MASK == ~0
cmpq $__NR_syscall_max,%rax
-@@ -759,7 +1212,7 @@ tracesys:
+@@ -744,7 +1196,7 @@ tracesys:
cmpl $__NR_syscall_max,%eax
#endif
ja int_ret_from_sys_call /* RAX(%rsp) set to -ENOSYS above */
@@ -22252,7 +22089,7 @@ index 7272089..0b74104 100644
call *sys_call_table(,%rax,8)
movq %rax,RAX-ARGOFFSET(%rsp)
/* Use IRET because user could have changed frame */
-@@ -780,7 +1233,9 @@ GLOBAL(int_with_check)
+@@ -765,7 +1217,9 @@ GLOBAL(int_with_check)
andl %edi,%edx
jnz int_careful
andl $~TS_COMPAT,TI_status(%rcx)
@@ -22263,7 +22100,7 @@ index 7272089..0b74104 100644
/* Either reschedule or signal or syscall exit tracking needed. */
/* First do a reschedule test. */
-@@ -826,7 +1281,7 @@ int_restore_rest:
+@@ -811,7 +1265,7 @@ int_restore_rest:
TRACE_IRQS_OFF
jmp int_with_check
CFI_ENDPROC
@@ -22272,7 +22109,7 @@ index 7272089..0b74104 100644
.macro FORK_LIKE func
ENTRY(stub_\func)
-@@ -839,9 +1294,10 @@ ENTRY(stub_\func)
+@@ -824,9 +1278,10 @@ ENTRY(stub_\func)
DEFAULT_FRAME 0 8 /* offset 8: return address */
call sys_\func
RESTORE_TOP_OF_STACK %r11, 8
@@ -22284,7 +22121,7 @@ index 7272089..0b74104 100644
.endm
.macro FIXED_FRAME label,func
-@@ -851,9 +1307,10 @@ ENTRY(\label)
+@@ -836,9 +1291,10 @@ ENTRY(\label)
FIXUP_TOP_OF_STACK %r11, 8-ARGOFFSET
call \func
RESTORE_TOP_OF_STACK %r11, 8-ARGOFFSET
@@ -22296,7 +22133,7 @@ index 7272089..0b74104 100644
.endm
FORK_LIKE clone
-@@ -870,9 +1327,10 @@ ENTRY(ptregscall_common)
+@@ -855,9 +1311,10 @@ ENTRY(ptregscall_common)
movq_cfi_restore R12+8, r12
movq_cfi_restore RBP+8, rbp
movq_cfi_restore RBX+8, rbx
@@ -22308,7 +22145,7 @@ index 7272089..0b74104 100644
ENTRY(stub_execve)
CFI_STARTPROC
-@@ -885,7 +1343,7 @@ ENTRY(stub_execve)
+@@ -870,7 +1327,7 @@ ENTRY(stub_execve)
RESTORE_REST
jmp int_ret_from_sys_call
CFI_ENDPROC
@@ -22317,7 +22154,7 @@ index 7272089..0b74104 100644
/*
* sigreturn is special because it needs to restore all registers on return.
-@@ -902,7 +1360,7 @@ ENTRY(stub_rt_sigreturn)
+@@ -887,7 +1344,7 @@ ENTRY(stub_rt_sigreturn)
RESTORE_REST
jmp int_ret_from_sys_call
CFI_ENDPROC
@@ -22326,7 +22163,7 @@ index 7272089..0b74104 100644
#ifdef CONFIG_X86_X32_ABI
ENTRY(stub_x32_rt_sigreturn)
-@@ -916,7 +1374,7 @@ ENTRY(stub_x32_rt_sigreturn)
+@@ -901,7 +1358,7 @@ ENTRY(stub_x32_rt_sigreturn)
RESTORE_REST
jmp int_ret_from_sys_call
CFI_ENDPROC
@@ -22335,7 +22172,7 @@ index 7272089..0b74104 100644
ENTRY(stub_x32_execve)
CFI_STARTPROC
-@@ -930,7 +1388,7 @@ ENTRY(stub_x32_execve)
+@@ -915,7 +1372,7 @@ ENTRY(stub_x32_execve)
RESTORE_REST
jmp int_ret_from_sys_call
CFI_ENDPROC
@@ -22344,7 +22181,7 @@ index 7272089..0b74104 100644
#endif
-@@ -967,7 +1425,7 @@ vector=vector+1
+@@ -952,7 +1409,7 @@ vector=vector+1
2: jmp common_interrupt
.endr
CFI_ENDPROC
@@ -22353,7 +22190,7 @@ index 7272089..0b74104 100644
.previous
END(interrupt)
-@@ -987,6 +1445,16 @@ END(interrupt)
+@@ -972,6 +1429,16 @@ END(interrupt)
subq $ORIG_RAX-RBP, %rsp
CFI_ADJUST_CFA_OFFSET ORIG_RAX-RBP
SAVE_ARGS_IRQ
@@ -22370,7 +22207,7 @@ index 7272089..0b74104 100644
call \func
.endm
-@@ -1019,7 +1487,7 @@ ret_from_intr:
+@@ -1004,7 +1471,7 @@ ret_from_intr:
exit_intr:
GET_THREAD_INFO(%rcx)
@@ -22379,7 +22216,7 @@ index 7272089..0b74104 100644
je retint_kernel
/* Interrupt came from user space */
-@@ -1041,12 +1509,16 @@ retint_swapgs: /* return to user-space */
+@@ -1026,12 +1493,16 @@ retint_swapgs: /* return to user-space */
* The iretq could re-enable interrupts:
*/
DISABLE_INTERRUPTS(CLBR_ANY)
@@ -22396,7 +22233,7 @@ index 7272089..0b74104 100644
/*
* The iretq could re-enable interrupts:
*/
-@@ -1129,7 +1601,7 @@ ENTRY(retint_kernel)
+@@ -1114,7 +1585,7 @@ ENTRY(retint_kernel)
#endif
CFI_ENDPROC
@@ -22405,7 +22242,7 @@ index 7272089..0b74104 100644
/*
* End of kprobes section
*/
-@@ -1147,7 +1619,7 @@ ENTRY(\sym)
+@@ -1132,7 +1603,7 @@ ENTRY(\sym)
interrupt \do_sym
jmp ret_from_intr
CFI_ENDPROC
@@ -22413,8 +22250,8 @@ index 7272089..0b74104 100644
+ENDPROC(\sym)
.endm
- #ifdef CONFIG_SMP
-@@ -1208,12 +1680,22 @@ ENTRY(\sym)
+ #ifdef CONFIG_TRACING
+@@ -1215,12 +1686,22 @@ ENTRY(\sym)
CFI_ADJUST_CFA_OFFSET ORIG_RAX-R15
call error_entry
DEFAULT_FRAME 0
@@ -22438,7 +22275,7 @@ index 7272089..0b74104 100644
.endm
.macro paranoidzeroentry sym do_sym
-@@ -1226,15 +1708,25 @@ ENTRY(\sym)
+@@ -1233,15 +1714,25 @@ ENTRY(\sym)
CFI_ADJUST_CFA_OFFSET ORIG_RAX-R15
call save_paranoid
TRACE_IRQS_OFF
@@ -22466,7 +22303,7 @@ index 7272089..0b74104 100644
.macro paranoidzeroentry_ist sym do_sym ist
ENTRY(\sym)
INTR_FRAME
-@@ -1245,14 +1737,30 @@ ENTRY(\sym)
+@@ -1252,14 +1743,30 @@ ENTRY(\sym)
CFI_ADJUST_CFA_OFFSET ORIG_RAX-R15
call save_paranoid
TRACE_IRQS_OFF_DEBUG
@@ -22498,7 +22335,7 @@ index 7272089..0b74104 100644
.endm
.macro errorentry sym do_sym
-@@ -1264,13 +1772,23 @@ ENTRY(\sym)
+@@ -1271,13 +1778,23 @@ ENTRY(\sym)
CFI_ADJUST_CFA_OFFSET ORIG_RAX-R15
call error_entry
DEFAULT_FRAME 0
@@ -22523,7 +22360,7 @@ index 7272089..0b74104 100644
.endm
/* error code is on the stack already */
-@@ -1284,13 +1802,23 @@ ENTRY(\sym)
+@@ -1291,13 +1808,23 @@ ENTRY(\sym)
call save_paranoid
DEFAULT_FRAME 0
TRACE_IRQS_OFF
@@ -22548,7 +22385,7 @@ index 7272089..0b74104 100644
.endm
zeroentry divide_error do_divide_error
-@@ -1320,9 +1848,10 @@ gs_change:
+@@ -1327,9 +1854,10 @@ gs_change:
2: mfence /* workaround */
SWAPGS
popfq_cfi
@@ -22560,7 +22397,7 @@ index 7272089..0b74104 100644
_ASM_EXTABLE(gs_change,bad_gs)
.section .fixup,"ax"
-@@ -1350,9 +1879,10 @@ ENTRY(call_softirq)
+@@ -1357,9 +1885,10 @@ ENTRY(call_softirq)
CFI_DEF_CFA_REGISTER rsp
CFI_ADJUST_CFA_OFFSET -8
decl PER_CPU_VAR(irq_count)
@@ -22572,7 +22409,7 @@ index 7272089..0b74104 100644
#ifdef CONFIG_XEN
zeroentry xen_hypervisor_callback xen_do_hypervisor_callback
-@@ -1390,7 +1920,7 @@ ENTRY(xen_do_hypervisor_callback) # do_hypervisor_callback(struct *pt_regs)
+@@ -1397,7 +1926,7 @@ ENTRY(xen_do_hypervisor_callback) # do_hypervisor_callback(struct *pt_regs)
decl PER_CPU_VAR(irq_count)
jmp error_exit
CFI_ENDPROC
@@ -22581,16 +22418,16 @@ index 7272089..0b74104 100644
/*
* Hypervisor uses this for application faults while it executes.
-@@ -1449,7 +1979,7 @@ ENTRY(xen_failsafe_callback)
+@@ -1456,7 +1985,7 @@ ENTRY(xen_failsafe_callback)
SAVE_ALL
jmp error_exit
CFI_ENDPROC
-END(xen_failsafe_callback)
+ENDPROC(xen_failsafe_callback)
- apicinterrupt HYPERVISOR_CALLBACK_VECTOR \
+ apicinterrupt3 HYPERVISOR_CALLBACK_VECTOR \
xen_hvm_callback_vector xen_evtchn_do_upcall
-@@ -1501,18 +2031,33 @@ ENTRY(paranoid_exit)
+@@ -1508,18 +2037,33 @@ ENTRY(paranoid_exit)
DEFAULT_FRAME
DISABLE_INTERRUPTS(CLBR_NONE)
TRACE_IRQS_OFF_DEBUG
@@ -22626,7 +22463,7 @@ index 7272089..0b74104 100644
jmp irq_return
paranoid_userspace:
GET_THREAD_INFO(%rcx)
-@@ -1541,7 +2086,7 @@ paranoid_schedule:
+@@ -1548,7 +2092,7 @@ paranoid_schedule:
TRACE_IRQS_OFF
jmp paranoid_userspace
CFI_ENDPROC
@@ -22635,7 +22472,7 @@ index 7272089..0b74104 100644
/*
* Exception entry point. This expects an error code/orig_rax on the stack.
-@@ -1568,12 +2113,13 @@ ENTRY(error_entry)
+@@ -1575,12 +2119,13 @@ ENTRY(error_entry)
movq_cfi r14, R14+8
movq_cfi r15, R15+8
xorl %ebx,%ebx
@@ -22650,7 +22487,7 @@ index 7272089..0b74104 100644
ret
/*
-@@ -1600,7 +2146,7 @@ bstep_iret:
+@@ -1607,7 +2152,7 @@ bstep_iret:
movq %rcx,RIP+8(%rsp)
jmp error_swapgs
CFI_ENDPROC
@@ -22659,7 +22496,7 @@ index 7272089..0b74104 100644
/* ebx: no swapgs flag (1: don't need swapgs, 0: need it) */
-@@ -1611,7 +2157,7 @@ ENTRY(error_exit)
+@@ -1618,7 +2163,7 @@ ENTRY(error_exit)
DISABLE_INTERRUPTS(CLBR_NONE)
TRACE_IRQS_OFF
GET_THREAD_INFO(%rcx)
@@ -22668,7 +22505,7 @@ index 7272089..0b74104 100644
jne retint_kernel
LOCKDEP_SYS_EXIT_IRQ
movl TI_flags(%rcx),%edx
-@@ -1620,7 +2166,7 @@ ENTRY(error_exit)
+@@ -1627,7 +2172,7 @@ ENTRY(error_exit)
jnz retint_careful
jmp retint_swapgs
CFI_ENDPROC
@@ -22677,7 +22514,7 @@ index 7272089..0b74104 100644
/*
* Test if a given stack is an NMI stack or not.
-@@ -1678,9 +2224,11 @@ ENTRY(nmi)
+@@ -1685,9 +2230,11 @@ ENTRY(nmi)
* If %cs was not the kernel segment, then the NMI triggered in user
* space, which means it is definitely not nested.
*/
@@ -22690,7 +22527,7 @@ index 7272089..0b74104 100644
/*
* Check the special variable on the stack to see if NMIs are
* executing.
-@@ -1714,8 +2262,7 @@ nested_nmi:
+@@ -1721,8 +2268,7 @@ nested_nmi:
1:
/* Set up the interrupted NMIs stack to jump to repeat_nmi */
@@ -22700,7 +22537,7 @@ index 7272089..0b74104 100644
CFI_ADJUST_CFA_OFFSET 1*8
leaq -10*8(%rsp), %rdx
pushq_cfi $__KERNEL_DS
-@@ -1733,6 +2280,7 @@ nested_nmi_out:
+@@ -1740,6 +2286,7 @@ nested_nmi_out:
CFI_RESTORE rdx
/* No need to check faults here */
@@ -22708,7 +22545,7 @@ index 7272089..0b74104 100644
INTERRUPT_RETURN
CFI_RESTORE_STATE
-@@ -1849,6 +2397,8 @@ end_repeat_nmi:
+@@ -1856,6 +2403,8 @@ end_repeat_nmi:
*/
movq %cr2, %r12
@@ -22717,7 +22554,7 @@ index 7272089..0b74104 100644
/* paranoidentry do_nmi, 0; without TRACE_IRQS_OFF */
movq %rsp,%rdi
movq $-1,%rsi
-@@ -1861,26 +2411,31 @@ end_repeat_nmi:
+@@ -1868,26 +2417,31 @@ end_repeat_nmi:
movq %r12, %cr2
1:
@@ -22820,7 +22657,7 @@ index d4bdd25..912664c 100644
return -EFAULT;
diff --git a/arch/x86/kernel/head64.c b/arch/x86/kernel/head64.c
-index 55b6761..a6456fc 100644
+index 1be8e43..d9b9ef6 100644
--- a/arch/x86/kernel/head64.c
+++ b/arch/x86/kernel/head64.c
@@ -67,12 +67,12 @@ again:
@@ -22864,7 +22701,7 @@ index 55b6761..a6456fc 100644
}
pmd = (physaddr & PMD_MASK) + early_pmd_flags;
pmd_p[pmd_index(address)] = pmd;
-@@ -175,7 +175,6 @@ void __init x86_64_start_kernel(char * real_mode_data)
+@@ -175,7 +175,6 @@ asmlinkage void __init x86_64_start_kernel(char * real_mode_data)
if (console_loglevel == 10)
early_printk("Kernel alive\n");
@@ -22873,7 +22710,7 @@ index 55b6761..a6456fc 100644
init_level4_pgt[511] = early_level4_pgt[511];
diff --git a/arch/x86/kernel/head_32.S b/arch/x86/kernel/head_32.S
-index 73afd11..0ef46f2 100644
+index 81ba276..30c5411 100644
--- a/arch/x86/kernel/head_32.S
+++ b/arch/x86/kernel/head_32.S
@@ -26,6 +26,12 @@
@@ -23043,7 +22880,7 @@ index 73afd11..0ef46f2 100644
num_subarch_entries = (. - subarch_entries) / 4
.previous
#else
-@@ -355,6 +427,7 @@ default_entry:
+@@ -354,6 +426,7 @@ default_entry:
movl pa(mmu_cr4_features),%eax
movl %eax,%cr4
@@ -23051,7 +22888,7 @@ index 73afd11..0ef46f2 100644
testb $X86_CR4_PAE, %al # check if PAE is enabled
jz enable_paging
-@@ -383,6 +456,9 @@ default_entry:
+@@ -382,6 +455,9 @@ default_entry:
/* Make changes effective */
wrmsr
@@ -23061,7 +22898,7 @@ index 73afd11..0ef46f2 100644
enable_paging:
/*
-@@ -451,14 +527,20 @@ is486:
+@@ -449,14 +525,20 @@ is486:
1: movl $(__KERNEL_DS),%eax # reload all the segment registers
movl %eax,%ss # after changing gdt.
@@ -23083,7 +22920,7 @@ index 73afd11..0ef46f2 100644
movl %eax,%gs
xorl %eax,%eax # Clear LDT
-@@ -534,8 +616,11 @@ setup_once:
+@@ -512,8 +594,11 @@ setup_once:
* relocation. Manually set base address in stack canary
* segment descriptor.
*/
@@ -23096,7 +22933,7 @@ index 73afd11..0ef46f2 100644
movw %cx, 8 * GDT_ENTRY_STACK_CANARY + 2(%eax)
shrl $16, %ecx
movb %cl, 8 * GDT_ENTRY_STACK_CANARY + 4(%eax)
-@@ -566,7 +651,7 @@ ENDPROC(early_idt_handlers)
+@@ -544,7 +629,7 @@ ENDPROC(early_idt_handlers)
/* This is global to keep gas from relaxing the jumps */
ENTRY(early_idt_handler)
cld
@@ -23105,7 +22942,7 @@ index 73afd11..0ef46f2 100644
je hlt_loop
incl %ss:early_recursion_flag
-@@ -604,8 +689,8 @@ ENTRY(early_idt_handler)
+@@ -582,8 +667,8 @@ ENTRY(early_idt_handler)
pushl (20+6*4)(%esp) /* trapno */
pushl $fault_msg
call printk
@@ -23115,7 +22952,7 @@ index 73afd11..0ef46f2 100644
hlt_loop:
hlt
jmp hlt_loop
-@@ -624,8 +709,11 @@ ENDPROC(early_idt_handler)
+@@ -602,8 +687,11 @@ ENDPROC(early_idt_handler)
/* This is the default interrupt "handler" :-) */
ALIGN
ignore_int:
@@ -23128,7 +22965,7 @@ index 73afd11..0ef46f2 100644
pushl %eax
pushl %ecx
pushl %edx
-@@ -634,9 +722,6 @@ ignore_int:
+@@ -612,9 +700,6 @@ ignore_int:
movl $(__KERNEL_DS),%eax
movl %eax,%ds
movl %eax,%es
@@ -23138,7 +22975,7 @@ index 73afd11..0ef46f2 100644
pushl 16(%esp)
pushl 24(%esp)
pushl 32(%esp)
-@@ -670,29 +755,43 @@ ENTRY(setup_once_ref)
+@@ -648,29 +733,34 @@ ENTRY(setup_once_ref)
/*
* BSS section
*/
@@ -23166,15 +23003,6 @@ index 73afd11..0ef46f2 100644
+#else
.fill 1024,4,0
+#endif
-+
-+/*
-+ * The IDT has to be page-aligned to simplify the Pentium
-+ * F0 0F bug workaround.. We have a special link segment
-+ * for this.
-+ */
-+.section .idt,"a",@progbits
-+ENTRY(idt_table)
-+ .fill 256,8,0
/*
* This starts the data section.
@@ -23187,7 +23015,7 @@ index 73afd11..0ef46f2 100644
ENTRY(initial_page_table)
.long pa(initial_pg_pmd+PGD_IDENT_ATTR),0 /* low identity map */
# if KPMDS == 3
-@@ -711,12 +810,20 @@ ENTRY(initial_page_table)
+@@ -689,12 +779,20 @@ ENTRY(initial_page_table)
# error "Kernel PMDs should be 1, 2 or 3"
# endif
.align PAGE_SIZE /* needs to be page-sized too */
@@ -23209,7 +23037,7 @@ index 73afd11..0ef46f2 100644
__INITRODATA
int_msg:
-@@ -744,7 +851,7 @@ fault_msg:
+@@ -722,7 +820,7 @@ fault_msg:
* segment size, and 32-bit linear address value:
*/
@@ -23218,7 +23046,7 @@ index 73afd11..0ef46f2 100644
.globl boot_gdt_descr
.globl idt_descr
-@@ -753,7 +860,7 @@ fault_msg:
+@@ -731,7 +829,7 @@ fault_msg:
.word 0 # 32 bit align gdt_desc.address
boot_gdt_descr:
.word __BOOT_DS+7
@@ -23227,7 +23055,7 @@ index 73afd11..0ef46f2 100644
.word 0 # 32-bit align idt_desc.address
idt_descr:
-@@ -764,7 +871,7 @@ idt_descr:
+@@ -742,7 +840,7 @@ idt_descr:
.word 0 # 32 bit align gdt_desc.address
ENTRY(early_gdt_descr)
.word GDT_ENTRIES*8-1
@@ -23236,7 +23064,7 @@ index 73afd11..0ef46f2 100644
/*
* The boot_gdt must mirror the equivalent in setup.S and is
-@@ -773,5 +880,65 @@ ENTRY(early_gdt_descr)
+@@ -751,5 +849,65 @@ ENTRY(early_gdt_descr)
.align L1_CACHE_BYTES
ENTRY(boot_gdt)
.fill GDT_ENTRY_BOOT_CS,8,0
@@ -23305,7 +23133,7 @@ index 73afd11..0ef46f2 100644
+ .fill PAGE_SIZE_asm - GDT_SIZE,1,0
+ .endr
diff --git a/arch/x86/kernel/head_64.S b/arch/x86/kernel/head_64.S
-index a836860..1b5c665 100644
+index e1aabdb..fee4fee 100644
--- a/arch/x86/kernel/head_64.S
+++ b/arch/x86/kernel/head_64.S
@@ -20,6 +20,8 @@
@@ -23330,7 +23158,7 @@ index a836860..1b5c665 100644
.text
__HEAD
-@@ -89,11 +97,23 @@ startup_64:
+@@ -89,11 +97,24 @@ startup_64:
* Fixup the physical addresses in the page table
*/
addq %rbp, early_level4_pgt + (L4_START_KERNEL*8)(%rip)
@@ -23348,16 +23176,16 @@ index a836860..1b5c665 100644
+#endif
+
+ addq %rbp, level3_vmemmap_pgt + (L3_VMEMMAP_START*8)(%rip)
-
-- addq %rbp, level2_fixmap_pgt + (506*8)(%rip)
++
+ addq %rbp, level3_kernel_pgt + (L3_START_KERNEL*8)(%rip)
+ addq %rbp, level3_kernel_pgt + ((L3_START_KERNEL+1)*8)(%rip)
-+
+
+ addq %rbp, level2_fixmap_pgt + (506*8)(%rip)
+ addq %rbp, level2_fixmap_pgt + (507*8)(%rip)
/*
* Set up the identity mapping for the switchover. These
-@@ -177,8 +197,8 @@ ENTRY(secondary_startup_64)
+@@ -177,8 +198,8 @@ ENTRY(secondary_startup_64)
movq $(init_level4_pgt - __START_KERNEL_map), %rax
1:
@@ -23368,7 +23196,7 @@ index a836860..1b5c665 100644
movq %rcx, %cr4
/* Setup early boot stage 4 level pagetables. */
-@@ -199,10 +219,18 @@ ENTRY(secondary_startup_64)
+@@ -199,10 +220,19 @@ ENTRY(secondary_startup_64)
movl $MSR_EFER, %ecx
rdmsr
btsl $_EFER_SCE, %eax /* Enable System Call */
@@ -23377,18 +23205,19 @@ index a836860..1b5c665 100644
jnc 1f
btsl $_EFER_NX, %eax
btsq $_PAGE_BIT_NX,early_pmd_flags(%rip)
-+ leaq init_level4_pgt(%rip), %rdi
+#ifndef CONFIG_EFI
-+ btsq $_PAGE_BIT_NX, 8*L4_PAGE_OFFSET(%rdi)
++ btsq $_PAGE_BIT_NX, init_level4_pgt + 8*L4_PAGE_OFFSET(%rip)
+#endif
-+ btsq $_PAGE_BIT_NX, 8*L4_VMALLOC_START(%rdi)
-+ btsq $_PAGE_BIT_NX, 8*L4_VMALLOC_END(%rdi)
-+ btsq $_PAGE_BIT_NX, 8*L4_VMEMMAP_START(%rdi)
++ btsq $_PAGE_BIT_NX, init_level4_pgt + 8*L4_VMALLOC_START(%rip)
++ btsq $_PAGE_BIT_NX, init_level4_pgt + 8*L4_VMALLOC_END(%rip)
++ btsq $_PAGE_BIT_NX, init_level4_pgt + 8*L4_VMEMMAP_START(%rip)
++ btsq $_PAGE_BIT_NX, level2_fixmap_pgt + 8*506(%rip)
++ btsq $_PAGE_BIT_NX, level2_fixmap_pgt + 8*507(%rip)
+ btsq $_PAGE_BIT_NX, __supported_pte_mask(%rip)
1: wrmsr /* Make changes effective */
/* Setup cr0 */
-@@ -282,6 +310,7 @@ ENTRY(secondary_startup_64)
+@@ -282,6 +312,7 @@ ENTRY(secondary_startup_64)
* REX.W + FF /5 JMP m16:64 Jump far, absolute indirect,
* address given in m16:64.
*/
@@ -23396,7 +23225,7 @@ index a836860..1b5c665 100644
movq initial_code(%rip),%rax
pushq $0 # fake return address to stop unwinder
pushq $__KERNEL_CS # set correct cs
-@@ -388,7 +417,7 @@ ENTRY(early_idt_handler)
+@@ -388,7 +419,7 @@ ENTRY(early_idt_handler)
call dump_stack
#ifdef CONFIG_KALLSYMS
leaq early_idt_ripmsg(%rip),%rdi
@@ -23405,7 +23234,7 @@ index a836860..1b5c665 100644
call __print_symbol
#endif
#endif /* EARLY_PRINTK */
-@@ -416,6 +445,7 @@ ENDPROC(early_idt_handler)
+@@ -416,6 +447,7 @@ ENDPROC(early_idt_handler)
early_recursion_flag:
.long 0
@@ -23413,7 +23242,7 @@ index a836860..1b5c665 100644
#ifdef CONFIG_EARLY_PRINTK
early_idt_msg:
.asciz "PANIC: early exception %02lx rip %lx:%lx error %lx cr2 %lx\n"
-@@ -443,29 +473,52 @@ NEXT_PAGE(early_level4_pgt)
+@@ -443,29 +475,52 @@ NEXT_PAGE(early_level4_pgt)
NEXT_PAGE(early_dynamic_pgts)
.fill 512*EARLY_DYNAMIC_PAGE_TABLES,8,0
@@ -23475,7 +23304,7 @@ index a836860..1b5c665 100644
NEXT_PAGE(level3_kernel_pgt)
.fill L3_START_KERNEL,8,0
-@@ -473,6 +526,9 @@ NEXT_PAGE(level3_kernel_pgt)
+@@ -473,6 +528,9 @@ NEXT_PAGE(level3_kernel_pgt)
.quad level2_kernel_pgt - __START_KERNEL_map + _KERNPG_TABLE
.quad level2_fixmap_pgt - __START_KERNEL_map + _PAGE_TABLE
@@ -23485,23 +23314,22 @@ index a836860..1b5c665 100644
NEXT_PAGE(level2_kernel_pgt)
/*
* 512 MB kernel mapping. We spend a full page on this pagetable
-@@ -488,39 +544,70 @@ NEXT_PAGE(level2_kernel_pgt)
- KERNEL_IMAGE_SIZE/PMD_SIZE)
-
+@@ -490,28 +548,64 @@ NEXT_PAGE(level2_kernel_pgt)
NEXT_PAGE(level2_fixmap_pgt)
-- .fill 506,8,0
-- .quad level1_fixmap_pgt - __START_KERNEL_map + _PAGE_TABLE
+ .fill 506,8,0
+ .quad level1_fixmap_pgt - __START_KERNEL_map + _PAGE_TABLE
- /* 8MB reserved for vsyscalls + a 2MB hole = 4 + 1 entries */
- .fill 5,8,0
-+ .fill 507,8,0
+ .quad level1_vsyscall_pgt - __START_KERNEL_map + _PAGE_TABLE
+ /* 6MB reserved for vsyscalls + a 2MB hole = 3 + 1 entries */
+ .fill 4,8,0
--NEXT_PAGE(level1_fixmap_pgt)
-+NEXT_PAGE(level1_vsyscall_pgt)
+ NEXT_PAGE(level1_fixmap_pgt)
.fill 512,8,0
++NEXT_PAGE(level1_vsyscall_pgt)
++ .fill 512,8,0
++
#undef PMDS
- .data
@@ -23552,25 +23380,11 @@ index a836860..1b5c665 100644
#include "../../x86/xen/xen-head.S"
-
-- .section .bss, "aw", @nobits
+- __PAGE_ALIGNED_BSS
+
+ .section .rodata,"a",@progbits
-+NEXT_PAGE(empty_zero_page)
-+ .skip PAGE_SIZE
-+
- .align PAGE_SIZE
- ENTRY(idt_table)
-- .skip IDT_ENTRIES * 16
-+ .fill 512,8,0
-
- .align L1_CACHE_BYTES
- ENTRY(nmi_idt_table)
-- .skip IDT_ENTRIES * 16
--
-- __PAGE_ALIGNED_BSS
--NEXT_PAGE(empty_zero_page)
-- .skip PAGE_SIZE
-+ .fill 512,8,0
+ NEXT_PAGE(empty_zero_page)
+ .skip PAGE_SIZE
diff --git a/arch/x86/kernel/i386_ksyms_32.c b/arch/x86/kernel/i386_ksyms_32.c
index 0fa6912..b37438b 100644
--- a/arch/x86/kernel/i386_ksyms_32.c
@@ -23601,7 +23415,7 @@ index 0fa6912..b37438b 100644
+EXPORT_SYMBOL(cpu_pgd);
+#endif
diff --git a/arch/x86/kernel/i387.c b/arch/x86/kernel/i387.c
-index f7ea30d..6318acc 100644
+index 5d576ab..1403a03 100644
--- a/arch/x86/kernel/i387.c
+++ b/arch/x86/kernel/i387.c
@@ -51,7 +51,7 @@ static inline bool interrupted_kernel_fpu_idle(void)
@@ -23668,7 +23482,7 @@ index a979b5b..1d6db75 100644
.callback = dmi_io_delay_0xed_port,
.ident = "Compaq Presario V6000",
diff --git a/arch/x86/kernel/ioport.c b/arch/x86/kernel/ioport.c
-index 4ddaf66..6292f4e 100644
+index 4ddaf66..49d5c18 100644
--- a/arch/x86/kernel/ioport.c
+++ b/arch/x86/kernel/ioport.c
@@ -6,6 +6,7 @@
@@ -23679,19 +23493,19 @@ index 4ddaf66..6292f4e 100644
#include <linux/errno.h>
#include <linux/types.h>
#include <linux/ioport.h>
-@@ -28,6 +29,12 @@ asmlinkage long sys_ioperm(unsigned long from, unsigned long num, int turn_on)
-
- if ((from + num <= from) || (from + num > IO_BITMAP_BITS))
+@@ -30,6 +31,12 @@ asmlinkage long sys_ioperm(unsigned long from, unsigned long num, int turn_on)
return -EINVAL;
+ if (turn_on && !capable(CAP_SYS_RAWIO))
+ return -EPERM;
+#ifdef CONFIG_GRKERNSEC_IO
+ if (turn_on && grsec_disable_privio) {
+ gr_handle_ioperm();
-+ return -EPERM;
++ return -ENODEV;
+ }
+#endif
- if (turn_on && !capable(CAP_SYS_RAWIO))
- return -EPERM;
+ /*
+ * If it's the first ioperm() call in this thread's lifetime, set the
@@ -54,7 +61,7 @@ asmlinkage long sys_ioperm(unsigned long from, unsigned long num, int turn_on)
* because the ->io_bitmap_max value must match the bitmap
* contents:
@@ -23701,33 +23515,33 @@ index 4ddaf66..6292f4e 100644
if (turn_on)
bitmap_clear(t->io_bitmap_ptr, from, num);
-@@ -103,6 +110,12 @@ SYSCALL_DEFINE1(iopl, unsigned int, level)
- return -EINVAL;
- /* Trying to gain more privileges? */
+@@ -105,6 +112,12 @@ SYSCALL_DEFINE1(iopl, unsigned int, level)
if (level > old) {
+ if (!capable(CAP_SYS_RAWIO))
+ return -EPERM;
+#ifdef CONFIG_GRKERNSEC_IO
+ if (grsec_disable_privio) {
+ gr_handle_iopl();
-+ return -EPERM;
++ return -ENODEV;
+ }
+#endif
- if (!capable(CAP_SYS_RAWIO))
- return -EPERM;
}
+ regs->flags = (regs->flags & ~X86_EFLAGS_IOPL) | (level << 12);
+ t->iopl = level << 12;
diff --git a/arch/x86/kernel/irq.c b/arch/x86/kernel/irq.c
-index ac0631d..ff7cb62 100644
+index 22d0687..e07b2a5 100644
--- a/arch/x86/kernel/irq.c
+++ b/arch/x86/kernel/irq.c
-@@ -18,7 +18,7 @@
- #include <asm/mce.h>
- #include <asm/hw_irq.h>
+@@ -21,7 +21,7 @@
+ #define CREATE_TRACE_POINTS
+ #include <asm/trace/irq_vectors.h>
-atomic_t irq_err_count;
+atomic_unchecked_t irq_err_count;
/* Function pointer for generic interrupt vector handling */
void (*x86_platform_ipi_callback)(void) = NULL;
-@@ -122,9 +122,9 @@ int arch_show_interrupts(struct seq_file *p, int prec)
+@@ -125,9 +125,9 @@ int arch_show_interrupts(struct seq_file *p, int prec)
seq_printf(p, "%10u ", per_cpu(mce_poll_count, j));
seq_printf(p, " Machine check polls\n");
#endif
@@ -23739,7 +23553,7 @@ index ac0631d..ff7cb62 100644
#endif
return 0;
}
-@@ -164,7 +164,7 @@ u64 arch_irq_stat_cpu(unsigned int cpu)
+@@ -167,7 +167,7 @@ u64 arch_irq_stat_cpu(unsigned int cpu)
u64 arch_irq_stat(void)
{
@@ -23749,7 +23563,7 @@ index ac0631d..ff7cb62 100644
}
diff --git a/arch/x86/kernel/irq_32.c b/arch/x86/kernel/irq_32.c
-index 344faf8..355f60d 100644
+index 4186755..784efa0 100644
--- a/arch/x86/kernel/irq_32.c
+++ b/arch/x86/kernel/irq_32.c
@@ -39,7 +39,7 @@ static int check_stack_overflow(void)
@@ -23821,7 +23635,7 @@ index 344faf8..355f60d 100644
@@ -121,29 +125,14 @@ execute_on_irq_stack(int overflow, struct irq_desc *desc, int irq)
*/
- void __cpuinit irq_ctx_init(int cpu)
+ void irq_ctx_init(int cpu)
{
- union irq_ctx *irqctx;
-
@@ -23835,7 +23649,9 @@ index 344faf8..355f60d 100644
- irqctx->tinfo.cpu = cpu;
- irqctx->tinfo.preempt_count = HARDIRQ_OFFSET;
- irqctx->tinfo.addr_limit = MAKE_MM_SEG(0);
--
++ per_cpu(hardirq_ctx, cpu) = page_address(alloc_pages_node(cpu_to_node(cpu), THREADINFO_GFP, THREAD_SIZE_ORDER));
++ per_cpu(softirq_ctx, cpu) = page_address(alloc_pages_node(cpu_to_node(cpu), THREADINFO_GFP, THREAD_SIZE_ORDER));
+
- per_cpu(hardirq_ctx, cpu) = irqctx;
-
- irqctx = page_address(alloc_pages_node(cpu_to_node(cpu),
@@ -23846,15 +23662,12 @@ index 344faf8..355f60d 100644
- irqctx->tinfo.addr_limit = MAKE_MM_SEG(0);
-
- per_cpu(softirq_ctx, cpu) = irqctx;
-+ per_cpu(hardirq_ctx, cpu) = page_address(alloc_pages_node(cpu_to_node(cpu), THREADINFO_GFP, THREAD_SIZE_ORDER));
-+ per_cpu(softirq_ctx, cpu) = page_address(alloc_pages_node(cpu_to_node(cpu), THREADINFO_GFP, THREAD_SIZE_ORDER));
-+
-+ printk(KERN_DEBUG "CPU %u irqstacks, hard=%p soft=%p\n",
-+ cpu, per_cpu(hardirq_ctx, cpu), per_cpu(softirq_ctx, cpu));
++ printk(KERN_DEBUG "CPU %u irqstacks, hard=%p soft=%p\n",
++ cpu, per_cpu(hardirq_ctx, cpu), per_cpu(softirq_ctx, cpu));
printk(KERN_DEBUG "CPU %u irqstacks, hard=%p soft=%p\n",
cpu, per_cpu(hardirq_ctx, cpu), per_cpu(softirq_ctx, cpu));
-@@ -152,7 +141,6 @@ void __cpuinit irq_ctx_init(int cpu)
+@@ -152,7 +141,6 @@ void irq_ctx_init(int cpu)
asmlinkage void do_softirq(void)
{
unsigned long flags;
@@ -23911,19 +23724,35 @@ index d04d3ec..ea4b374 100644
return;
if (regs->sp >= curbase + sizeof(struct thread_info) +
-diff --git a/arch/x86/kernel/kdebugfs.c b/arch/x86/kernel/kdebugfs.c
-index dc1404b..bbc43e7 100644
---- a/arch/x86/kernel/kdebugfs.c
-+++ b/arch/x86/kernel/kdebugfs.c
-@@ -27,7 +27,7 @@ struct setup_data_node {
- u32 len;
- };
+diff --git a/arch/x86/kernel/jump_label.c b/arch/x86/kernel/jump_label.c
+index ee11b7d..4df4d0c 100644
+--- a/arch/x86/kernel/jump_label.c
++++ b/arch/x86/kernel/jump_label.c
+@@ -49,7 +49,7 @@ static void __jump_label_transform(struct jump_entry *entry,
+ * We are enabling this jump label. If it is not a nop
+ * then something must have gone wrong.
+ */
+- if (unlikely(memcmp((void *)entry->code, ideal_nop, 5) != 0))
++ if (unlikely(memcmp((void *)ktla_ktva(entry->code), ideal_nop, 5) != 0))
+ bug_at((void *)entry->code, __LINE__);
--static ssize_t setup_data_read(struct file *file, char __user *user_buf,
-+static ssize_t __size_overflow(3) setup_data_read(struct file *file, char __user *user_buf,
- size_t count, loff_t *ppos)
- {
- struct setup_data_node *node = file->private_data;
+ code.jump = 0xe9;
+@@ -64,13 +64,13 @@ static void __jump_label_transform(struct jump_entry *entry,
+ */
+ if (init) {
+ const unsigned char default_nop[] = { STATIC_KEY_INIT_NOP };
+- if (unlikely(memcmp((void *)entry->code, default_nop, 5) != 0))
++ if (unlikely(memcmp((void *)ktla_ktva(entry->code), default_nop, 5) != 0))
+ bug_at((void *)entry->code, __LINE__);
+ } else {
+ code.jump = 0xe9;
+ code.offset = entry->target -
+ (entry->code + JUMP_LABEL_NOP_SIZE);
+- if (unlikely(memcmp((void *)entry->code, &code, 5) != 0))
++ if (unlikely(memcmp((void *)ktla_ktva(entry->code), &code, 5) != 0))
+ bug_at((void *)entry->code, __LINE__);
+ }
+ memcpy(&code, ideal_nops[NOP_ATOMIC5], JUMP_LABEL_NOP_SIZE);
diff --git a/arch/x86/kernel/kgdb.c b/arch/x86/kernel/kgdb.c
index 836f832..a8bda67 100644
--- a/arch/x86/kernel/kgdb.c
@@ -24018,7 +23847,7 @@ index 836f832..a8bda67 100644
}
diff --git a/arch/x86/kernel/kprobes/core.c b/arch/x86/kernel/kprobes/core.c
-index 211bce4..6e2580a 100644
+index 79a3f96..6ba030a 100644
--- a/arch/x86/kernel/kprobes/core.c
+++ b/arch/x86/kernel/kprobes/core.c
@@ -119,9 +119,12 @@ static void __kprobes __synthesize_relative_insn(void *from, void *to, u8 op)
@@ -24135,7 +23964,7 @@ index 211bce4..6e2580a 100644
switch (val) {
diff --git a/arch/x86/kernel/kprobes/opt.c b/arch/x86/kernel/kprobes/opt.c
-index 76dc6f0..66bdfc3 100644
+index 898160b..758cde8 100644
--- a/arch/x86/kernel/kprobes/opt.c
+++ b/arch/x86/kernel/kprobes/opt.c
@@ -79,6 +79,7 @@ found:
@@ -24153,8 +23982,8 @@ index 76dc6f0..66bdfc3 100644
+ pax_close_kernel();
}
- static void __used __kprobes kprobes_optinsn_template_holder(void)
-@@ -338,7 +340,7 @@ int __kprobes arch_prepare_optimized_kprobe(struct optimized_kprobe *op)
+ asm (
+@@ -335,7 +337,7 @@ int __kprobes arch_prepare_optimized_kprobe(struct optimized_kprobe *op)
* Verify if the address gap is in 2GB range, because this uses
* a relative jump.
*/
@@ -24163,7 +23992,7 @@ index 76dc6f0..66bdfc3 100644
if (abs(rel) > 0x7fffffff)
return -ERANGE;
-@@ -353,16 +355,18 @@ int __kprobes arch_prepare_optimized_kprobe(struct optimized_kprobe *op)
+@@ -350,16 +352,18 @@ int __kprobes arch_prepare_optimized_kprobe(struct optimized_kprobe *op)
op->optinsn.size = ret;
/* Copy arch-dep-instance from template */
@@ -24185,16 +24014,16 @@ index 76dc6f0..66bdfc3 100644
(u8 *)op->kp.addr + op->optinsn.size);
flush_icache_range((unsigned long) buf,
-@@ -385,7 +389,7 @@ static void __kprobes setup_optimize_kprobe(struct text_poke_param *tprm,
- ((long)op->kp.addr + RELATIVEJUMP_SIZE));
+@@ -384,7 +388,7 @@ void __kprobes arch_optimize_kprobes(struct list_head *oplist)
+ WARN_ON(kprobe_disabled(&op->kp));
- /* Backup instructions which will be replaced by jump address */
-- memcpy(op->optinsn.copied_insn, op->kp.addr + INT3_SIZE,
-+ memcpy(op->optinsn.copied_insn, ktla_ktva(op->kp.addr) + INT3_SIZE,
- RELATIVE_ADDR_SIZE);
+ /* Backup instructions which will be replaced by jump address */
+- memcpy(op->optinsn.copied_insn, op->kp.addr + INT3_SIZE,
++ memcpy(op->optinsn.copied_insn, ktla_ktva(op->kp.addr) + INT3_SIZE,
+ RELATIVE_ADDR_SIZE);
- insn_buf[0] = RELATIVEJUMP_OPCODE;
-@@ -483,7 +487,7 @@ setup_detour_execution(struct kprobe *p, struct pt_regs *regs, int reenter)
+ insn_buf[0] = RELATIVEJUMP_OPCODE;
+@@ -433,7 +437,7 @@ setup_detour_execution(struct kprobe *p, struct pt_regs *regs, int reenter)
/* This kprobe is really able to run optimized path. */
op = container_of(p, struct optimized_kprobe, kp);
/* Detour through copied instructions */
@@ -24203,19 +24032,6 @@ index 76dc6f0..66bdfc3 100644
if (!reenter)
reset_current_kprobe();
preempt_enable_no_resched();
-diff --git a/arch/x86/kernel/kvm.c b/arch/x86/kernel/kvm.c
-index cd6d9a5..16245a4 100644
---- a/arch/x86/kernel/kvm.c
-+++ b/arch/x86/kernel/kvm.c
-@@ -455,7 +455,7 @@ static int __cpuinit kvm_cpu_notify(struct notifier_block *self,
- return NOTIFY_OK;
- }
-
--static struct notifier_block __cpuinitdata kvm_cpu_notifier = {
-+static struct notifier_block kvm_cpu_notifier = {
- .notifier_call = kvm_cpu_notify,
- };
- #endif
diff --git a/arch/x86/kernel/ldt.c b/arch/x86/kernel/ldt.c
index ebc9873..1b9724b 100644
--- a/arch/x86/kernel/ldt.c
@@ -24316,7 +24132,7 @@ index 5b19e4d..6476a76 100644
relocate_kernel_ptr = control_page;
page_list[PA_CONTROL_PAGE] = __pa(control_page);
diff --git a/arch/x86/kernel/microcode_core.c b/arch/x86/kernel/microcode_core.c
-index 22db92b..d546bec 100644
+index 15c9876..0a43909 100644
--- a/arch/x86/kernel/microcode_core.c
+++ b/arch/x86/kernel/microcode_core.c
@@ -513,7 +513,7 @@ mc_cpu_callback(struct notifier_block *nb, unsigned long action, void *hcpu)
@@ -24486,10 +24302,10 @@ index 216a4d7..228255a 100644
if ((s64)val != *(s32 *)loc)
goto overflow;
diff --git a/arch/x86/kernel/msr.c b/arch/x86/kernel/msr.c
-index ce13049..e2e9c3c 100644
+index 88458fa..349f7a4 100644
--- a/arch/x86/kernel/msr.c
+++ b/arch/x86/kernel/msr.c
-@@ -233,7 +233,7 @@ static int __cpuinit msr_class_cpu_callback(struct notifier_block *nfb,
+@@ -233,7 +233,7 @@ static int msr_class_cpu_callback(struct notifier_block *nfb,
return notifier_from_errno(err);
}
@@ -24499,10 +24315,10 @@ index ce13049..e2e9c3c 100644
};
diff --git a/arch/x86/kernel/nmi.c b/arch/x86/kernel/nmi.c
-index 6030805..2d33f21 100644
+index 6fcb49c..5b3f4ff 100644
--- a/arch/x86/kernel/nmi.c
+++ b/arch/x86/kernel/nmi.c
-@@ -105,7 +105,7 @@ static int __kprobes nmi_handle(unsigned int type, struct pt_regs *regs, bool b2
+@@ -138,7 +138,7 @@ static int __kprobes nmi_handle(unsigned int type, struct pt_regs *regs, bool b2
return handled;
}
@@ -24511,7 +24327,7 @@ index 6030805..2d33f21 100644
{
struct nmi_desc *desc = nmi_to_desc(type);
unsigned long flags;
-@@ -129,9 +129,9 @@ int __register_nmi_handler(unsigned int type, struct nmiaction *action)
+@@ -162,9 +162,9 @@ int __register_nmi_handler(unsigned int type, struct nmiaction *action)
* event confuses some handlers (kdump uses this flag)
*/
if (action->flags & NMI_FLAG_FIRST)
@@ -24523,7 +24339,7 @@ index 6030805..2d33f21 100644
spin_unlock_irqrestore(&desc->lock, flags);
return 0;
-@@ -154,7 +154,7 @@ void unregister_nmi_handler(unsigned int type, const char *name)
+@@ -187,7 +187,7 @@ void unregister_nmi_handler(unsigned int type, const char *name)
if (!strcmp(n->name, name)) {
WARN(in_nmi(),
"Trying to free NMI (%s) from NMI context!\n", n->name);
@@ -24532,7 +24348,7 @@ index 6030805..2d33f21 100644
break;
}
}
-@@ -479,6 +479,17 @@ static inline void nmi_nesting_postprocess(void)
+@@ -512,6 +512,17 @@ static inline void nmi_nesting_postprocess(void)
dotraplinkage notrace __kprobes void
do_nmi(struct pt_regs *regs, long error_code)
{
@@ -24573,20 +24389,20 @@ index 6d9582e..f746287 100644
return;
}
diff --git a/arch/x86/kernel/paravirt-spinlocks.c b/arch/x86/kernel/paravirt-spinlocks.c
-index 676b8c7..870ba04 100644
+index bbb6c73..24a58ef 100644
--- a/arch/x86/kernel/paravirt-spinlocks.c
+++ b/arch/x86/kernel/paravirt-spinlocks.c
-@@ -13,7 +13,7 @@ default_spin_lock_flags(arch_spinlock_t *lock, unsigned long flags)
- arch_spin_lock(lock);
- }
+@@ -8,7 +8,7 @@
+
+ #include <asm/paravirt.h>
-struct pv_lock_ops pv_lock_ops = {
+struct pv_lock_ops pv_lock_ops __read_only = {
#ifdef CONFIG_SMP
- .spin_is_locked = __ticket_spin_is_locked,
- .spin_is_contended = __ticket_spin_is_contended,
+ .lock_spinning = __PV_IS_CALLEE_SAVE(paravirt_nop),
+ .unlock_kick = paravirt_nop,
diff --git a/arch/x86/kernel/paravirt.c b/arch/x86/kernel/paravirt.c
-index cd6de64..27c6af0 100644
+index 1b10af8..0b58cbc 100644
--- a/arch/x86/kernel/paravirt.c
+++ b/arch/x86/kernel/paravirt.c
@@ -55,6 +55,9 @@ u64 _paravirt_ident_64(u64 x)
@@ -24599,7 +24415,7 @@ index cd6de64..27c6af0 100644
void __init default_banner(void)
{
-@@ -147,15 +150,19 @@ unsigned paravirt_patch_default(u8 type, u16 clobbers, void *insnbuf,
+@@ -142,15 +145,19 @@ unsigned paravirt_patch_default(u8 type, u16 clobbers, void *insnbuf,
if (opfunc == NULL)
/* If there's no function, patch it with a ud2a (BUG) */
ret = paravirt_patch_insns(insnbuf, len, ud2a, ud2a+sizeof(ud2a));
@@ -24614,15 +24430,15 @@ index cd6de64..27c6af0 100644
ret = paravirt_patch_ident_32(insnbuf, len);
- else if (opfunc == _paravirt_ident_64)
+ else if (opfunc == (void *)_paravirt_ident_64)
-+ ret = paravirt_patch_ident_64(insnbuf, len);
+ ret = paravirt_patch_ident_64(insnbuf, len);
+#if defined(CONFIG_X86_32) && defined(CONFIG_X86_PAE)
+ else if (opfunc == (void *)__raw_callee_save__paravirt_ident_64)
- ret = paravirt_patch_ident_64(insnbuf, len);
++ ret = paravirt_patch_ident_64(insnbuf, len);
+#endif
else if (type == PARAVIRT_PATCH(pv_cpu_ops.iret) ||
type == PARAVIRT_PATCH(pv_cpu_ops.irq_enable_sysexit) ||
-@@ -180,7 +187,7 @@ unsigned paravirt_patch_insns(void *insnbuf, unsigned len,
+@@ -175,7 +182,7 @@ unsigned paravirt_patch_insns(void *insnbuf, unsigned len,
if (insn_len > len || start == NULL)
insn_len = len;
else
@@ -24631,7 +24447,7 @@ index cd6de64..27c6af0 100644
return insn_len;
}
-@@ -304,7 +311,7 @@ enum paravirt_lazy_mode paravirt_get_lazy_mode(void)
+@@ -299,7 +306,7 @@ enum paravirt_lazy_mode paravirt_get_lazy_mode(void)
return this_cpu_read(paravirt_lazy_mode);
}
@@ -24640,7 +24456,7 @@ index cd6de64..27c6af0 100644
.name = "bare hardware",
.paravirt_enabled = 0,
.kernel_rpl = 0,
-@@ -315,16 +322,16 @@ struct pv_info pv_info = {
+@@ -310,16 +317,16 @@ struct pv_info pv_info = {
#endif
};
@@ -24655,21 +24471,21 @@ index cd6de64..27c6af0 100644
.steal_clock = native_steal_clock,
};
--struct pv_irq_ops pv_irq_ops = {
-+struct pv_irq_ops pv_irq_ops __read_only = {
+-__visible struct pv_irq_ops pv_irq_ops = {
++__visible struct pv_irq_ops pv_irq_ops __read_only = {
.save_fl = __PV_IS_CALLEE_SAVE(native_save_fl),
.restore_fl = __PV_IS_CALLEE_SAVE(native_restore_fl),
.irq_disable = __PV_IS_CALLEE_SAVE(native_irq_disable),
-@@ -336,7 +343,7 @@ struct pv_irq_ops pv_irq_ops = {
+@@ -331,7 +338,7 @@ __visible struct pv_irq_ops pv_irq_ops = {
#endif
};
--struct pv_cpu_ops pv_cpu_ops = {
-+struct pv_cpu_ops pv_cpu_ops __read_only = {
+-__visible struct pv_cpu_ops pv_cpu_ops = {
++__visible struct pv_cpu_ops pv_cpu_ops __read_only = {
.cpuid = native_cpuid,
.get_debugreg = native_get_debugreg,
.set_debugreg = native_set_debugreg,
-@@ -394,21 +401,26 @@ struct pv_cpu_ops pv_cpu_ops = {
+@@ -389,21 +396,26 @@ __visible struct pv_cpu_ops pv_cpu_ops = {
.end_context_switch = paravirt_nop,
};
@@ -24699,7 +24515,7 @@ index cd6de64..27c6af0 100644
.read_cr2 = native_read_cr2,
.write_cr2 = native_write_cr2,
-@@ -458,6 +470,7 @@ struct pv_mmu_ops pv_mmu_ops = {
+@@ -453,6 +465,7 @@ struct pv_mmu_ops pv_mmu_ops = {
.make_pud = PTE_IDENT,
.set_pgd = native_set_pgd,
@@ -24707,7 +24523,7 @@ index cd6de64..27c6af0 100644
#endif
#endif /* PAGETABLE_LEVELS >= 3 */
-@@ -478,6 +491,12 @@ struct pv_mmu_ops pv_mmu_ops = {
+@@ -473,6 +486,12 @@ struct pv_mmu_ops pv_mmu_ops = {
},
.set_fixmap = native_set_fixmap,
@@ -24760,15 +24576,15 @@ index 6c483ba..d10ce2f 100644
static struct dma_map_ops swiotlb_dma_ops = {
diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c
-index 59b9037..047a1ef 100644
+index 3fb8d95..254dc51 100644
--- a/arch/x86/kernel/process.c
+++ b/arch/x86/kernel/process.c
@@ -36,7 +36,8 @@
* section. Since TSS's are completely CPU-local, we want them
* on exact cacheline boundaries, to eliminate cacheline ping-pong.
*/
--DEFINE_PER_CPU_SHARED_ALIGNED(struct tss_struct, init_tss) = INIT_TSS;
-+struct tss_struct init_tss[NR_CPUS] ____cacheline_internodealigned_in_smp = { [0 ... NR_CPUS-1] = INIT_TSS };
+-__visible DEFINE_PER_CPU_SHARED_ALIGNED(struct tss_struct, init_tss) = INIT_TSS;
++struct tss_struct init_tss[NR_CPUS] __visible ____cacheline_internodealigned_in_smp = { [0 ... NR_CPUS-1] = INIT_TSS };
+EXPORT_SYMBOL(init_tss);
#ifdef CONFIG_X86_64
@@ -24868,7 +24684,7 @@ index 59b9037..047a1ef 100644
+}
+#endif
diff --git a/arch/x86/kernel/process_32.c b/arch/x86/kernel/process_32.c
-index 7305f7d..22f73d6 100644
+index 884f98f..ec23e04 100644
--- a/arch/x86/kernel/process_32.c
+++ b/arch/x86/kernel/process_32.c
@@ -65,6 +65,7 @@ asmlinkage void ret_from_kernel_thread(void) __asm__("ret_from_kernel_thread");
@@ -24902,7 +24718,7 @@ index 7305f7d..22f73d6 100644
print_symbol("EIP is at %s\n", regs->ip);
printk(KERN_DEFAULT "EAX: %08lx EBX: %08lx ECX: %08lx EDX: %08lx\n",
-@@ -128,20 +128,21 @@ void release_thread(struct task_struct *dead_task)
+@@ -133,20 +133,21 @@ void release_thread(struct task_struct *dead_task)
int copy_thread(unsigned long clone_flags, unsigned long sp,
unsigned long arg, struct task_struct *p)
{
@@ -24928,7 +24744,7 @@ index 7305f7d..22f73d6 100644
childregs->fs = __KERNEL_PERCPU;
childregs->bx = sp; /* function */
childregs->bp = arg;
-@@ -248,7 +249,7 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p)
+@@ -253,7 +254,7 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p)
struct thread_struct *prev = &prev_p->thread,
*next = &next_p->thread;
int cpu = smp_processor_id();
@@ -24937,7 +24753,7 @@ index 7305f7d..22f73d6 100644
fpu_switch_t fpu;
/* never put a printk in __switch_to... printk() calls wake_up*() indirectly */
-@@ -272,6 +273,10 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p)
+@@ -277,6 +278,10 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p)
*/
lazy_save_gs(prev->gs);
@@ -24948,7 +24764,7 @@ index 7305f7d..22f73d6 100644
/*
* Load the per-thread Thread-Local Storage descriptor.
*/
-@@ -302,6 +307,9 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p)
+@@ -307,6 +312,9 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p)
*/
arch_end_context_switch(next_p);
@@ -24958,7 +24774,7 @@ index 7305f7d..22f73d6 100644
/*
* Restore %gs if needed (which is common)
*/
-@@ -310,8 +318,6 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p)
+@@ -315,8 +323,6 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p)
switch_fpu_finish(next_p, fpu);
@@ -24967,16 +24783,16 @@ index 7305f7d..22f73d6 100644
return prev_p;
}
-@@ -341,4 +347,3 @@ unsigned long get_wchan(struct task_struct *p)
+@@ -346,4 +352,3 @@ unsigned long get_wchan(struct task_struct *p)
} while (count++ < 16);
return 0;
}
-
diff --git a/arch/x86/kernel/process_64.c b/arch/x86/kernel/process_64.c
-index 355ae06..560fbbe 100644
+index bb1dc51..08dda7f 100644
--- a/arch/x86/kernel/process_64.c
+++ b/arch/x86/kernel/process_64.c
-@@ -151,10 +151,11 @@ int copy_thread(unsigned long clone_flags, unsigned long sp,
+@@ -158,10 +158,11 @@ int copy_thread(unsigned long clone_flags, unsigned long sp,
struct pt_regs *childregs;
struct task_struct *me = current;
@@ -24989,7 +24805,7 @@ index 355ae06..560fbbe 100644
set_tsk_thread_flag(p, TIF_FORK);
p->fpu_counter = 0;
p->thread.io_bitmap_ptr = NULL;
-@@ -165,6 +166,8 @@ int copy_thread(unsigned long clone_flags, unsigned long sp,
+@@ -172,6 +173,8 @@ int copy_thread(unsigned long clone_flags, unsigned long sp,
p->thread.fs = p->thread.fsindex ? 0 : me->thread.fs;
savesegment(es, p->thread.es);
savesegment(ds, p->thread.ds);
@@ -24998,7 +24814,7 @@ index 355ae06..560fbbe 100644
memset(p->thread.ptrace_bps, 0, sizeof(p->thread.ptrace_bps));
if (unlikely(p->flags & PF_KTHREAD)) {
-@@ -273,7 +276,7 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p)
+@@ -280,7 +283,7 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p)
struct thread_struct *prev = &prev_p->thread;
struct thread_struct *next = &next_p->thread;
int cpu = smp_processor_id();
@@ -25007,7 +24823,7 @@ index 355ae06..560fbbe 100644
unsigned fsindex, gsindex;
fpu_switch_t fpu;
-@@ -296,6 +299,9 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p)
+@@ -303,6 +306,9 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p)
if (unlikely(next->ds | prev->ds))
loadsegment(ds, next->ds);
@@ -25017,7 +24833,7 @@ index 355ae06..560fbbe 100644
/* We must save %fs and %gs before load_TLS() because
* %fs and %gs may be cleared by load_TLS().
-@@ -355,10 +361,9 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p)
+@@ -362,10 +368,9 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p)
prev->usersp = this_cpu_read(old_rsp);
this_cpu_write(old_rsp, next->usersp);
this_cpu_write(current_task, next_p);
@@ -25030,7 +24846,7 @@ index 355ae06..560fbbe 100644
/*
* Now maybe reload the debug registers and handle I/O bitmaps
-@@ -427,12 +432,11 @@ unsigned long get_wchan(struct task_struct *p)
+@@ -434,12 +439,11 @@ unsigned long get_wchan(struct task_struct *p)
if (!p || p == current || p->state == TASK_RUNNING)
return 0;
stack = (unsigned long)task_stack_page(p);
@@ -25046,7 +24862,7 @@ index 355ae06..560fbbe 100644
ip = *(u64 *)(fp+8);
if (!in_sched_functions(ip))
diff --git a/arch/x86/kernel/ptrace.c b/arch/x86/kernel/ptrace.c
-index 29a8120..a50b5ee 100644
+index 7461f50..1334029 100644
--- a/arch/x86/kernel/ptrace.c
+++ b/arch/x86/kernel/ptrace.c
@@ -184,14 +184,13 @@ unsigned long kernel_stack_pointer(struct pt_regs *regs)
@@ -25077,7 +24893,7 @@ index 29a8120..a50b5ee 100644
struct arch_hw_breakpoint *info;
for (i = 0; i < HBP_NUM; i++) {
-@@ -856,7 +855,7 @@ long arch_ptrace(struct task_struct *child, long request,
+@@ -822,7 +821,7 @@ long arch_ptrace(struct task_struct *child, long request,
unsigned long addr, unsigned long data)
{
int ret;
@@ -25086,7 +24902,7 @@ index 29a8120..a50b5ee 100644
switch (request) {
/* read the word at location addr in the USER area. */
-@@ -941,14 +940,14 @@ long arch_ptrace(struct task_struct *child, long request,
+@@ -907,14 +906,14 @@ long arch_ptrace(struct task_struct *child, long request,
if ((int) addr < 0)
return -EIO;
ret = do_get_thread_area(child, addr,
@@ -25103,7 +24919,7 @@ index 29a8120..a50b5ee 100644
break;
#endif
-@@ -1326,7 +1325,7 @@ long compat_arch_ptrace(struct task_struct *child, compat_long_t request,
+@@ -1292,7 +1291,7 @@ long compat_arch_ptrace(struct task_struct *child, compat_long_t request,
#ifdef CONFIG_X86_64
@@ -25112,7 +24928,7 @@ index 29a8120..a50b5ee 100644
[REGSET_GENERAL] = {
.core_note_type = NT_PRSTATUS,
.n = sizeof(struct user_regs_struct) / sizeof(long),
-@@ -1367,7 +1366,7 @@ static const struct user_regset_view user_x86_64_view = {
+@@ -1333,7 +1332,7 @@ static const struct user_regset_view user_x86_64_view = {
#endif /* CONFIG_X86_64 */
#if defined CONFIG_X86_32 || defined CONFIG_IA32_EMULATION
@@ -25121,7 +24937,7 @@ index 29a8120..a50b5ee 100644
[REGSET_GENERAL] = {
.core_note_type = NT_PRSTATUS,
.n = sizeof(struct user_regs_struct32) / sizeof(u32),
-@@ -1420,7 +1419,7 @@ static const struct user_regset_view user_x86_32_view = {
+@@ -1386,7 +1385,7 @@ static const struct user_regset_view user_x86_32_view = {
*/
u64 xstate_fx_sw_bytes[USER_XSTATE_FX_SW_WORDS];
@@ -25130,7 +24946,7 @@ index 29a8120..a50b5ee 100644
{
#ifdef CONFIG_X86_64
x86_64_regsets[REGSET_XSTATE].n = size / sizeof(u64);
-@@ -1455,7 +1454,7 @@ static void fill_sigtrap_info(struct task_struct *tsk,
+@@ -1421,7 +1420,7 @@ static void fill_sigtrap_info(struct task_struct *tsk,
memset(info, 0, sizeof(*info));
info->si_signo = SIGTRAP;
info->si_code = si_code;
@@ -25139,7 +24955,7 @@ index 29a8120..a50b5ee 100644
}
void user_single_step_siginfo(struct task_struct *tsk,
-@@ -1484,6 +1483,10 @@ void send_sigtrap(struct task_struct *tsk, struct pt_regs *regs,
+@@ -1450,6 +1449,10 @@ void send_sigtrap(struct task_struct *tsk, struct pt_regs *regs,
# define IS_IA32 0
#endif
@@ -25150,7 +24966,7 @@ index 29a8120..a50b5ee 100644
/*
* We must return the syscall number to actually look up in the table.
* This can be -1L to skip running any syscall at all.
-@@ -1494,6 +1497,11 @@ long syscall_trace_enter(struct pt_regs *regs)
+@@ -1460,6 +1463,11 @@ long syscall_trace_enter(struct pt_regs *regs)
user_exit();
@@ -25162,7 +24978,7 @@ index 29a8120..a50b5ee 100644
/*
* If we stepped into a sysenter/syscall insn, it trapped in
* kernel mode; do_debug() cleared TF and set TIF_SINGLESTEP.
-@@ -1549,6 +1557,11 @@ void syscall_trace_leave(struct pt_regs *regs)
+@@ -1515,6 +1523,11 @@ void syscall_trace_leave(struct pt_regs *regs)
*/
user_exit();
@@ -25175,7 +24991,7 @@ index 29a8120..a50b5ee 100644
if (unlikely(test_thread_flag(TIF_SYSCALL_TRACEPOINT)))
diff --git a/arch/x86/kernel/pvclock.c b/arch/x86/kernel/pvclock.c
-index 2cb9470..ff1fd80 100644
+index a16bae3..1f65f25 100644
--- a/arch/x86/kernel/pvclock.c
+++ b/arch/x86/kernel/pvclock.c
@@ -43,11 +43,11 @@ unsigned long pvclock_tsc_khz(struct pvclock_vcpu_time_info *src)
@@ -25207,19 +25023,10 @@ index 2cb9470..ff1fd80 100644
return ret;
diff --git a/arch/x86/kernel/reboot.c b/arch/x86/kernel/reboot.c
-index 90fd119..61aa5d2 100644
+index 618ce26..ec7e21c 100644
--- a/arch/x86/kernel/reboot.c
+++ b/arch/x86/kernel/reboot.c
-@@ -36,7 +36,7 @@ void (*pm_power_off)(void);
- EXPORT_SYMBOL(pm_power_off);
-
- static const struct desc_ptr no_idt = {};
--static int reboot_mode;
-+static unsigned short reboot_mode;
- enum reboot_type reboot_type = BOOT_ACPI;
- int reboot_force;
-
-@@ -157,6 +157,11 @@ static int __init set_bios_reboot(const struct dmi_system_id *d)
+@@ -68,6 +68,11 @@ static int __init set_bios_reboot(const struct dmi_system_id *d)
void __noreturn machine_real_restart(unsigned int type)
{
@@ -25231,7 +25038,7 @@ index 90fd119..61aa5d2 100644
local_irq_disable();
/*
-@@ -184,7 +189,29 @@ void __noreturn machine_real_restart(unsigned int type)
+@@ -95,7 +100,29 @@ void __noreturn machine_real_restart(unsigned int type)
/* Jump to the identity-mapped low memory code */
#ifdef CONFIG_X86_32
@@ -25262,7 +25069,7 @@ index 90fd119..61aa5d2 100644
"rm" (real_mode_header->machine_real_restart_asm),
"a" (type));
#else
-@@ -547,7 +574,7 @@ void __attribute__((weak)) mach_reboot_fixups(void)
+@@ -466,7 +493,7 @@ void __attribute__((weak)) mach_reboot_fixups(void)
* try to force a triple fault and then cycle between hitting the keyboard
* controller and doing that
*/
@@ -25271,7 +25078,7 @@ index 90fd119..61aa5d2 100644
{
int i;
int attempt = 0;
-@@ -670,13 +697,13 @@ void native_machine_shutdown(void)
+@@ -575,13 +602,13 @@ void native_machine_shutdown(void)
#endif
}
@@ -25287,7 +25094,7 @@ index 90fd119..61aa5d2 100644
{
pr_notice("machine restart\n");
-@@ -685,7 +712,7 @@ static void native_machine_restart(char *__unused)
+@@ -590,7 +617,7 @@ static void native_machine_restart(char *__unused)
__machine_emergency_restart(0);
}
@@ -25296,7 +25103,7 @@ index 90fd119..61aa5d2 100644
{
/* Stop other cpus and apics */
machine_shutdown();
-@@ -695,7 +722,7 @@ static void native_machine_halt(void)
+@@ -600,7 +627,7 @@ static void native_machine_halt(void)
stop_this_cpu(NULL);
}
@@ -25305,7 +25112,7 @@ index 90fd119..61aa5d2 100644
{
if (pm_power_off) {
if (!reboot_force)
-@@ -704,9 +731,10 @@ static void native_machine_power_off(void)
+@@ -609,9 +636,10 @@ static void native_machine_power_off(void)
}
/* A fallback in case there is no PM info available */
tboot_shutdown(TB_SHUTDOWN_HALT);
@@ -25331,7 +25138,7 @@ index c8e41e9..64049ef 100644
/*
* PCI ids solely used for fixups_table go here
diff --git a/arch/x86/kernel/relocate_kernel_64.S b/arch/x86/kernel/relocate_kernel_64.S
-index f2bb9c9..bed145d7 100644
+index 3fd2c69..16ef367 100644
--- a/arch/x86/kernel/relocate_kernel_64.S
+++ b/arch/x86/kernel/relocate_kernel_64.S
@@ -11,6 +11,7 @@
@@ -25342,16 +25149,26 @@ index f2bb9c9..bed145d7 100644
/*
* Must be relocatable PIC code callable as a C function
-@@ -167,6 +168,7 @@ identity_mapped:
- xorq %r14, %r14
- xorq %r15, %r15
+@@ -96,8 +97,7 @@ relocate_kernel:
+
+ /* jump to identity mapped page */
+ addq $(identity_mapped - relocate_kernel), %r8
+- pushq %r8
+- ret
++ jmp *%r8
+
+ identity_mapped:
+ /* set return address to 0 if not preserving context */
+@@ -167,6 +167,7 @@ identity_mapped:
+ xorl %r14d, %r14d
+ xorl %r15d, %r15d
+ pax_force_retaddr 0, 1
ret
1:
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
-index 91964c6..bbab1da 100644
+index f0de629..a4978a8f 100644
--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@ -110,6 +110,7 @@
@@ -25367,14 +25184,14 @@ index 91964c6..bbab1da 100644
-#if !defined(CONFIG_X86_PAE) || defined(CONFIG_X86_64)
--unsigned long mmu_cr4_features;
+-__visible unsigned long mmu_cr4_features;
+#ifdef CONFIG_X86_64
-+unsigned long mmu_cr4_features __read_only = X86_CR4_PSE | X86_CR4_PAE | X86_CR4_PGE;
++__visible unsigned long mmu_cr4_features __read_only = X86_CR4_PSE | X86_CR4_PAE | X86_CR4_PGE;
+#elif defined(CONFIG_X86_PAE)
-+unsigned long mmu_cr4_features __read_only = X86_CR4_PAE;
++__visible unsigned long mmu_cr4_features __read_only = X86_CR4_PAE;
#else
--unsigned long mmu_cr4_features = X86_CR4_PAE;
-+unsigned long mmu_cr4_features __read_only;
+-__visible unsigned long mmu_cr4_features = X86_CR4_PAE;
++__visible unsigned long mmu_cr4_features __read_only;
#endif
+void set_in_cr4(unsigned long mask)
@@ -25416,15 +25233,6 @@ index 91964c6..bbab1da 100644
/* Boot loader ID and version as integers, for the benefit of proc_dointvec */
int bootloader_type, bootloader_version;
-@@ -442,7 +481,7 @@ static void __init parse_setup_data(void)
-
- switch (data_type) {
- case SETUP_E820_EXT:
-- parse_e820_ext(pa_data, data_len);
-+ parse_e820_ext((struct setup_data __force_kernel *)pa_data, data_len);
- break;
- case SETUP_DTB:
- add_dtb(pa_data);
@@ -768,7 +807,7 @@ static void __init trim_bios_range(void)
* area (640->1Mb) as ram even though it is not.
* take them out.
@@ -25553,10 +25361,10 @@ index 5cdff03..80fa283 100644
* Up to this point, the boot CPU has been using .init.data
* area. Reload any changed state for the boot CPU.
diff --git a/arch/x86/kernel/signal.c b/arch/x86/kernel/signal.c
-index 087ab2a..f798055 100644
+index 9e5de68..16c53cb 100644
--- a/arch/x86/kernel/signal.c
+++ b/arch/x86/kernel/signal.c
-@@ -196,7 +196,7 @@ static unsigned long align_sigframe(unsigned long sp)
+@@ -190,7 +190,7 @@ static unsigned long align_sigframe(unsigned long sp)
* Align the stack pointer according to the i386 ABI,
* i.e. so that on function entry ((sp + 4) & 15) == 0.
*/
@@ -25565,7 +25373,7 @@ index 087ab2a..f798055 100644
#else /* !CONFIG_X86_32 */
sp = round_down(sp, 16) - 8;
#endif
-@@ -304,9 +304,9 @@ __setup_frame(int sig, struct ksignal *ksig, sigset_t *set,
+@@ -298,9 +298,9 @@ __setup_frame(int sig, struct ksignal *ksig, sigset_t *set,
}
if (current->mm->context.vdso)
@@ -25577,7 +25385,7 @@ index 087ab2a..f798055 100644
if (ksig->ka.sa.sa_flags & SA_RESTORER)
restorer = ksig->ka.sa.sa_restorer;
-@@ -320,7 +320,7 @@ __setup_frame(int sig, struct ksignal *ksig, sigset_t *set,
+@@ -314,7 +314,7 @@ __setup_frame(int sig, struct ksignal *ksig, sigset_t *set,
* reasons and because gdb uses it as a signature to notice
* signal handler stack frames.
*/
@@ -25586,7 +25394,7 @@ index 087ab2a..f798055 100644
if (err)
return -EFAULT;
-@@ -367,7 +367,10 @@ static int __setup_rt_frame(int sig, struct ksignal *ksig,
+@@ -361,7 +361,10 @@ static int __setup_rt_frame(int sig, struct ksignal *ksig,
save_altstack_ex(&frame->uc.uc_stack, regs->sp);
/* Set up to return from userspace. */
@@ -25598,7 +25406,7 @@ index 087ab2a..f798055 100644
if (ksig->ka.sa.sa_flags & SA_RESTORER)
restorer = ksig->ka.sa.sa_restorer;
put_user_ex(restorer, &frame->pretcode);
-@@ -379,7 +382,7 @@ static int __setup_rt_frame(int sig, struct ksignal *ksig,
+@@ -373,7 +376,7 @@ static int __setup_rt_frame(int sig, struct ksignal *ksig,
* reasons and because gdb uses it as a signature to notice
* signal handler stack frames.
*/
@@ -25607,7 +25415,7 @@ index 087ab2a..f798055 100644
} put_user_catch(err);
err |= copy_siginfo_to_user(&frame->info, &ksig->info);
-@@ -615,7 +618,12 @@ setup_rt_frame(struct ksignal *ksig, struct pt_regs *regs)
+@@ -609,7 +612,12 @@ setup_rt_frame(struct ksignal *ksig, struct pt_regs *regs)
{
int usig = signr_convert(ksig->sig);
sigset_t *set = sigmask_to_save();
@@ -25621,7 +25429,7 @@ index 087ab2a..f798055 100644
/* Set up the stack frame */
if (is_ia32_frame()) {
-@@ -626,7 +634,7 @@ setup_rt_frame(struct ksignal *ksig, struct pt_regs *regs)
+@@ -620,7 +628,7 @@ setup_rt_frame(struct ksignal *ksig, struct pt_regs *regs)
} else if (is_x32_frame()) {
return x32_setup_rt_frame(ksig, cset, regs);
} else {
@@ -25631,10 +25439,10 @@ index 087ab2a..f798055 100644
}
diff --git a/arch/x86/kernel/smp.c b/arch/x86/kernel/smp.c
-index 48d2b7d..90d328a 100644
+index 7c3a5a6..f0a8961 100644
--- a/arch/x86/kernel/smp.c
+++ b/arch/x86/kernel/smp.c
-@@ -285,7 +285,7 @@ static int __init nonmi_ipi_setup(char *str)
+@@ -341,7 +341,7 @@ static int __init nonmi_ipi_setup(char *str)
__setup("nonmi_ipi", nonmi_ipi_setup);
@@ -25644,32 +25452,35 @@ index 48d2b7d..90d328a 100644
.smp_prepare_cpus = native_smp_prepare_cpus,
.smp_cpus_done = native_smp_cpus_done,
diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c
-index bfd348e..914f323 100644
+index 6cacab6..750636a 100644
--- a/arch/x86/kernel/smpboot.c
+++ b/arch/x86/kernel/smpboot.c
-@@ -251,14 +251,18 @@ notrace static void __cpuinit start_secondary(void *unused)
+@@ -251,14 +251,18 @@ static void notrace start_secondary(void *unused)
enable_start_cpu0 = 0;
-#ifdef CONFIG_X86_32
-+ /* otherwise gcc will move up smp_processor_id before the cpu_init */
-+ barrier();
+- /* switch away from the initial page table */
+- load_cr3(swapper_pg_dir);
+- __flush_tlb_all();
+-#endif
+-
+ /* otherwise gcc will move up smp_processor_id before the cpu_init */
+ barrier();
+
- /* switch away from the initial page table */
++ /* switch away from the initial page table */
+#ifdef CONFIG_PAX_PER_CPU_PGD
+ load_cr3(get_cpu_pgd(smp_processor_id(), kernel));
+ __flush_tlb_all();
+#elif defined(CONFIG_X86_32)
- load_cr3(swapper_pg_dir);
- __flush_tlb_all();
- #endif
-
-- /* otherwise gcc will move up smp_processor_id before the cpu_init */
-- barrier();
++ load_cr3(swapper_pg_dir);
++ __flush_tlb_all();
++#endif
++
/*
* Check TSC synchronization with the BP:
*/
-@@ -748,6 +752,7 @@ static int __cpuinit do_boot_cpu(int apicid, int cpu, struct task_struct *idle)
+@@ -749,6 +753,7 @@ static int do_boot_cpu(int apicid, int cpu, struct task_struct *idle)
idle->thread.sp = (unsigned long) (((struct pt_regs *)
(THREAD_SIZE + task_stack_page(idle))) - 1);
per_cpu(current_task, cpu) = idle;
@@ -25677,7 +25488,7 @@ index bfd348e..914f323 100644
#ifdef CONFIG_X86_32
/* Stack for startup_32 can be just as for start_secondary onwards */
-@@ -755,11 +760,13 @@ static int __cpuinit do_boot_cpu(int apicid, int cpu, struct task_struct *idle)
+@@ -756,11 +761,13 @@ static int do_boot_cpu(int apicid, int cpu, struct task_struct *idle)
#else
clear_tsk_thread_flag(idle, TIF_FORK);
initial_gs = per_cpu_offset(cpu);
@@ -25694,7 +25505,7 @@ index bfd348e..914f323 100644
initial_code = (unsigned long)start_secondary;
stack_start = idle->thread.sp;
-@@ -908,6 +915,15 @@ int __cpuinit native_cpu_up(unsigned int cpu, struct task_struct *tidle)
+@@ -909,6 +916,15 @@ int native_cpu_up(unsigned int cpu, struct task_struct *tidle)
/* the FPU context is blank, nobody can own it */
__cpu_disable_lazy_restore(cpu);
@@ -26037,10 +25848,10 @@ index 30277e2..5664a29 100644
if (!(addr & ~PAGE_MASK))
return addr;
diff --git a/arch/x86/kernel/tboot.c b/arch/x86/kernel/tboot.c
-index f84fe00..f41d9f1 100644
+index 91a4496..1730bff 100644
--- a/arch/x86/kernel/tboot.c
+++ b/arch/x86/kernel/tboot.c
-@@ -220,7 +220,7 @@ static int tboot_setup_sleep(void)
+@@ -221,7 +221,7 @@ static int tboot_setup_sleep(void)
void tboot_shutdown(u32 shutdown_type)
{
@@ -26049,7 +25860,7 @@ index f84fe00..f41d9f1 100644
if (!tboot_enabled())
return;
-@@ -242,7 +242,7 @@ void tboot_shutdown(u32 shutdown_type)
+@@ -243,7 +243,7 @@ void tboot_shutdown(u32 shutdown_type)
switch_to_tboot_pt();
@@ -26058,8 +25869,8 @@ index f84fe00..f41d9f1 100644
shutdown();
/* should not reach here */
-@@ -300,7 +300,7 @@ static int tboot_sleep(u8 sleep_state, u32 pm1a_control, u32 pm1b_control)
- return 0;
+@@ -310,7 +310,7 @@ static int tboot_extended_sleep(u8 sleep_state, u32 val_a, u32 val_b)
+ return -ENODEV;
}
-static atomic_t ap_wfs_count;
@@ -26067,7 +25878,7 @@ index f84fe00..f41d9f1 100644
static int tboot_wait_for_aps(int num_aps)
{
-@@ -324,16 +324,16 @@ static int __cpuinit tboot_cpu_callback(struct notifier_block *nfb,
+@@ -334,9 +334,9 @@ static int tboot_cpu_callback(struct notifier_block *nfb, unsigned long action,
{
switch (action) {
case CPU_DYING:
@@ -26079,15 +25890,7 @@ index f84fe00..f41d9f1 100644
return NOTIFY_BAD;
break;
}
- return NOTIFY_OK;
- }
-
--static struct notifier_block tboot_cpu_notifier __cpuinitdata =
-+static struct notifier_block tboot_cpu_notifier =
- {
- .notifier_call = tboot_cpu_callback,
- };
-@@ -345,7 +345,7 @@ static __init int tboot_late_init(void)
+@@ -422,7 +422,7 @@ static __init int tboot_late_init(void)
tboot_create_trampoline();
@@ -26095,7 +25898,7 @@ index f84fe00..f41d9f1 100644
+ atomic_set_unchecked(&ap_wfs_count, 0);
register_hotcpu_notifier(&tboot_cpu_notifier);
- acpi_os_set_prepare_sleep(&tboot_sleep);
+ #ifdef CONFIG_DEBUG_FS
diff --git a/arch/x86/kernel/time.c b/arch/x86/kernel/time.c
index 24d3c91..d06b473 100644
--- a/arch/x86/kernel/time.c
@@ -26155,24 +25958,47 @@ index f7fec09..9991981 100644
return -EFAULT;
else
info = infobuf;
+diff --git a/arch/x86/kernel/tracepoint.c b/arch/x86/kernel/tracepoint.c
+index 1c113db..287b42e 100644
+--- a/arch/x86/kernel/tracepoint.c
++++ b/arch/x86/kernel/tracepoint.c
+@@ -9,11 +9,11 @@
+ #include <linux/atomic.h>
+
+ atomic_t trace_idt_ctr = ATOMIC_INIT(0);
+-struct desc_ptr trace_idt_descr = { NR_VECTORS * 16 - 1,
++const struct desc_ptr trace_idt_descr = { NR_VECTORS * 16 - 1,
+ (unsigned long) trace_idt_table };
+
+ /* No need to be aligned, but done to keep all IDTs defined the same way. */
+-gate_desc trace_idt_table[NR_VECTORS] __page_aligned_bss;
++gate_desc trace_idt_table[NR_VECTORS] __page_aligned_rodata;
+
+ static int trace_irq_vector_refcount;
+ static DEFINE_MUTEX(irq_vector_mutex);
diff --git a/arch/x86/kernel/traps.c b/arch/x86/kernel/traps.c
-index 772e2a8..bad5bf6 100644
+index 8c8093b..c93f581 100644
--- a/arch/x86/kernel/traps.c
+++ b/arch/x86/kernel/traps.c
-@@ -68,12 +68,6 @@
- #include <asm/setup.h>
+@@ -66,7 +66,7 @@
+ #include <asm/proto.h>
- asmlinkage int system_call(void);
--
--/*
-- * The IDT has to be page-aligned to simplify the Pentium
-- * F0 0F bug workaround.
-- */
--gate_desc idt_table[NR_VECTORS] __page_aligned_data = { { { { 0, 0 } } }, };
+ /* No need to be aligned, but done to keep all IDTs defined the same way. */
+-gate_desc debug_idt_table[NR_VECTORS] __page_aligned_bss;
++gate_desc debug_idt_table[NR_VECTORS] __page_aligned_rodata;
+ #else
+ #include <asm/processor-flags.h>
+ #include <asm/setup.h>
+@@ -75,7 +75,7 @@ asmlinkage int system_call(void);
#endif
+ /* Must be page-aligned because the real IDT is used in a fixmap. */
+-gate_desc idt_table[NR_VECTORS] __page_aligned_bss;
++gate_desc idt_table[NR_VECTORS] __page_aligned_rodata;
+
DECLARE_BITMAP(used_vectors, NR_VECTORS);
-@@ -106,11 +100,11 @@ static inline void preempt_conditional_cli(struct pt_regs *regs)
+ EXPORT_SYMBOL_GPL(used_vectors);
+@@ -107,11 +107,11 @@ static inline void preempt_conditional_cli(struct pt_regs *regs)
}
static int __kprobes
@@ -26186,7 +26012,7 @@ index 772e2a8..bad5bf6 100644
/*
* Traps 0, 1, 3, 4, and 5 should be forwarded to vm86.
* On nmi (interrupt 2), do_trap should not be called.
-@@ -123,12 +117,24 @@ do_trap_no_signal(struct task_struct *tsk, int trapnr, char *str,
+@@ -124,12 +124,24 @@ do_trap_no_signal(struct task_struct *tsk, int trapnr, char *str,
return -1;
}
#endif
@@ -26212,7 +26038,7 @@ index 772e2a8..bad5bf6 100644
return 0;
}
-@@ -136,7 +142,7 @@ do_trap_no_signal(struct task_struct *tsk, int trapnr, char *str,
+@@ -137,7 +149,7 @@ do_trap_no_signal(struct task_struct *tsk, int trapnr, char *str,
}
static void __kprobes
@@ -26221,7 +26047,7 @@ index 772e2a8..bad5bf6 100644
long error_code, siginfo_t *info)
{
struct task_struct *tsk = current;
-@@ -160,7 +166,7 @@ do_trap(int trapnr, int signr, char *str, struct pt_regs *regs,
+@@ -161,7 +173,7 @@ do_trap(int trapnr, int signr, char *str, struct pt_regs *regs,
if (show_unhandled_signals && unhandled_signal(tsk, signr) &&
printk_ratelimit()) {
pr_info("%s[%d] trap %s ip:%lx sp:%lx error:%lx",
@@ -26230,7 +26056,7 @@ index 772e2a8..bad5bf6 100644
regs->ip, regs->sp, error_code);
print_vma_addr(" in ", regs->ip);
pr_cont("\n");
-@@ -273,7 +279,7 @@ do_general_protection(struct pt_regs *regs, long error_code)
+@@ -277,7 +289,7 @@ do_general_protection(struct pt_regs *regs, long error_code)
conditional_sti(regs);
#ifdef CONFIG_X86_32
@@ -26239,7 +26065,7 @@ index 772e2a8..bad5bf6 100644
local_irq_enable();
handle_vm86_fault((struct kernel_vm86_regs *) regs, error_code);
goto exit;
-@@ -281,18 +287,42 @@ do_general_protection(struct pt_regs *regs, long error_code)
+@@ -285,18 +297,42 @@ do_general_protection(struct pt_regs *regs, long error_code)
#endif
tsk = current;
@@ -26284,7 +26110,7 @@ index 772e2a8..bad5bf6 100644
tsk->thread.error_code = error_code;
tsk->thread.trap_nr = X86_TRAP_GP;
-@@ -450,7 +480,7 @@ dotraplinkage void __kprobes do_debug(struct pt_regs *regs, long error_code)
+@@ -457,7 +493,7 @@ dotraplinkage void __kprobes do_debug(struct pt_regs *regs, long error_code)
/* It's safe to allow irq's after DR6 has been saved */
preempt_conditional_sti(regs);
@@ -26293,7 +26119,7 @@ index 772e2a8..bad5bf6 100644
handle_vm86_trap((struct kernel_vm86_regs *) regs, error_code,
X86_TRAP_DB);
preempt_conditional_cli(regs);
-@@ -465,7 +495,7 @@ dotraplinkage void __kprobes do_debug(struct pt_regs *regs, long error_code)
+@@ -472,7 +508,7 @@ dotraplinkage void __kprobes do_debug(struct pt_regs *regs, long error_code)
* We already checked v86 mode above, so we can check for kernel mode
* by just checking the CPL of CS.
*/
@@ -26302,7 +26128,7 @@ index 772e2a8..bad5bf6 100644
tsk->thread.debugreg6 &= ~DR_STEP;
set_tsk_thread_flag(tsk, TIF_SINGLESTEP);
regs->flags &= ~X86_EFLAGS_TF;
-@@ -497,7 +527,7 @@ void math_error(struct pt_regs *regs, int error_code, int trapnr)
+@@ -504,7 +540,7 @@ void math_error(struct pt_regs *regs, int error_code, int trapnr)
return;
conditional_sti(regs);
@@ -26414,7 +26240,7 @@ index e8edcf5..27f9344 100644
goto cannot_handle;
if ((segoffs >> 16) == BIOSSEG)
diff --git a/arch/x86/kernel/vmlinux.lds.S b/arch/x86/kernel/vmlinux.lds.S
-index 10c4f30..57377c2 100644
+index 10c4f30..65408b9 100644
--- a/arch/x86/kernel/vmlinux.lds.S
+++ b/arch/x86/kernel/vmlinux.lds.S
@@ -26,6 +26,13 @@
@@ -26483,7 +26309,7 @@ index 10c4f30..57377c2 100644
HEAD_TEXT
. = ALIGN(8);
_stext = .;
-@@ -104,13 +124,48 @@ SECTIONS
+@@ -104,13 +124,47 @@ SECTIONS
IRQENTRY_TEXT
*(.fixup)
*(.gnu.warning)
@@ -26519,7 +26345,6 @@ index 10c4f30..57377c2 100644
+#ifdef CONFIG_X86_32
+ . = ALIGN(PAGE_SIZE);
+ .rodata.page_aligned : AT(ADDR(.rodata.page_aligned) - LOAD_OFFSET) {
-+ *(.idt)
+ . = ALIGN(PAGE_SIZE);
+ *(.empty_zero_page)
+ *(.initial_pg_fixmap)
@@ -26536,7 +26361,7 @@ index 10c4f30..57377c2 100644
#if defined(CONFIG_DEBUG_RODATA)
/* .text should occupy whole number of pages */
-@@ -122,16 +177,20 @@ SECTIONS
+@@ -122,16 +176,20 @@ SECTIONS
/* Data */
.data : AT(ADDR(.data) - LOAD_OFFSET) {
@@ -26560,7 +26385,7 @@ index 10c4f30..57377c2 100644
PAGE_ALIGNED_DATA(PAGE_SIZE)
-@@ -172,12 +231,19 @@ SECTIONS
+@@ -172,12 +230,19 @@ SECTIONS
#endif /* CONFIG_X86_64 */
/* Init code and data - will be freed after init */
@@ -26583,7 +26408,7 @@ index 10c4f30..57377c2 100644
/*
* percpu offsets are zero-based on SMP. PERCPU_VADDR() changes the
* output PHDR, so the next output section - .init.text - should
-@@ -186,12 +252,27 @@ SECTIONS
+@@ -186,12 +251,27 @@ SECTIONS
PERCPU_VADDR(INTERNODE_CACHE_BYTES, 0, :percpu)
#endif
@@ -26616,7 +26441,7 @@ index 10c4f30..57377c2 100644
.x86_cpu_dev.init : AT(ADDR(.x86_cpu_dev.init) - LOAD_OFFSET) {
__x86_cpu_dev_start = .;
-@@ -253,19 +334,12 @@ SECTIONS
+@@ -253,19 +333,12 @@ SECTIONS
}
. = ALIGN(8);
@@ -26637,7 +26462,7 @@ index 10c4f30..57377c2 100644
PERCPU_SECTION(INTERNODE_CACHE_BYTES)
#endif
-@@ -284,16 +358,10 @@ SECTIONS
+@@ -284,16 +357,10 @@ SECTIONS
.smp_locks : AT(ADDR(.smp_locks) - LOAD_OFFSET) {
__smp_locks = .;
*(.smp_locks)
@@ -26655,7 +26480,7 @@ index 10c4f30..57377c2 100644
/* BSS */
. = ALIGN(PAGE_SIZE);
.bss : AT(ADDR(.bss) - LOAD_OFFSET) {
-@@ -309,6 +377,7 @@ SECTIONS
+@@ -309,6 +376,7 @@ SECTIONS
__brk_base = .;
. += 64 * 1024; /* 64k alignment slop space */
*(.brk_reservation) /* areas brk users have reserved */
@@ -26663,7 +26488,7 @@ index 10c4f30..57377c2 100644
__brk_limit = .;
}
-@@ -335,13 +404,12 @@ SECTIONS
+@@ -335,13 +403,12 @@ SECTIONS
* for the boot processor.
*/
#define INIT_PER_CPU(x) init_per_cpu__##x = x + __per_cpu_load
@@ -26679,7 +26504,7 @@ index 10c4f30..57377c2 100644
#ifdef CONFIG_SMP
diff --git a/arch/x86/kernel/vsyscall_64.c b/arch/x86/kernel/vsyscall_64.c
-index 9a907a6..f83f921 100644
+index 1f96f93..d5c8f7a 100644
--- a/arch/x86/kernel/vsyscall_64.c
+++ b/arch/x86/kernel/vsyscall_64.c
@@ -56,15 +56,13 @@
@@ -26743,19 +26568,10 @@ index b014d94..e775258 100644
+EXPORT_SYMBOL(cpu_pgd);
+#endif
diff --git a/arch/x86/kernel/x86_init.c b/arch/x86/kernel/x86_init.c
-index 45a14db..075bb9b 100644
+index 8ce0072..431a0e7 100644
--- a/arch/x86/kernel/x86_init.c
+++ b/arch/x86/kernel/x86_init.c
-@@ -85,7 +85,7 @@ struct x86_init_ops x86_init __initdata = {
- },
- };
-
--struct x86_cpuinit_ops x86_cpuinit __cpuinitdata = {
-+struct x86_cpuinit_ops x86_cpuinit __cpuinitconst = {
- .early_percpu_clock_init = x86_init_noop,
- .setup_percpu_clockev = setup_secondary_APIC_clock,
- };
-@@ -93,7 +93,7 @@ struct x86_cpuinit_ops x86_cpuinit __cpuinitdata = {
+@@ -93,7 +93,7 @@ struct x86_cpuinit_ops x86_cpuinit = {
static void default_nmi_init(void) { };
static int default_i8042_detect(void) { return 1; };
@@ -26764,18 +26580,18 @@ index 45a14db..075bb9b 100644
.calibrate_tsc = native_calibrate_tsc,
.get_wallclock = mach_get_cmos_time,
.set_wallclock = mach_set_rtc_mmss,
-@@ -107,7 +107,7 @@ struct x86_platform_ops x86_platform = {
- };
-
+@@ -109,7 +109,7 @@ struct x86_platform_ops x86_platform = {
EXPORT_SYMBOL_GPL(x86_platform);
+
+ #if defined(CONFIG_PCI_MSI)
-struct x86_msi_ops x86_msi = {
+struct x86_msi_ops x86_msi __read_only = {
.setup_msi_irqs = native_setup_msi_irqs,
.compose_msi_msg = native_compose_msi_msg,
.teardown_msi_irq = native_teardown_msi_irq,
-@@ -116,7 +116,7 @@ struct x86_msi_ops x86_msi = {
- .setup_hpet_msi = default_setup_hpet_msi,
- };
+@@ -140,7 +140,7 @@ void arch_restore_msi_irqs(struct pci_dev *dev, int irq)
+ }
+ #endif
-struct x86_io_apic_ops x86_io_apic_ops = {
+struct x86_io_apic_ops x86_io_apic_ops __read_only = {
@@ -26783,7 +26599,7 @@ index 45a14db..075bb9b 100644
.read = native_io_apic_read,
.write = native_io_apic_write,
diff --git a/arch/x86/kernel/xsave.c b/arch/x86/kernel/xsave.c
-index ada87a3..afea76d 100644
+index 422fd82..c3687ca 100644
--- a/arch/x86/kernel/xsave.c
+++ b/arch/x86/kernel/xsave.c
@@ -199,6 +199,7 @@ static inline int save_user_xstate(struct xsave_struct __user *buf)
@@ -26803,7 +26619,7 @@ index ada87a3..afea76d 100644
if ((unsigned long)buf % 64 || fx_only) {
u64 init_bv = pcntxt_mask & ~XSTATE_FPSSE;
diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c
-index a20ecb5..d0e2194 100644
+index b110fe6..d9c19f2 100644
--- a/arch/x86/kvm/cpuid.c
+++ b/arch/x86/kvm/cpuid.c
@@ -124,15 +124,20 @@ int kvm_vcpu_ioctl_set_cpuid2(struct kvm_vcpu *vcpu,
@@ -26853,37 +26669,8 @@ index a20ecb5..d0e2194 100644
return 0;
out:
-diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c
-index 5484d54..d5f90d0 100644
---- a/arch/x86/kvm/emulate.c
-+++ b/arch/x86/kvm/emulate.c
-@@ -329,6 +329,7 @@ static void invalidate_registers(struct x86_emulate_ctxt *ctxt)
-
- #define ____emulate_2op(ctxt, _op, _x, _y, _suffix, _dsttype) \
- do { \
-+ unsigned long _tmp; \
- __asm__ __volatile__ ( \
- _PRE_EFLAGS("0", "4", "2") \
- _op _suffix " %"_x"3,%1; " \
-@@ -343,8 +344,6 @@ static void invalidate_registers(struct x86_emulate_ctxt *ctxt)
- /* Raw emulation: instruction has two explicit operands. */
- #define __emulate_2op_nobyte(ctxt,_op,_wx,_wy,_lx,_ly,_qx,_qy) \
- do { \
-- unsigned long _tmp; \
-- \
- switch ((ctxt)->dst.bytes) { \
- case 2: \
- ____emulate_2op(ctxt,_op,_wx,_wy,"w",u16); \
-@@ -360,7 +359,6 @@ static void invalidate_registers(struct x86_emulate_ctxt *ctxt)
-
- #define __emulate_2op(ctxt,_op,_bx,_by,_wx,_wy,_lx,_ly,_qx,_qy) \
- do { \
-- unsigned long _tmp; \
- switch ((ctxt)->dst.bytes) { \
- case 1: \
- ____emulate_2op(ctxt,_op,_bx,_by,"b",u8); \
diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c
-index 0eee2c8..94a32c3 100644
+index 5439117..d08f3d4 100644
--- a/arch/x86/kvm/lapic.c
+++ b/arch/x86/kvm/lapic.c
@@ -55,7 +55,7 @@
@@ -26896,10 +26683,10 @@ index 0eee2c8..94a32c3 100644
#define APIC_LVT_NUM 6
/* 14 is the version for Xeon and Pentium 8.4.8*/
diff --git a/arch/x86/kvm/paging_tmpl.h b/arch/x86/kvm/paging_tmpl.h
-index da20860..d19fdf5 100644
+index ad75d77..a679d32 100644
--- a/arch/x86/kvm/paging_tmpl.h
+++ b/arch/x86/kvm/paging_tmpl.h
-@@ -208,7 +208,7 @@ retry_walk:
+@@ -331,7 +331,7 @@ retry_walk:
if (unlikely(kvm_is_error_hva(host_addr)))
goto error;
@@ -26909,10 +26696,10 @@ index da20860..d19fdf5 100644
goto error;
walker->ptep_user[walker->level - 1] = ptep_user;
diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
-index a14a6ea..dc86cf0 100644
+index c0bc803..6837a50 100644
--- a/arch/x86/kvm/svm.c
+++ b/arch/x86/kvm/svm.c
-@@ -3493,7 +3493,11 @@ static void reload_tss(struct kvm_vcpu *vcpu)
+@@ -3501,7 +3501,11 @@ static void reload_tss(struct kvm_vcpu *vcpu)
int cpu = raw_smp_processor_id();
struct svm_cpu_data *sd = per_cpu(svm_data, cpu);
@@ -26924,7 +26711,7 @@ index a14a6ea..dc86cf0 100644
load_TR_desc();
}
-@@ -3894,6 +3898,10 @@ static void svm_vcpu_run(struct kvm_vcpu *vcpu)
+@@ -3902,6 +3906,10 @@ static void svm_vcpu_run(struct kvm_vcpu *vcpu)
#endif
#endif
@@ -26936,10 +26723,10 @@ index a14a6ea..dc86cf0 100644
local_irq_disable();
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
-index 5402c94..c3bdeee 100644
+index 2b2fce1..da76be4 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
-@@ -1311,12 +1311,12 @@ static void vmcs_write64(unsigned long field, u64 value)
+@@ -1316,12 +1316,12 @@ static void vmcs_write64(unsigned long field, u64 value)
#endif
}
@@ -26954,7 +26741,7 @@ index 5402c94..c3bdeee 100644
{
vmcs_writel(field, vmcs_readl(field) | mask);
}
-@@ -1517,7 +1517,11 @@ static void reload_tss(void)
+@@ -1522,7 +1522,11 @@ static void reload_tss(void)
struct desc_struct *descs;
descs = (void *)gdt->address;
@@ -26966,7 +26753,7 @@ index 5402c94..c3bdeee 100644
load_TR_desc();
}
-@@ -1741,6 +1745,10 @@ static void vmx_vcpu_load(struct kvm_vcpu *vcpu, int cpu)
+@@ -1746,6 +1750,10 @@ static void vmx_vcpu_load(struct kvm_vcpu *vcpu, int cpu)
vmcs_writel(HOST_TR_BASE, kvm_read_tr_base()); /* 22.2.4 */
vmcs_writel(HOST_GDTR_BASE, gdt->address); /* 22.2.4 */
@@ -26977,7 +26764,16 @@ index 5402c94..c3bdeee 100644
rdmsrl(MSR_IA32_SYSENTER_ESP, sysenter_esp);
vmcs_writel(HOST_IA32_SYSENTER_ESP, sysenter_esp); /* 22.2.3 */
vmx->loaded_vmcs->cpu = cpu;
-@@ -2935,8 +2943,11 @@ static __init int hardware_setup(void)
+@@ -2037,7 +2045,7 @@ static void setup_msrs(struct vcpu_vmx *vmx)
+ * reads and returns guest's timestamp counter "register"
+ * guest_tsc = host_tsc + tsc_offset -- 21.3
+ */
+-static u64 guest_read_tsc(void)
++static u64 __intentional_overflow(-1) guest_read_tsc(void)
+ {
+ u64 host_tsc, tsc_offset;
+
+@@ -2982,8 +2990,11 @@ static __init int hardware_setup(void)
if (!cpu_has_vmx_flexpriority())
flexpriority_enabled = 0;
@@ -26991,7 +26787,7 @@ index 5402c94..c3bdeee 100644
if (enable_ept && !cpu_has_vmx_ept_2m_page())
kvm_disable_largepages();
-@@ -2947,13 +2958,15 @@ static __init int hardware_setup(void)
+@@ -2994,13 +3005,15 @@ static __init int hardware_setup(void)
if (!cpu_has_vmx_apicv())
enable_apicv = 0;
@@ -27011,7 +26807,7 @@ index 5402c94..c3bdeee 100644
if (nested)
nested_vmx_setup_ctls_msrs();
-@@ -4076,7 +4089,10 @@ static void vmx_set_constant_host_state(struct vcpu_vmx *vmx)
+@@ -4127,7 +4140,10 @@ static void vmx_set_constant_host_state(struct vcpu_vmx *vmx)
vmcs_writel(HOST_CR0, read_cr0() & ~X86_CR0_TS); /* 22.2.3 */
vmcs_writel(HOST_CR4, read_cr4()); /* 22.2.3, 22.2.5 */
@@ -27022,7 +26818,7 @@ index 5402c94..c3bdeee 100644
vmcs_write16(HOST_CS_SELECTOR, __KERNEL_CS); /* 22.2.4 */
#ifdef CONFIG_X86_64
-@@ -4098,7 +4114,7 @@ static void vmx_set_constant_host_state(struct vcpu_vmx *vmx)
+@@ -4149,7 +4165,7 @@ static void vmx_set_constant_host_state(struct vcpu_vmx *vmx)
vmcs_writel(HOST_IDTR_BASE, dt.address); /* 22.2.4 */
vmx->host_idt_base = dt.address;
@@ -27031,7 +26827,7 @@ index 5402c94..c3bdeee 100644
rdmsr(MSR_IA32_SYSENTER_CS, low32, high32);
vmcs_write32(HOST_IA32_SYSENTER_CS, low32);
-@@ -7030,6 +7046,12 @@ static void __noclone vmx_vcpu_run(struct kvm_vcpu *vcpu)
+@@ -7191,6 +7207,12 @@ static void __noclone vmx_vcpu_run(struct kvm_vcpu *vcpu)
"jmp 2f \n\t"
"1: " __ex(ASM_VMX_VMRESUME) "\n\t"
"2: "
@@ -27044,7 +26840,7 @@ index 5402c94..c3bdeee 100644
/* Save guest registers, load host registers, keep flags */
"mov %0, %c[wordsize](%%" _ASM_SP ") \n\t"
"pop %0 \n\t"
-@@ -7082,6 +7104,11 @@ static void __noclone vmx_vcpu_run(struct kvm_vcpu *vcpu)
+@@ -7243,6 +7265,11 @@ static void __noclone vmx_vcpu_run(struct kvm_vcpu *vcpu)
#endif
[cr2]"i"(offsetof(struct vcpu_vmx, vcpu.arch.cr2)),
[wordsize]"i"(sizeof(ulong))
@@ -27056,7 +26852,7 @@ index 5402c94..c3bdeee 100644
: "cc", "memory"
#ifdef CONFIG_X86_64
, "rax", "rbx", "rdi", "rsi"
-@@ -7095,7 +7122,7 @@ static void __noclone vmx_vcpu_run(struct kvm_vcpu *vcpu)
+@@ -7256,7 +7283,7 @@ static void __noclone vmx_vcpu_run(struct kvm_vcpu *vcpu)
if (debugctlmsr)
update_debugctlmsr(debugctlmsr);
@@ -27065,7 +26861,7 @@ index 5402c94..c3bdeee 100644
/*
* The sysexit path does not restore ds/es, so we must set them to
* a reasonable value ourselves.
-@@ -7104,8 +7131,18 @@ static void __noclone vmx_vcpu_run(struct kvm_vcpu *vcpu)
+@@ -7265,8 +7292,18 @@ static void __noclone vmx_vcpu_run(struct kvm_vcpu *vcpu)
* may be executed in interrupt context, which saves and restore segments
* around it, nullifying its effect.
*/
@@ -27087,10 +26883,10 @@ index 5402c94..c3bdeee 100644
vcpu->arch.regs_avail = ~((1 << VCPU_REGS_RIP) | (1 << VCPU_REGS_RSP)
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
-index e8ba99c..ee9d7d9 100644
+index e5ca72a..83d5177 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
-@@ -1725,8 +1725,8 @@ static int xen_hvm_config(struct kvm_vcpu *vcpu, u64 data)
+@@ -1779,8 +1779,8 @@ static int xen_hvm_config(struct kvm_vcpu *vcpu, u64 data)
{
struct kvm *kvm = vcpu->kvm;
int lm = is_long_mode(vcpu);
@@ -27101,7 +26897,7 @@ index e8ba99c..ee9d7d9 100644
u8 blob_size = lm ? kvm->arch.xen_hvm_config.blob_size_64
: kvm->arch.xen_hvm_config.blob_size_32;
u32 page_num = data & ~PAGE_MASK;
-@@ -2609,6 +2609,8 @@ long kvm_arch_dev_ioctl(struct file *filp,
+@@ -2663,6 +2663,8 @@ long kvm_arch_dev_ioctl(struct file *filp,
if (n < msr_list.nmsrs)
goto out;
r = -EFAULT;
@@ -27110,7 +26906,7 @@ index e8ba99c..ee9d7d9 100644
if (copy_to_user(user_msr_list->indices, &msrs_to_save,
num_msrs_to_save * sizeof(u32)))
goto out;
-@@ -5297,7 +5299,7 @@ static struct notifier_block pvclock_gtod_notifier = {
+@@ -5462,7 +5464,7 @@ static struct notifier_block pvclock_gtod_notifier = {
};
#endif
@@ -27118,12 +26914,12 @@ index e8ba99c..ee9d7d9 100644
+int kvm_arch_init(const void *opaque)
{
int r;
- struct kvm_x86_ops *ops = (struct kvm_x86_ops *)opaque;
+ struct kvm_x86_ops *ops = opaque;
diff --git a/arch/x86/lguest/boot.c b/arch/x86/lguest/boot.c
-index 7114c63..a1018fc 100644
+index bdf8532..f63c587 100644
--- a/arch/x86/lguest/boot.c
+++ b/arch/x86/lguest/boot.c
-@@ -1201,9 +1201,10 @@ static __init int early_put_chars(u32 vtermno, const char *buf, int count)
+@@ -1206,9 +1206,10 @@ static __init int early_put_chars(u32 vtermno, const char *buf, int count)
* Rebooting also tells the Host we're finished, but the RESTART flag tells the
* Launcher to reboot us.
*/
@@ -28267,7 +28063,7 @@ index 2419d5f..953ee51 100644
CFI_RESTORE_STATE
diff --git a/arch/x86/lib/csum-wrappers_64.c b/arch/x86/lib/csum-wrappers_64.c
-index 7609e0e..5464390 100644
+index 7609e0e..b449b98 100644
--- a/arch/x86/lib/csum-wrappers_64.c
+++ b/arch/x86/lib/csum-wrappers_64.c
@@ -53,10 +53,12 @@ csum_partial_copy_from_user(const void __user *src, void *dst,
@@ -28291,9 +28087,8 @@ index 7609e0e..5464390 100644
+ pax_open_userland();
stac();
- ret = csum_partial_copy_generic(src, (void __force *)dst,
-- len, isum, NULL, errp);
+ ret = csum_partial_copy_generic(src, (void __force_kernel *)____m(dst),
-+ len, isum, NULL, errp);
+ len, isum, NULL, errp);
clac();
+ pax_close_userland();
return ret;
@@ -29445,7 +29240,7 @@ index a63efd6..ccecad8 100644
ret
CFI_ENDPROC
diff --git a/arch/x86/lib/usercopy_32.c b/arch/x86/lib/usercopy_32.c
-index 3eb18ac..6890bc3 100644
+index 3eb18ac..4b22130 100644
--- a/arch/x86/lib/usercopy_32.c
+++ b/arch/x86/lib/usercopy_32.c
@@ -42,11 +42,13 @@ do { \
@@ -29524,7 +29319,7 @@ index 3eb18ac..6890bc3 100644
" addl $-64, %0\n"
" addl $64, %4\n"
" addl $64, %3\n"
-@@ -149,10 +151,12 @@ __copy_user_intel(void __user *to, const void *from, unsigned long size)
+@@ -149,10 +151,116 @@ __copy_user_intel(void __user *to, const void *from, unsigned long size)
" shrl $2, %0\n"
" andl $3, %%eax\n"
" cld\n"
@@ -29534,13 +29329,55 @@ index 3eb18ac..6890bc3 100644
"37: rep; movsb\n"
"100:\n"
+ __COPYUSER_RESTORE_ES
- ".section .fixup,\"ax\"\n"
- "101: lea 0(%%eax,%0,4),%0\n"
- " jmp 100b\n"
-@@ -202,46 +206,150 @@ __copy_user_intel(void __user *to, const void *from, unsigned long size)
- }
-
- static unsigned long
++ ".section .fixup,\"ax\"\n"
++ "101: lea 0(%%eax,%0,4),%0\n"
++ " jmp 100b\n"
++ ".previous\n"
++ _ASM_EXTABLE(1b,100b)
++ _ASM_EXTABLE(2b,100b)
++ _ASM_EXTABLE(3b,100b)
++ _ASM_EXTABLE(4b,100b)
++ _ASM_EXTABLE(5b,100b)
++ _ASM_EXTABLE(6b,100b)
++ _ASM_EXTABLE(7b,100b)
++ _ASM_EXTABLE(8b,100b)
++ _ASM_EXTABLE(9b,100b)
++ _ASM_EXTABLE(10b,100b)
++ _ASM_EXTABLE(11b,100b)
++ _ASM_EXTABLE(12b,100b)
++ _ASM_EXTABLE(13b,100b)
++ _ASM_EXTABLE(14b,100b)
++ _ASM_EXTABLE(15b,100b)
++ _ASM_EXTABLE(16b,100b)
++ _ASM_EXTABLE(17b,100b)
++ _ASM_EXTABLE(18b,100b)
++ _ASM_EXTABLE(19b,100b)
++ _ASM_EXTABLE(20b,100b)
++ _ASM_EXTABLE(21b,100b)
++ _ASM_EXTABLE(22b,100b)
++ _ASM_EXTABLE(23b,100b)
++ _ASM_EXTABLE(24b,100b)
++ _ASM_EXTABLE(25b,100b)
++ _ASM_EXTABLE(26b,100b)
++ _ASM_EXTABLE(27b,100b)
++ _ASM_EXTABLE(28b,100b)
++ _ASM_EXTABLE(29b,100b)
++ _ASM_EXTABLE(30b,100b)
++ _ASM_EXTABLE(31b,100b)
++ _ASM_EXTABLE(32b,100b)
++ _ASM_EXTABLE(33b,100b)
++ _ASM_EXTABLE(34b,100b)
++ _ASM_EXTABLE(35b,100b)
++ _ASM_EXTABLE(36b,100b)
++ _ASM_EXTABLE(37b,100b)
++ _ASM_EXTABLE(99b,101b)
++ : "=&c"(size), "=&D" (d0), "=&S" (d1)
++ : "1"(to), "2"(from), "0"(size)
++ : "eax", "edx", "memory");
++ return size;
++}
++
++static unsigned long
+__generic_copy_from_user_intel(void *to, const void __user *from, unsigned long size)
+{
+ int d0, d1;
@@ -29596,57 +29433,10 @@ index 3eb18ac..6890bc3 100644
+ "36: movl %%eax, %0\n"
+ "37: rep; "__copyuser_seg" movsb\n"
+ "100:\n"
-+ ".section .fixup,\"ax\"\n"
-+ "101: lea 0(%%eax,%0,4),%0\n"
-+ " jmp 100b\n"
-+ ".previous\n"
-+ _ASM_EXTABLE(1b,100b)
-+ _ASM_EXTABLE(2b,100b)
-+ _ASM_EXTABLE(3b,100b)
-+ _ASM_EXTABLE(4b,100b)
-+ _ASM_EXTABLE(5b,100b)
-+ _ASM_EXTABLE(6b,100b)
-+ _ASM_EXTABLE(7b,100b)
-+ _ASM_EXTABLE(8b,100b)
-+ _ASM_EXTABLE(9b,100b)
-+ _ASM_EXTABLE(10b,100b)
-+ _ASM_EXTABLE(11b,100b)
-+ _ASM_EXTABLE(12b,100b)
-+ _ASM_EXTABLE(13b,100b)
-+ _ASM_EXTABLE(14b,100b)
-+ _ASM_EXTABLE(15b,100b)
-+ _ASM_EXTABLE(16b,100b)
-+ _ASM_EXTABLE(17b,100b)
-+ _ASM_EXTABLE(18b,100b)
-+ _ASM_EXTABLE(19b,100b)
-+ _ASM_EXTABLE(20b,100b)
-+ _ASM_EXTABLE(21b,100b)
-+ _ASM_EXTABLE(22b,100b)
-+ _ASM_EXTABLE(23b,100b)
-+ _ASM_EXTABLE(24b,100b)
-+ _ASM_EXTABLE(25b,100b)
-+ _ASM_EXTABLE(26b,100b)
-+ _ASM_EXTABLE(27b,100b)
-+ _ASM_EXTABLE(28b,100b)
-+ _ASM_EXTABLE(29b,100b)
-+ _ASM_EXTABLE(30b,100b)
-+ _ASM_EXTABLE(31b,100b)
-+ _ASM_EXTABLE(32b,100b)
-+ _ASM_EXTABLE(33b,100b)
-+ _ASM_EXTABLE(34b,100b)
-+ _ASM_EXTABLE(35b,100b)
-+ _ASM_EXTABLE(36b,100b)
-+ _ASM_EXTABLE(37b,100b)
-+ _ASM_EXTABLE(99b,101b)
-+ : "=&c"(size), "=&D" (d0), "=&S" (d1)
-+ : "1"(to), "2"(from), "0"(size)
-+ : "eax", "edx", "memory");
-+ return size;
-+}
-+
-+static unsigned long __size_overflow(3)
- __copy_user_zeroing_intel(void *to, const void __user *from, unsigned long size)
- {
+ ".section .fixup,\"ax\"\n"
+ "101: lea 0(%%eax,%0,4),%0\n"
+ " jmp 100b\n"
+@@ -207,41 +315,41 @@ __copy_user_zeroing_intel(void *to, const void __user *from, unsigned long size)
int d0, d1;
__asm__ __volatile__(
" .align 2,0x90\n"
@@ -29718,15 +29508,7 @@ index 3eb18ac..6890bc3 100644
"8:\n"
".section .fixup,\"ax\"\n"
"9: lea 0(%%eax,%0,4),%0\n"
-@@ -298,48 +406,48 @@ __copy_user_zeroing_intel(void *to, const void __user *from, unsigned long size)
- * hyoshiok@miraclelinux.com
- */
-
--static unsigned long __copy_user_zeroing_intel_nocache(void *to,
-+static unsigned long __size_overflow(3) __copy_user_zeroing_intel_nocache(void *to,
- const void __user *from, unsigned long size)
- {
- int d0, d1;
+@@ -305,41 +413,41 @@ static unsigned long __copy_user_zeroing_intel_nocache(void *to,
__asm__ __volatile__(
" .align 2,0x90\n"
@@ -29798,15 +29580,7 @@ index 3eb18ac..6890bc3 100644
"8:\n"
".section .fixup,\"ax\"\n"
"9: lea 0(%%eax,%0,4),%0\n"
-@@ -392,48 +500,48 @@ static unsigned long __copy_user_zeroing_intel_nocache(void *to,
- return size;
- }
-
--static unsigned long __copy_user_intel_nocache(void *to,
-+static unsigned long __size_overflow(3) __copy_user_intel_nocache(void *to,
- const void __user *from, unsigned long size)
- {
- int d0, d1;
+@@ -399,41 +507,41 @@ static unsigned long __copy_user_intel_nocache(void *to,
__asm__ __volatile__(
" .align 2,0x90\n"
@@ -30048,7 +29822,7 @@ index 3eb18ac..6890bc3 100644
+EXPORT_SYMBOL(set_fs);
+#endif
diff --git a/arch/x86/lib/usercopy_64.c b/arch/x86/lib/usercopy_64.c
-index 906fea3..0194a18 100644
+index c905e89..01ab928 100644
--- a/arch/x86/lib/usercopy_64.c
+++ b/arch/x86/lib/usercopy_64.c
@@ -18,6 +18,7 @@ unsigned long __clear_user(void __user *addr, unsigned long size)
@@ -30091,7 +29865,7 @@ index 906fea3..0194a18 100644
@@ -69,11 +70,13 @@ EXPORT_SYMBOL(copy_in_user);
* it is not necessary to optimize tail handling.
*/
- unsigned long
+ __visible unsigned long
-copy_user_handle_tail(char *to, char *from, unsigned len, unsigned zerorest)
+copy_user_handle_tail(char __user *to, char __user *from, unsigned long len, unsigned zerorest)
{
@@ -30177,7 +29951,7 @@ index 903ec1e..c4166b2 100644
}
diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c
-index 654be4a..a4a3da1 100644
+index 3aaeffc..42ea9fb 100644
--- a/arch/x86/mm/fault.c
+++ b/arch/x86/mm/fault.c
@@ -14,11 +14,18 @@
@@ -30369,7 +30143,7 @@ index 654be4a..a4a3da1 100644
static void
show_fault_oops(struct pt_regs *regs, unsigned long error_code,
-@@ -579,14 +663,26 @@ show_fault_oops(struct pt_regs *regs, unsigned long error_code,
+@@ -579,15 +663,27 @@ show_fault_oops(struct pt_regs *regs, unsigned long error_code,
if (!oops_may_print())
return;
@@ -30382,8 +30156,8 @@ index 654be4a..a4a3da1 100644
if (pte && pte_present(*pte) && !pte_exec(*pte))
- printk(nx_warning, from_kuid(&init_user_ns, current_uid()));
+ printk(nx_warning, from_kuid_munged(&init_user_ns, current_uid()), current->comm, task_pid_nr(current));
-+ }
-+
+ }
+
+#ifdef CONFIG_PAX_KERNEXEC
+ if (init_mm.start_code <= address && address < init_mm.end_code) {
+ if (current->signal->curr_ip)
@@ -30393,11 +30167,12 @@ index 654be4a..a4a3da1 100644
+ else
+ printk(KERN_ERR "PAX: %s:%d, uid/euid: %u/%u, attempted to modify kernel code\n", current->comm, task_pid_nr(current),
+ from_kuid_munged(&init_user_ns, current_uid()), from_kuid_munged(&init_user_ns, current_euid()));
- }
++ }
+#endif
-
++
printk(KERN_ALERT "BUG: unable to handle kernel ");
if (address < PAGE_SIZE)
+ printk(KERN_CONT "NULL pointer dereference");
@@ -750,6 +846,22 @@ __bad_area_nosemaphore(struct pt_regs *regs, unsigned long error_code,
return;
}
@@ -30430,7 +30205,7 @@ index 654be4a..a4a3da1 100644
code = BUS_MCEERR_AR;
}
#endif
-@@ -898,6 +1010,99 @@ static int spurious_fault_check(unsigned long error_code, pte_t *pte)
+@@ -889,6 +1001,99 @@ static int spurious_fault_check(unsigned long error_code, pte_t *pte)
return 1;
}
@@ -30530,7 +30305,7 @@ index 654be4a..a4a3da1 100644
/*
* Handle a spurious fault caused by a stale TLB entry.
*
-@@ -964,6 +1169,9 @@ int show_unhandled_signals = 1;
+@@ -955,6 +1160,9 @@ int show_unhandled_signals = 1;
static inline int
access_error(unsigned long error_code, struct vm_area_struct *vma)
{
@@ -30540,7 +30315,7 @@ index 654be4a..a4a3da1 100644
if (error_code & PF_WRITE) {
/* write, present and write, not present: */
if (unlikely(!(vma->vm_flags & VM_WRITE)))
-@@ -992,7 +1200,7 @@ static inline bool smap_violation(int error_code, struct pt_regs *regs)
+@@ -983,7 +1191,7 @@ static inline bool smap_violation(int error_code, struct pt_regs *regs)
if (error_code & PF_USER)
return false;
@@ -30549,20 +30324,10 @@ index 654be4a..a4a3da1 100644
return false;
return true;
-@@ -1008,19 +1216,34 @@ __do_page_fault(struct pt_regs *regs, unsigned long error_code)
- {
- struct vm_area_struct *vma;
- struct task_struct *tsk;
-- unsigned long address;
- struct mm_struct *mm;
- int fault;
- int write = error_code & PF_WRITE;
- unsigned int flags = FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_KILLABLE |
- (write ? FAULT_FLAG_WRITE : 0);
+@@ -1010,6 +1218,22 @@ __do_page_fault(struct pt_regs *regs, unsigned long error_code)
+ /* Get the faulting address: */
+ address = read_cr2();
-+ /* Get the faulting address: */
-+ unsigned long address = read_cr2();
-+
+#if defined(CONFIG_X86_64) && defined(CONFIG_PAX_MEMORY_UDEREF)
+ if (!user_mode(regs) && address < 2 * pax_user_shadow_base) {
+ if (!search_exception_tables(regs->ip)) {
@@ -30579,16 +30344,10 @@ index 654be4a..a4a3da1 100644
+ }
+#endif
+
- tsk = current;
- mm = tsk->mm;
-
-- /* Get the faulting address: */
-- address = read_cr2();
--
/*
* Detect and handle instructions that would cause a page fault for
* both a tracked kernel page and a userspace page.
-@@ -1080,7 +1303,7 @@ __do_page_fault(struct pt_regs *regs, unsigned long error_code)
+@@ -1069,7 +1293,7 @@ __do_page_fault(struct pt_regs *regs, unsigned long error_code)
* User-mode registers count as a user access even for any
* potential system fault or CPU buglet:
*/
@@ -30596,8 +30355,8 @@ index 654be4a..a4a3da1 100644
+ if (user_mode(regs)) {
local_irq_enable();
error_code |= PF_USER;
- } else {
-@@ -1142,6 +1365,11 @@ retry:
+ flags |= FAULT_FLAG_USER;
+@@ -1135,6 +1359,11 @@ retry:
might_sleep();
}
@@ -30609,7 +30368,7 @@ index 654be4a..a4a3da1 100644
vma = find_vma(mm, address);
if (unlikely(!vma)) {
bad_area(regs, error_code, address);
-@@ -1153,18 +1381,24 @@ retry:
+@@ -1146,18 +1375,24 @@ retry:
bad_area(regs, error_code, address);
return;
}
@@ -30645,7 +30404,7 @@ index 654be4a..a4a3da1 100644
if (unlikely(expand_stack(vma, address))) {
bad_area(regs, error_code, address);
return;
-@@ -1230,3 +1464,292 @@ do_page_fault(struct pt_regs *regs, unsigned long error_code)
+@@ -1231,3 +1466,292 @@ do_page_fault(struct pt_regs *regs, unsigned long error_code)
__do_page_fault(regs, error_code);
exception_exit(prev_state);
}
@@ -30952,10 +30711,10 @@ index dd74e46..7d26398 100644
return 0;
diff --git a/arch/x86/mm/highmem_32.c b/arch/x86/mm/highmem_32.c
-index 252b8f5..4dcfdc1 100644
+index 4500142..53a363c 100644
--- a/arch/x86/mm/highmem_32.c
+++ b/arch/x86/mm/highmem_32.c
-@@ -44,7 +44,11 @@ void *kmap_atomic_prot(struct page *page, pgprot_t prot)
+@@ -45,7 +45,11 @@ void *kmap_atomic_prot(struct page *page, pgprot_t prot)
idx = type + KM_TYPE_NR*smp_processor_id();
vaddr = __fix_to_virt(FIX_KMAP_BEGIN + idx);
BUG_ON(!pte_none(*(kmap_pte-idx)));
@@ -30968,10 +30727,10 @@ index 252b8f5..4dcfdc1 100644
return (void *)vaddr;
diff --git a/arch/x86/mm/hugetlbpage.c b/arch/x86/mm/hugetlbpage.c
-index ae1aa71..d9bea75 100644
+index 9d980d8..6bbfacb 100644
--- a/arch/x86/mm/hugetlbpage.c
+++ b/arch/x86/mm/hugetlbpage.c
-@@ -271,23 +271,30 @@ follow_huge_pud(struct mm_struct *mm, unsigned long address,
+@@ -92,23 +92,30 @@ int pmd_huge_support(void)
#ifdef HAVE_ARCH_HUGETLB_UNMAPPED_AREA
static unsigned long hugetlb_get_unmapped_area_bottomup(struct file *file,
unsigned long addr, unsigned long len,
@@ -31005,7 +30764,7 @@ index ae1aa71..d9bea75 100644
{
struct hstate *h = hstate_file(file);
struct vm_unmapped_area_info info;
-@@ -299,6 +306,7 @@ static unsigned long hugetlb_get_unmapped_area_topdown(struct file *file,
+@@ -120,6 +127,7 @@ static unsigned long hugetlb_get_unmapped_area_topdown(struct file *file,
info.high_limit = current->mm->mmap_base;
info.align_mask = PAGE_MASK & ~huge_page_mask(h);
info.align_offset = 0;
@@ -31013,7 +30772,7 @@ index ae1aa71..d9bea75 100644
addr = vm_unmapped_area(&info);
/*
-@@ -311,6 +319,12 @@ static unsigned long hugetlb_get_unmapped_area_topdown(struct file *file,
+@@ -132,6 +140,12 @@ static unsigned long hugetlb_get_unmapped_area_topdown(struct file *file,
VM_BUG_ON(addr != -ENOMEM);
info.flags = 0;
info.low_limit = TASK_UNMAPPED_BASE;
@@ -31026,7 +30785,7 @@ index ae1aa71..d9bea75 100644
info.high_limit = TASK_SIZE;
addr = vm_unmapped_area(&info);
}
-@@ -325,10 +339,20 @@ hugetlb_get_unmapped_area(struct file *file, unsigned long addr,
+@@ -146,10 +160,20 @@ hugetlb_get_unmapped_area(struct file *file, unsigned long addr,
struct hstate *h = hstate_file(file);
struct mm_struct *mm = current->mm;
struct vm_area_struct *vma;
@@ -31048,7 +30807,7 @@ index ae1aa71..d9bea75 100644
return -ENOMEM;
if (flags & MAP_FIXED) {
-@@ -337,19 +361,22 @@ hugetlb_get_unmapped_area(struct file *file, unsigned long addr,
+@@ -158,19 +182,22 @@ hugetlb_get_unmapped_area(struct file *file, unsigned long addr,
return addr;
}
@@ -31076,7 +30835,7 @@ index ae1aa71..d9bea75 100644
#endif /*HAVE_ARCH_HUGETLB_UNMAPPED_AREA*/
diff --git a/arch/x86/mm/init.c b/arch/x86/mm/init.c
-index 7a5bf1b..c96ab0d 100644
+index 04664cd..dae6e5d 100644
--- a/arch/x86/mm/init.c
+++ b/arch/x86/mm/init.c
@@ -4,6 +4,7 @@
@@ -31131,10 +30890,10 @@ index 7a5bf1b..c96ab0d 100644
+#ifdef CONFIG_GRKERNSEC_KMEM
+ /* allow BDA */
+ if (!pagenr)
-+ return 1;
+ return 1;
+ /* allow EBDA */
+ if (pagenr >= ebda_start && pagenr < ebda_end)
- return 1;
++ return 1;
+ /* if tboot is in use, allow access to its hardcoded serial log range */
+ if (tboot_enabled() && ((0x60000 >> PAGE_SHIFT) <= pagenr) && (pagenr < (0x68000 >> PAGE_SHIFT)))
+ return 1;
@@ -31157,7 +30916,7 @@ index 7a5bf1b..c96ab0d 100644
if (iomem_is_exclusive(pagenr << PAGE_SHIFT))
return 0;
if (!page_is_ram(pagenr))
-@@ -538,8 +582,117 @@ void free_init_pages(char *what, unsigned long begin, unsigned long end)
+@@ -530,8 +574,117 @@ void free_init_pages(char *what, unsigned long begin, unsigned long end)
#endif
}
@@ -31233,7 +30992,7 @@ index 7a5bf1b..c96ab0d 100644
+ pgd = pgd_offset_k(addr);
+ pud = pud_offset(pgd, addr);
+ pmd = pmd_offset(pud, addr);
-+ set_pmd(pmd, __pmd(pmd_val(*pmd) | (_PAGE_NX & __supported_pte_mask)));
++ set_pmd(pmd, __pmd(pmd_val(*pmd) | (_PAGE_NX & __supported_pte_mask)));
+ }
+*/
+#endif
@@ -31259,7 +31018,7 @@ index 7a5bf1b..c96ab0d 100644
+ addr = (unsigned long)__va(__pa(__START_KERNEL_map));
+ end = addr + KERNEL_IMAGE_SIZE;
+ for (; addr < end; addr += PMD_SIZE) {
-+ pgd = pgd_offset_k(addr);
++ pgd = pgd_offset_k(addr);
+ pud = pud_offset(pgd, addr);
+ pmd = pmd_offset(pud, addr);
+ if (!pmd_present(*pmd))
@@ -31272,11 +31031,11 @@ index 7a5bf1b..c96ab0d 100644
+ flush_tlb_all();
+#endif
+
- free_init_pages("unused kernel memory",
+ free_init_pages("unused kernel",
(unsigned long)(&__init_begin),
(unsigned long)(&__init_end));
diff --git a/arch/x86/mm/init_32.c b/arch/x86/mm/init_32.c
-index 3ac7e31..89611b7 100644
+index 4287f1f..3b99c71 100644
--- a/arch/x86/mm/init_32.c
+++ b/arch/x86/mm/init_32.c
@@ -62,33 +62,6 @@ static noinline int do_test_wp_bit(void);
@@ -31490,16 +31249,7 @@ index 3ac7e31..89611b7 100644
EXPORT_SYMBOL_GPL(__supported_pte_mask);
/* user-defined highmem size */
-@@ -772,7 +774,7 @@ void __init mem_init(void)
- after_bootmem = 1;
-
- codesize = (unsigned long) &_etext - (unsigned long) &_text;
-- datasize = (unsigned long) &_edata - (unsigned long) &_etext;
-+ datasize = (unsigned long) &_edata - (unsigned long) &_sdata;
- initsize = (unsigned long) &__init_end - (unsigned long) &__init_begin;
-
- printk(KERN_INFO "Memory: %luk/%luk available (%dk kernel code, "
-@@ -813,10 +815,10 @@ void __init mem_init(void)
+@@ -787,10 +789,10 @@ void __init mem_init(void)
((unsigned long)&__init_end -
(unsigned long)&__init_begin) >> 10,
@@ -31513,7 +31263,7 @@ index 3ac7e31..89611b7 100644
((unsigned long)&_etext - (unsigned long)&_text) >> 10);
/*
-@@ -906,6 +908,7 @@ void set_kernel_text_rw(void)
+@@ -880,6 +882,7 @@ void set_kernel_text_rw(void)
if (!kernel_set_to_readonly)
return;
@@ -31521,7 +31271,7 @@ index 3ac7e31..89611b7 100644
pr_debug("Set kernel text: %lx - %lx for read write\n",
start, start+size);
-@@ -920,6 +923,7 @@ void set_kernel_text_ro(void)
+@@ -894,6 +897,7 @@ void set_kernel_text_ro(void)
if (!kernel_set_to_readonly)
return;
@@ -31529,7 +31279,7 @@ index 3ac7e31..89611b7 100644
pr_debug("Set kernel text: %lx - %lx for read only\n",
start, start+size);
-@@ -948,6 +952,7 @@ void mark_rodata_ro(void)
+@@ -922,6 +926,7 @@ void mark_rodata_ro(void)
unsigned long start = PFN_ALIGN(_text);
unsigned long size = PFN_ALIGN(_etext) - start;
@@ -31538,7 +31288,7 @@ index 3ac7e31..89611b7 100644
printk(KERN_INFO "Write protecting the kernel text: %luk\n",
size >> 10);
diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c
-index bb00c46..bf91a67 100644
+index 104d56a..62ba13f1 100644
--- a/arch/x86/mm/init_64.c
+++ b/arch/x86/mm/init_64.c
@@ -151,7 +151,7 @@ early_param("gbpages", parse_direct_gbpages_on);
@@ -31662,7 +31412,7 @@ index bb00c46..bf91a67 100644
spin_unlock(&init_mm.page_table_lock);
pgd_changed = true;
}
-@@ -1221,8 +1242,8 @@ int kern_addr_valid(unsigned long addr)
+@@ -1188,8 +1209,8 @@ int kern_addr_valid(unsigned long addr)
static struct vm_area_struct gate_vma = {
.vm_start = VSYSCALL_START,
.vm_end = VSYSCALL_START + (VSYSCALL_MAPPED_PAGES * PAGE_SIZE),
@@ -31673,7 +31423,7 @@ index bb00c46..bf91a67 100644
};
struct vm_area_struct *get_gate_vma(struct mm_struct *mm)
-@@ -1256,7 +1277,7 @@ int in_gate_area_no_mm(unsigned long addr)
+@@ -1223,7 +1244,7 @@ int in_gate_area_no_mm(unsigned long addr)
const char *arch_vma_name(struct vm_area_struct *vma)
{
@@ -31683,7 +31433,7 @@ index bb00c46..bf91a67 100644
if (vma == &gate_vma)
return "[vsyscall]";
diff --git a/arch/x86/mm/iomap_32.c b/arch/x86/mm/iomap_32.c
-index 7b179b4..6bd1777 100644
+index 7b179b4..6bd17777 100644
--- a/arch/x86/mm/iomap_32.c
+++ b/arch/x86/mm/iomap_32.c
@@ -64,7 +64,11 @@ void *kmap_atomic_prot_pfn(unsigned long pfn, pgprot_t prot)
@@ -31699,7 +31449,7 @@ index 7b179b4..6bd1777 100644
return (void *)vaddr;
diff --git a/arch/x86/mm/ioremap.c b/arch/x86/mm/ioremap.c
-index 9a1e658..da003f3 100644
+index 799580c..72f9fe0 100644
--- a/arch/x86/mm/ioremap.c
+++ b/arch/x86/mm/ioremap.c
@@ -97,7 +97,7 @@ static void __iomem *__ioremap_caller(resource_size_t phys_addr,
@@ -31776,7 +31526,7 @@ index d87dd6d..bf3fa66 100644
pte = kmemcheck_pte_lookup(address);
diff --git a/arch/x86/mm/mmap.c b/arch/x86/mm/mmap.c
-index 5c1ae28..45f4ac9 100644
+index 25e7e13..1964579 100644
--- a/arch/x86/mm/mmap.c
+++ b/arch/x86/mm/mmap.c
@@ -52,7 +52,7 @@ static unsigned int stack_maxrandom_size(void)
@@ -31853,7 +31603,7 @@ index 5c1ae28..45f4ac9 100644
if (mmap_is_legacy()) {
mm->mmap_base = mm->mmap_legacy_base;
diff --git a/arch/x86/mm/mmio-mod.c b/arch/x86/mm/mmio-mod.c
-index dc0b727..f612039 100644
+index 0057a7a..95c7edd 100644
--- a/arch/x86/mm/mmio-mod.c
+++ b/arch/x86/mm/mmio-mod.c
@@ -194,7 +194,7 @@ static void pre(struct kmmio_probe *p, struct pt_regs *regs,
@@ -31902,7 +31652,7 @@ index dc0b727..f612039 100644
might_sleep();
if (is_enabled()) /* recheck and proper locking in *_core() */
diff --git a/arch/x86/mm/numa.c b/arch/x86/mm/numa.c
-index a71c4e2..301ae44 100644
+index 8bf93ba..dbcd670 100644
--- a/arch/x86/mm/numa.c
+++ b/arch/x86/mm/numa.c
@@ -474,7 +474,7 @@ static bool __init numa_meminfo_cover_memory(const struct numa_meminfo *mi)
@@ -32129,7 +31879,7 @@ index 9f0614d..92ae64a 100644
p += get_opcode(p, &opcode);
for (i = 0; i < ARRAY_SIZE(imm_wop); i++)
diff --git a/arch/x86/mm/pgtable.c b/arch/x86/mm/pgtable.c
-index 17fda6a..f7d54a0 100644
+index dfa537a..fd45c64 100644
--- a/arch/x86/mm/pgtable.c
+++ b/arch/x86/mm/pgtable.c
@@ -91,10 +91,67 @@ static inline void pgd_list_del(pgd_t *pgd)
@@ -32144,7 +31894,7 @@ index 17fda6a..f7d54a0 100644
+void __shadow_user_pgds(pgd_t *dst, const pgd_t *src)
+{
+ unsigned int count = USER_PGD_PTRS;
-+
+
+ if (!pax_user_shadow_base)
+ return;
+
@@ -32170,7 +31920,7 @@ index 17fda6a..f7d54a0 100644
+#if defined(CONFIG_X86_64) && defined(CONFIG_PAX_MEMORY_UDEREF)
+ pgd = __pgd(pgd_val(pgd) & clone_pgd_mask);
+#endif
-
++
+ *dst++ = pgd;
+ }
+
@@ -32278,7 +32028,7 @@ index 17fda6a..f7d54a0 100644
return -ENOMEM;
}
-@@ -219,51 +279,55 @@ static int preallocate_pmds(pmd_t *pmds[])
+@@ -219,49 +279,52 @@ static int preallocate_pmds(pmd_t *pmds[])
* preallocate which never got a corresponding vma will need to be
* freed manually.
*/
@@ -32311,7 +32061,6 @@ index 17fda6a..f7d54a0 100644
{
- pud_t *pud;
+ pyd_t *pyd;
- unsigned long addr;
int i;
- if (PREALLOCATED_PMDS == 0) /* Work around gcc-3.4.x bug */
@@ -32319,19 +32068,17 @@ index 17fda6a..f7d54a0 100644
return;
- pud = pud_offset(pgd, 0);
+-
+- for (i = 0; i < PREALLOCATED_PMDS; i++, pud++) {
+- pmd_t *pmd = pmds[i];
+#ifdef CONFIG_X86_64
+ pyd = pyd_offset(mm, 0L);
+#else
+ pyd = pyd_offset(pgd, 0L);
+#endif
-- for (addr = i = 0; i < PREALLOCATED_PMDS;
-- i++, pud++, addr += PUD_SIZE) {
-- pmd_t *pmd = pmds[i];
-+ for (addr = i = 0; i < PREALLOCATED_PXDS;
-+ i++, pyd++, addr += PYD_SIZE) {
++ for (i = 0; i < PREALLOCATED_PXDS; i++, pyd++) {
+ pxd_t *pxd = pxds[i];
-
if (i >= KERNEL_PGD_BOUNDARY)
- memcpy(pmd, (pmd_t *)pgd_page_vaddr(swapper_pg_dir[i]),
- sizeof(pmd_t) * PTRS_PER_PMD);
@@ -32351,7 +32098,7 @@ index 17fda6a..f7d54a0 100644
pgd = (pgd_t *)__get_free_page(PGALLOC_GFP);
-@@ -272,11 +336,11 @@ pgd_t *pgd_alloc(struct mm_struct *mm)
+@@ -270,11 +333,11 @@ pgd_t *pgd_alloc(struct mm_struct *mm)
mm->pgd = pgd;
@@ -32365,7 +32112,7 @@ index 17fda6a..f7d54a0 100644
/*
* Make sure that pre-populating the pmds is atomic with
-@@ -286,14 +350,14 @@ pgd_t *pgd_alloc(struct mm_struct *mm)
+@@ -284,14 +347,14 @@ pgd_t *pgd_alloc(struct mm_struct *mm)
spin_lock(&pgd_lock);
pgd_ctor(mm, pgd);
@@ -32383,7 +32130,7 @@ index 17fda6a..f7d54a0 100644
out_free_pgd:
free_page((unsigned long)pgd);
out:
-@@ -302,7 +366,7 @@ out:
+@@ -300,7 +363,7 @@ out:
void pgd_free(struct mm_struct *mm, pgd_t *pgd)
{
@@ -32433,7 +32180,7 @@ index e666cbb..61788c45 100644
unsigned long phys_addr = x - PAGE_OFFSET;
/* VMALLOC_* aren't constants */
diff --git a/arch/x86/mm/setup_nx.c b/arch/x86/mm/setup_nx.c
-index 410531d..0f16030 100644
+index 90555bf..f5f1828 100644
--- a/arch/x86/mm/setup_nx.c
+++ b/arch/x86/mm/setup_nx.c
@@ -5,8 +5,10 @@
@@ -32441,7 +32188,7 @@ index 410531d..0f16030 100644
#include <asm/proto.h>
+#if defined(CONFIG_X86_64) || defined(CONFIG_X86_PAE)
- static int disable_nx __cpuinitdata;
+ static int disable_nx;
+#ifndef CONFIG_PAX_PAGEEXEC
/*
@@ -32455,7 +32202,7 @@ index 410531d..0f16030 100644
+
+#endif
- void __cpuinit x86_configure_nx(void)
+ void x86_configure_nx(void)
{
+#if defined(CONFIG_X86_64) || defined(CONFIG_X86_PAE)
if (cpu_has_nx && !disable_nx)
@@ -32466,7 +32213,7 @@ index 410531d..0f16030 100644
}
diff --git a/arch/x86/mm/tlb.c b/arch/x86/mm/tlb.c
-index 282375f..e03a98f 100644
+index ae699b3..f1b2ad2 100644
--- a/arch/x86/mm/tlb.c
+++ b/arch/x86/mm/tlb.c
@@ -48,7 +48,11 @@ void leave_mm(int cpu)
@@ -32638,18 +32385,10 @@ index 877b9a1..a8ecf42 100644
+ pax_force_retaddr
ret
diff --git a/arch/x86/net/bpf_jit_comp.c b/arch/x86/net/bpf_jit_comp.c
-index f66b540..3e88dfb 100644
+index 26328e8..5f96c25 100644
--- a/arch/x86/net/bpf_jit_comp.c
+++ b/arch/x86/net/bpf_jit_comp.c
-@@ -12,6 +12,7 @@
- #include <linux/netdevice.h>
- #include <linux/filter.h>
- #include <linux/if_vlan.h>
-+#include <linux/random.h>
-
- /*
- * Conventions :
-@@ -49,13 +50,90 @@ static inline u8 *emit_code(u8 *ptr, u32 bytes, unsigned int len)
+@@ -50,13 +50,90 @@ static inline u8 *emit_code(u8 *ptr, u32 bytes, unsigned int len)
return ptr + len;
}
@@ -32740,7 +32479,7 @@ index f66b540..3e88dfb 100644
#define CLEAR_A() EMIT2(0x31, 0xc0) /* xor %eax,%eax */
#define CLEAR_X() EMIT2(0x31, 0xdb) /* xor %ebx,%ebx */
-@@ -90,6 +168,24 @@ do { \
+@@ -91,6 +168,24 @@ do { \
#define X86_JBE 0x76
#define X86_JA 0x77
@@ -32765,7 +32504,7 @@ index f66b540..3e88dfb 100644
#define EMIT_COND_JMP(op, offset) \
do { \
if (is_near(offset)) \
-@@ -97,6 +193,7 @@ do { \
+@@ -98,6 +193,7 @@ do { \
else { \
EMIT2(0x0f, op + 0x10); \
EMIT(offset, 4); /* jxx .+off32 */ \
@@ -32773,19 +32512,53 @@ index f66b540..3e88dfb 100644
} \
} while (0)
-@@ -121,6 +218,11 @@ static inline void bpf_flush_icache(void *start, void *end)
- set_fs(old_fs);
+@@ -145,55 +241,54 @@ static int pkt_type_offset(void)
+ return -1;
}
-+struct bpf_jit_work {
-+ struct work_struct work;
-+ void *image;
-+};
-+
- #define CHOOSE_LOAD_FUNC(K, func) \
- ((int)K < 0 ? ((int)K >= SKF_LL_OFF ? func##_negative_offset : func) : func##_positive_offset)
+-struct bpf_binary_header {
+- unsigned int pages;
+- /* Note : for security reasons, bpf code will follow a randomly
+- * sized amount of int3 instructions
+- */
+- u8 image[];
+-};
+-
+-static struct bpf_binary_header *bpf_alloc_binary(unsigned int proglen,
++/* Note : for security reasons, bpf code will follow a randomly
++ * sized amount of int3 instructions
++ */
++static u8 *bpf_alloc_binary(unsigned int proglen,
+ u8 **image_ptr)
+ {
+ unsigned int sz, hole;
+- struct bpf_binary_header *header;
++ u8 *header;
-@@ -146,7 +248,7 @@ static int pkt_type_offset(void)
+ /* Most of BPF filters are really small,
+ * but if some of them fill a page, allow at least
+ * 128 extra bytes to insert a random section of int3
+ */
+- sz = round_up(proglen + sizeof(*header) + 128, PAGE_SIZE);
+- header = module_alloc(sz);
++ sz = round_up(proglen + 128, PAGE_SIZE);
++ header = module_alloc_exec(sz);
+ if (!header)
+ return NULL;
+
++ pax_open_kernel();
+ memset(header, 0xcc, sz); /* fill whole space with int3 instructions */
++ pax_close_kernel();
+
+- header->pages = sz / PAGE_SIZE;
+- hole = sz - (proglen + sizeof(*header));
++ hole = PAGE_SIZE - (proglen & ~PAGE_MASK);
+
+ /* insert a random number of int3 instructions before BPF code */
+- *image_ptr = &header->image[prandom_u32() % hole];
++ *image_ptr = &header[prandom_u32() % hole];
+ return header;
+ }
void bpf_jit_compile(struct sk_filter *fp)
{
@@ -32794,7 +32567,14 @@ index f66b540..3e88dfb 100644
u8 *prog;
unsigned int proglen, oldproglen = 0;
int ilen, i;
-@@ -159,6 +261,9 @@ void bpf_jit_compile(struct sk_filter *fp)
+ int t_offset, f_offset;
+ u8 t_op, f_op, seen = 0, pass;
+ u8 *image = NULL;
+- struct bpf_binary_header *header = NULL;
++ u8 *header = NULL;
+ u8 *func;
+ int pc_ret0 = -1; /* bpf index of first RET #0 instruction (if any) */
+ unsigned int cleanup_addr; /* epilogue code offset */
unsigned int *addrs;
const struct sock_filter *filter = fp->insns;
int flen = fp->len;
@@ -32804,14 +32584,10 @@ index f66b540..3e88dfb 100644
if (!bpf_jit_enable)
return;
-@@ -167,11 +272,19 @@ void bpf_jit_compile(struct sk_filter *fp)
+@@ -202,11 +297,15 @@ void bpf_jit_compile(struct sk_filter *fp)
if (addrs == NULL)
return;
-+ fp->work = kmalloc(sizeof(*fp->work), GFP_KERNEL);
-+ if (!fp->work)
-+ goto out;
-+
+#ifdef CONFIG_GRKERNSEC_JIT_HARDEN
+ randkey = get_random_int();
+#endif
@@ -32826,7 +32602,7 @@ index f66b540..3e88dfb 100644
addrs[i] = proglen;
}
cleanup_addr = proglen; /* epilogue address */
-@@ -282,10 +395,8 @@ void bpf_jit_compile(struct sk_filter *fp)
+@@ -317,10 +416,8 @@ void bpf_jit_compile(struct sk_filter *fp)
case BPF_S_ALU_MUL_K: /* A *= K */
if (is_imm8(K))
EMIT3(0x6b, 0xc0, K); /* imul imm8,%eax,%eax */
@@ -32839,7 +32615,7 @@ index f66b540..3e88dfb 100644
break;
case BPF_S_ALU_DIV_X: /* A /= X; */
seen |= SEEN_XREG;
-@@ -325,13 +436,23 @@ void bpf_jit_compile(struct sk_filter *fp)
+@@ -360,13 +457,23 @@ void bpf_jit_compile(struct sk_filter *fp)
break;
case BPF_S_ALU_MOD_K: /* A %= K; */
EMIT2(0x31, 0xd2); /* xor %edx,%edx */
@@ -32863,7 +32639,7 @@ index f66b540..3e88dfb 100644
EMIT4(0x48, 0xc1, 0xe8, 0x20); /* shr $0x20,%rax */
break;
case BPF_S_ALU_AND_X:
-@@ -602,8 +723,7 @@ common_load_ind: seen |= SEEN_DATAREF | SEEN_XREG;
+@@ -637,8 +744,7 @@ common_load_ind: seen |= SEEN_DATAREF | SEEN_XREG;
if (is_imm8(K)) {
EMIT3(0x8d, 0x73, K); /* lea imm8(%rbx), %esi */
} else {
@@ -32873,22 +32649,13 @@ index f66b540..3e88dfb 100644
}
} else {
EMIT2(0x89,0xde); /* mov %ebx,%esi */
-@@ -686,17 +806,18 @@ cond_branch: f_offset = addrs[i + filter[i].jf] - addrs[i];
- break;
- default:
- /* hmm, too complex filter, give up with jit compiler */
-- goto out;
-+ goto error;
- }
- ilen = prog - temp;
- if (image) {
+@@ -728,10 +834,12 @@ cond_branch: f_offset = addrs[i + filter[i].jf] - addrs[i];
if (unlikely(proglen + ilen > oldproglen)) {
pr_err("bpb_jit_compile fatal error\n");
-- kfree(addrs);
-- module_free(NULL, image);
-- return;
+ kfree(addrs);
+- module_free(NULL, header);
+ module_free_exec(NULL, image);
-+ goto error;
+ return;
}
+ pax_open_kernel();
memcpy(image + proglen, temp, ilen);
@@ -32896,56 +32663,27 @@ index f66b540..3e88dfb 100644
}
proglen += ilen;
addrs[i] = proglen;
-@@ -717,11 +838,9 @@ cond_branch: f_offset = addrs[i + filter[i].jf] - addrs[i];
- break;
- }
- if (proglen == oldproglen) {
-- image = module_alloc(max_t(unsigned int,
-- proglen,
-- sizeof(struct work_struct)));
-+ image = module_alloc_exec(proglen);
- if (!image)
-- goto out;
-+ goto error;
- }
- oldproglen = proglen;
- }
-@@ -732,7 +851,10 @@ cond_branch: f_offset = addrs[i + filter[i].jf] - addrs[i];
+@@ -764,7 +872,6 @@ cond_branch: f_offset = addrs[i + filter[i].jf] - addrs[i];
+
if (image) {
- bpf_flush_icache(image, image + proglen);
+ bpf_flush_icache(header, image + proglen);
+- set_memory_ro((unsigned long)header, header->pages);
fp->bpf_func = (void *)image;
-- }
-+ } else
-+error:
-+ kfree(fp->work);
-+
+ }
out:
- kfree(addrs);
- return;
-@@ -740,18 +862,20 @@ out:
-
- static void jit_free_defer(struct work_struct *arg)
- {
-- module_free(NULL, arg);
-+ module_free_exec(NULL, ((struct bpf_jit_work *)arg)->image);
-+ kfree(arg);
- }
-
- /* run from softirq, we must use a work_struct to call
-- * module_free() from process context
-+ * module_free_exec() from process context
- */
- void bpf_jit_free(struct sk_filter *fp)
+@@ -776,10 +883,9 @@ static void bpf_jit_free_deferred(struct work_struct *work)
{
- if (fp->bpf_func != sk_run_filter) {
-- struct work_struct *work = (struct work_struct *)fp->bpf_func;
-+ struct work_struct *work = &fp->work->work;
+ struct sk_filter *fp = container_of(work, struct sk_filter, work);
+ unsigned long addr = (unsigned long)fp->bpf_func & PAGE_MASK;
+- struct bpf_binary_header *header = (void *)addr;
- INIT_WORK(work, jit_free_defer);
-+ fp->work->image = fp->bpf_func;
- schedule_work(work);
- }
+- set_memory_rw(addr, header->pages);
+- module_free(NULL, header);
++ set_memory_rw(addr, 1);
++ module_free_exec(NULL, (void *)addr);
+ kfree(fp);
}
+
diff --git a/arch/x86/oprofile/backtrace.c b/arch/x86/oprofile/backtrace.c
index d6aa6e8..266395a 100644
--- a/arch/x86/oprofile/backtrace.c
@@ -32983,7 +32721,7 @@ index d6aa6e8..266395a 100644
if (depth)
dump_trace(NULL, regs, (unsigned long *)stack, 0,
diff --git a/arch/x86/oprofile/nmi_int.c b/arch/x86/oprofile/nmi_int.c
-index 48768df..ba9143c 100644
+index 6890d84..1dad1f1 100644
--- a/arch/x86/oprofile/nmi_int.c
+++ b/arch/x86/oprofile/nmi_int.c
@@ -23,6 +23,7 @@
@@ -33009,7 +32747,7 @@ index 48768df..ba9143c 100644
mux_init(ops);
diff --git a/arch/x86/oprofile/op_model_amd.c b/arch/x86/oprofile/op_model_amd.c
-index b2b9443..be58856 100644
+index 50d86c0..7985318 100644
--- a/arch/x86/oprofile/op_model_amd.c
+++ b/arch/x86/oprofile/op_model_amd.c
@@ -519,9 +519,11 @@ static int op_amd_init(struct oprofile_operations *ops)
@@ -33065,19 +32803,6 @@ index 71e8a67..6a313bb 100644
struct op_counter_config;
-diff --git a/arch/x86/pci/amd_bus.c b/arch/x86/pci/amd_bus.c
-index e9e6ed5..e47ae67 100644
---- a/arch/x86/pci/amd_bus.c
-+++ b/arch/x86/pci/amd_bus.c
-@@ -337,7 +337,7 @@ static int __cpuinit amd_cpu_notify(struct notifier_block *self,
- return NOTIFY_OK;
- }
-
--static struct notifier_block __cpuinitdata amd_cpu_notifier = {
-+static struct notifier_block amd_cpu_notifier = {
- .notifier_call = amd_cpu_notify,
- };
-
diff --git a/arch/x86/pci/irq.c b/arch/x86/pci/irq.c
index 372e9b8..e775a6c 100644
--- a/arch/x86/pci/irq.c
@@ -33119,11 +32844,11 @@ index 372e9b8..e775a6c 100644
.callback = fix_broken_hp_bios_irq9,
.ident = "HP Pavilion N5400 Series Laptop",
diff --git a/arch/x86/pci/mrst.c b/arch/x86/pci/mrst.c
-index 6eb18c4..20d83de 100644
+index 903fded..94b0d88 100644
--- a/arch/x86/pci/mrst.c
+++ b/arch/x86/pci/mrst.c
-@@ -238,7 +238,9 @@ int __init pci_mrst_init(void)
- printk(KERN_INFO "Intel MID platform detected, using MID PCI ops\n");
+@@ -241,7 +241,9 @@ int __init pci_mrst_init(void)
+ pr_info("Intel MID platform detected, using MID PCI ops\n");
pci_mmcfg_late_init();
pcibios_enable_irq = mrst_pci_irq_enable;
- pci_root_ops = pci_mrst_ops;
@@ -33488,7 +33213,7 @@ index 40e4469..d915bf9 100644
local_irq_restore(efi_rt_eflags);
diff --git a/arch/x86/platform/efi/efi_64.c b/arch/x86/platform/efi/efi_64.c
-index 39a0e7f..872396e 100644
+index 39a0e7f1..872396e 100644
--- a/arch/x86/platform/efi/efi_64.c
+++ b/arch/x86/platform/efi/efi_64.c
@@ -76,6 +76,11 @@ void __init efi_call_phys_prelog(void)
@@ -33712,7 +33437,7 @@ index 4c07cca..2c8427d 100644
ret
ENDPROC(efi_call6)
diff --git a/arch/x86/platform/mrst/mrst.c b/arch/x86/platform/mrst/mrst.c
-index a0a0a43..a48e233 100644
+index 3ca5957..7909c18 100644
--- a/arch/x86/platform/mrst/mrst.c
+++ b/arch/x86/platform/mrst/mrst.c
@@ -78,13 +78,15 @@ struct sfi_rtc_table_entry sfi_mrtc_array[SFI_MRTC_MAX];
@@ -33747,7 +33472,7 @@ index d6ee929..3637cb5 100644
.getproplen = olpc_dt_getproplen,
.getproperty = olpc_dt_getproperty,
diff --git a/arch/x86/power/cpu.c b/arch/x86/power/cpu.c
-index 1cf5b30..fd45732 100644
+index 424f4c9..f2a2988 100644
--- a/arch/x86/power/cpu.c
+++ b/arch/x86/power/cpu.c
@@ -137,11 +137,8 @@ static void do_fpu_end(void)
@@ -34151,7 +33876,7 @@ index fd14be1..e3c79c0 100644
#
diff --git a/arch/x86/vdso/vdso32-setup.c b/arch/x86/vdso/vdso32-setup.c
-index 0faad64..39ef157 100644
+index d6bfb87..876ee18 100644
--- a/arch/x86/vdso/vdso32-setup.c
+++ b/arch/x86/vdso/vdso32-setup.c
@@ -25,6 +25,7 @@
@@ -34310,7 +34035,7 @@ index 431e875..cbb23f3 100644
-}
-__setup("vdso=", vdso_setup);
diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
-index a492be2..08678da 100644
+index fa6ade7..73da73a5 100644
--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -123,8 +123,6 @@ EXPORT_SYMBOL_GPL(xen_start_info);
@@ -34322,7 +34047,7 @@ index a492be2..08678da 100644
RESERVE_BRK(shared_info_page_brk, PAGE_SIZE);
__read_mostly int xen_have_vector_callback;
EXPORT_SYMBOL_GPL(xen_have_vector_callback);
-@@ -542,8 +540,7 @@ static void xen_load_gdt(const struct desc_ptr *dtr)
+@@ -541,8 +539,7 @@ static void xen_load_gdt(const struct desc_ptr *dtr)
{
unsigned long va = dtr->address;
unsigned int size = dtr->size + 1;
@@ -34332,7 +34057,7 @@ index a492be2..08678da 100644
int f;
/*
-@@ -591,8 +588,7 @@ static void __init xen_load_gdt_boot(const struct desc_ptr *dtr)
+@@ -590,8 +587,7 @@ static void __init xen_load_gdt_boot(const struct desc_ptr *dtr)
{
unsigned long va = dtr->address;
unsigned int size = dtr->size + 1;
@@ -34342,7 +34067,7 @@ index a492be2..08678da 100644
int f;
/*
-@@ -600,7 +596,7 @@ static void __init xen_load_gdt_boot(const struct desc_ptr *dtr)
+@@ -599,7 +595,7 @@ static void __init xen_load_gdt_boot(const struct desc_ptr *dtr)
* 8-byte entries, or 16 4k pages..
*/
@@ -34351,7 +34076,7 @@ index a492be2..08678da 100644
BUG_ON(va & ~PAGE_MASK);
for (f = 0; va < dtr->address + size; va += PAGE_SIZE, f++) {
-@@ -985,7 +981,7 @@ static u32 xen_safe_apic_wait_icr_idle(void)
+@@ -988,7 +984,7 @@ static u32 xen_safe_apic_wait_icr_idle(void)
return 0;
}
@@ -34360,7 +34085,7 @@ index a492be2..08678da 100644
{
apic->read = xen_apic_read;
apic->write = xen_apic_write;
-@@ -1290,30 +1286,30 @@ static const struct pv_apic_ops xen_apic_ops __initconst = {
+@@ -1293,30 +1289,30 @@ static const struct pv_apic_ops xen_apic_ops __initconst = {
#endif
};
@@ -34398,7 +34123,7 @@ index a492be2..08678da 100644
{
if (pm_power_off)
pm_power_off();
-@@ -1464,7 +1460,17 @@ asmlinkage void __init xen_start_kernel(void)
+@@ -1467,7 +1463,17 @@ asmlinkage void __init xen_start_kernel(void)
__userpte_alloc_gfp &= ~__GFP_HIGHMEM;
/* Work out if we support NX */
@@ -34417,7 +34142,7 @@ index a492be2..08678da 100644
xen_setup_features();
-@@ -1495,13 +1501,6 @@ asmlinkage void __init xen_start_kernel(void)
+@@ -1498,13 +1504,6 @@ asmlinkage void __init xen_start_kernel(void)
machine_ops = xen_machine_ops;
@@ -34431,19 +34156,19 @@ index a492be2..08678da 100644
xen_smp_init();
#ifdef CONFIG_ACPI_NUMA
-@@ -1700,7 +1699,7 @@ static int __cpuinit xen_hvm_cpu_notify(struct notifier_block *self,
- return NOTIFY_OK;
- }
-
--static struct notifier_block xen_hvm_cpu_notifier __cpuinitdata = {
-+static struct notifier_block xen_hvm_cpu_notifier = {
- .notifier_call = xen_hvm_cpu_notify,
- };
-
diff --git a/arch/x86/xen/mmu.c b/arch/x86/xen/mmu.c
-index fdc3ba2..3daee39 100644
+index fdc3ba2..23cae00 100644
--- a/arch/x86/xen/mmu.c
+++ b/arch/x86/xen/mmu.c
+@@ -379,7 +379,7 @@ static pteval_t pte_mfn_to_pfn(pteval_t val)
+ return val;
+ }
+
+-static pteval_t pte_pfn_to_mfn(pteval_t val)
++static pteval_t __intentional_overflow(-1) pte_pfn_to_mfn(pteval_t val)
+ {
+ if (val & _PAGE_PRESENT) {
+ unsigned long pfn = (val & PTE_PFN_MASK) >> PAGE_SHIFT;
@@ -1894,6 +1894,9 @@ void __init xen_setup_kernel_pagetable(pgd_t *pgd, unsigned long max_pfn)
/* L3_k[510] -> level2_kernel_pgt
* L3_i[511] -> level2_fixmap_pgt */
@@ -34484,22 +34209,30 @@ index fdc3ba2..3daee39 100644
.alloc_pud = xen_alloc_pmd_init,
.release_pud = xen_release_pmd_init,
diff --git a/arch/x86/xen/smp.c b/arch/x86/xen/smp.c
-index a1e58e1..9392ad8 100644
+index 31d0475..51af671 100644
--- a/arch/x86/xen/smp.c
+++ b/arch/x86/xen/smp.c
-@@ -240,11 +240,6 @@ static void __init xen_smp_prepare_boot_cpu(void)
- {
- BUG_ON(smp_processor_id() != 0);
+@@ -274,17 +274,13 @@ static void __init xen_smp_prepare_boot_cpu(void)
native_smp_prepare_boot_cpu();
+
+ if (xen_pv_domain()) {
+- /* We've switched to the "real" per-cpu gdt, so make sure the
+- old memory can be recycled */
+- make_lowmem_page_readwrite(xen_initial_gdt);
-
-- /* We've switched to the "real" per-cpu gdt, so make sure the
-- old memory can be recycled */
-- make_lowmem_page_readwrite(xen_initial_gdt);
--
- xen_filter_cpu_maps();
- xen_setup_vcpu_info_placement();
- }
-@@ -314,7 +309,7 @@ cpu_initialize_context(unsigned int cpu, struct task_struct *idle)
+ #ifdef CONFIG_X86_32
+ /*
+ * Xen starts us with XEN_FLAT_RING1_DS, but linux code
+ * expects __USER_DS
+ */
+- loadsegment(ds, __USER_DS);
+- loadsegment(es, __USER_DS);
++ loadsegment(ds, __KERNEL_DS);
++ loadsegment(es, __KERNEL_DS);
+ #endif
+
+ xen_filter_cpu_maps();
+@@ -364,7 +360,7 @@ cpu_initialize_context(unsigned int cpu, struct task_struct *idle)
ctxt->user_regs.ss = __KERNEL_DS;
#ifdef CONFIG_X86_32
ctxt->user_regs.fs = __KERNEL_PERCPU;
@@ -34508,7 +34241,7 @@ index a1e58e1..9392ad8 100644
#else
ctxt->gs_base_kernel = per_cpu_offset(cpu);
#endif
-@@ -324,8 +319,8 @@ cpu_initialize_context(unsigned int cpu, struct task_struct *idle)
+@@ -374,8 +370,8 @@ cpu_initialize_context(unsigned int cpu, struct task_struct *idle)
{
ctxt->user_regs.eflags = 0x1000; /* IOPL_RING1 */
@@ -34519,7 +34252,7 @@ index a1e58e1..9392ad8 100644
xen_copy_trap_info(ctxt->trap_ctxt);
-@@ -370,13 +365,12 @@ static int __cpuinit xen_cpu_up(unsigned int cpu, struct task_struct *idle)
+@@ -420,13 +416,12 @@ static int xen_cpu_up(unsigned int cpu, struct task_struct *idle)
int rc;
per_cpu(current_task, cpu) = idle;
@@ -34535,15 +34268,15 @@ index a1e58e1..9392ad8 100644
#endif
xen_setup_runstate_info(cpu);
xen_setup_timer(cpu);
-@@ -651,7 +645,7 @@ static const struct smp_ops xen_smp_ops __initconst = {
+@@ -702,7 +697,7 @@ static const struct smp_ops xen_smp_ops __initconst = {
void __init xen_smp_init(void)
{
- smp_ops = xen_smp_ops;
+ memcpy((void *)&smp_ops, &xen_smp_ops, sizeof smp_ops);
xen_fill_possible_map();
- xen_init_spinlocks();
}
+
diff --git a/arch/x86/xen/xen-asm_32.S b/arch/x86/xen/xen-asm_32.S
index 33ca6e4..0ded929 100644
--- a/arch/x86/xen/xen-asm_32.S
@@ -34592,7 +34325,7 @@ index 7faed58..ba4427c 100644
mov %rsi,xen_start_info
mov $init_thread_union+THREAD_SIZE,%rsp
diff --git a/arch/x86/xen/xen-ops.h b/arch/x86/xen/xen-ops.h
-index a95b417..b6dbd0b 100644
+index 95f8c61..611d6e8 100644
--- a/arch/x86/xen/xen-ops.h
+++ b/arch/x86/xen/xen-ops.h
@@ -10,8 +10,6 @@
@@ -34666,19 +34399,19 @@ index af00795..2bb8105 100644
#define XCHAL_ICACHE_SIZE 32768 /* I-cache size in bytes or 0 */
#define XCHAL_DCACHE_SIZE 32768 /* D-cache size in bytes or 0 */
diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c
-index e8918ff..b3ffc51 100644
+index 4e491d9..c8e18e4 100644
--- a/block/blk-cgroup.c
+++ b/block/blk-cgroup.c
-@@ -825,7 +825,7 @@ static void blkcg_css_free(struct cgroup *cgroup)
-
- static struct cgroup_subsys_state *blkcg_css_alloc(struct cgroup *cgroup)
+@@ -812,7 +812,7 @@ static void blkcg_css_free(struct cgroup_subsys_state *css)
+ static struct cgroup_subsys_state *
+ blkcg_css_alloc(struct cgroup_subsys_state *parent_css)
{
- static atomic64_t id_seq = ATOMIC64_INIT(0);
+ static atomic64_unchecked_t id_seq = ATOMIC64_INIT(0);
struct blkcg *blkcg;
- struct cgroup *parent = cgroup->parent;
-@@ -840,7 +840,7 @@ static struct cgroup_subsys_state *blkcg_css_alloc(struct cgroup *cgroup)
+ if (!parent_css) {
+@@ -826,7 +826,7 @@ blkcg_css_alloc(struct cgroup_subsys_state *parent_css)
blkcg->cfq_weight = CFQ_WEIGHT_DEFAULT;
blkcg->cfq_leaf_weight = CFQ_WEIGHT_DEFAULT;
@@ -34688,7 +34421,7 @@ index e8918ff..b3ffc51 100644
spin_lock_init(&blkcg->lock);
INIT_RADIX_TREE(&blkcg->blkg_tree, GFP_ATOMIC);
diff --git a/block/blk-iopoll.c b/block/blk-iopoll.c
-index 58916af..eb9dbcf 100644
+index 4b8d9b54..a7178c0 100644
--- a/block/blk-iopoll.c
+++ b/block/blk-iopoll.c
@@ -77,7 +77,7 @@ void blk_iopoll_complete(struct blk_iopoll *iopoll)
@@ -34696,19 +34429,10 @@ index 58916af..eb9dbcf 100644
EXPORT_SYMBOL(blk_iopoll_complete);
-static void blk_iopoll_softirq(struct softirq_action *h)
-+static void blk_iopoll_softirq(void)
++static __latent_entropy void blk_iopoll_softirq(void)
{
struct list_head *list = &__get_cpu_var(blk_cpu_iopoll);
int rearm = 0, budget = blk_iopoll_budget;
-@@ -209,7 +209,7 @@ static int __cpuinit blk_iopoll_cpu_notify(struct notifier_block *self,
- return NOTIFY_OK;
- }
-
--static struct notifier_block __cpuinitdata blk_iopoll_cpu_notifier = {
-+static struct notifier_block blk_iopoll_cpu_notifier = {
- .notifier_call = blk_iopoll_cpu_notify,
- };
-
diff --git a/block/blk-map.c b/block/blk-map.c
index 623e1cd..ca1e109 100644
--- a/block/blk-map.c
@@ -34723,7 +34447,7 @@ index 623e1cd..ca1e109 100644
bio = bio_copy_kern(q, kbuf, len, gfp_mask, reading);
else
diff --git a/block/blk-softirq.c b/block/blk-softirq.c
-index 467c8de..f3628c5 100644
+index ec9e606..3f38839 100644
--- a/block/blk-softirq.c
+++ b/block/blk-softirq.c
@@ -18,7 +18,7 @@ static DEFINE_PER_CPU(struct list_head, blk_cpu_done);
@@ -34731,19 +34455,10 @@ index 467c8de..f3628c5 100644
* while passing them to the queue registered handler.
*/
-static void blk_done_softirq(struct softirq_action *h)
-+static void blk_done_softirq(void)
++static __latent_entropy void blk_done_softirq(void)
{
struct list_head *cpu_list, local_list;
-@@ -98,7 +98,7 @@ static int __cpuinit blk_cpu_notify(struct notifier_block *self,
- return NOTIFY_OK;
- }
-
--static struct notifier_block __cpuinitdata blk_cpu_notifier = {
-+static struct notifier_block blk_cpu_notifier = {
- .notifier_call = blk_cpu_notify,
- };
-
diff --git a/block/bsg.c b/block/bsg.c
index 420a5a9..23834aa 100644
--- a/block/bsg.c
@@ -34776,10 +34491,10 @@ index 420a5a9..23834aa 100644
if (blk_verify_command(rq->cmd, has_write_perm))
return -EPERM;
diff --git a/block/compat_ioctl.c b/block/compat_ioctl.c
-index 7c668c8..db3521c 100644
+index fbd5a67..5d631b5 100644
--- a/block/compat_ioctl.c
+++ b/block/compat_ioctl.c
-@@ -340,7 +340,7 @@ static int compat_fd_ioctl(struct block_device *bdev, fmode_t mode,
+@@ -341,7 +341,7 @@ static int compat_fd_ioctl(struct block_device *bdev, fmode_t mode,
err |= __get_user(f->spec1, &uf->spec1);
err |= __get_user(f->fmt_gap, &uf->fmt_gap);
err |= __get_user(name, &uf->name);
@@ -34789,7 +34504,7 @@ index 7c668c8..db3521c 100644
err = -EFAULT;
goto out;
diff --git a/block/genhd.c b/block/genhd.c
-index cdeb527..10aa34d 100644
+index 791f419..89f21c4 100644
--- a/block/genhd.c
+++ b/block/genhd.c
@@ -467,21 +467,24 @@ static char *bdevt_str(dev_t devt, char *buf)
@@ -34821,32 +34536,43 @@ index cdeb527..10aa34d 100644
EXPORT_SYMBOL(blk_unregister_region);
diff --git a/block/partitions/efi.c b/block/partitions/efi.c
-index c85fc89..51e690b 100644
+index a8287b4..241a48e 100644
--- a/block/partitions/efi.c
+++ b/block/partitions/efi.c
-@@ -234,14 +234,14 @@ static gpt_entry *alloc_read_gpt_entries(struct parsed_partitions *state,
+@@ -292,14 +292,14 @@ static gpt_entry *alloc_read_gpt_entries(struct parsed_partitions *state,
if (!gpt)
return NULL;
-- count = le32_to_cpu(gpt->num_partition_entries) *
-- le32_to_cpu(gpt->sizeof_partition_entry);
-- if (!count)
+ if (!le32_to_cpu(gpt->num_partition_entries))
- return NULL;
-- pte = kmalloc(count, GFP_KERNEL);
++ return NULL;
+ pte = kcalloc(le32_to_cpu(gpt->num_partition_entries), le32_to_cpu(gpt->sizeof_partition_entry), GFP_KERNEL);
- if (!pte)
- return NULL;
-
-+ count = le32_to_cpu(gpt->num_partition_entries) *
-+ le32_to_cpu(gpt->sizeof_partition_entry);
++ if (!pte)
++ return NULL;
++
+ count = le32_to_cpu(gpt->num_partition_entries) *
+ le32_to_cpu(gpt->sizeof_partition_entry);
+- if (!count)
+- return NULL;
+- pte = kmalloc(count, GFP_KERNEL);
+- if (!pte)
+- return NULL;
+-
if (read_lba(state, le64_to_cpu(gpt->partition_entry_lba),
- (u8 *) pte,
- count) < count) {
+ (u8 *) pte, count) < count) {
+ kfree(pte);
diff --git a/block/scsi_ioctl.c b/block/scsi_ioctl.c
-index a5ffcc9..3cedc9c 100644
+index a5ffcc9..e057498 100644
--- a/block/scsi_ioctl.c
+++ b/block/scsi_ioctl.c
+@@ -67,7 +67,7 @@ static int scsi_get_bus(struct request_queue *q, int __user *p)
+ return put_user(0, p);
+ }
+
+-static int sg_get_timeout(struct request_queue *q)
++static int __intentional_overflow(-1) sg_get_timeout(struct request_queue *q)
+ {
+ return jiffies_to_clock_t(q->sg_timeout);
+ }
@@ -224,8 +224,20 @@ EXPORT_SYMBOL(blk_verify_command);
static int blk_fill_sghdr_rq(struct request_queue *q, struct request *rq,
struct sg_io_hdr *hdr, fmode_t mode)
@@ -34921,7 +34647,7 @@ index 7bdd61b..afec999 100644
static void cryptd_queue_worker(struct work_struct *work);
diff --git a/crypto/pcrypt.c b/crypto/pcrypt.c
-index b2c99dc..476c9fb 100644
+index f8c920c..ab2cb5a 100644
--- a/crypto/pcrypt.c
+++ b/crypto/pcrypt.c
@@ -440,7 +440,7 @@ static int pcrypt_sysfs_add(struct padata_instance *pinst, const char *name)
@@ -34933,17 +34659,6 @@ index b2c99dc..476c9fb 100644
if (!ret)
kobject_uevent(&pinst->kobj, KOBJ_ADD);
-@@ -455,8 +455,8 @@ static int pcrypt_init_padata(struct padata_pcrypt *pcrypt,
-
- get_online_cpus();
-
-- pcrypt->wq = alloc_workqueue(name,
-- WQ_MEM_RECLAIM | WQ_CPU_INTENSIVE, 1);
-+ pcrypt->wq = alloc_workqueue("%s",
-+ WQ_MEM_RECLAIM | WQ_CPU_INTENSIVE, 1, name);
- if (!pcrypt->wq)
- goto err;
-
diff --git a/drivers/acpi/apei/apei-internal.h b/drivers/acpi/apei/apei-internal.h
index f220d64..d359ad6 100644
--- a/drivers/acpi/apei/apei-internal.h
@@ -34979,10 +34694,10 @@ index 33dc6a0..4b24b47 100644
EXPORT_SYMBOL_GPL(cper_next_record_id);
diff --git a/drivers/acpi/apei/ghes.c b/drivers/acpi/apei/ghes.c
-index fcd7d91..6b2f1a3 100644
+index 8ec37bb..b0716e5 100644
--- a/drivers/acpi/apei/ghes.c
+++ b/drivers/acpi/apei/ghes.c
-@@ -468,7 +468,7 @@ static void __ghes_print_estatus(const char *pfx,
+@@ -498,7 +498,7 @@ static void __ghes_print_estatus(const char *pfx,
const struct acpi_hest_generic *generic,
const struct acpi_hest_generic_status *estatus)
{
@@ -34991,7 +34706,7 @@ index fcd7d91..6b2f1a3 100644
unsigned int curr_seqno;
char pfx_seq[64];
-@@ -479,7 +479,7 @@ static void __ghes_print_estatus(const char *pfx,
+@@ -509,7 +509,7 @@ static void __ghes_print_estatus(const char *pfx,
else
pfx = KERN_ERR;
}
@@ -35001,24 +34716,24 @@ index fcd7d91..6b2f1a3 100644
printk("%s""Hardware error from APEI Generic Hardware Error Source: %d\n",
pfx_seq, generic->header.source_id);
diff --git a/drivers/acpi/bgrt.c b/drivers/acpi/bgrt.c
-index be60399..778b33e8 100644
+index a83e3c6..c3d617f 100644
--- a/drivers/acpi/bgrt.c
+++ b/drivers/acpi/bgrt.c
-@@ -87,8 +87,10 @@ static int __init bgrt_init(void)
+@@ -86,8 +86,10 @@ static int __init bgrt_init(void)
+ if (!bgrt_image)
return -ENODEV;
- sysfs_bin_attr_init(&image_attr);
-- image_attr.private = bgrt_image;
-- image_attr.size = bgrt_image_size;
+- bin_attr_image.private = bgrt_image;
+- bin_attr_image.size = bgrt_image_size;
+ pax_open_kernel();
-+ *(void **)&image_attr.private = bgrt_image;
-+ *(size_t *)&image_attr.size = bgrt_image_size;
++ *(void **)&bin_attr_image.private = bgrt_image;
++ *(size_t *)&bin_attr_image.size = bgrt_image_size;
+ pax_close_kernel();
bgrt_kobj = kobject_create_and_add("bgrt", acpi_kobj);
if (!bgrt_kobj)
diff --git a/drivers/acpi/blacklist.c b/drivers/acpi/blacklist.c
-index cb96296..b81293b 100644
+index 9515f18..4b149c9 100644
--- a/drivers/acpi/blacklist.c
+++ b/drivers/acpi/blacklist.c
@@ -52,7 +52,7 @@ struct acpi_blacklist_item {
@@ -35030,7 +34745,7 @@ index cb96296..b81293b 100644
/*
* POLICY: If *anything* doesn't work, put it on the blacklist.
-@@ -193,7 +193,7 @@ static int __init dmi_disable_osi_win7(const struct dmi_system_id *d)
+@@ -199,7 +199,7 @@ static int __init dmi_disable_osi_win8(const struct dmi_system_id *d)
return 0;
}
@@ -35039,64 +34754,11 @@ index cb96296..b81293b 100644
{
.callback = dmi_disable_osi_vista,
.ident = "Fujitsu Siemens",
-diff --git a/drivers/acpi/ec_sys.c b/drivers/acpi/ec_sys.c
-index 7586544..636a2f0 100644
---- a/drivers/acpi/ec_sys.c
-+++ b/drivers/acpi/ec_sys.c
-@@ -12,6 +12,7 @@
- #include <linux/acpi.h>
- #include <linux/debugfs.h>
- #include <linux/module.h>
-+#include <linux/uaccess.h>
- #include "internal.h"
-
- MODULE_AUTHOR("Thomas Renninger <trenn@suse.de>");
-@@ -34,7 +35,7 @@ static ssize_t acpi_ec_read_io(struct file *f, char __user *buf,
- * struct acpi_ec *ec = ((struct seq_file *)f->private_data)->private;
- */
- unsigned int size = EC_SPACE_SIZE;
-- u8 *data = (u8 *) buf;
-+ u8 data;
- loff_t init_off = *off;
- int err = 0;
-
-@@ -47,9 +48,11 @@ static ssize_t acpi_ec_read_io(struct file *f, char __user *buf,
- size = count;
-
- while (size) {
-- err = ec_read(*off, &data[*off - init_off]);
-+ err = ec_read(*off, &data);
- if (err)
- return err;
-+ if (put_user(data, &buf[*off - init_off]))
-+ return -EFAULT;
- *off += 1;
- size--;
- }
-@@ -65,7 +68,6 @@ static ssize_t acpi_ec_write_io(struct file *f, const char __user *buf,
-
- unsigned int size = count;
- loff_t init_off = *off;
-- u8 *data = (u8 *) buf;
- int err = 0;
-
- if (*off >= EC_SPACE_SIZE)
-@@ -76,7 +78,9 @@ static ssize_t acpi_ec_write_io(struct file *f, const char __user *buf,
- }
-
- while (size) {
-- u8 byte_write = data[*off - init_off];
-+ u8 byte_write;
-+ if (get_user(byte_write, &buf[*off - init_off]))
-+ return -EFAULT;
- err = ec_write(*off, byte_write);
- if (err)
- return err;
diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c
-index 4056d31..ef54bc1 100644
+index c7414a5..d5afd71 100644
--- a/drivers/acpi/processor_idle.c
+++ b/drivers/acpi/processor_idle.c
-@@ -968,7 +968,7 @@ static int acpi_processor_setup_cpuidle_states(struct acpi_processor *pr)
+@@ -966,7 +966,7 @@ static int acpi_processor_setup_cpuidle_states(struct acpi_processor *pr)
{
int i, count = CPUIDLE_DRIVER_STATE_START;
struct acpi_processor_cx *cx;
@@ -35106,7 +34768,7 @@ index 4056d31..ef54bc1 100644
if (!pr->flags.power_setup_done)
diff --git a/drivers/acpi/sysfs.c b/drivers/acpi/sysfs.c
-index fcae5fa..e9f71ea 100644
+index 05306a5..733d1f0 100644
--- a/drivers/acpi/sysfs.c
+++ b/drivers/acpi/sysfs.c
@@ -423,11 +423,11 @@ static u32 num_counters;
@@ -35124,10 +34786,10 @@ index fcae5fa..e9f71ea 100644
static void delete_gpe_attr_array(void)
{
diff --git a/drivers/ata/libahci.c b/drivers/ata/libahci.c
-index 8905e03..d1b0719 100644
+index cfb7447..98f2149 100644
--- a/drivers/ata/libahci.c
+++ b/drivers/ata/libahci.c
-@@ -1230,7 +1230,7 @@ int ahci_kick_engine(struct ata_port *ap)
+@@ -1239,7 +1239,7 @@ int ahci_kick_engine(struct ata_port *ap)
}
EXPORT_SYMBOL_GPL(ahci_kick_engine);
@@ -35137,7 +34799,7 @@ index 8905e03..d1b0719 100644
unsigned long timeout_msec)
{
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
-index cd6aa28..6f5e966 100644
+index 81a94a3..b711c74 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -98,7 +98,7 @@ static unsigned int ata_dev_set_xfermode(struct ata_device *dev);
@@ -35149,7 +34811,7 @@ index cd6aa28..6f5e966 100644
struct ata_force_param {
const char *name;
-@@ -4793,7 +4793,7 @@ void ata_qc_free(struct ata_queued_cmd *qc)
+@@ -4809,7 +4809,7 @@ void ata_qc_free(struct ata_queued_cmd *qc)
struct ata_port *ap;
unsigned int tag;
@@ -35158,7 +34820,7 @@ index cd6aa28..6f5e966 100644
ap = qc->ap;
qc->flags = 0;
-@@ -4809,7 +4809,7 @@ void __ata_qc_complete(struct ata_queued_cmd *qc)
+@@ -4825,7 +4825,7 @@ void __ata_qc_complete(struct ata_queued_cmd *qc)
struct ata_port *ap;
struct ata_link *link;
@@ -35167,7 +34829,7 @@ index cd6aa28..6f5e966 100644
WARN_ON_ONCE(!(qc->flags & ATA_QCFLAG_ACTIVE));
ap = qc->ap;
link = qc->dev->link;
-@@ -5927,6 +5927,7 @@ static void ata_finalize_port_ops(struct ata_port_operations *ops)
+@@ -5944,6 +5944,7 @@ static void ata_finalize_port_ops(struct ata_port_operations *ops)
return;
spin_lock(&lock);
@@ -35175,7 +34837,7 @@ index cd6aa28..6f5e966 100644
for (cur = ops->inherits; cur; cur = cur->inherits) {
void **inherit = (void **)cur;
-@@ -5940,8 +5941,9 @@ static void ata_finalize_port_ops(struct ata_port_operations *ops)
+@@ -5957,8 +5958,9 @@ static void ata_finalize_port_ops(struct ata_port_operations *ops)
if (IS_ERR(*pp))
*pp = NULL;
@@ -35186,20 +34848,20 @@ index cd6aa28..6f5e966 100644
spin_unlock(&lock);
}
-@@ -6134,7 +6136,7 @@ int ata_host_register(struct ata_host *host, struct scsi_host_template *sht)
+@@ -6151,7 +6153,7 @@ int ata_host_register(struct ata_host *host, struct scsi_host_template *sht)
/* give ports names and add SCSI hosts */
- for (i = 0; i < host->n_ports; i++)
+ for (i = 0; i < host->n_ports; i++) {
- host->ports[i]->print_id = atomic_inc_return(&ata_print_id);
+ host->ports[i]->print_id = atomic_inc_return_unchecked(&ata_print_id);
+ host->ports[i]->local_port_no = i + 1;
+ }
-
- /* Create associated sysfs transport objects */
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
-index 0101af5..c70c325 100644
+index db6dfcf..770d1f0 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
-@@ -4105,7 +4105,7 @@ int ata_sas_port_init(struct ata_port *ap)
+@@ -4113,7 +4113,7 @@ int ata_sas_port_init(struct ata_port *ap)
if (rc)
return rc;
@@ -35209,7 +34871,7 @@ index 0101af5..c70c325 100644
}
EXPORT_SYMBOL_GPL(ata_sas_port_init);
diff --git a/drivers/ata/libata.h b/drivers/ata/libata.h
-index 577d902b..cb4781e 100644
+index 45b5ab3..98446b8 100644
--- a/drivers/ata/libata.h
+++ b/drivers/ata/libata.h
@@ -53,7 +53,7 @@ enum {
@@ -35222,7 +34884,7 @@ index 577d902b..cb4781e 100644
extern int libata_fua;
extern int libata_noacpi;
diff --git a/drivers/ata/pata_arasan_cf.c b/drivers/ata/pata_arasan_cf.c
-index 7638121..357a965 100644
+index 853f610..97d24da 100644
--- a/drivers/ata/pata_arasan_cf.c
+++ b/drivers/ata/pata_arasan_cf.c
@@ -865,7 +865,9 @@ static int arasan_cf_probe(struct platform_device *pdev)
@@ -35250,7 +34912,7 @@ index f9b983a..887b9d8 100644
return 0;
}
diff --git a/drivers/atm/ambassador.c b/drivers/atm/ambassador.c
-index 77a7480d..05cde58 100644
+index 62a7607..cc4be104 100644
--- a/drivers/atm/ambassador.c
+++ b/drivers/atm/ambassador.c
@@ -454,7 +454,7 @@ static void tx_complete (amb_dev * dev, tx_out * tx) {
@@ -35489,10 +35151,10 @@ index 204814e..cede831 100644
fore200e->tx_sat++;
DPRINTK(2, "tx queue of device %s is saturated, PDU dropped - heartbeat is %08x\n",
diff --git a/drivers/atm/he.c b/drivers/atm/he.c
-index 507362a..a845e57 100644
+index 8557adc..3fb5d55 100644
--- a/drivers/atm/he.c
+++ b/drivers/atm/he.c
-@@ -1698,7 +1698,7 @@ he_service_rbrq(struct he_dev *he_dev, int group)
+@@ -1691,7 +1691,7 @@ he_service_rbrq(struct he_dev *he_dev, int group)
if (RBRQ_HBUF_ERR(he_dev->rbrq_head)) {
hprintk("HBUF_ERR! (cid 0x%x)\n", cid);
@@ -35501,7 +35163,7 @@ index 507362a..a845e57 100644
goto return_host_buffers;
}
-@@ -1725,7 +1725,7 @@ he_service_rbrq(struct he_dev *he_dev, int group)
+@@ -1718,7 +1718,7 @@ he_service_rbrq(struct he_dev *he_dev, int group)
RBRQ_LEN_ERR(he_dev->rbrq_head)
? "LEN_ERR" : "",
vcc->vpi, vcc->vci);
@@ -35510,7 +35172,7 @@ index 507362a..a845e57 100644
goto return_host_buffers;
}
-@@ -1777,7 +1777,7 @@ he_service_rbrq(struct he_dev *he_dev, int group)
+@@ -1770,7 +1770,7 @@ he_service_rbrq(struct he_dev *he_dev, int group)
vcc->push(vcc, skb);
spin_lock(&he_dev->global_lock);
@@ -35519,7 +35181,7 @@ index 507362a..a845e57 100644
return_host_buffers:
++pdus_assembled;
-@@ -2103,7 +2103,7 @@ __enqueue_tpd(struct he_dev *he_dev, struct he_tpd *tpd, unsigned cid)
+@@ -2096,7 +2096,7 @@ __enqueue_tpd(struct he_dev *he_dev, struct he_tpd *tpd, unsigned cid)
tpd->vcc->pop(tpd->vcc, tpd->skb);
else
dev_kfree_skb_any(tpd->skb);
@@ -35528,7 +35190,7 @@ index 507362a..a845e57 100644
}
pci_pool_free(he_dev->tpd_pool, tpd, TPD_ADDR(tpd->status));
return;
-@@ -2515,7 +2515,7 @@ he_send(struct atm_vcc *vcc, struct sk_buff *skb)
+@@ -2508,7 +2508,7 @@ he_send(struct atm_vcc *vcc, struct sk_buff *skb)
vcc->pop(vcc, skb);
else
dev_kfree_skb_any(skb);
@@ -35537,7 +35199,7 @@ index 507362a..a845e57 100644
return -EINVAL;
}
-@@ -2526,7 +2526,7 @@ he_send(struct atm_vcc *vcc, struct sk_buff *skb)
+@@ -2519,7 +2519,7 @@ he_send(struct atm_vcc *vcc, struct sk_buff *skb)
vcc->pop(vcc, skb);
else
dev_kfree_skb_any(skb);
@@ -35546,7 +35208,7 @@ index 507362a..a845e57 100644
return -EINVAL;
}
#endif
-@@ -2538,7 +2538,7 @@ he_send(struct atm_vcc *vcc, struct sk_buff *skb)
+@@ -2531,7 +2531,7 @@ he_send(struct atm_vcc *vcc, struct sk_buff *skb)
vcc->pop(vcc, skb);
else
dev_kfree_skb_any(skb);
@@ -35555,7 +35217,7 @@ index 507362a..a845e57 100644
spin_unlock_irqrestore(&he_dev->global_lock, flags);
return -ENOMEM;
}
-@@ -2580,7 +2580,7 @@ he_send(struct atm_vcc *vcc, struct sk_buff *skb)
+@@ -2573,7 +2573,7 @@ he_send(struct atm_vcc *vcc, struct sk_buff *skb)
vcc->pop(vcc, skb);
else
dev_kfree_skb_any(skb);
@@ -35564,7 +35226,7 @@ index 507362a..a845e57 100644
spin_unlock_irqrestore(&he_dev->global_lock, flags);
return -ENOMEM;
}
-@@ -2611,7 +2611,7 @@ he_send(struct atm_vcc *vcc, struct sk_buff *skb)
+@@ -2604,7 +2604,7 @@ he_send(struct atm_vcc *vcc, struct sk_buff *skb)
__enqueue_tpd(he_dev, tpd, cid);
spin_unlock_irqrestore(&he_dev->global_lock, flags);
@@ -35912,10 +35574,10 @@ index fa7d701..1e404c7 100644
lvcc->rx.buf.ptr = &lvcc->rx.buf.start[SERVICE_GET_END(s) * 4];
cardvcc_write(lvcc, SERVICE_GET_END(s), vcc_rxreadptr);
diff --git a/drivers/atm/nicstar.c b/drivers/atm/nicstar.c
-index 6587dc2..149833d 100644
+index 5aca5f4..ce3a6b0 100644
--- a/drivers/atm/nicstar.c
+++ b/drivers/atm/nicstar.c
-@@ -1641,7 +1641,7 @@ static int ns_send(struct atm_vcc *vcc, struct sk_buff *skb)
+@@ -1640,7 +1640,7 @@ static int ns_send(struct atm_vcc *vcc, struct sk_buff *skb)
if ((vc = (vc_map *) vcc->dev_data) == NULL) {
printk("nicstar%d: vcc->dev_data == NULL on ns_send().\n",
card->index);
@@ -35924,7 +35586,7 @@ index 6587dc2..149833d 100644
dev_kfree_skb_any(skb);
return -EINVAL;
}
-@@ -1649,7 +1649,7 @@ static int ns_send(struct atm_vcc *vcc, struct sk_buff *skb)
+@@ -1648,7 +1648,7 @@ static int ns_send(struct atm_vcc *vcc, struct sk_buff *skb)
if (!vc->tx) {
printk("nicstar%d: Trying to transmit on a non-tx VC.\n",
card->index);
@@ -35933,7 +35595,7 @@ index 6587dc2..149833d 100644
dev_kfree_skb_any(skb);
return -EINVAL;
}
-@@ -1657,14 +1657,14 @@ static int ns_send(struct atm_vcc *vcc, struct sk_buff *skb)
+@@ -1656,14 +1656,14 @@ static int ns_send(struct atm_vcc *vcc, struct sk_buff *skb)
if (vcc->qos.aal != ATM_AAL5 && vcc->qos.aal != ATM_AAL0) {
printk("nicstar%d: Only AAL0 and AAL5 are supported.\n",
card->index);
@@ -35950,7 +35612,7 @@ index 6587dc2..149833d 100644
dev_kfree_skb_any(skb);
return -EINVAL;
}
-@@ -1712,11 +1712,11 @@ static int ns_send(struct atm_vcc *vcc, struct sk_buff *skb)
+@@ -1711,11 +1711,11 @@ static int ns_send(struct atm_vcc *vcc, struct sk_buff *skb)
}
if (push_scqe(card, vc, scq, &scqe, skb) != 0) {
@@ -35964,7 +35626,7 @@ index 6587dc2..149833d 100644
return 0;
}
-@@ -2033,14 +2033,14 @@ static void dequeue_rx(ns_dev * card, ns_rsqe * rsqe)
+@@ -2032,14 +2032,14 @@ static void dequeue_rx(ns_dev * card, ns_rsqe * rsqe)
printk
("nicstar%d: Can't allocate buffers for aal0.\n",
card->index);
@@ -35981,7 +35643,7 @@ index 6587dc2..149833d 100644
dev_kfree_skb_any(sb);
break;
}
-@@ -2055,7 +2055,7 @@ static void dequeue_rx(ns_dev * card, ns_rsqe * rsqe)
+@@ -2054,7 +2054,7 @@ static void dequeue_rx(ns_dev * card, ns_rsqe * rsqe)
ATM_SKB(sb)->vcc = vcc;
__net_timestamp(sb);
vcc->push(vcc, sb);
@@ -35990,7 +35652,7 @@ index 6587dc2..149833d 100644
cell += ATM_CELL_PAYLOAD;
}
-@@ -2072,7 +2072,7 @@ static void dequeue_rx(ns_dev * card, ns_rsqe * rsqe)
+@@ -2071,7 +2071,7 @@ static void dequeue_rx(ns_dev * card, ns_rsqe * rsqe)
if (iovb == NULL) {
printk("nicstar%d: Out of iovec buffers.\n",
card->index);
@@ -35999,7 +35661,7 @@ index 6587dc2..149833d 100644
recycle_rx_buf(card, skb);
return;
}
-@@ -2096,7 +2096,7 @@ static void dequeue_rx(ns_dev * card, ns_rsqe * rsqe)
+@@ -2095,7 +2095,7 @@ static void dequeue_rx(ns_dev * card, ns_rsqe * rsqe)
small or large buffer itself. */
} else if (NS_PRV_IOVCNT(iovb) >= NS_MAX_IOVECS) {
printk("nicstar%d: received too big AAL5 SDU.\n", card->index);
@@ -36008,7 +35670,7 @@ index 6587dc2..149833d 100644
recycle_iovec_rx_bufs(card, (struct iovec *)iovb->data,
NS_MAX_IOVECS);
NS_PRV_IOVCNT(iovb) = 0;
-@@ -2116,7 +2116,7 @@ static void dequeue_rx(ns_dev * card, ns_rsqe * rsqe)
+@@ -2115,7 +2115,7 @@ static void dequeue_rx(ns_dev * card, ns_rsqe * rsqe)
("nicstar%d: Expected a small buffer, and this is not one.\n",
card->index);
which_list(card, skb);
@@ -36017,7 +35679,7 @@ index 6587dc2..149833d 100644
recycle_rx_buf(card, skb);
vc->rx_iov = NULL;
recycle_iov_buf(card, iovb);
-@@ -2129,7 +2129,7 @@ static void dequeue_rx(ns_dev * card, ns_rsqe * rsqe)
+@@ -2128,7 +2128,7 @@ static void dequeue_rx(ns_dev * card, ns_rsqe * rsqe)
("nicstar%d: Expected a large buffer, and this is not one.\n",
card->index);
which_list(card, skb);
@@ -36026,7 +35688,7 @@ index 6587dc2..149833d 100644
recycle_iovec_rx_bufs(card, (struct iovec *)iovb->data,
NS_PRV_IOVCNT(iovb));
vc->rx_iov = NULL;
-@@ -2152,7 +2152,7 @@ static void dequeue_rx(ns_dev * card, ns_rsqe * rsqe)
+@@ -2151,7 +2151,7 @@ static void dequeue_rx(ns_dev * card, ns_rsqe * rsqe)
printk(" - PDU size mismatch.\n");
else
printk(".\n");
@@ -36035,7 +35697,7 @@ index 6587dc2..149833d 100644
recycle_iovec_rx_bufs(card, (struct iovec *)iovb->data,
NS_PRV_IOVCNT(iovb));
vc->rx_iov = NULL;
-@@ -2166,7 +2166,7 @@ static void dequeue_rx(ns_dev * card, ns_rsqe * rsqe)
+@@ -2165,7 +2165,7 @@ static void dequeue_rx(ns_dev * card, ns_rsqe * rsqe)
/* skb points to a small buffer */
if (!atm_charge(vcc, skb->truesize)) {
push_rxbufs(card, skb);
@@ -36044,7 +35706,7 @@ index 6587dc2..149833d 100644
} else {
skb_put(skb, len);
dequeue_sm_buf(card, skb);
-@@ -2176,7 +2176,7 @@ static void dequeue_rx(ns_dev * card, ns_rsqe * rsqe)
+@@ -2175,7 +2175,7 @@ static void dequeue_rx(ns_dev * card, ns_rsqe * rsqe)
ATM_SKB(skb)->vcc = vcc;
__net_timestamp(skb);
vcc->push(vcc, skb);
@@ -36053,7 +35715,7 @@ index 6587dc2..149833d 100644
}
} else if (NS_PRV_IOVCNT(iovb) == 2) { /* One small plus one large buffer */
struct sk_buff *sb;
-@@ -2187,7 +2187,7 @@ static void dequeue_rx(ns_dev * card, ns_rsqe * rsqe)
+@@ -2186,7 +2186,7 @@ static void dequeue_rx(ns_dev * card, ns_rsqe * rsqe)
if (len <= NS_SMBUFSIZE) {
if (!atm_charge(vcc, sb->truesize)) {
push_rxbufs(card, sb);
@@ -36062,7 +35724,7 @@ index 6587dc2..149833d 100644
} else {
skb_put(sb, len);
dequeue_sm_buf(card, sb);
-@@ -2197,7 +2197,7 @@ static void dequeue_rx(ns_dev * card, ns_rsqe * rsqe)
+@@ -2196,7 +2196,7 @@ static void dequeue_rx(ns_dev * card, ns_rsqe * rsqe)
ATM_SKB(sb)->vcc = vcc;
__net_timestamp(sb);
vcc->push(vcc, sb);
@@ -36071,7 +35733,7 @@ index 6587dc2..149833d 100644
}
push_rxbufs(card, skb);
-@@ -2206,7 +2206,7 @@ static void dequeue_rx(ns_dev * card, ns_rsqe * rsqe)
+@@ -2205,7 +2205,7 @@ static void dequeue_rx(ns_dev * card, ns_rsqe * rsqe)
if (!atm_charge(vcc, skb->truesize)) {
push_rxbufs(card, skb);
@@ -36080,7 +35742,7 @@ index 6587dc2..149833d 100644
} else {
dequeue_lg_buf(card, skb);
#ifdef NS_USE_DESTRUCTORS
-@@ -2219,7 +2219,7 @@ static void dequeue_rx(ns_dev * card, ns_rsqe * rsqe)
+@@ -2218,7 +2218,7 @@ static void dequeue_rx(ns_dev * card, ns_rsqe * rsqe)
ATM_SKB(skb)->vcc = vcc;
__net_timestamp(skb);
vcc->push(vcc, skb);
@@ -36089,7 +35751,7 @@ index 6587dc2..149833d 100644
}
push_rxbufs(card, sb);
-@@ -2240,7 +2240,7 @@ static void dequeue_rx(ns_dev * card, ns_rsqe * rsqe)
+@@ -2239,7 +2239,7 @@ static void dequeue_rx(ns_dev * card, ns_rsqe * rsqe)
printk
("nicstar%d: Out of huge buffers.\n",
card->index);
@@ -36098,7 +35760,7 @@ index 6587dc2..149833d 100644
recycle_iovec_rx_bufs(card,
(struct iovec *)
iovb->data,
-@@ -2291,7 +2291,7 @@ static void dequeue_rx(ns_dev * card, ns_rsqe * rsqe)
+@@ -2290,7 +2290,7 @@ static void dequeue_rx(ns_dev * card, ns_rsqe * rsqe)
card->hbpool.count++;
} else
dev_kfree_skb_any(hb);
@@ -36107,7 +35769,7 @@ index 6587dc2..149833d 100644
} else {
/* Copy the small buffer to the huge buffer */
sb = (struct sk_buff *)iov->iov_base;
-@@ -2328,7 +2328,7 @@ static void dequeue_rx(ns_dev * card, ns_rsqe * rsqe)
+@@ -2327,7 +2327,7 @@ static void dequeue_rx(ns_dev * card, ns_rsqe * rsqe)
#endif /* NS_USE_DESTRUCTORS */
__net_timestamp(hb);
vcc->push(vcc, hb);
@@ -36232,24 +35894,11 @@ index 969c3c2..9b72956 100644
wake_up(&zatm_vcc->tx_wait);
}
-diff --git a/drivers/base/attribute_container.c b/drivers/base/attribute_container.c
-index d78b204..ecc1929 100644
---- a/drivers/base/attribute_container.c
-+++ b/drivers/base/attribute_container.c
-@@ -167,7 +167,7 @@ attribute_container_add_device(struct device *dev,
- ic->classdev.parent = get_device(dev);
- ic->classdev.class = cont->class;
- cont->class->dev_release = attribute_container_release;
-- dev_set_name(&ic->classdev, dev_name(dev));
-+ dev_set_name(&ic->classdev, "%s", dev_name(dev));
- if (fn)
- fn(cont, dev, &ic->classdev);
- else
diff --git a/drivers/base/bus.c b/drivers/base/bus.c
-index d414331..b4dd4ba 100644
+index 4c289ab..de1c333 100644
--- a/drivers/base/bus.c
+++ b/drivers/base/bus.c
-@@ -1163,7 +1163,7 @@ int subsys_interface_register(struct subsys_interface *sif)
+@@ -1193,7 +1193,7 @@ int subsys_interface_register(struct subsys_interface *sif)
return -EINVAL;
mutex_lock(&subsys->p->mutex);
@@ -36258,7 +35907,7 @@ index d414331..b4dd4ba 100644
if (sif->add_dev) {
subsys_dev_iter_init(&iter, subsys, NULL, NULL);
while ((dev = subsys_dev_iter_next(&iter)))
-@@ -1188,7 +1188,7 @@ void subsys_interface_unregister(struct subsys_interface *sif)
+@@ -1218,7 +1218,7 @@ void subsys_interface_unregister(struct subsys_interface *sif)
subsys = sif->subsys;
mutex_lock(&subsys->p->mutex);
@@ -36296,10 +35945,10 @@ index 7413d06..79155fa 100644
while (1) {
spin_lock(&req_lock);
diff --git a/drivers/base/node.c b/drivers/base/node.c
-index 7616a77c..8f57f51 100644
+index bc9f43b..29703b8 100644
--- a/drivers/base/node.c
+++ b/drivers/base/node.c
-@@ -626,7 +626,7 @@ static ssize_t print_nodes_state(enum node_states state, char *buf)
+@@ -620,7 +620,7 @@ static ssize_t print_nodes_state(enum node_states state, char *buf)
struct node_attr {
struct device_attribute attr;
enum node_states state;
@@ -36309,7 +35958,7 @@ index 7616a77c..8f57f51 100644
static ssize_t show_node_state(struct device *dev,
struct device_attribute *attr, char *buf)
diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c
-index 7072404..76dcebd 100644
+index bfb8955..42c9b9a 100644
--- a/drivers/base/power/domain.c
+++ b/drivers/base/power/domain.c
@@ -1850,7 +1850,7 @@ int pm_genpd_attach_cpuidle(struct generic_pm_domain *genpd, int state)
@@ -36331,7 +35980,7 @@ index 7072404..76dcebd 100644
if (IS_ERR_OR_NULL(genpd))
diff --git a/drivers/base/power/sysfs.c b/drivers/base/power/sysfs.c
-index a53ebd2..8f73eeb 100644
+index 03e089a..0e9560c 100644
--- a/drivers/base/power/sysfs.c
+++ b/drivers/base/power/sysfs.c
@@ -185,7 +185,7 @@ static ssize_t rtpm_status_show(struct device *dev,
@@ -36344,7 +35993,7 @@ index a53ebd2..8f73eeb 100644
static DEVICE_ATTR(runtime_status, 0444, rtpm_status_show, NULL);
diff --git a/drivers/base/power/wakeup.c b/drivers/base/power/wakeup.c
-index 79715e7..df06b3b 100644
+index 2d56f41..8830f19 100644
--- a/drivers/base/power/wakeup.c
+++ b/drivers/base/power/wakeup.c
@@ -29,14 +29,14 @@ bool events_check_enabled __read_mostly;
@@ -36405,7 +36054,7 @@ index e8d11b6..7b1b36f 100644
}
EXPORT_SYMBOL_GPL(unregister_syscore_ops);
diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c
-index 90a4e6b..002d10f 100644
+index edfa251..1734d4d 100644
--- a/drivers/block/cciss.c
+++ b/drivers/block/cciss.c
@@ -3011,7 +3011,7 @@ static void start_io(ctlr_info_t *h)
@@ -36465,7 +36114,7 @@ index 90a4e6b..002d10f 100644
h->transMethod = CFGTBL_Trans_Performant;
return;
-@@ -4320,7 +4320,7 @@ static int cciss_pci_init(ctlr_info_t *h)
+@@ -4327,7 +4327,7 @@ static int cciss_pci_init(ctlr_info_t *h)
if (prod_index < 0)
return -ENODEV;
h->product_name = products[prod_index].product_name;
@@ -36474,7 +36123,7 @@ index 90a4e6b..002d10f 100644
if (cciss_board_disabled(h)) {
dev_warn(&h->pdev->dev, "controller appears to be disabled\n");
-@@ -5052,7 +5052,7 @@ reinit_after_soft_reset:
+@@ -5059,7 +5059,7 @@ reinit_after_soft_reset:
}
/* make sure the board interrupts are off */
@@ -36483,7 +36132,7 @@ index 90a4e6b..002d10f 100644
rc = cciss_request_irq(h, do_cciss_msix_intr, do_cciss_intx);
if (rc)
goto clean2;
-@@ -5102,7 +5102,7 @@ reinit_after_soft_reset:
+@@ -5109,7 +5109,7 @@ reinit_after_soft_reset:
* fake ones to scoop up any residual completions.
*/
spin_lock_irqsave(&h->lock, flags);
@@ -36492,7 +36141,7 @@ index 90a4e6b..002d10f 100644
spin_unlock_irqrestore(&h->lock, flags);
free_irq(h->intr[h->intr_mode], h);
rc = cciss_request_irq(h, cciss_msix_discard_completions,
-@@ -5122,9 +5122,9 @@ reinit_after_soft_reset:
+@@ -5129,9 +5129,9 @@ reinit_after_soft_reset:
dev_info(&h->pdev->dev, "Board READY.\n");
dev_info(&h->pdev->dev,
"Waiting for stale completions to drain.\n");
@@ -36504,7 +36153,7 @@ index 90a4e6b..002d10f 100644
rc = controller_reset_failed(h->cfgtable);
if (rc)
-@@ -5147,7 +5147,7 @@ reinit_after_soft_reset:
+@@ -5154,7 +5154,7 @@ reinit_after_soft_reset:
cciss_scsi_setup(h);
/* Turn the interrupts on so we can service requests */
@@ -36513,7 +36162,7 @@ index 90a4e6b..002d10f 100644
/* Get the firmware version */
inq_buff = kzalloc(sizeof(InquiryData_struct), GFP_KERNEL);
-@@ -5219,7 +5219,7 @@ static void cciss_shutdown(struct pci_dev *pdev)
+@@ -5226,7 +5226,7 @@ static void cciss_shutdown(struct pci_dev *pdev)
kfree(flush_buf);
if (return_code != IO_OK)
dev_warn(&h->pdev->dev, "Error flushing cache\n");
@@ -36669,7 +36318,7 @@ index be73e9d..7fbf140 100644
cmdlist_t *reqQ;
cmdlist_t *cmpQ;
diff --git a/drivers/block/drbd/drbd_int.h b/drivers/block/drbd/drbd_int.h
-index f943aac..99bfd19 100644
+index 2d7f608..11245fe 100644
--- a/drivers/block/drbd/drbd_int.h
+++ b/drivers/block/drbd/drbd_int.h
@@ -582,7 +582,7 @@ struct drbd_epoch {
@@ -36681,7 +36330,7 @@ index f943aac..99bfd19 100644
atomic_t active; /* increased on every req. added, and dec on every finished. */
unsigned long flags;
};
-@@ -1021,7 +1021,7 @@ struct drbd_conf {
+@@ -1022,7 +1022,7 @@ struct drbd_conf {
unsigned int al_tr_number;
int al_tr_cycle;
wait_queue_head_t seq_wait;
@@ -36690,7 +36339,7 @@ index f943aac..99bfd19 100644
unsigned int peer_seq;
spinlock_t peer_seq_lock;
unsigned int minor;
-@@ -1562,7 +1562,7 @@ static inline int drbd_setsockopt(struct socket *sock, int level, int optname,
+@@ -1572,7 +1572,7 @@ static inline int drbd_setsockopt(struct socket *sock, int level, int optname,
char __user *uoptval;
int err;
@@ -36700,7 +36349,7 @@ index f943aac..99bfd19 100644
set_fs(KERNEL_DS);
if (level == SOL_SOCKET)
diff --git a/drivers/block/drbd/drbd_main.c b/drivers/block/drbd/drbd_main.c
-index a5dca6a..bb27967 100644
+index 55635ed..40e837c 100644
--- a/drivers/block/drbd/drbd_main.c
+++ b/drivers/block/drbd/drbd_main.c
@@ -1317,7 +1317,7 @@ static int _drbd_send_ack(struct drbd_conf *mdev, enum drbd_packet cmd,
@@ -36733,10 +36382,10 @@ index a5dca6a..bb27967 100644
idr_destroy(&tconn->volumes);
diff --git a/drivers/block/drbd/drbd_nl.c b/drivers/block/drbd/drbd_nl.c
-index 9e3f441..4044d47 100644
+index 8cc1e64..ba7ffa9 100644
--- a/drivers/block/drbd/drbd_nl.c
+++ b/drivers/block/drbd/drbd_nl.c
-@@ -3339,7 +3339,7 @@ out:
+@@ -3440,7 +3440,7 @@ out:
void drbd_bcast_event(struct drbd_conf *mdev, const struct sib_info *sib)
{
@@ -36745,7 +36394,7 @@ index 9e3f441..4044d47 100644
struct sk_buff *msg;
struct drbd_genlmsghdr *d_out;
unsigned seq;
-@@ -3352,7 +3352,7 @@ void drbd_bcast_event(struct drbd_conf *mdev, const struct sib_info *sib)
+@@ -3453,7 +3453,7 @@ void drbd_bcast_event(struct drbd_conf *mdev, const struct sib_info *sib)
return;
}
@@ -36755,7 +36404,7 @@ index 9e3f441..4044d47 100644
if (!msg)
goto failed;
diff --git a/drivers/block/drbd/drbd_receiver.c b/drivers/block/drbd/drbd_receiver.c
-index 4222aff..1f79506 100644
+index cc29cd3..d4b058b 100644
--- a/drivers/block/drbd/drbd_receiver.c
+++ b/drivers/block/drbd/drbd_receiver.c
@@ -834,7 +834,7 @@ int drbd_connected(struct drbd_conf *mdev)
@@ -36854,7 +36503,7 @@ index 4222aff..1f79506 100644
static struct asender_cmd asender_tbl[] = {
[P_PING] = { 0, got_Ping },
diff --git a/drivers/block/loop.c b/drivers/block/loop.c
-index 4a81165..53dc2c7 100644
+index c8dac73..1800093 100644
--- a/drivers/block/loop.c
+++ b/drivers/block/loop.c
@@ -232,7 +232,7 @@ static int __do_lo_send_write(struct file *file,
@@ -36867,18 +36516,53 @@ index 4a81165..53dc2c7 100644
file_end_write(file);
if (likely(bw == len))
diff --git a/drivers/block/pktcdvd.c b/drivers/block/pktcdvd.c
-index f5d0ea1..c62380a 100644
+index 5618847..5a46f3b 100644
--- a/drivers/block/pktcdvd.c
+++ b/drivers/block/pktcdvd.c
-@@ -84,7 +84,7 @@
- #define MAX_SPEED 0xffff
+@@ -108,7 +108,7 @@ static int pkt_seq_show(struct seq_file *m, void *p);
- #define ZONE(sector, pd) (((sector) + (pd)->offset) & \
-- ~(sector_t)((pd)->settings.size - 1))
-+ ~(sector_t)((pd)->settings.size - 1UL))
+ static sector_t get_zone(sector_t sector, struct pktcdvd_device *pd)
+ {
+- return (sector + pd->offset) & ~(sector_t)(pd->settings.size - 1);
++ return (sector + pd->offset) & ~(sector_t)(pd->settings.size - 1UL);
+ }
+
+ /*
+@@ -1897,7 +1897,7 @@ static noinline_for_stack int pkt_probe_settings(struct pktcdvd_device *pd)
+ return -EROFS;
+ }
+ pd->settings.fp = ti.fp;
+- pd->offset = (be32_to_cpu(ti.track_start) << 2) & (pd->settings.size - 1);
++ pd->offset = (be32_to_cpu(ti.track_start) << 2) & (pd->settings.size - 1UL);
+
+ if (ti.nwa_v) {
+ pd->nwa = be32_to_cpu(ti.next_writable);
+diff --git a/drivers/bluetooth/btwilink.c b/drivers/bluetooth/btwilink.c
+index 60abf59..80789e1 100644
+--- a/drivers/bluetooth/btwilink.c
++++ b/drivers/bluetooth/btwilink.c
+@@ -293,7 +293,7 @@ static int ti_st_send_frame(struct sk_buff *skb)
+
+ static int bt_ti_probe(struct platform_device *pdev)
+ {
+- static struct ti_st *hst;
++ struct ti_st *hst;
+ struct hci_dev *hdev;
+ int err;
+
+diff --git a/drivers/bus/arm-cci.c b/drivers/bus/arm-cci.c
+index 2009266..7be9ca2 100644
+--- a/drivers/bus/arm-cci.c
++++ b/drivers/bus/arm-cci.c
+@@ -405,7 +405,7 @@ static int __init cci_probe(void)
+
+ nb_cci_ports = cci_config->nb_ace + cci_config->nb_ace_lite;
+
+- ports = kcalloc(sizeof(*ports), nb_cci_ports, GFP_KERNEL);
++ ports = kcalloc(nb_cci_ports, sizeof(*ports), GFP_KERNEL);
+ if (!ports)
+ return -ENOMEM;
- static DEFINE_MUTEX(pktcdvd_mutex);
- static struct pktcdvd_device *pkt_devs[MAX_WRITERS];
diff --git a/drivers/cdrom/cdrom.c b/drivers/cdrom/cdrom.c
index 8a3aff7..d7538c2 100644
--- a/drivers/cdrom/cdrom.c
@@ -36932,7 +36616,7 @@ index 8a3aff7..d7538c2 100644
return 1;
diff --git a/drivers/cdrom/gdrom.c b/drivers/cdrom/gdrom.c
-index 4afcb65..a68a32d 100644
+index 5980cb9..6d7bd7e 100644
--- a/drivers/cdrom/gdrom.c
+++ b/drivers/cdrom/gdrom.c
@@ -491,7 +491,6 @@ static struct cdrom_device_ops gdrom_ops = {
@@ -36944,7 +36628,7 @@ index 4afcb65..a68a32d 100644
static int gdrom_bdops_open(struct block_device *bdev, fmode_t mode)
diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig
-index 3bb6fa3..34013fb 100644
+index 1421997..33f5d6d 100644
--- a/drivers/char/Kconfig
+++ b/drivers/char/Kconfig
@@ -8,7 +8,8 @@ source "drivers/tty/Kconfig"
@@ -36957,7 +36641,7 @@ index 3bb6fa3..34013fb 100644
help
Say Y here if you want to support the /dev/kmem device. The
/dev/kmem device is rarely used, but can be used for certain
-@@ -582,6 +583,7 @@ config DEVPORT
+@@ -570,6 +571,7 @@ config DEVPORT
bool
depends on !M68K
depends on ISA || PCI
@@ -36979,10 +36663,10 @@ index a48e05b..6bac831 100644
kfree(usegment);
kfree(ksegment);
diff --git a/drivers/char/agp/frontend.c b/drivers/char/agp/frontend.c
-index 2e04433..771f2cc 100644
+index 1b19239..b87b143 100644
--- a/drivers/char/agp/frontend.c
+++ b/drivers/char/agp/frontend.c
-@@ -817,7 +817,7 @@ static int agpioc_reserve_wrap(struct agp_file_private *priv, void __user *arg)
+@@ -819,7 +819,7 @@ static int agpioc_reserve_wrap(struct agp_file_private *priv, void __user *arg)
if (copy_from_user(&reserve, arg, sizeof(struct agp_region)))
return -EFAULT;
@@ -36991,7 +36675,7 @@ index 2e04433..771f2cc 100644
return -EFAULT;
client = agp_find_client_by_pid(reserve.pid);
-@@ -847,7 +847,7 @@ static int agpioc_reserve_wrap(struct agp_file_private *priv, void __user *arg)
+@@ -849,7 +849,7 @@ static int agpioc_reserve_wrap(struct agp_file_private *priv, void __user *arg)
if (segment == NULL)
return -ENOMEM;
@@ -37013,7 +36697,7 @@ index 4f94375..413694e 100644
return -EINVAL;
else
diff --git a/drivers/char/hpet.c b/drivers/char/hpet.c
-index d784650..e8bfd69 100644
+index 448ce5e..3a76625 100644
--- a/drivers/char/hpet.c
+++ b/drivers/char/hpet.c
@@ -559,7 +559,7 @@ static inline unsigned long hpet_time_div(struct hpets *hpets,
@@ -37039,7 +36723,7 @@ index 86fe45c..c0ea948 100644
}
diff --git a/drivers/char/ipmi/ipmi_msghandler.c b/drivers/char/ipmi/ipmi_msghandler.c
-index 4445fa1..7c6de37 100644
+index ec4e10f..f2a763b 100644
--- a/drivers/char/ipmi/ipmi_msghandler.c
+++ b/drivers/char/ipmi/ipmi_msghandler.c
@@ -420,7 +420,7 @@ struct ipmi_smi {
@@ -37073,10 +36757,10 @@ index 4445fa1..7c6de37 100644
intf->proc_dir = NULL;
diff --git a/drivers/char/ipmi/ipmi_si_intf.c b/drivers/char/ipmi/ipmi_si_intf.c
-index af4b23f..79806fc 100644
+index 15e4a60..b046093 100644
--- a/drivers/char/ipmi/ipmi_si_intf.c
+++ b/drivers/char/ipmi/ipmi_si_intf.c
-@@ -275,7 +275,7 @@ struct smi_info {
+@@ -280,7 +280,7 @@ struct smi_info {
unsigned char slave_addr;
/* Counters and things for the proc filesystem. */
@@ -37085,7 +36769,7 @@ index af4b23f..79806fc 100644
struct task_struct *thread;
-@@ -284,9 +284,9 @@ struct smi_info {
+@@ -289,9 +289,9 @@ struct smi_info {
};
#define smi_inc_stat(smi, stat) \
@@ -37097,7 +36781,7 @@ index af4b23f..79806fc 100644
#define SI_MAX_PARMS 4
-@@ -3258,7 +3258,7 @@ static int try_smi_init(struct smi_info *new_smi)
+@@ -3324,7 +3324,7 @@ static int try_smi_init(struct smi_info *new_smi)
atomic_set(&new_smi->req_events, 0);
new_smi->run_to_completion = 0;
for (i = 0; i < SI_NUM_STATS; i++)
@@ -37107,7 +36791,7 @@ index af4b23f..79806fc 100644
new_smi->interrupt_disabled = 1;
atomic_set(&new_smi->stop_operation, 0);
diff --git a/drivers/char/mem.c b/drivers/char/mem.c
-index 1ccbe94..6ad651a 100644
+index f895a8c..2bc9147 100644
--- a/drivers/char/mem.c
+++ b/drivers/char/mem.c
@@ -18,6 +18,7 @@
@@ -37118,7 +36802,7 @@ index 1ccbe94..6ad651a 100644
#include <linux/ptrace.h>
#include <linux/device.h>
#include <linux/highmem.h>
-@@ -38,6 +39,10 @@
+@@ -37,6 +38,10 @@
#define DEVPORT_MINOR 4
@@ -37129,7 +36813,7 @@ index 1ccbe94..6ad651a 100644
static inline unsigned long size_inside_page(unsigned long start,
unsigned long size)
{
-@@ -69,9 +74,13 @@ static inline int range_is_allowed(unsigned long pfn, unsigned long size)
+@@ -68,9 +73,13 @@ static inline int range_is_allowed(unsigned long pfn, unsigned long size)
while (cursor < to) {
if (!devmem_is_allowed(pfn)) {
@@ -37143,7 +36827,7 @@ index 1ccbe94..6ad651a 100644
return 0;
}
cursor += PAGE_SIZE;
-@@ -79,6 +88,11 @@ static inline int range_is_allowed(unsigned long pfn, unsigned long size)
+@@ -78,6 +87,11 @@ static inline int range_is_allowed(unsigned long pfn, unsigned long size)
}
return 1;
}
@@ -37155,7 +36839,7 @@ index 1ccbe94..6ad651a 100644
#else
static inline int range_is_allowed(unsigned long pfn, unsigned long size)
{
-@@ -121,6 +135,7 @@ static ssize_t read_mem(struct file *file, char __user *buf,
+@@ -120,6 +134,7 @@ static ssize_t read_mem(struct file *file, char __user *buf,
while (count > 0) {
unsigned long remaining;
@@ -37163,7 +36847,7 @@ index 1ccbe94..6ad651a 100644
sz = size_inside_page(p, count);
-@@ -136,7 +151,23 @@ static ssize_t read_mem(struct file *file, char __user *buf,
+@@ -135,7 +150,23 @@ static ssize_t read_mem(struct file *file, char __user *buf,
if (!ptr)
return -EFAULT;
@@ -37188,16 +36872,7 @@ index 1ccbe94..6ad651a 100644
unxlate_dev_mem_ptr(p, ptr);
if (remaining)
return -EFAULT;
-@@ -379,7 +410,7 @@ static ssize_t read_oldmem(struct file *file, char __user *buf,
- else
- csize = count;
-
-- rc = copy_oldmem_page(pfn, buf, csize, offset, 1);
-+ rc = copy_oldmem_page(pfn, (char __force_kernel *)buf, csize, offset, 1);
- if (rc < 0)
- return rc;
- buf += csize;
-@@ -399,9 +430,8 @@ static ssize_t read_kmem(struct file *file, char __user *buf,
+@@ -364,9 +395,8 @@ static ssize_t read_kmem(struct file *file, char __user *buf,
size_t count, loff_t *ppos)
{
unsigned long p = *ppos;
@@ -37208,7 +36883,7 @@ index 1ccbe94..6ad651a 100644
read = 0;
if (p < (unsigned long) high_memory) {
-@@ -423,6 +453,8 @@ static ssize_t read_kmem(struct file *file, char __user *buf,
+@@ -388,6 +418,8 @@ static ssize_t read_kmem(struct file *file, char __user *buf,
}
#endif
while (low_count > 0) {
@@ -37217,7 +36892,7 @@ index 1ccbe94..6ad651a 100644
sz = size_inside_page(p, low_count);
/*
-@@ -432,7 +464,22 @@ static ssize_t read_kmem(struct file *file, char __user *buf,
+@@ -397,7 +429,22 @@ static ssize_t read_kmem(struct file *file, char __user *buf,
*/
kbuf = xlate_dev_kmem_ptr((char *)p);
@@ -37241,9 +36916,9 @@ index 1ccbe94..6ad651a 100644
return -EFAULT;
buf += sz;
p += sz;
-@@ -869,6 +916,9 @@ static const struct memdev {
- #ifdef CONFIG_CRASH_DUMP
- [12] = { "oldmem", 0, &oldmem_fops, NULL },
+@@ -822,6 +869,9 @@ static const struct memdev {
+ #ifdef CONFIG_PRINTK
+ [11] = { "kmsg", 0644, &kmsg_fops, NULL },
#endif
+#if defined(CONFIG_GRKERNSEC) && !defined(CONFIG_GRKERNSEC_NO_RBAC)
+ [13] = { "grsec",S_IRUSR | S_IWUGO, &grsec_fops, NULL },
@@ -37251,7 +36926,7 @@ index 1ccbe94..6ad651a 100644
};
static int memory_open(struct inode *inode, struct file *filp)
-@@ -940,7 +990,7 @@ static int __init chr_dev_init(void)
+@@ -893,7 +943,7 @@ static int __init chr_dev_init(void)
continue;
device_create(mem_class, NULL, MKDEV(MEM_MAJOR, minor),
@@ -37260,18 +36935,6 @@ index 1ccbe94..6ad651a 100644
}
return tty_init();
-diff --git a/drivers/char/mwave/tp3780i.c b/drivers/char/mwave/tp3780i.c
-index c689697..04e6d6a 100644
---- a/drivers/char/mwave/tp3780i.c
-+++ b/drivers/char/mwave/tp3780i.c
-@@ -479,6 +479,7 @@ int tp3780I_QueryAbilities(THINKPAD_BD_DATA * pBDData, MW_ABILITIES * pAbilities
- PRINTK_2(TRACE_TP3780I,
- "tp3780i::tp3780I_QueryAbilities entry pBDData %p\n", pBDData);
-
-+ memset(pAbilities, 0, sizeof(*pAbilities));
- /* fill out standard constant fields */
- pAbilities->instr_per_sec = pBDData->rDspSettings.uIps;
- pAbilities->data_size = pBDData->rDspSettings.uDStoreSize;
diff --git a/drivers/char/nvram.c b/drivers/char/nvram.c
index 9df78e2..01ba9ae 100644
--- a/drivers/char/nvram.c
@@ -37286,7 +36949,7 @@ index 9df78e2..01ba9ae 100644
*ppos = i;
diff --git a/drivers/char/pcmcia/synclink_cs.c b/drivers/char/pcmcia/synclink_cs.c
-index 5c5cc00..ac9edb7 100644
+index d39cca6..8c1e269 100644
--- a/drivers/char/pcmcia/synclink_cs.c
+++ b/drivers/char/pcmcia/synclink_cs.c
@@ -2345,9 +2345,9 @@ static void mgslpc_close(struct tty_struct *tty, struct file * filp)
@@ -37361,10 +37024,10 @@ index 5c5cc00..ac9edb7 100644
if (cmd != SIOCWANDEV)
diff --git a/drivers/char/random.c b/drivers/char/random.c
-index 81eefa1..219a156 100644
+index 7a744d3..35a177ee 100644
--- a/drivers/char/random.c
+++ b/drivers/char/random.c
-@@ -272,8 +272,13 @@
+@@ -269,8 +269,13 @@
/*
* Configuration information
*/
@@ -37378,7 +37041,7 @@ index 81eefa1..219a156 100644
#define SEC_XFER_SIZE 512
#define EXTRACT_SIZE 10
-@@ -313,10 +318,17 @@ static struct poolinfo {
+@@ -310,10 +315,17 @@ static struct poolinfo {
int poolwords;
int tap1, tap2, tap3, tap4, tap5;
} poolinfo_table[] = {
@@ -37396,7 +37059,7 @@ index 81eefa1..219a156 100644
#if 0
/* x^2048 + x^1638 + x^1231 + x^819 + x^411 + x + 1 -- 115 */
{ 2048, 1638, 1231, 819, 411, 1 },
-@@ -524,8 +536,8 @@ static void _mix_pool_bytes(struct entropy_store *r, const void *in,
+@@ -521,8 +533,8 @@ static void _mix_pool_bytes(struct entropy_store *r, const void *in,
input_rotate += i ? 7 : 14;
}
@@ -37407,7 +37070,7 @@ index 81eefa1..219a156 100644
smp_wmb();
if (out)
-@@ -1032,7 +1044,7 @@ static ssize_t extract_entropy_user(struct entropy_store *r, void __user *buf,
+@@ -1029,7 +1041,7 @@ static ssize_t extract_entropy_user(struct entropy_store *r, void __user *buf,
extract_buf(r, tmp);
i = min_t(int, nbytes, EXTRACT_SIZE);
@@ -37416,7 +37079,7 @@ index 81eefa1..219a156 100644
ret = -EFAULT;
break;
}
-@@ -1368,7 +1380,7 @@ EXPORT_SYMBOL(generate_random_uuid);
+@@ -1365,7 +1377,7 @@ EXPORT_SYMBOL(generate_random_uuid);
#include <linux/sysctl.h>
static int min_read_thresh = 8, min_write_thresh;
@@ -37425,17 +37088,17 @@ index 81eefa1..219a156 100644
static int max_write_thresh = INPUT_POOL_WORDS * 32;
static char sysctl_bootid[16];
-@@ -1384,7 +1396,7 @@ static char sysctl_bootid[16];
- static int proc_do_uuid(ctl_table *table, int write,
+@@ -1381,7 +1393,7 @@ static char sysctl_bootid[16];
+ static int proc_do_uuid(struct ctl_table *table, int write,
void __user *buffer, size_t *lenp, loff_t *ppos)
{
-- ctl_table fake_table;
+- struct ctl_table fake_table;
+ ctl_table_no_const fake_table;
unsigned char buf[64], tmp_uuid[16], *uuid;
uuid = table->data;
diff --git a/drivers/char/sonypi.c b/drivers/char/sonypi.c
-index bf2349db..5456d53 100644
+index 7cc1fe22..b602d6b 100644
--- a/drivers/char/sonypi.c
+++ b/drivers/char/sonypi.c
@@ -54,6 +54,7 @@
@@ -37455,7 +37118,7 @@ index bf2349db..5456d53 100644
int model;
struct input_dev *input_jog_dev;
struct input_dev *input_key_dev;
-@@ -897,7 +898,7 @@ static int sonypi_misc_fasync(int fd, struct file *filp, int on)
+@@ -892,7 +893,7 @@ static int sonypi_misc_fasync(int fd, struct file *filp, int on)
static int sonypi_misc_release(struct inode *inode, struct file *file)
{
mutex_lock(&sonypi_device.lock);
@@ -37464,7 +37127,7 @@ index bf2349db..5456d53 100644
mutex_unlock(&sonypi_device.lock);
return 0;
}
-@@ -906,9 +907,9 @@ static int sonypi_misc_open(struct inode *inode, struct file *file)
+@@ -901,9 +902,9 @@ static int sonypi_misc_open(struct inode *inode, struct file *file)
{
mutex_lock(&sonypi_device.lock);
/* Flush input queue on first open */
@@ -37527,7 +37190,7 @@ index 84ddc55..1d32f1e 100644
return 0;
}
diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c
-index fc45567..fa2a590 100644
+index b79cf3e..de172d64f 100644
--- a/drivers/char/virtio_console.c
+++ b/drivers/char/virtio_console.c
@@ -682,7 +682,7 @@ static ssize_t fill_readbuf(struct port *port, char *out_buf, size_t out_count,
@@ -37562,7 +37225,7 @@ index a33f46f..a720eed 100644
composite = kzalloc(sizeof(*composite), GFP_KERNEL);
if (!composite) {
diff --git a/drivers/clk/socfpga/clk.c b/drivers/clk/socfpga/clk.c
-index bd11315..7f87098 100644
+index 81dd31a..ef5c542 100644
--- a/drivers/clk/socfpga/clk.c
+++ b/drivers/clk/socfpga/clk.c
@@ -22,6 +22,7 @@
@@ -37572,10 +37235,10 @@ index bd11315..7f87098 100644
+#include <asm/pgtable.h>
/* Clock Manager offsets */
- #define CLKMGR_CTRL 0x0
-@@ -135,8 +136,10 @@ static __init struct clk *socfpga_clk_init(struct device_node *node,
- if (strcmp(clk_name, "main_pll") || strcmp(clk_name, "periph_pll") ||
- strcmp(clk_name, "sdram_pll")) {
+ #define CLKMGR_CTRL 0x0
+@@ -152,8 +153,10 @@ static __init struct clk *socfpga_clk_init(struct device_node *node,
+ streq(clk_name, "periph_pll") ||
+ streq(clk_name, "sdram_pll")) {
socfpga_clk->hw.bit_idx = SOCFPGA_PLL_EXT_ENA;
- clk_pll_ops.enable = clk_gate_ops.enable;
- clk_pll_ops.disable = clk_gate_ops.disable;
@@ -37586,47 +37249,17 @@ index bd11315..7f87098 100644
}
clk = clk_register(NULL, &socfpga_clk->hw.hw);
-diff --git a/drivers/clocksource/arm_arch_timer.c b/drivers/clocksource/arm_arch_timer.c
-index a2b2541..bc1e7ff 100644
---- a/drivers/clocksource/arm_arch_timer.c
-+++ b/drivers/clocksource/arm_arch_timer.c
-@@ -264,7 +264,7 @@ static int __cpuinit arch_timer_cpu_notify(struct notifier_block *self,
- return NOTIFY_OK;
+@@ -244,7 +247,7 @@ static unsigned long socfpga_clk_recalc_rate(struct clk_hw *hwclk,
+ return parent_rate / div;
}
--static struct notifier_block arch_timer_cpu_nb __cpuinitdata = {
-+static struct notifier_block arch_timer_cpu_nb = {
- .notifier_call = arch_timer_cpu_notify,
- };
-
-diff --git a/drivers/clocksource/bcm_kona_timer.c b/drivers/clocksource/bcm_kona_timer.c
-index 350f493..489479e 100644
---- a/drivers/clocksource/bcm_kona_timer.c
-+++ b/drivers/clocksource/bcm_kona_timer.c
-@@ -199,7 +199,7 @@ static struct irqaction kona_timer_irq = {
- .handler = kona_timer_interrupt,
- };
-
--static void __init kona_timer_init(void)
-+static void __init kona_timer_init(struct device_node *np)
- {
- kona_timers_init();
- kona_timer_clockevents_init();
-diff --git a/drivers/clocksource/metag_generic.c b/drivers/clocksource/metag_generic.c
-index ade7513..069445f 100644
---- a/drivers/clocksource/metag_generic.c
-+++ b/drivers/clocksource/metag_generic.c
-@@ -169,7 +169,7 @@ static int __cpuinit arch_timer_cpu_notify(struct notifier_block *self,
- return NOTIFY_OK;
- }
-
--static struct notifier_block __cpuinitdata arch_timer_cpu_nb = {
-+static struct notifier_block arch_timer_cpu_nb = {
- .notifier_call = arch_timer_cpu_notify,
- };
-
+-static struct clk_ops gateclk_ops = {
++static clk_ops_no_const gateclk_ops __read_only = {
+ .recalc_rate = socfpga_clk_recalc_rate,
+ .get_parent = socfpga_clk_get_parent,
+ .set_parent = socfpga_clk_set_parent,
diff --git a/drivers/cpufreq/acpi-cpufreq.c b/drivers/cpufreq/acpi-cpufreq.c
-index edc089e..bc7c0bc 100644
+index 506fd23..01a593f 100644
--- a/drivers/cpufreq/acpi-cpufreq.c
+++ b/drivers/cpufreq/acpi-cpufreq.c
@@ -172,7 +172,7 @@ static ssize_t show_global_boost(struct kobject *kobj,
@@ -37638,7 +37271,7 @@ index edc089e..bc7c0bc 100644
show_global_boost,
store_global_boost);
-@@ -705,8 +705,11 @@ static int acpi_cpufreq_cpu_init(struct cpufreq_policy *policy)
+@@ -721,8 +721,11 @@ static int acpi_cpufreq_cpu_init(struct cpufreq_policy *policy)
data->acpi_data = per_cpu_ptr(acpi_perf_data, cpu);
per_cpu(acfreq_data, cpu) = data;
@@ -37652,7 +37285,7 @@ index edc089e..bc7c0bc 100644
result = acpi_processor_register_performance(data->acpi_data, cpu);
if (result)
-@@ -832,7 +835,9 @@ static int acpi_cpufreq_cpu_init(struct cpufreq_policy *policy)
+@@ -850,7 +853,9 @@ static int acpi_cpufreq_cpu_init(struct cpufreq_policy *policy)
policy->cur = acpi_cpufreq_guess_freq(data, policy->cpu);
break;
case ACPI_ADR_SPACE_FIXED_HARDWARE:
@@ -37663,34 +37296,20 @@ index edc089e..bc7c0bc 100644
policy->cur = get_cur_freq_on_cpu(cpu);
break;
default:
-@@ -843,8 +848,11 @@ static int acpi_cpufreq_cpu_init(struct cpufreq_policy *policy)
- acpi_processor_notify_smm(THIS_MODULE);
-
- /* Check for APERF/MPERF support in hardware */
-- if (boot_cpu_has(X86_FEATURE_APERFMPERF))
-- acpi_cpufreq_driver.getavg = cpufreq_get_measured_perf;
-+ if (boot_cpu_has(X86_FEATURE_APERFMPERF)) {
-+ pax_open_kernel();
-+ *(void **)&acpi_cpufreq_driver.getavg = cpufreq_get_measured_perf;
-+ pax_close_kernel();
-+ }
-
- pr_debug("CPU%u - ACPI performance management activated.\n", cpu);
- for (i = 0; i < perf->state_count; i++)
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
-index 6485547..477033e 100644
+index 04548f7..457a342 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
-@@ -1854,7 +1854,7 @@ static int __cpuinit cpufreq_cpu_callback(struct notifier_block *nfb,
+@@ -2069,7 +2069,7 @@ static int cpufreq_cpu_callback(struct notifier_block *nfb,
return NOTIFY_OK;
}
-static struct notifier_block __refdata cpufreq_cpu_notifier = {
+static struct notifier_block cpufreq_cpu_notifier = {
- .notifier_call = cpufreq_cpu_callback,
+ .notifier_call = cpufreq_cpu_callback,
};
-@@ -1886,8 +1886,11 @@ int cpufreq_register_driver(struct cpufreq_driver *driver_data)
+@@ -2101,8 +2101,11 @@ int cpufreq_register_driver(struct cpufreq_driver *driver_data)
pr_debug("trying to register driver %s\n", driver_data->name);
@@ -37705,10 +37324,10 @@ index 6485547..477033e 100644
write_lock_irqsave(&cpufreq_driver_lock, flags);
if (cpufreq_driver) {
diff --git a/drivers/cpufreq/cpufreq_governor.c b/drivers/cpufreq/cpufreq_governor.c
-index a86ff72..aad2b03 100644
+index 0806c31..6a73276 100644
--- a/drivers/cpufreq/cpufreq_governor.c
+++ b/drivers/cpufreq/cpufreq_governor.c
-@@ -235,7 +235,7 @@ int cpufreq_governor_dbs(struct cpufreq_policy *policy,
+@@ -187,7 +187,7 @@ int cpufreq_governor_dbs(struct cpufreq_policy *policy,
struct dbs_data *dbs_data;
struct od_cpu_dbs_info_s *od_dbs_info = NULL;
struct cs_cpu_dbs_info_s *cs_dbs_info = NULL;
@@ -37717,7 +37336,7 @@ index a86ff72..aad2b03 100644
struct od_dbs_tuners *od_tuners = NULL;
struct cs_dbs_tuners *cs_tuners = NULL;
struct cpu_dbs_common_info *cpu_cdbs;
-@@ -298,7 +298,7 @@ int cpufreq_governor_dbs(struct cpufreq_policy *policy,
+@@ -253,7 +253,7 @@ int cpufreq_governor_dbs(struct cpufreq_policy *policy,
if ((cdata->governor == GOV_CONSERVATIVE) &&
(!policy->governor->initialized)) {
@@ -37726,7 +37345,7 @@ index a86ff72..aad2b03 100644
cpufreq_register_notifier(cs_ops->notifier_block,
CPUFREQ_TRANSITION_NOTIFIER);
-@@ -315,7 +315,7 @@ int cpufreq_governor_dbs(struct cpufreq_policy *policy,
+@@ -273,7 +273,7 @@ int cpufreq_governor_dbs(struct cpufreq_policy *policy,
if ((dbs_data->cdata->governor == GOV_CONSERVATIVE) &&
(policy->governor->initialized == 1)) {
@@ -37736,10 +37355,10 @@ index a86ff72..aad2b03 100644
cpufreq_unregister_notifier(cs_ops->notifier_block,
CPUFREQ_TRANSITION_NOTIFIER);
diff --git a/drivers/cpufreq/cpufreq_governor.h b/drivers/cpufreq/cpufreq_governor.h
-index 0d9e6be..461fd3b 100644
+index 88cd39f..87f0393 100644
--- a/drivers/cpufreq/cpufreq_governor.h
+++ b/drivers/cpufreq/cpufreq_governor.h
-@@ -204,7 +204,7 @@ struct common_dbs_data {
+@@ -202,7 +202,7 @@ struct common_dbs_data {
void (*exit)(struct dbs_data *dbs_data);
/* Governor specific ops, see below */
@@ -37747,12 +37366,30 @@ index 0d9e6be..461fd3b 100644
+ const void *gov_ops;
};
- /* Governer Per policy data */
+ /* Governor Per policy data */
+@@ -222,7 +222,7 @@ struct od_ops {
+ unsigned int (*powersave_bias_target)(struct cpufreq_policy *policy,
+ unsigned int freq_next, unsigned int relation);
+ void (*freq_increase)(struct cpufreq_policy *policy, unsigned int freq);
+-};
++} __no_const;
+
+ struct cs_ops {
+ struct notifier_block *notifier_block;
diff --git a/drivers/cpufreq/cpufreq_ondemand.c b/drivers/cpufreq/cpufreq_ondemand.c
-index c087347..dad6268 100644
+index 32f26f6..feb657b 100644
--- a/drivers/cpufreq/cpufreq_ondemand.c
+++ b/drivers/cpufreq/cpufreq_ondemand.c
-@@ -615,14 +615,18 @@ void od_register_powersave_bias_handler(unsigned int (*f)
+@@ -522,7 +522,7 @@ static void od_exit(struct dbs_data *dbs_data)
+
+ define_get_cpu_dbs_routines(od_cpu_dbs_info);
+
+-static struct od_ops od_ops = {
++static struct od_ops od_ops __read_only = {
+ .powersave_bias_init_cpu = ondemand_powersave_bias_init_cpu,
+ .powersave_bias_target = generic_powersave_bias_target,
+ .freq_increase = dbs_freq_increase,
+@@ -577,14 +577,18 @@ void od_register_powersave_bias_handler(unsigned int (*f)
(struct cpufreq_policy *, unsigned int, unsigned int),
unsigned int powersave_bias)
{
@@ -37774,10 +37411,10 @@ index c087347..dad6268 100644
}
EXPORT_SYMBOL_GPL(od_unregister_powersave_bias_handler);
diff --git a/drivers/cpufreq/cpufreq_stats.c b/drivers/cpufreq/cpufreq_stats.c
-index bfd6273..e39dd63 100644
+index 4cf0d28..5830372 100644
--- a/drivers/cpufreq/cpufreq_stats.c
+++ b/drivers/cpufreq/cpufreq_stats.c
-@@ -365,7 +365,7 @@ static int __cpuinit cpufreq_stat_cpu_callback(struct notifier_block *nfb,
+@@ -352,7 +352,7 @@ static int cpufreq_stat_cpu_callback(struct notifier_block *nfb,
}
/* priority=1 so this will get called before cpufreq_remove_dev */
@@ -37787,7 +37424,7 @@ index bfd6273..e39dd63 100644
.priority = 1,
};
diff --git a/drivers/cpufreq/p4-clockmod.c b/drivers/cpufreq/p4-clockmod.c
-index 421ef37..e708530c 100644
+index 2f0a2a6..93d728e 100644
--- a/drivers/cpufreq/p4-clockmod.c
+++ b/drivers/cpufreq/p4-clockmod.c
@@ -160,10 +160,14 @@ static unsigned int cpufreq_p4_get_frequency(struct cpuinfo_x86 *c)
@@ -37819,7 +37456,7 @@ index 421ef37..e708530c 100644
if (speedstep_detect_processor() == SPEEDSTEP_CPU_P4M) {
printk(KERN_WARNING PFX "Warning: Pentium 4-M detected. "
diff --git a/drivers/cpufreq/sparc-us3-cpufreq.c b/drivers/cpufreq/sparc-us3-cpufreq.c
-index c71ee14..7c2e183 100644
+index ac76b48..2445bc6 100644
--- a/drivers/cpufreq/sparc-us3-cpufreq.c
+++ b/drivers/cpufreq/sparc-us3-cpufreq.c
@@ -18,14 +18,12 @@
@@ -37866,7 +37503,7 @@ index c71ee14..7c2e183 100644
static int __init us3_freq_init(void)
{
unsigned long manuf, impl, ver;
-@@ -208,57 +219,15 @@ static int __init us3_freq_init(void)
+@@ -208,55 +219,15 @@ static int __init us3_freq_init(void)
(impl == CHEETAH_IMPL ||
impl == CHEETAH_PLUS_IMPL ||
impl == JAGUAR_IMPL ||
@@ -37874,12 +37511,11 @@ index c71ee14..7c2e183 100644
- struct cpufreq_driver *driver;
-
- ret = -ENOMEM;
-- driver = kzalloc(sizeof(struct cpufreq_driver), GFP_KERNEL);
+- driver = kzalloc(sizeof(*driver), GFP_KERNEL);
- if (!driver)
- goto err_out;
-
-- us3_freq_table = kzalloc(
-- (NR_CPUS * sizeof(struct us3_freq_percpu_info)),
+- us3_freq_table = kzalloc((NR_CPUS * sizeof(*us3_freq_table)),
- GFP_KERNEL);
- if (!us3_freq_table)
- goto err_out;
@@ -37889,7 +37525,6 @@ index c71ee14..7c2e183 100644
- driver->target = us3_freq_target;
- driver->get = us3_freq_get;
- driver->exit = us3_freq_cpu_exit;
-- driver->owner = THIS_MODULE,
- strcpy(driver->name, "UltraSPARC-III");
-
- cpufreq_us3_driver = driver;
@@ -37928,7 +37563,7 @@ index c71ee14..7c2e183 100644
MODULE_AUTHOR("David S. Miller <davem@redhat.com>");
diff --git a/drivers/cpufreq/speedstep-centrino.c b/drivers/cpufreq/speedstep-centrino.c
-index 618e6f4..e89d915 100644
+index f897d51..15da295 100644
--- a/drivers/cpufreq/speedstep-centrino.c
+++ b/drivers/cpufreq/speedstep-centrino.c
@@ -353,8 +353,11 @@ static int centrino_cpu_init(struct cpufreq_policy *policy)
@@ -37946,10 +37581,10 @@ index 618e6f4..e89d915 100644
if (policy->cpu != 0)
return -ENODEV;
diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c
-index c3a93fe..e808f24 100644
+index d75040d..4738ca5 100644
--- a/drivers/cpuidle/cpuidle.c
+++ b/drivers/cpuidle/cpuidle.c
-@@ -254,7 +254,7 @@ static int poll_idle(struct cpuidle_device *dev,
+@@ -252,7 +252,7 @@ static int poll_idle(struct cpuidle_device *dev,
static void poll_idle_init(struct cpuidle_driver *drv)
{
@@ -37981,10 +37616,10 @@ index ea2f8e7..70ac501 100644
}
diff --git a/drivers/cpuidle/sysfs.c b/drivers/cpuidle/sysfs.c
-index 428754a..8bdf9cc 100644
+index 8739cc0..dc859d0 100644
--- a/drivers/cpuidle/sysfs.c
+++ b/drivers/cpuidle/sysfs.c
-@@ -131,7 +131,7 @@ static struct attribute *cpuidle_switch_attrs[] = {
+@@ -134,7 +134,7 @@ static struct attribute *cpuidle_switch_attrs[] = {
NULL
};
@@ -37994,7 +37629,7 @@ index 428754a..8bdf9cc 100644
.name = "cpuidle",
};
diff --git a/drivers/crypto/hifn_795x.c b/drivers/crypto/hifn_795x.c
-index ebf130e..e32d8a9 100644
+index 12fea3e..1e28f47 100644
--- a/drivers/crypto/hifn_795x.c
+++ b/drivers/crypto/hifn_795x.c
@@ -51,7 +51,7 @@ module_param_string(hifn_pll_ref, hifn_pll_ref, sizeof(hifn_pll_ref), 0444);
@@ -38016,19 +37651,10 @@ index ebf130e..e32d8a9 100644
err = pci_request_regions(pdev, name);
if (err)
diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c
-index 3b36797..db0b0c0 100644
+index c99c00d..990a4b2 100644
--- a/drivers/devfreq/devfreq.c
+++ b/drivers/devfreq/devfreq.c
-@@ -477,7 +477,7 @@ struct devfreq *devfreq_add_device(struct device *dev,
- GFP_KERNEL);
- devfreq->last_stat_updated = jiffies;
-
-- dev_set_name(&devfreq->dev, dev_name(dev));
-+ dev_set_name(&devfreq->dev, "%s", dev_name(dev));
- err = device_register(&devfreq->dev);
- if (err) {
- put_device(&devfreq->dev);
-@@ -588,7 +588,7 @@ int devfreq_add_governor(struct devfreq_governor *governor)
+@@ -607,7 +607,7 @@ int devfreq_add_governor(struct devfreq_governor *governor)
goto err_out;
}
@@ -38037,7 +37663,7 @@ index 3b36797..db0b0c0 100644
list_for_each_entry(devfreq, &devfreq_list, node) {
int ret = 0;
-@@ -676,7 +676,7 @@ int devfreq_remove_governor(struct devfreq_governor *governor)
+@@ -695,7 +695,7 @@ int devfreq_remove_governor(struct devfreq_governor *governor)
}
}
@@ -38046,11 +37672,11 @@ index 3b36797..db0b0c0 100644
err_out:
mutex_unlock(&devfreq_list_lock);
-diff --git a/drivers/dma/sh/shdma.c b/drivers/dma/sh/shdma.c
-index b70709b..1d8d02a 100644
---- a/drivers/dma/sh/shdma.c
-+++ b/drivers/dma/sh/shdma.c
-@@ -476,7 +476,7 @@ static int sh_dmae_nmi_handler(struct notifier_block *self,
+diff --git a/drivers/dma/sh/shdmac.c b/drivers/dma/sh/shdmac.c
+index 1069e88..dfcd642 100644
+--- a/drivers/dma/sh/shdmac.c
++++ b/drivers/dma/sh/shdmac.c
+@@ -511,7 +511,7 @@ static int sh_dmae_nmi_handler(struct notifier_block *self,
return ret;
}
@@ -38076,10 +37702,10 @@ index 211021d..201d47f 100644
EXPORT_SYMBOL_GPL(edac_device_alloc_index);
diff --git a/drivers/edac/edac_mc_sysfs.c b/drivers/edac/edac_mc_sysfs.c
-index c4d700a..0b57abd 100644
+index 9f7e0e60..348c875 100644
--- a/drivers/edac/edac_mc_sysfs.c
+++ b/drivers/edac/edac_mc_sysfs.c
-@@ -148,7 +148,7 @@ static const char * const edac_caps[] = {
+@@ -150,7 +150,7 @@ static const char * const edac_caps[] = {
struct dev_ch_attribute {
struct device_attribute attr;
int channel;
@@ -38088,7 +37714,7 @@ index c4d700a..0b57abd 100644
#define DEVICE_CHANNEL(_name, _mode, _show, _store, _var) \
struct dev_ch_attribute dev_attr_legacy_##_name = \
-@@ -1005,14 +1005,16 @@ int edac_create_sysfs_mci_device(struct mem_ctl_info *mci)
+@@ -1007,14 +1007,16 @@ int edac_create_sysfs_mci_device(struct mem_ctl_info *mci)
}
if (mci->set_sdram_scrub_rate || mci->get_sdram_scrub_rate) {
@@ -38266,10 +37892,10 @@ index 57ea7f4..af06b76 100644
card->driver->update_phy_reg(card, 4,
PHY_LINK_ACTIVE | PHY_CONTENDER, 0);
diff --git a/drivers/firewire/core-device.c b/drivers/firewire/core-device.c
-index 664a6ff..af13580 100644
+index de4aa40..49ab1f2 100644
--- a/drivers/firewire/core-device.c
+++ b/drivers/firewire/core-device.c
-@@ -232,7 +232,7 @@ EXPORT_SYMBOL(fw_device_enable_phys_dma);
+@@ -253,7 +253,7 @@ EXPORT_SYMBOL(fw_device_enable_phys_dma);
struct config_rom_attribute {
struct device_attribute attr;
u32 key;
@@ -38279,7 +37905,7 @@ index 664a6ff..af13580 100644
static ssize_t show_immediate(struct device *dev,
struct device_attribute *dattr, char *buf)
diff --git a/drivers/firewire/core-transaction.c b/drivers/firewire/core-transaction.c
-index 28a94c7..58da63a 100644
+index e5af0e3..d318058 100644
--- a/drivers/firewire/core-transaction.c
+++ b/drivers/firewire/core-transaction.c
@@ -38,6 +38,7 @@
@@ -38316,22 +37942,10 @@ index 94a58a0..f5eba42 100644
container_of(_dev_attr, struct dmi_device_attribute, dev_attr)
diff --git a/drivers/firmware/dmi_scan.c b/drivers/firmware/dmi_scan.c
-index eb760a2..d71c868 100644
+index fa0affb..aa448eb 100644
--- a/drivers/firmware/dmi_scan.c
+++ b/drivers/firmware/dmi_scan.c
-@@ -497,11 +497,6 @@ void __init dmi_scan_machine(void)
- }
- }
- else {
-- /*
-- * no iounmap() for that ioremap(); it would be a no-op, but
-- * it's so early in setup that sucker gets confused into doing
-- * what it shouldn't if we actually call it.
-- */
- p = dmi_ioremap(0xF0000, 0x10000);
- if (p == NULL)
- goto error;
-@@ -792,7 +787,7 @@ int dmi_walk(void (*decode)(const struct dmi_header *, void *),
+@@ -791,7 +791,7 @@ int dmi_walk(void (*decode)(const struct dmi_header *, void *),
if (buf == NULL)
return -1;
@@ -38367,7 +37981,7 @@ index 5145fa3..0d3babd 100644
return efivars_register(&generic_efivars, &generic_ops, efi_kobj);
}
diff --git a/drivers/firmware/efi/efivars.c b/drivers/firmware/efi/efivars.c
-index 8bd1bb6..c48b0c6 100644
+index 8a7432a..28fb839 100644
--- a/drivers/firmware/efi/efivars.c
+++ b/drivers/firmware/efi/efivars.c
@@ -452,7 +452,7 @@ efivar_create_sysfs_entry(struct efivar_entry *new_var)
@@ -38395,10 +38009,10 @@ index 2a90ba6..07f3733 100644
ret = sysfs_create_bin_file(firmware_kobj, &memconsole_bin_attr);
diff --git a/drivers/gpio/gpio-ich.c b/drivers/gpio/gpio-ich.c
-index e16d932..f0206ef 100644
+index 814addb..0937d7f 100644
--- a/drivers/gpio/gpio-ich.c
+++ b/drivers/gpio/gpio-ich.c
-@@ -69,7 +69,7 @@ struct ichx_desc {
+@@ -71,7 +71,7 @@ struct ichx_desc {
/* Some chipsets have quirks, let these use their own request/get */
int (*request)(struct gpio_chip *chip, unsigned offset);
int (*get)(struct gpio_chip *chip, unsigned offset);
@@ -38421,10 +38035,10 @@ index 9902732..64b62dd 100644
return -EINVAL;
}
diff --git a/drivers/gpu/drm/drm_crtc_helper.c b/drivers/gpu/drm/drm_crtc_helper.c
-index ed1334e..ee0dd42 100644
+index c722c3b..2ec6040 100644
--- a/drivers/gpu/drm/drm_crtc_helper.c
+++ b/drivers/gpu/drm/drm_crtc_helper.c
-@@ -321,7 +321,7 @@ static bool drm_encoder_crtc_ok(struct drm_encoder *encoder,
+@@ -328,7 +328,7 @@ static bool drm_encoder_crtc_ok(struct drm_encoder *encoder,
struct drm_crtc *tmp;
int crtc_mask = 1;
@@ -38434,10 +38048,19 @@ index ed1334e..ee0dd42 100644
dev = crtc->dev;
diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
-index 2ab782c..d994a37 100644
+index fe58d08..07bc38e 100644
--- a/drivers/gpu/drm/drm_drv.c
+++ b/drivers/gpu/drm/drm_drv.c
-@@ -306,7 +306,7 @@ module_exit(drm_core_exit);
+@@ -186,7 +186,7 @@ static void drm_legacy_dev_reinit(struct drm_device *dev)
+ atomic_set(&dev->vma_count, 0);
+
+ for (i = 0; i < ARRAY_SIZE(dev->counts); i++)
+- atomic_set(&dev->counts[i], 0);
++ atomic_set_unchecked(&dev->counts[i], 0);
+
+ dev->sigdata.lock = NULL;
+
+@@ -302,7 +302,7 @@ module_exit(drm_core_exit);
/**
* Copy and IOCTL return string to user space
*/
@@ -38446,7 +38069,7 @@ index 2ab782c..d994a37 100644
{
int len;
-@@ -376,7 +376,7 @@ long drm_ioctl(struct file *filp,
+@@ -372,7 +372,7 @@ long drm_ioctl(struct file *filp,
struct drm_file *file_priv = filp->private_data;
struct drm_device *dev;
const struct drm_ioctl_desc *ioctl = NULL;
@@ -38455,7 +38078,7 @@ index 2ab782c..d994a37 100644
unsigned int nr = DRM_IOCTL_NR(cmd);
int retcode = -EINVAL;
char stack_kdata[128];
-@@ -389,7 +389,7 @@ long drm_ioctl(struct file *filp,
+@@ -385,7 +385,7 @@ long drm_ioctl(struct file *filp,
return -ENODEV;
atomic_inc(&dev->ioctl_count);
@@ -38465,19 +38088,10 @@ index 2ab782c..d994a37 100644
if ((nr >= DRM_CORE_IOCTL_COUNT) &&
diff --git a/drivers/gpu/drm/drm_fops.c b/drivers/gpu/drm/drm_fops.c
-index 429e07d..e681a2c 100644
+index 3f84277..c627c54 100644
--- a/drivers/gpu/drm/drm_fops.c
+++ b/drivers/gpu/drm/drm_fops.c
-@@ -71,7 +71,7 @@ static int drm_setup(struct drm_device * dev)
- }
-
- for (i = 0; i < ARRAY_SIZE(dev->counts); i++)
-- atomic_set(&dev->counts[i], 0);
-+ atomic_set_unchecked(&dev->counts[i], 0);
-
- dev->sigdata.lock = NULL;
-
-@@ -135,7 +135,7 @@ int drm_open(struct inode *inode, struct file *filp)
+@@ -97,7 +97,7 @@ int drm_open(struct inode *inode, struct file *filp)
if (drm_device_is_unplugged(dev))
return -ENODEV;
@@ -38486,7 +38100,7 @@ index 429e07d..e681a2c 100644
need_setup = 1;
mutex_lock(&dev->struct_mutex);
old_imapping = inode->i_mapping;
-@@ -151,7 +151,7 @@ int drm_open(struct inode *inode, struct file *filp)
+@@ -113,7 +113,7 @@ int drm_open(struct inode *inode, struct file *filp)
retcode = drm_open_helper(inode, filp, dev);
if (retcode)
goto err_undo;
@@ -38495,7 +38109,7 @@ index 429e07d..e681a2c 100644
if (need_setup) {
retcode = drm_setup(dev);
if (retcode)
-@@ -166,7 +166,7 @@ err_undo:
+@@ -128,7 +128,7 @@ err_undo:
iput(container_of(dev->dev_mapping, struct inode, i_data));
dev->dev_mapping = old_mapping;
mutex_unlock(&dev->struct_mutex);
@@ -38504,7 +38118,7 @@ index 429e07d..e681a2c 100644
return retcode;
}
EXPORT_SYMBOL(drm_open);
-@@ -441,7 +441,7 @@ int drm_release(struct inode *inode, struct file *filp)
+@@ -405,7 +405,7 @@ int drm_release(struct inode *inode, struct file *filp)
mutex_lock(&drm_global_mutex);
@@ -38513,7 +38127,7 @@ index 429e07d..e681a2c 100644
if (dev->driver->preclose)
dev->driver->preclose(dev, file_priv);
-@@ -450,10 +450,10 @@ int drm_release(struct inode *inode, struct file *filp)
+@@ -414,10 +414,10 @@ int drm_release(struct inode *inode, struct file *filp)
* Begin inline drm_release
*/
@@ -38526,7 +38140,7 @@ index 429e07d..e681a2c 100644
/* Release any auth tokens that might point to this file_priv,
(do that under the drm_global_mutex) */
-@@ -550,8 +550,8 @@ int drm_release(struct inode *inode, struct file *filp)
+@@ -516,8 +516,8 @@ int drm_release(struct inode *inode, struct file *filp)
* End inline drm_release
*/
@@ -38599,7 +38213,7 @@ index f731116..629842c 100644
item->object = NULL;
}
diff --git a/drivers/gpu/drm/drm_info.c b/drivers/gpu/drm/drm_info.c
-index d4b20ce..77a8d41 100644
+index 5329832..b503f49 100644
--- a/drivers/gpu/drm/drm_info.c
+++ b/drivers/gpu/drm/drm_info.c
@@ -75,10 +75,14 @@ int drm_vm_info(struct seq_file *m, void *data)
@@ -38630,7 +38244,7 @@ index d4b20ce..77a8d41 100644
type = "??";
else
type = types[map->type];
-@@ -253,7 +257,11 @@ int drm_vma_info(struct seq_file *m, void *data)
+@@ -257,7 +261,11 @@ int drm_vma_info(struct seq_file *m, void *data)
vma->vm_flags & VM_MAYSHARE ? 's' : 'p',
vma->vm_flags & VM_LOCKED ? 'l' : '-',
vma->vm_flags & VM_IO ? 'i' : '-',
@@ -38694,19 +38308,6 @@ index 2f4c434..dd12cd2 100644
else
ret = drm_ioctl(filp, cmd, arg);
-diff --git a/drivers/gpu/drm/drm_ioctl.c b/drivers/gpu/drm/drm_ioctl.c
-index e77bd8b..1571b85 100644
---- a/drivers/gpu/drm/drm_ioctl.c
-+++ b/drivers/gpu/drm/drm_ioctl.c
-@@ -252,7 +252,7 @@ int drm_getstats(struct drm_device *dev, void *data,
- stats->data[i].value =
- (file_priv->master->lock.hw_lock ? file_priv->master->lock.hw_lock->lock : 0);
- else
-- stats->data[i].value = atomic_read(&dev->counts[i]);
-+ stats->data[i].value = atomic_read_unchecked(&dev->counts[i]);
- stats->data[i].type = dev->types[i];
- }
-
diff --git a/drivers/gpu/drm/drm_lock.c b/drivers/gpu/drm/drm_lock.c
index d752c96..fe08455 100644
--- a/drivers/gpu/drm/drm_lock.c
@@ -38730,10 +38331,10 @@ index d752c96..fe08455 100644
if (drm_lock_free(&master->lock, lock->context)) {
/* FIXME: Should really bail out here. */
diff --git a/drivers/gpu/drm/drm_stub.c b/drivers/gpu/drm/drm_stub.c
-index 16f3ec5..b28f9ca 100644
+index 39d8645..59e06fa 100644
--- a/drivers/gpu/drm/drm_stub.c
+++ b/drivers/gpu/drm/drm_stub.c
-@@ -501,7 +501,7 @@ void drm_unplug_dev(struct drm_device *dev)
+@@ -484,7 +484,7 @@ void drm_unplug_dev(struct drm_device *dev)
drm_device_set_unplugged(dev);
@@ -38743,10 +38344,10 @@ index 16f3ec5..b28f9ca 100644
}
mutex_unlock(&drm_global_mutex);
diff --git a/drivers/gpu/drm/drm_sysfs.c b/drivers/gpu/drm/drm_sysfs.c
-index 0229665..f61329c 100644
+index 2290b3b..22056a1 100644
--- a/drivers/gpu/drm/drm_sysfs.c
+++ b/drivers/gpu/drm/drm_sysfs.c
-@@ -499,7 +499,7 @@ EXPORT_SYMBOL(drm_sysfs_hotplug_event);
+@@ -524,7 +524,7 @@ EXPORT_SYMBOL(drm_sysfs_hotplug_event);
int drm_sysfs_device_add(struct drm_minor *minor)
{
int err;
@@ -38756,10 +38357,10 @@ index 0229665..f61329c 100644
minor->kdev.parent = minor->dev->dev;
diff --git a/drivers/gpu/drm/i810/i810_dma.c b/drivers/gpu/drm/i810/i810_dma.c
-index 004ecdf..db1f6e0 100644
+index ab1892eb..d7009ca 100644
--- a/drivers/gpu/drm/i810/i810_dma.c
+++ b/drivers/gpu/drm/i810/i810_dma.c
-@@ -945,8 +945,8 @@ static int i810_dma_vertex(struct drm_device *dev, void *data,
+@@ -944,8 +944,8 @@ static int i810_dma_vertex(struct drm_device *dev, void *data,
dma->buflist[vertex->idx],
vertex->discard, vertex->used);
@@ -38770,7 +38371,7 @@ index 004ecdf..db1f6e0 100644
sarea_priv->last_enqueue = dev_priv->counter - 1;
sarea_priv->last_dispatch = (int)hw_status[5];
-@@ -1106,8 +1106,8 @@ static int i810_dma_mc(struct drm_device *dev, void *data,
+@@ -1105,8 +1105,8 @@ static int i810_dma_mc(struct drm_device *dev, void *data,
i810_dma_dispatch_mc(dev, dma->buflist[mc->idx], mc->used,
mc->last_render);
@@ -38782,7 +38383,7 @@ index 004ecdf..db1f6e0 100644
sarea_priv->last_dispatch = (int)hw_status[5];
diff --git a/drivers/gpu/drm/i810/i810_drv.h b/drivers/gpu/drm/i810/i810_drv.h
-index 6e0acad..93c8289 100644
+index d4d16ed..8fb0b51 100644
--- a/drivers/gpu/drm/i810/i810_drv.h
+++ b/drivers/gpu/drm/i810/i810_drv.h
@@ -108,8 +108,8 @@ typedef struct drm_i810_private {
@@ -38797,10 +38398,10 @@ index 6e0acad..93c8289 100644
int front_offset;
} drm_i810_private_t;
diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
-index e913d32..4d9b351 100644
+index a6f4cb5..6b2beb2 100644
--- a/drivers/gpu/drm/i915/i915_debugfs.c
+++ b/drivers/gpu/drm/i915/i915_debugfs.c
-@@ -499,7 +499,7 @@ static int i915_interrupt_info(struct seq_file *m, void *data)
+@@ -624,7 +624,7 @@ static int i915_interrupt_info(struct seq_file *m, void *data)
I915_READ(GTIMR));
}
seq_printf(m, "Interrupts received: %d\n",
@@ -38810,10 +38411,10 @@ index e913d32..4d9b351 100644
if (IS_GEN6(dev) || IS_GEN7(dev)) {
seq_printf(m,
diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c
-index 17d9b0b..860e6d9 100644
+index d5c784d..06e5c36 100644
--- a/drivers/gpu/drm/i915/i915_dma.c
+++ b/drivers/gpu/drm/i915/i915_dma.c
-@@ -1259,7 +1259,7 @@ static bool i915_switcheroo_can_switch(struct pci_dev *pdev)
+@@ -1263,7 +1263,7 @@ static bool i915_switcheroo_can_switch(struct pci_dev *pdev)
bool can_switch;
spin_lock(&dev->count_lock);
@@ -38823,10 +38424,10 @@ index 17d9b0b..860e6d9 100644
return can_switch;
}
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
-index 47d8b68..52f5d8d 100644
+index ab0f2c0..53c1bda 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
-@@ -916,7 +916,7 @@ typedef struct drm_i915_private {
+@@ -1181,7 +1181,7 @@ typedef struct drm_i915_private {
drm_dma_handle_t *status_page_dmah;
struct resource mch_res;
@@ -38835,20 +38436,11 @@ index 47d8b68..52f5d8d 100644
/* protects the irq masks */
spinlock_t irq_lock;
-@@ -1813,7 +1813,7 @@ extern struct i2c_adapter *intel_gmbus_get_adapter(
- struct drm_i915_private *dev_priv, unsigned port);
- extern void intel_gmbus_set_speed(struct i2c_adapter *adapter, int speed);
- extern void intel_gmbus_force_bit(struct i2c_adapter *adapter, bool force_bit);
--extern inline bool intel_gmbus_is_forced_bit(struct i2c_adapter *adapter)
-+static inline bool intel_gmbus_is_forced_bit(struct i2c_adapter *adapter)
- {
- return container_of(adapter, struct intel_gmbus, adapter)->force_bit;
- }
diff --git a/drivers/gpu/drm/i915/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
-index 117ce38..eefd237 100644
+index bf34577..3fd2ffa 100644
--- a/drivers/gpu/drm/i915/i915_gem_execbuffer.c
+++ b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
-@@ -727,9 +727,9 @@ i915_gem_check_execbuffer(struct drm_i915_gem_execbuffer2 *exec)
+@@ -768,9 +768,9 @@ i915_gem_check_execbuffer(struct drm_i915_gem_execbuffer2 *exec)
static int
validate_exec_list(struct drm_i915_gem_exec_object2 *exec,
@@ -38896,10 +38488,10 @@ index 3c59584..500f2e9 100644
return ret;
diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
-index c8d16a6..ca71b5e 100644
+index 4b91228..590c643 100644
--- a/drivers/gpu/drm/i915/i915_irq.c
+++ b/drivers/gpu/drm/i915/i915_irq.c
-@@ -670,7 +670,7 @@ static irqreturn_t valleyview_irq_handler(int irq, void *arg)
+@@ -1085,7 +1085,7 @@ static irqreturn_t valleyview_irq_handler(int irq, void *arg)
int pipe;
u32 pipe_stats[I915_MAX_PIPES];
@@ -38908,25 +38500,16 @@ index c8d16a6..ca71b5e 100644
while (true) {
iir = I915_READ(VLV_IIR);
-@@ -835,7 +835,7 @@ static irqreturn_t ivybridge_irq_handler(int irq, void *arg)
+@@ -1390,7 +1390,7 @@ static irqreturn_t ironlake_irq_handler(int irq, void *arg)
irqreturn_t ret = IRQ_NONE;
- int i;
-
-- atomic_inc(&dev_priv->irq_received);
-+ atomic_inc_unchecked(&dev_priv->irq_received);
-
- /* disable master interrupt before clearing iir */
- de_ier = I915_READ(DEIER);
-@@ -925,7 +925,7 @@ static irqreturn_t ironlake_irq_handler(int irq, void *arg)
- int ret = IRQ_NONE;
- u32 de_iir, gt_iir, de_ier, pm_iir, sde_ier;
+ bool err_int_reenable = false;
- atomic_inc(&dev_priv->irq_received);
+ atomic_inc_unchecked(&dev_priv->irq_received);
- /* disable master interrupt before clearing iir */
- de_ier = I915_READ(DEIER);
-@@ -2135,7 +2135,7 @@ static void ironlake_irq_preinstall(struct drm_device *dev)
+ /* We get interrupts on unclaimed registers, so check for this before we
+ * do any I915_{READ,WRITE}. */
+@@ -2146,7 +2146,7 @@ static void ironlake_irq_preinstall(struct drm_device *dev)
{
drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private;
@@ -38935,7 +38518,7 @@ index c8d16a6..ca71b5e 100644
I915_WRITE(HWSTAM, 0xeffe);
-@@ -2170,7 +2170,7 @@ static void valleyview_irq_preinstall(struct drm_device *dev)
+@@ -2164,7 +2164,7 @@ static void valleyview_irq_preinstall(struct drm_device *dev)
drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private;
int pipe;
@@ -38944,7 +38527,7 @@ index c8d16a6..ca71b5e 100644
/* VLV magic */
I915_WRITE(VLV_IMR, 0);
-@@ -2457,7 +2457,7 @@ static void i8xx_irq_preinstall(struct drm_device * dev)
+@@ -2452,7 +2452,7 @@ static void i8xx_irq_preinstall(struct drm_device * dev)
drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private;
int pipe;
@@ -38953,7 +38536,7 @@ index c8d16a6..ca71b5e 100644
for_each_pipe(pipe)
I915_WRITE(PIPESTAT(pipe), 0);
-@@ -2536,7 +2536,7 @@ static irqreturn_t i8xx_irq_handler(int irq, void *arg)
+@@ -2530,7 +2530,7 @@ static irqreturn_t i8xx_irq_handler(int irq, void *arg)
I915_DISPLAY_PLANE_A_FLIP_PENDING_INTERRUPT |
I915_DISPLAY_PLANE_B_FLIP_PENDING_INTERRUPT;
@@ -38962,7 +38545,7 @@ index c8d16a6..ca71b5e 100644
iir = I915_READ16(IIR);
if (iir == 0)
-@@ -2611,7 +2611,7 @@ static void i915_irq_preinstall(struct drm_device * dev)
+@@ -2604,7 +2604,7 @@ static void i915_irq_preinstall(struct drm_device * dev)
drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private;
int pipe;
@@ -38971,7 +38554,7 @@ index c8d16a6..ca71b5e 100644
if (I915_HAS_HOTPLUG(dev)) {
I915_WRITE(PORT_HOTPLUG_EN, 0);
-@@ -2710,7 +2710,7 @@ static irqreturn_t i915_irq_handler(int irq, void *arg)
+@@ -2703,7 +2703,7 @@ static irqreturn_t i915_irq_handler(int irq, void *arg)
I915_DISPLAY_PLANE_B_FLIP_PENDING_INTERRUPT;
int pipe, ret = IRQ_NONE;
@@ -38980,7 +38563,7 @@ index c8d16a6..ca71b5e 100644
iir = I915_READ(IIR);
do {
-@@ -2837,7 +2837,7 @@ static void i965_irq_preinstall(struct drm_device * dev)
+@@ -2827,7 +2827,7 @@ static void i965_irq_preinstall(struct drm_device * dev)
drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private;
int pipe;
@@ -38989,7 +38572,7 @@ index c8d16a6..ca71b5e 100644
I915_WRITE(PORT_HOTPLUG_EN, 0);
I915_WRITE(PORT_HOTPLUG_STAT, I915_READ(PORT_HOTPLUG_STAT));
-@@ -2944,7 +2944,7 @@ static irqreturn_t i965_irq_handler(int irq, void *arg)
+@@ -2941,7 +2941,7 @@ static irqreturn_t i965_irq_handler(int irq, void *arg)
I915_DISPLAY_PLANE_A_FLIP_PENDING_INTERRUPT |
I915_DISPLAY_PLANE_B_FLIP_PENDING_INTERRUPT;
@@ -38999,10 +38582,10 @@ index c8d16a6..ca71b5e 100644
iir = I915_READ(IIR);
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
-index c714d4d..665732e 100644
+index 333aa1b..0183e38 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
-@@ -8939,13 +8939,13 @@ struct intel_quirk {
+@@ -9976,13 +9976,13 @@ struct intel_quirk {
int subsystem_vendor;
int subsystem_device;
void (*hook)(struct drm_device *dev);
@@ -39018,7 +38601,7 @@ index c714d4d..665732e 100644
static int intel_dmi_reverse_brightness(const struct dmi_system_id *id)
{
-@@ -8953,18 +8953,20 @@ static int intel_dmi_reverse_brightness(const struct dmi_system_id *id)
+@@ -9990,18 +9990,20 @@ static int intel_dmi_reverse_brightness(const struct dmi_system_id *id)
return 1;
}
@@ -39050,7 +38633,7 @@ index c714d4d..665732e 100644
},
};
diff --git a/drivers/gpu/drm/mga/mga_drv.h b/drivers/gpu/drm/mga/mga_drv.h
-index 54558a0..2d97005 100644
+index ca4bc54..ee598a2 100644
--- a/drivers/gpu/drm/mga/mga_drv.h
+++ b/drivers/gpu/drm/mga/mga_drv.h
@@ -120,9 +120,9 @@ typedef struct drm_mga_private {
@@ -39141,7 +38724,7 @@ index 598c281..60d590e 100644
*sequence = cur_fence;
diff --git a/drivers/gpu/drm/nouveau/nouveau_bios.c b/drivers/gpu/drm/nouveau/nouveau_bios.c
-index 6aa2137..fe8dc55 100644
+index 3e72876..d1c15ad 100644
--- a/drivers/gpu/drm/nouveau/nouveau_bios.c
+++ b/drivers/gpu/drm/nouveau/nouveau_bios.c
@@ -965,7 +965,7 @@ static int parse_bit_tmds_tbl_entry(struct drm_device *dev, struct nvbios *bios,
@@ -39154,42 +38737,19 @@ index 6aa2137..fe8dc55 100644
#define BIT_TABLE(id, funcid) ((struct bit_table){ id, parse_bit_##funcid##_tbl_entry })
diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.h b/drivers/gpu/drm/nouveau/nouveau_drm.h
-index f2b30f8..d0f9a95 100644
+index 994fd6e..6e12565 100644
--- a/drivers/gpu/drm/nouveau/nouveau_drm.h
+++ b/drivers/gpu/drm/nouveau/nouveau_drm.h
-@@ -92,7 +92,7 @@ struct nouveau_drm {
+@@ -94,7 +94,6 @@ struct nouveau_drm {
struct drm_global_reference mem_global_ref;
struct ttm_bo_global_ref bo_global_ref;
struct ttm_bo_device bdev;
- atomic_t validate_sequence;
-+ atomic_unchecked_t validate_sequence;
int (*move)(struct nouveau_channel *,
struct ttm_buffer_object *,
struct ttm_mem_reg *, struct ttm_mem_reg *);
-diff --git a/drivers/gpu/drm/nouveau/nouveau_gem.c b/drivers/gpu/drm/nouveau/nouveau_gem.c
-index 5bccf31..7b5667c 100644
---- a/drivers/gpu/drm/nouveau/nouveau_gem.c
-+++ b/drivers/gpu/drm/nouveau/nouveau_gem.c
-@@ -323,7 +323,7 @@ validate_init(struct nouveau_channel *chan, struct drm_file *file_priv,
- int ret, i;
- struct nouveau_bo *res_bo = NULL;
-
-- sequence = atomic_add_return(1, &drm->ttm.validate_sequence);
-+ sequence = atomic_add_return_unchecked(1, &drm->ttm.validate_sequence);
- retry:
- if (++trycnt > 100000) {
- NV_ERROR(cli, "%s failed and gave up.\n", __func__);
-@@ -360,7 +360,7 @@ retry:
- if (ret) {
- validate_fini(op, NULL);
- if (unlikely(ret == -EAGAIN)) {
-- sequence = atomic_add_return(1, &drm->ttm.validate_sequence);
-+ sequence = atomic_add_return_unchecked(1, &drm->ttm.validate_sequence);
- ret = ttm_bo_reserve_slowpath(&nvbo->bo, true,
- sequence);
- if (!ret)
diff --git a/drivers/gpu/drm/nouveau/nouveau_ioc32.c b/drivers/gpu/drm/nouveau/nouveau_ioc32.c
-index 08214bc..9208577 100644
+index c1a7e5a..38b8539 100644
--- a/drivers/gpu/drm/nouveau/nouveau_ioc32.c
+++ b/drivers/gpu/drm/nouveau/nouveau_ioc32.c
@@ -50,7 +50,7 @@ long nouveau_compat_ioctl(struct file *filp, unsigned int cmd,
@@ -39202,10 +38762,10 @@ index 08214bc..9208577 100644
if (nr < DRM_COMMAND_BASE)
diff --git a/drivers/gpu/drm/nouveau/nouveau_vga.c b/drivers/gpu/drm/nouveau/nouveau_vga.c
-index 25d3495..d81aaf6 100644
+index 81638d7..2e45854 100644
--- a/drivers/gpu/drm/nouveau/nouveau_vga.c
+++ b/drivers/gpu/drm/nouveau/nouveau_vga.c
-@@ -62,7 +62,7 @@ nouveau_switcheroo_can_switch(struct pci_dev *pdev)
+@@ -65,7 +65,7 @@ nouveau_switcheroo_can_switch(struct pci_dev *pdev)
bool can_switch;
spin_lock(&dev->count_lock);
@@ -39214,8 +38774,127 @@ index 25d3495..d81aaf6 100644
spin_unlock(&dev->count_lock);
return can_switch;
}
+diff --git a/drivers/gpu/drm/qxl/qxl_cmd.c b/drivers/gpu/drm/qxl/qxl_cmd.c
+index eb89653..613cf71 100644
+--- a/drivers/gpu/drm/qxl/qxl_cmd.c
++++ b/drivers/gpu/drm/qxl/qxl_cmd.c
+@@ -285,27 +285,27 @@ static int wait_for_io_cmd_user(struct qxl_device *qdev, uint8_t val, long port,
+ int ret;
+
+ mutex_lock(&qdev->async_io_mutex);
+- irq_num = atomic_read(&qdev->irq_received_io_cmd);
++ irq_num = atomic_read_unchecked(&qdev->irq_received_io_cmd);
+ if (qdev->last_sent_io_cmd > irq_num) {
+ if (intr)
+ ret = wait_event_interruptible_timeout(qdev->io_cmd_event,
+- atomic_read(&qdev->irq_received_io_cmd) > irq_num, 5*HZ);
++ atomic_read_unchecked(&qdev->irq_received_io_cmd) > irq_num, 5*HZ);
+ else
+ ret = wait_event_timeout(qdev->io_cmd_event,
+- atomic_read(&qdev->irq_received_io_cmd) > irq_num, 5*HZ);
++ atomic_read_unchecked(&qdev->irq_received_io_cmd) > irq_num, 5*HZ);
+ /* 0 is timeout, just bail the "hw" has gone away */
+ if (ret <= 0)
+ goto out;
+- irq_num = atomic_read(&qdev->irq_received_io_cmd);
++ irq_num = atomic_read_unchecked(&qdev->irq_received_io_cmd);
+ }
+ outb(val, addr);
+ qdev->last_sent_io_cmd = irq_num + 1;
+ if (intr)
+ ret = wait_event_interruptible_timeout(qdev->io_cmd_event,
+- atomic_read(&qdev->irq_received_io_cmd) > irq_num, 5*HZ);
++ atomic_read_unchecked(&qdev->irq_received_io_cmd) > irq_num, 5*HZ);
+ else
+ ret = wait_event_timeout(qdev->io_cmd_event,
+- atomic_read(&qdev->irq_received_io_cmd) > irq_num, 5*HZ);
++ atomic_read_unchecked(&qdev->irq_received_io_cmd) > irq_num, 5*HZ);
+ out:
+ if (ret > 0)
+ ret = 0;
+diff --git a/drivers/gpu/drm/qxl/qxl_debugfs.c b/drivers/gpu/drm/qxl/qxl_debugfs.c
+index c3c2bbd..bc3c0fb 100644
+--- a/drivers/gpu/drm/qxl/qxl_debugfs.c
++++ b/drivers/gpu/drm/qxl/qxl_debugfs.c
+@@ -42,10 +42,10 @@ qxl_debugfs_irq_received(struct seq_file *m, void *data)
+ struct drm_info_node *node = (struct drm_info_node *) m->private;
+ struct qxl_device *qdev = node->minor->dev->dev_private;
+
+- seq_printf(m, "%d\n", atomic_read(&qdev->irq_received));
+- seq_printf(m, "%d\n", atomic_read(&qdev->irq_received_display));
+- seq_printf(m, "%d\n", atomic_read(&qdev->irq_received_cursor));
+- seq_printf(m, "%d\n", atomic_read(&qdev->irq_received_io_cmd));
++ seq_printf(m, "%d\n", atomic_read_unchecked(&qdev->irq_received));
++ seq_printf(m, "%d\n", atomic_read_unchecked(&qdev->irq_received_display));
++ seq_printf(m, "%d\n", atomic_read_unchecked(&qdev->irq_received_cursor));
++ seq_printf(m, "%d\n", atomic_read_unchecked(&qdev->irq_received_io_cmd));
+ seq_printf(m, "%d\n", qdev->irq_received_error);
+ return 0;
+ }
+diff --git a/drivers/gpu/drm/qxl/qxl_drv.h b/drivers/gpu/drm/qxl/qxl_drv.h
+index f7c9add..fb971d2 100644
+--- a/drivers/gpu/drm/qxl/qxl_drv.h
++++ b/drivers/gpu/drm/qxl/qxl_drv.h
+@@ -290,10 +290,10 @@ struct qxl_device {
+ unsigned int last_sent_io_cmd;
+
+ /* interrupt handling */
+- atomic_t irq_received;
+- atomic_t irq_received_display;
+- atomic_t irq_received_cursor;
+- atomic_t irq_received_io_cmd;
++ atomic_unchecked_t irq_received;
++ atomic_unchecked_t irq_received_display;
++ atomic_unchecked_t irq_received_cursor;
++ atomic_unchecked_t irq_received_io_cmd;
+ unsigned irq_received_error;
+ wait_queue_head_t display_event;
+ wait_queue_head_t cursor_event;
+diff --git a/drivers/gpu/drm/qxl/qxl_irq.c b/drivers/gpu/drm/qxl/qxl_irq.c
+index 21393dc..329f3a9 100644
+--- a/drivers/gpu/drm/qxl/qxl_irq.c
++++ b/drivers/gpu/drm/qxl/qxl_irq.c
+@@ -33,19 +33,19 @@ irqreturn_t qxl_irq_handler(DRM_IRQ_ARGS)
+
+ pending = xchg(&qdev->ram_header->int_pending, 0);
+
+- atomic_inc(&qdev->irq_received);
++ atomic_inc_unchecked(&qdev->irq_received);
+
+ if (pending & QXL_INTERRUPT_DISPLAY) {
+- atomic_inc(&qdev->irq_received_display);
++ atomic_inc_unchecked(&qdev->irq_received_display);
+ wake_up_all(&qdev->display_event);
+ qxl_queue_garbage_collect(qdev, false);
+ }
+ if (pending & QXL_INTERRUPT_CURSOR) {
+- atomic_inc(&qdev->irq_received_cursor);
++ atomic_inc_unchecked(&qdev->irq_received_cursor);
+ wake_up_all(&qdev->cursor_event);
+ }
+ if (pending & QXL_INTERRUPT_IO_CMD) {
+- atomic_inc(&qdev->irq_received_io_cmd);
++ atomic_inc_unchecked(&qdev->irq_received_io_cmd);
+ wake_up_all(&qdev->io_cmd_event);
+ }
+ if (pending & QXL_INTERRUPT_ERROR) {
+@@ -82,10 +82,10 @@ int qxl_irq_init(struct qxl_device *qdev)
+ init_waitqueue_head(&qdev->io_cmd_event);
+ INIT_WORK(&qdev->client_monitors_config_work,
+ qxl_client_monitors_config_work_func);
+- atomic_set(&qdev->irq_received, 0);
+- atomic_set(&qdev->irq_received_display, 0);
+- atomic_set(&qdev->irq_received_cursor, 0);
+- atomic_set(&qdev->irq_received_io_cmd, 0);
++ atomic_set_unchecked(&qdev->irq_received, 0);
++ atomic_set_unchecked(&qdev->irq_received_display, 0);
++ atomic_set_unchecked(&qdev->irq_received_cursor, 0);
++ atomic_set_unchecked(&qdev->irq_received_io_cmd, 0);
+ qdev->irq_received_error = 0;
+ ret = drm_irq_install(qdev->ddev);
+ qdev->ram_header->int_mask = QXL_INTERRUPT_MASK;
diff --git a/drivers/gpu/drm/qxl/qxl_ttm.c b/drivers/gpu/drm/qxl/qxl_ttm.c
-index 489cb8c..0b8d0d3 100644
+index 037786d..2a95e33 100644
--- a/drivers/gpu/drm/qxl/qxl_ttm.c
+++ b/drivers/gpu/drm/qxl/qxl_ttm.c
@@ -103,7 +103,7 @@ static void qxl_ttm_global_fini(struct qxl_device *qdev)
@@ -39238,14 +38917,24 @@ index 489cb8c..0b8d0d3 100644
}
vma->vm_ops = &qxl_ttm_vm_ops;
return 0;
-@@ -556,25 +558,23 @@ static int qxl_mm_dump_table(struct seq_file *m, void *data)
+@@ -558,25 +560,23 @@ static int qxl_mm_dump_table(struct seq_file *m, void *data)
static int qxl_ttm_debugfs_init(struct qxl_device *qdev)
{
#if defined(CONFIG_DEBUG_FS)
- static struct drm_info_list qxl_mem_types_list[QXL_DEBUGFS_MEM_TYPES];
- static char qxl_mem_types_names[QXL_DEBUGFS_MEM_TYPES][32];
- unsigned i;
--
++ static struct drm_info_list qxl_mem_types_list[QXL_DEBUGFS_MEM_TYPES] = {
++ {
++ .name = "qxl_mem_mm",
++ .show = &qxl_mm_dump_table,
++ },
++ {
++ .name = "qxl_surf_mm",
++ .show = &qxl_mm_dump_table,
++ }
++ };
+
- for (i = 0; i < QXL_DEBUGFS_MEM_TYPES; i++) {
- if (i == 0)
- sprintf(qxl_mem_types_names[i], "qxl_mem_mm");
@@ -39258,30 +38947,19 @@ index 489cb8c..0b8d0d3 100644
- qxl_mem_types_list[i].data = qdev->mman.bdev.man[TTM_PL_VRAM].priv;
- else
- qxl_mem_types_list[i].data = qdev->mman.bdev.man[TTM_PL_PRIV0].priv;
-+ static struct drm_info_list qxl_mem_types_list[QXL_DEBUGFS_MEM_TYPES] = {
-+ {
-+ .name = "qxl_mem_mm",
-+ .show = &qxl_mm_dump_table,
-+ },
-+ {
-+ .name = "qxl_surf_mm",
-+ .show = &qxl_mm_dump_table,
-+ }
-+ };
-
-- }
-- return qxl_debugfs_add_files(qdev, qxl_mem_types_list, i);
+ pax_open_kernel();
+ *(void **)&qxl_mem_types_list[0].data = qdev->mman.bdev.man[TTM_PL_VRAM].priv;
+ *(void **)&qxl_mem_types_list[1].data = qdev->mman.bdev.man[TTM_PL_PRIV0].priv;
+ pax_close_kernel();
-+
+
+- }
+- return qxl_debugfs_add_files(qdev, qxl_mem_types_list, i);
+ return qxl_debugfs_add_files(qdev, qxl_mem_types_list, QXL_DEBUGFS_MEM_TYPES);
#else
return 0;
#endif
diff --git a/drivers/gpu/drm/r128/r128_cce.c b/drivers/gpu/drm/r128/r128_cce.c
-index d4660cf..70dbe65 100644
+index c451257..0ad2134 100644
--- a/drivers/gpu/drm/r128/r128_cce.c
+++ b/drivers/gpu/drm/r128/r128_cce.c
@@ -377,7 +377,7 @@ static int r128_do_init_cce(struct drm_device *dev, drm_r128_init_t *init)
@@ -39294,7 +38972,7 @@ index d4660cf..70dbe65 100644
/* We don't support anything other than bus-mastering ring mode,
* but the ring can be in either AGP or PCI space for the ring
diff --git a/drivers/gpu/drm/r128/r128_drv.h b/drivers/gpu/drm/r128/r128_drv.h
-index 930c71b..499aded 100644
+index 56eb5e3..c4ec43d 100644
--- a/drivers/gpu/drm/r128/r128_drv.h
+++ b/drivers/gpu/drm/r128/r128_drv.h
@@ -90,14 +90,14 @@ typedef struct drm_r128_private {
@@ -39372,7 +39050,7 @@ index 2ea4f09..d391371 100644
return IRQ_HANDLED;
}
diff --git a/drivers/gpu/drm/r128/r128_state.c b/drivers/gpu/drm/r128/r128_state.c
-index 19bb7e6..de7e2a2 100644
+index 01dd9ae..6352f04 100644
--- a/drivers/gpu/drm/r128/r128_state.c
+++ b/drivers/gpu/drm/r128/r128_state.c
@@ -320,10 +320,10 @@ static void r128_clear_box(drm_r128_private_t *dev_priv,
@@ -39389,10 +39067,10 @@ index 19bb7e6..de7e2a2 100644
#endif
diff --git a/drivers/gpu/drm/radeon/mkregtable.c b/drivers/gpu/drm/radeon/mkregtable.c
-index 5a82b6b..9e69c73 100644
+index af85299..ed9ac8d 100644
--- a/drivers/gpu/drm/radeon/mkregtable.c
+++ b/drivers/gpu/drm/radeon/mkregtable.c
-@@ -637,14 +637,14 @@ static int parser_auth(struct table *t, const char *filename)
+@@ -624,14 +624,14 @@ static int parser_auth(struct table *t, const char *filename)
regex_t mask_rex;
regmatch_t match[4];
char buf[1024];
@@ -39410,10 +39088,10 @@ index 5a82b6b..9e69c73 100644
if (regcomp
(&mask_rex, "(0x[0-9a-fA-F]*) *([_a-zA-Z0-9]*)", REG_EXTENDED)) {
diff --git a/drivers/gpu/drm/radeon/radeon_device.c b/drivers/gpu/drm/radeon/radeon_device.c
-index 8df1525..62e95ef 100644
+index 841d0e0..9eaa268 100644
--- a/drivers/gpu/drm/radeon/radeon_device.c
+++ b/drivers/gpu/drm/radeon/radeon_device.c
-@@ -1014,7 +1014,7 @@ static bool radeon_switcheroo_can_switch(struct pci_dev *pdev)
+@@ -1117,7 +1117,7 @@ static bool radeon_switcheroo_can_switch(struct pci_dev *pdev)
bool can_switch;
spin_lock(&dev->count_lock);
@@ -39526,10 +39204,10 @@ index 4d20910..6726b6d 100644
DRM_DEBUG("pid=%d\n", DRM_CURRENTPID);
diff --git a/drivers/gpu/drm/radeon/radeon_ttm.c b/drivers/gpu/drm/radeon/radeon_ttm.c
-index 6c0ce89..57a2529 100644
+index 71245d6..94c556d 100644
--- a/drivers/gpu/drm/radeon/radeon_ttm.c
+++ b/drivers/gpu/drm/radeon/radeon_ttm.c
-@@ -782,7 +782,7 @@ void radeon_ttm_set_active_vram_size(struct radeon_device *rdev, u64 size)
+@@ -784,7 +784,7 @@ void radeon_ttm_set_active_vram_size(struct radeon_device *rdev, u64 size)
man->size = size >> PAGE_SHIFT;
}
@@ -39538,7 +39216,7 @@ index 6c0ce89..57a2529 100644
static const struct vm_operations_struct *ttm_vm_ops = NULL;
static int radeon_ttm_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
-@@ -823,8 +823,10 @@ int radeon_mmap(struct file *filp, struct vm_area_struct *vma)
+@@ -825,8 +825,10 @@ int radeon_mmap(struct file *filp, struct vm_area_struct *vma)
}
if (unlikely(ttm_vm_ops == NULL)) {
ttm_vm_ops = vma->vm_ops;
@@ -39549,12 +39227,13 @@ index 6c0ce89..57a2529 100644
}
vma->vm_ops = &radeon_ttm_vm_ops;
return 0;
-@@ -853,38 +855,33 @@ static int radeon_mm_dump_table(struct seq_file *m, void *data)
+@@ -855,38 +857,33 @@ static int radeon_mm_dump_table(struct seq_file *m, void *data)
static int radeon_ttm_debugfs_init(struct radeon_device *rdev)
{
#if defined(CONFIG_DEBUG_FS)
- static struct drm_info_list radeon_mem_types_list[RADEON_DEBUGFS_MEM_TYPES+2];
- static char radeon_mem_types_names[RADEON_DEBUGFS_MEM_TYPES+2][32];
+- unsigned i;
+ static struct drm_info_list radeon_mem_types_list[RADEON_DEBUGFS_MEM_TYPES+2] = {
+ {
+ .name = "radeon_vram_mm",
@@ -39573,7 +39252,7 @@ index 6c0ce89..57a2529 100644
+ .show = &ttm_dma_page_alloc_debugfs,
+ },
+ };
- unsigned i;
++ unsigned i = RADEON_DEBUGFS_MEM_TYPES + 1;
- for (i = 0; i < RADEON_DEBUGFS_MEM_TYPES; i++) {
- if (i == 0)
@@ -39613,13 +39292,13 @@ index 6c0ce89..57a2529 100644
return radeon_debugfs_add_files(rdev, radeon_mem_types_list, i);
diff --git a/drivers/gpu/drm/radeon/rs690.c b/drivers/gpu/drm/radeon/rs690.c
-index 55880d5..9e95342 100644
+index 1447d79..40b2a5b 100644
--- a/drivers/gpu/drm/radeon/rs690.c
+++ b/drivers/gpu/drm/radeon/rs690.c
-@@ -327,9 +327,11 @@ static void rs690_crtc_bandwidth_compute(struct radeon_device *rdev,
- if (rdev->pm.max_bandwidth.full > rdev->pm.sideport_bandwidth.full &&
+@@ -345,9 +345,11 @@ static void rs690_crtc_bandwidth_compute(struct radeon_device *rdev,
+ if (max_bandwidth.full > rdev->pm.sideport_bandwidth.full &&
rdev->pm.sideport_bandwidth.full)
- rdev->pm.max_bandwidth = rdev->pm.sideport_bandwidth;
+ max_bandwidth = rdev->pm.sideport_bandwidth;
- read_delay_latency.full = dfixed_const(370 * 800 * 1000);
+ read_delay_latency.full = dfixed_const(800 * 1000);
read_delay_latency.full = dfixed_div(read_delay_latency,
@@ -39627,7 +39306,7 @@ index 55880d5..9e95342 100644
+ a.full = dfixed_const(370);
+ read_delay_latency.full = dfixed_mul(read_delay_latency, a);
} else {
- if (rdev->pm.max_bandwidth.full > rdev->pm.k8_bandwidth.full &&
+ if (max_bandwidth.full > rdev->pm.k8_bandwidth.full &&
rdev->pm.k8_bandwidth.full)
diff --git a/drivers/gpu/drm/ttm/ttm_memory.c b/drivers/gpu/drm/ttm/ttm_memory.c
index dbc2def..0a9f710 100644
@@ -39652,12 +39331,12 @@ index dbc2def..0a9f710 100644
kobject_put(&zone->kobj);
return ret;
diff --git a/drivers/gpu/drm/ttm/ttm_page_alloc.c b/drivers/gpu/drm/ttm/ttm_page_alloc.c
-index bd2a3b4..122d9ad 100644
+index 863bef9..cba15cf 100644
--- a/drivers/gpu/drm/ttm/ttm_page_alloc.c
+++ b/drivers/gpu/drm/ttm/ttm_page_alloc.c
-@@ -394,9 +394,9 @@ static int ttm_pool_get_num_unused_pages(void)
- static int ttm_pool_mm_shrink(struct shrinker *shrink,
- struct shrink_control *sc)
+@@ -391,9 +391,9 @@ out:
+ static unsigned long
+ ttm_pool_shrink_scan(struct shrinker *shrink, struct shrink_control *sc)
{
- static atomic_t start_pool = ATOMIC_INIT(0);
+ static atomic_unchecked_t start_pool = ATOMIC_INIT(0);
@@ -39666,9 +39345,9 @@ index bd2a3b4..122d9ad 100644
+ unsigned pool_offset = atomic_add_return_unchecked(1, &start_pool);
struct ttm_page_pool *pool;
int shrink_pages = sc->nr_to_scan;
-
+ unsigned long freed = 0;
diff --git a/drivers/gpu/drm/udl/udl_fb.c b/drivers/gpu/drm/udl/udl_fb.c
-index dc0c065..58a0782 100644
+index 97e9d61..bf23c461 100644
--- a/drivers/gpu/drm/udl/udl_fb.c
+++ b/drivers/gpu/drm/udl/udl_fb.c
@@ -367,7 +367,6 @@ static int udl_fb_release(struct fb_info *info, int user)
@@ -39680,7 +39359,7 @@ index dc0c065..58a0782 100644
pr_warn("released /dev/fb%d user=%d count=%d\n",
diff --git a/drivers/gpu/drm/via/via_drv.h b/drivers/gpu/drm/via/via_drv.h
-index 893a650..6190d3b 100644
+index a811ef2..ff99b05 100644
--- a/drivers/gpu/drm/via/via_drv.h
+++ b/drivers/gpu/drm/via/via_drv.h
@@ -51,7 +51,7 @@ typedef struct drm_via_ring_buffer {
@@ -39776,7 +39455,7 @@ index ac98964..5dbf512 100644
case VIA_IRQ_ABSOLUTE:
break;
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h
-index 13aeda7..4a952d1 100644
+index 150ec64..f5165f2 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h
@@ -290,7 +290,7 @@ struct vmw_private {
@@ -39886,10 +39565,10 @@ index 8a8725c2..afed796 100644
marker = list_first_entry(&queue->head,
struct vmw_marker, head);
diff --git a/drivers/gpu/host1x/drm/dc.c b/drivers/gpu/host1x/drm/dc.c
-index 8c04943..4370ed9 100644
+index b1a05ad..1c9d899 100644
--- a/drivers/gpu/host1x/drm/dc.c
+++ b/drivers/gpu/host1x/drm/dc.c
-@@ -999,7 +999,7 @@ static int tegra_dc_debugfs_init(struct tegra_dc *dc, struct drm_minor *minor)
+@@ -1004,7 +1004,7 @@ static int tegra_dc_debugfs_init(struct tegra_dc *dc, struct drm_minor *minor)
}
for (i = 0; i < ARRAY_SIZE(debugfs_files); i++)
@@ -39898,11 +39577,33 @@ index 8c04943..4370ed9 100644
err = drm_debugfs_create_files(dc->debugfs_files,
ARRAY_SIZE(debugfs_files),
+diff --git a/drivers/gpu/vga/vga_switcheroo.c b/drivers/gpu/vga/vga_switcheroo.c
+index ec0ae2d..dc0780b 100644
+--- a/drivers/gpu/vga/vga_switcheroo.c
++++ b/drivers/gpu/vga/vga_switcheroo.c
+@@ -643,7 +643,7 @@ static int vga_switcheroo_runtime_resume(struct device *dev)
+
+ /* this version is for the case where the power switch is separate
+ to the device being powered down. */
+-int vga_switcheroo_init_domain_pm_ops(struct device *dev, struct dev_pm_domain *domain)
++int vga_switcheroo_init_domain_pm_ops(struct device *dev, dev_pm_domain_no_const *domain)
+ {
+ /* copy over all the bus versions */
+ if (dev->bus && dev->bus->pm) {
+@@ -688,7 +688,7 @@ static int vga_switcheroo_runtime_resume_hdmi_audio(struct device *dev)
+ return ret;
+ }
+
+-int vga_switcheroo_init_domain_pm_optimus_hdmi_audio(struct device *dev, struct dev_pm_domain *domain)
++int vga_switcheroo_init_domain_pm_optimus_hdmi_audio(struct device *dev, dev_pm_domain_no_const *domain)
+ {
+ /* copy over all the bus versions */
+ if (dev->bus && dev->bus->pm) {
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
-index c4e5cdf..7ab7631 100644
+index c08b5c1..6c3d50b 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
-@@ -2355,7 +2355,7 @@ EXPORT_SYMBOL_GPL(hid_ignore);
+@@ -2415,7 +2415,7 @@ EXPORT_SYMBOL_GPL(hid_ignore);
int hid_add_device(struct hid_device *hdev)
{
@@ -39911,7 +39612,7 @@ index c4e5cdf..7ab7631 100644
int ret;
if (WARN_ON(hdev->status & HID_STAT_ADDED))
-@@ -2389,7 +2389,7 @@ int hid_add_device(struct hid_device *hdev)
+@@ -2449,7 +2449,7 @@ int hid_add_device(struct hid_device *hdev)
/* XXX hack, any other cleaner solution after the driver core
* is converted to allow more than 20 bytes as the device name? */
dev_set_name(&hdev->dev, "%04X:%04X:%04X.%04X", hdev->bus,
@@ -39920,61 +39621,8 @@ index c4e5cdf..7ab7631 100644
hid_debug_register(hdev, dev_name(&hdev->dev));
ret = device_add(&hdev->dev);
-diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c
-index 3d8e58a..bf8b8ce 100644
---- a/drivers/hid/hid-multitouch.c
-+++ b/drivers/hid/hid-multitouch.c
-@@ -325,12 +325,21 @@ static void mt_feature_mapping(struct hid_device *hdev,
- dev_err(&hdev->dev, "HID_DG_INPUTMODE out of range\n");
- break;
- }
-+ /* Ignore if value index is out of bounds. */
-+ if (td->inputmode_index < 0 ||
-+ td->inputmode_index >= field->report_count) {
-+ dev_err(&hdev->dev, "HID_DG_INPUTMODE out of range\n");
-+ td->inputmode = -1;
-+ }
-
- td->inputmode = field->report->id;
- td->inputmode_index = usage->usage_index;
-
- break;
- case HID_DG_CONTACTMAX:
-+ /* Ignore if value count is out of bounds. */
-+ if (field->report_count < 1)
-+ break;
- td->maxcontact_report_id = field->report->id;
- td->maxcontacts = field->value[0];
- if (!td->maxcontacts &&
-@@ -745,15 +754,21 @@ static void mt_touch_report(struct hid_device *hid, struct hid_report *report)
- unsigned count;
- int r, n;
-
-+ if (report->maxfield == 0)
-+ return;
-+
- /*
- * Includes multi-packet support where subsequent
- * packets are sent with zero contactcount.
- */
-- if (td->cc_index >= 0) {
-- struct hid_field *field = report->field[td->cc_index];
-- int value = field->value[td->cc_value_index];
-- if (value)
-- td->num_expected = value;
-+ if (td->cc_index >= 0 && td->cc_index < report->maxfield) {
-+ field = report->field[td->cc_index];
-+ if (td->cc_value_index >= 0 &&
-+ td->cc_value_index < field->report_count) {
-+ int value = field->value[td->cc_value_index];
-+ if (value)
-+ td->num_expected = value;
-+ }
- }
-
- for (r = 0; r < report->maxfield; r++) {
diff --git a/drivers/hid/hid-wiimote-debug.c b/drivers/hid/hid-wiimote-debug.c
-index 90124ff..3761764 100644
+index c13fb5b..55a3802 100644
--- a/drivers/hid/hid-wiimote-debug.c
+++ b/drivers/hid/hid-wiimote-debug.c
@@ -66,7 +66,7 @@ static ssize_t wiidebug_eeprom_read(struct file *f, char __user *u, size_t s,
@@ -39987,7 +39635,7 @@ index 90124ff..3761764 100644
*off += size;
diff --git a/drivers/hid/uhid.c b/drivers/hid/uhid.c
-index 0bb3bb8..1222415 100644
+index cedc6da..2c3da2a 100644
--- a/drivers/hid/uhid.c
+++ b/drivers/hid/uhid.c
@@ -47,7 +47,7 @@ struct uhid_device {
@@ -39999,7 +39647,7 @@ index 0bb3bb8..1222415 100644
struct uhid_event report_buf;
};
-@@ -187,7 +187,7 @@ static int uhid_hid_get_raw(struct hid_device *hid, unsigned char rnum,
+@@ -163,7 +163,7 @@ static int uhid_hid_get_raw(struct hid_device *hid, unsigned char rnum,
spin_lock_irqsave(&uhid->qlock, flags);
ev->type = UHID_FEATURE;
@@ -40008,7 +39656,7 @@ index 0bb3bb8..1222415 100644
ev->u.feature.rnum = rnum;
ev->u.feature.rtype = report_type;
-@@ -471,7 +471,7 @@ static int uhid_dev_feature_answer(struct uhid_device *uhid,
+@@ -446,7 +446,7 @@ static int uhid_dev_feature_answer(struct uhid_device *uhid,
spin_lock_irqsave(&uhid->qlock, flags);
/* id for old report; drop it silently */
@@ -40018,10 +39666,10 @@ index 0bb3bb8..1222415 100644
if (atomic_read(&uhid->report_done))
goto unlock;
diff --git a/drivers/hv/channel.c b/drivers/hv/channel.c
-index 0b122f8..b1d8160 100644
+index 6de6c98..18319e9 100644
--- a/drivers/hv/channel.c
+++ b/drivers/hv/channel.c
-@@ -394,8 +394,8 @@ int vmbus_establish_gpadl(struct vmbus_channel *channel, void *kbuffer,
+@@ -406,8 +406,8 @@ int vmbus_establish_gpadl(struct vmbus_channel *channel, void *kbuffer,
int ret = 0;
int t;
@@ -40033,7 +39681,7 @@ index 0b122f8..b1d8160 100644
ret = create_gpadl_header(kbuffer, size, &msginfo, &msgcount);
if (ret)
diff --git a/drivers/hv/hv.c b/drivers/hv/hv.c
-index ae49237..380d4c9 100644
+index 88f4096..e50452e 100644
--- a/drivers/hv/hv.c
+++ b/drivers/hv/hv.c
@@ -112,7 +112,7 @@ static u64 do_hypercall(u64 control, void *input, void *output)
@@ -40046,7 +39694,7 @@ index ae49237..380d4c9 100644
__asm__ __volatile__ ("call *%8" : "=d"(hv_status_hi),
"=a"(hv_status_lo) : "d" (control_hi),
diff --git a/drivers/hv/hv_balloon.c b/drivers/hv/hv_balloon.c
-index deb5c25..ed2d4fd 100644
+index 7e17a54..a50a33d 100644
--- a/drivers/hv/hv_balloon.c
+++ b/drivers/hv/hv_balloon.c
@@ -464,7 +464,7 @@ MODULE_PARM_DESC(hot_add, "If set attempt memory hot_add");
@@ -40058,15 +39706,15 @@ index deb5c25..ed2d4fd 100644
static int dm_ring_size = (5 * PAGE_SIZE);
-@@ -825,7 +825,7 @@ static void hot_add_req(struct work_struct *dummy)
- memset(&resp, 0, sizeof(struct dm_hot_add_response));
- resp.hdr.type = DM_MEM_HOT_ADD_RESPONSE;
- resp.hdr.size = sizeof(struct dm_hot_add_response);
+@@ -886,7 +886,7 @@ static void hot_add_req(struct work_struct *dummy)
+ pr_info("Memory hot add failed\n");
+
+ dm->state = DM_INITIALIZED;
- resp.hdr.trans_id = atomic_inc_return(&trans_id);
+ resp.hdr.trans_id = atomic_inc_return_unchecked(&trans_id);
-
- #ifdef CONFIG_MEMORY_HOTPLUG
- pg_start = dm->ha_wrk.ha_page_range.finfo.start_page;
+ vmbus_sendpacket(dm->dev->channel, &resp,
+ sizeof(struct dm_hot_add_response),
+ (unsigned long)NULL,
@@ -960,7 +960,7 @@ static void post_status(struct hv_dynmem_device *dm)
memset(&status, 0, sizeof(struct dm_status));
status.hdr.type = DM_STATUS_REPORT;
@@ -40085,15 +39733,15 @@ index deb5c25..ed2d4fd 100644
return;
vmbus_sendpacket(dm->dev->channel, &status,
-@@ -1081,7 +1081,7 @@ static void balloon_up(struct work_struct *dummy)
- bl_resp = (struct dm_balloon_response *)send_buffer;
- memset(send_buffer, 0, PAGE_SIZE);
- bl_resp->hdr.type = DM_BALLOON_RESPONSE;
-- bl_resp->hdr.trans_id = atomic_inc_return(&trans_id);
-+ bl_resp->hdr.trans_id = atomic_inc_return_unchecked(&trans_id);
- bl_resp->hdr.size = sizeof(struct dm_balloon_response);
- bl_resp->more_pages = 1;
+@@ -1108,7 +1108,7 @@ static void balloon_up(struct work_struct *dummy)
+ */
+ do {
+- bl_resp->hdr.trans_id = atomic_inc_return(&trans_id);
++ bl_resp->hdr.trans_id = atomic_inc_return_unchecked(&trans_id);
+ ret = vmbus_sendpacket(dm_device.dev->channel,
+ bl_resp,
+ bl_resp->hdr.size,
@@ -1152,7 +1152,7 @@ static void balloon_down(struct hv_dynmem_device *dm,
memset(&resp, 0, sizeof(struct dm_unballoon_response));
@@ -40131,10 +39779,10 @@ index deb5c25..ed2d4fd 100644
cap_msg.caps.cap_bits.balloon = 1;
cap_msg.caps.cap_bits.hot_add = 1;
diff --git a/drivers/hv/hyperv_vmbus.h b/drivers/hv/hyperv_vmbus.h
-index 12f2f9e..679603c 100644
+index d84918f..7f38f9f 100644
--- a/drivers/hv/hyperv_vmbus.h
+++ b/drivers/hv/hyperv_vmbus.h
-@@ -591,7 +591,7 @@ enum vmbus_connect_state {
+@@ -595,7 +595,7 @@ enum vmbus_connect_state {
struct vmbus_connection {
enum vmbus_connect_state conn_state;
@@ -40144,10 +39792,10 @@ index 12f2f9e..679603c 100644
/*
* Represents channel interrupts. Each bit position represents a
diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c
-index 4004e54..c2de226 100644
+index f9fe46f..356b119 100644
--- a/drivers/hv/vmbus_drv.c
+++ b/drivers/hv/vmbus_drv.c
-@@ -668,10 +668,10 @@ int vmbus_device_register(struct hv_device *child_device_obj)
+@@ -672,10 +672,10 @@ int vmbus_device_register(struct hv_device *child_device_obj)
{
int ret = 0;
@@ -40161,7 +39809,7 @@ index 4004e54..c2de226 100644
child_device_obj->device.bus = &hv_bus;
child_device_obj->device.parent = &hv_acpi_dev->dev;
diff --git a/drivers/hwmon/acpi_power_meter.c b/drivers/hwmon/acpi_power_meter.c
-index 6351aba..dc4aaf4 100644
+index a9e3d01..9dd246e 100644
--- a/drivers/hwmon/acpi_power_meter.c
+++ b/drivers/hwmon/acpi_power_meter.c
@@ -117,7 +117,7 @@ struct sensor_template {
@@ -40224,10 +39872,10 @@ index b25c643..a13460d 100644
{
sysfs_attr_init(&attr->attr);
diff --git a/drivers/hwmon/coretemp.c b/drivers/hwmon/coretemp.c
-index 658ce3a..0d0c2f3 100644
+index 78be661..4dd032f 100644
--- a/drivers/hwmon/coretemp.c
+++ b/drivers/hwmon/coretemp.c
-@@ -790,7 +790,7 @@ static int __cpuinit coretemp_cpu_callback(struct notifier_block *nfb,
+@@ -797,7 +797,7 @@ static int coretemp_cpu_callback(struct notifier_block *nfb,
return NOTIFY_OK;
}
@@ -40237,7 +39885,7 @@ index 658ce3a..0d0c2f3 100644
};
diff --git a/drivers/hwmon/ibmaem.c b/drivers/hwmon/ibmaem.c
-index 1429f6e..ee03d59 100644
+index 632f1dc..57e6a58 100644
--- a/drivers/hwmon/ibmaem.c
+++ b/drivers/hwmon/ibmaem.c
@@ -926,7 +926,7 @@ static int aem_register_sensors(struct aem_data *data,
@@ -40250,7 +39898,7 @@ index 1429f6e..ee03d59 100644
/* Set up read-only sensors */
diff --git a/drivers/hwmon/iio_hwmon.c b/drivers/hwmon/iio_hwmon.c
-index 52b77af..aed1ddf 100644
+index 708081b..fe2d4ab 100644
--- a/drivers/hwmon/iio_hwmon.c
+++ b/drivers/hwmon/iio_hwmon.c
@@ -73,7 +73,7 @@ static int iio_hwmon_probe(struct platform_device *pdev)
@@ -40262,8 +39910,26 @@ index 52b77af..aed1ddf 100644
int ret, i;
int in_i = 1, temp_i = 1, curr_i = 1;
enum iio_chan_type type;
+diff --git a/drivers/hwmon/nct6775.c b/drivers/hwmon/nct6775.c
+index 6eb03ce..bea7e3e 100644
+--- a/drivers/hwmon/nct6775.c
++++ b/drivers/hwmon/nct6775.c
+@@ -936,10 +936,10 @@ static struct attribute_group *
+ nct6775_create_attr_group(struct device *dev, struct sensor_template_group *tg,
+ int repeat)
+ {
+- struct attribute_group *group;
++ attribute_group_no_const *group;
+ struct sensor_device_attr_u *su;
+- struct sensor_device_attribute *a;
+- struct sensor_device_attribute_2 *a2;
++ sensor_device_attribute_no_const *a;
++ sensor_device_attribute_2_no_const *a2;
+ struct attribute **attrs;
+ struct sensor_device_template **t;
+ int err, i, j, count;
diff --git a/drivers/hwmon/pmbus/pmbus_core.c b/drivers/hwmon/pmbus/pmbus_core.c
-index 9add6092..ee7ba3f 100644
+index 9319fcf..189ff45 100644
--- a/drivers/hwmon/pmbus/pmbus_core.c
+++ b/drivers/hwmon/pmbus/pmbus_core.c
@@ -781,7 +781,7 @@ static int pmbus_add_attribute(struct pmbus_data *data, struct attribute *attr)
@@ -40312,7 +39978,7 @@ index 9add6092..ee7ba3f 100644
label = devm_kzalloc(data->dev, sizeof(*label), GFP_KERNEL);
if (!label)
diff --git a/drivers/hwmon/sht15.c b/drivers/hwmon/sht15.c
-index 2507f90..1645765 100644
+index 97cd45a..ac54d8b 100644
--- a/drivers/hwmon/sht15.c
+++ b/drivers/hwmon/sht15.c
@@ -169,7 +169,7 @@ struct sht15_data {
@@ -40364,10 +40030,10 @@ index 2507f90..1645765 100644
}
diff --git a/drivers/hwmon/via-cputemp.c b/drivers/hwmon/via-cputemp.c
-index 76f157b..9c0db1b 100644
+index 38944e9..ae9e5ed 100644
--- a/drivers/hwmon/via-cputemp.c
+++ b/drivers/hwmon/via-cputemp.c
-@@ -296,7 +296,7 @@ static int __cpuinit via_cputemp_cpu_callback(struct notifier_block *nfb,
+@@ -296,7 +296,7 @@ static int via_cputemp_cpu_callback(struct notifier_block *nfb,
return NOTIFY_OK;
}
@@ -40389,6 +40055,19 @@ index 07f01ac..d79ad3d 100644
/* Wrapper access functions for multiplexed SMBus */
static DEFINE_MUTEX(amd756_lock);
+diff --git a/drivers/i2c/busses/i2c-diolan-u2c.c b/drivers/i2c/busses/i2c-diolan-u2c.c
+index dae3ddf..26e21d1 100644
+--- a/drivers/i2c/busses/i2c-diolan-u2c.c
++++ b/drivers/i2c/busses/i2c-diolan-u2c.c
+@@ -99,7 +99,7 @@ MODULE_PARM_DESC(frequency, "I2C clock frequency in hertz");
+ /* usb layer */
+
+ /* Send command to device, and get response. */
+-static int diolan_usb_transfer(struct i2c_diolan_u2c *dev)
++static int __intentional_overflow(-1) diolan_usb_transfer(struct i2c_diolan_u2c *dev)
+ {
+ int ret = 0;
+ int actual;
diff --git a/drivers/i2c/busses/i2c-nforce2-s4985.c b/drivers/i2c/busses/i2c-nforce2-s4985.c
index 2ca268d..c6acbdf 100644
--- a/drivers/i2c/busses/i2c-nforce2-s4985.c
@@ -40416,7 +40095,7 @@ index c3ccdea..5b3dc1a 100644
if (IS_ERR(rdwr_pa[i].buf)) {
res = PTR_ERR(rdwr_pa[i].buf);
diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
-index 2ff6204..218c16e 100644
+index 0b510ba..4fbb5085 100644
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -768,7 +768,7 @@ static void cdrom_do_block_pc(ide_drive_t *drive, struct request *rq)
@@ -40429,7 +40108,7 @@ index 2ff6204..218c16e 100644
}
}
diff --git a/drivers/iio/industrialio-core.c b/drivers/iio/industrialio-core.c
-index e145931..08bfc59 100644
+index f95c697..0a1b05c 100644
--- a/drivers/iio/industrialio-core.c
+++ b/drivers/iio/industrialio-core.c
@@ -506,7 +506,7 @@ static ssize_t iio_write_channel_info(struct device *dev,
@@ -40732,7 +40411,7 @@ index 1f95bba..9530f87 100644
sdata, wqe->wr.wr.atomic.swap);
goto send_comp;
diff --git a/drivers/infiniband/hw/mlx4/mad.c b/drivers/infiniband/hw/mlx4/mad.c
-index 4d599ce..697b17f 100644
+index f2a3f48..673ec79 100644
--- a/drivers/infiniband/hw/mlx4/mad.c
+++ b/drivers/infiniband/hw/mlx4/mad.c
@@ -98,7 +98,7 @@ __be64 mlx4_ib_gen_node_guid(void)
@@ -40744,11 +40423,24 @@ index 4d599ce..697b17f 100644
cpu_to_be64(0xff00000000000000LL);
}
+diff --git a/drivers/infiniband/hw/mlx4/mcg.c b/drivers/infiniband/hw/mlx4/mcg.c
+index 25b2cdf..099ff97 100644
+--- a/drivers/infiniband/hw/mlx4/mcg.c
++++ b/drivers/infiniband/hw/mlx4/mcg.c
+@@ -1040,7 +1040,7 @@ int mlx4_ib_mcg_port_init(struct mlx4_ib_demux_ctx *ctx)
+ {
+ char name[20];
+
+- atomic_set(&ctx->tid, 0);
++ atomic_set_unchecked(&ctx->tid, 0);
+ sprintf(name, "mlx4_ib_mcg%d", ctx->port);
+ ctx->mcg_wq = create_singlethread_workqueue(name);
+ if (!ctx->mcg_wq)
diff --git a/drivers/infiniband/hw/mlx4/mlx4_ib.h b/drivers/infiniband/hw/mlx4/mlx4_ib.h
-index f61ec26..ebf72cf 100644
+index 036b663..c9a8c73 100644
--- a/drivers/infiniband/hw/mlx4/mlx4_ib.h
+++ b/drivers/infiniband/hw/mlx4/mlx4_ib.h
-@@ -398,7 +398,7 @@ struct mlx4_ib_demux_ctx {
+@@ -404,7 +404,7 @@ struct mlx4_ib_demux_ctx {
struct list_head mcg_mgid0_list;
struct workqueue_struct *mcg_wq;
struct mlx4_ib_demux_pv_ctx **tun;
@@ -40758,7 +40450,7 @@ index f61ec26..ebf72cf 100644
};
diff --git a/drivers/infiniband/hw/mthca/mthca_cmd.c b/drivers/infiniband/hw/mthca/mthca_cmd.c
-index 9d3e5c1..d9afe4a 100644
+index 9d3e5c1..6f166df 100644
--- a/drivers/infiniband/hw/mthca/mthca_cmd.c
+++ b/drivers/infiniband/hw/mthca/mthca_cmd.c
@@ -772,7 +772,7 @@ static void mthca_setup_cmd_doorbells(struct mthca_dev *dev, u64 base)
@@ -40770,10 +40462,59 @@ index 9d3e5c1..d9afe4a 100644
{
struct mthca_mailbox *mailbox;
u32 *outbox;
+@@ -1612,7 +1612,7 @@ int mthca_HW2SW_MPT(struct mthca_dev *dev, struct mthca_mailbox *mailbox,
+ CMD_TIME_CLASS_B);
+ }
+
+-int mthca_WRITE_MTT(struct mthca_dev *dev, struct mthca_mailbox *mailbox,
++int __intentional_overflow(-1) mthca_WRITE_MTT(struct mthca_dev *dev, struct mthca_mailbox *mailbox,
+ int num_mtt)
+ {
+ return mthca_cmd(dev, mailbox->dma, num_mtt, 0, CMD_WRITE_MTT,
+@@ -1634,7 +1634,7 @@ int mthca_MAP_EQ(struct mthca_dev *dev, u64 event_mask, int unmap,
+ 0, CMD_MAP_EQ, CMD_TIME_CLASS_B);
+ }
+
+-int mthca_SW2HW_EQ(struct mthca_dev *dev, struct mthca_mailbox *mailbox,
++int __intentional_overflow(-1) mthca_SW2HW_EQ(struct mthca_dev *dev, struct mthca_mailbox *mailbox,
+ int eq_num)
+ {
+ return mthca_cmd(dev, mailbox->dma, eq_num, 0, CMD_SW2HW_EQ,
+@@ -1857,7 +1857,7 @@ int mthca_CONF_SPECIAL_QP(struct mthca_dev *dev, int type, u32 qpn)
+ CMD_TIME_CLASS_B);
+ }
+
+-int mthca_MAD_IFC(struct mthca_dev *dev, int ignore_mkey, int ignore_bkey,
++int __intentional_overflow(-1) mthca_MAD_IFC(struct mthca_dev *dev, int ignore_mkey, int ignore_bkey,
+ int port, struct ib_wc *in_wc, struct ib_grh *in_grh,
+ void *in_mad, void *response_mad)
+ {
+diff --git a/drivers/infiniband/hw/mthca/mthca_main.c b/drivers/infiniband/hw/mthca/mthca_main.c
+index 87897b9..7e79542 100644
+--- a/drivers/infiniband/hw/mthca/mthca_main.c
++++ b/drivers/infiniband/hw/mthca/mthca_main.c
+@@ -692,7 +692,7 @@ err_close:
+ return err;
+ }
+
+-static int mthca_setup_hca(struct mthca_dev *dev)
++static int __intentional_overflow(-1) mthca_setup_hca(struct mthca_dev *dev)
+ {
+ int err;
+
diff --git a/drivers/infiniband/hw/mthca/mthca_mr.c b/drivers/infiniband/hw/mthca/mthca_mr.c
-index ed9a989..e0c5871 100644
+index ed9a989..6aa5dc2 100644
--- a/drivers/infiniband/hw/mthca/mthca_mr.c
+++ b/drivers/infiniband/hw/mthca/mthca_mr.c
+@@ -81,7 +81,7 @@ struct mthca_mpt_entry {
+ * through the bitmaps)
+ */
+
+-static u32 mthca_buddy_alloc(struct mthca_buddy *buddy, int order)
++static u32 __intentional_overflow(-1) mthca_buddy_alloc(struct mthca_buddy *buddy, int order)
+ {
+ int o;
+ int m;
@@ -426,7 +426,7 @@ static inline u32 adjust_key(struct mthca_dev *dev, u32 key)
return key;
}
@@ -40783,6 +40524,28 @@ index ed9a989..e0c5871 100644
u64 iova, u64 total_size, u32 access, struct mthca_mr *mr)
{
struct mthca_mailbox *mailbox;
+@@ -516,7 +516,7 @@ int mthca_mr_alloc_notrans(struct mthca_dev *dev, u32 pd,
+ return mthca_mr_alloc(dev, pd, 12, 0, ~0ULL, access, mr);
+ }
+
+-int mthca_mr_alloc_phys(struct mthca_dev *dev, u32 pd,
++int __intentional_overflow(-1) mthca_mr_alloc_phys(struct mthca_dev *dev, u32 pd,
+ u64 *buffer_list, int buffer_size_shift,
+ int list_len, u64 iova, u64 total_size,
+ u32 access, struct mthca_mr *mr)
+diff --git a/drivers/infiniband/hw/mthca/mthca_provider.c b/drivers/infiniband/hw/mthca/mthca_provider.c
+index 5b71d43..35a9e14 100644
+--- a/drivers/infiniband/hw/mthca/mthca_provider.c
++++ b/drivers/infiniband/hw/mthca/mthca_provider.c
+@@ -763,7 +763,7 @@ unlock:
+ return 0;
+ }
+
+-static int mthca_resize_cq(struct ib_cq *ibcq, int entries, struct ib_udata *udata)
++static int __intentional_overflow(-1) mthca_resize_cq(struct ib_cq *ibcq, int entries, struct ib_udata *udata)
+ {
+ struct mthca_dev *dev = to_mdev(ibcq->device);
+ struct mthca_cq *cq = to_mcq(ibcq);
diff --git a/drivers/infiniband/hw/nes/nes.c b/drivers/infiniband/hw/nes/nes.c
index 4291410..d2ab1fb 100644
--- a/drivers/infiniband/hw/nes/nes.c
@@ -40865,7 +40628,7 @@ index 33cc589..3bd6538 100644
extern u32 int_mod_timer_init;
extern u32 int_mod_cq_depth_256;
diff --git a/drivers/infiniband/hw/nes/nes_cm.c b/drivers/infiniband/hw/nes/nes_cm.c
-index 24b9f1a..00fd004 100644
+index 6b29249..57081dd 100644
--- a/drivers/infiniband/hw/nes/nes_cm.c
+++ b/drivers/infiniband/hw/nes/nes_cm.c
@@ -68,14 +68,14 @@ u32 cm_packets_dropped;
@@ -40992,7 +40755,7 @@ index 24b9f1a..00fd004 100644
nes_disconnect(nesqp, 1);
cm_id->provider_data = nesqp;
-@@ -3033,7 +3033,7 @@ int nes_accept(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param)
+@@ -3035,7 +3035,7 @@ int nes_accept(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param)
nes_debug(NES_DBG_CM, "QP%u, cm_node=%p, jiffies = %lu listener = %p\n",
nesqp->hwqp.qp_id, cm_node, jiffies, cm_node->listener);
@@ -41001,7 +40764,7 @@ index 24b9f1a..00fd004 100644
nes_debug(NES_DBG_CM, "netdev refcnt = %u.\n",
netdev_refcnt_read(nesvnic->netdev));
-@@ -3228,7 +3228,7 @@ int nes_reject(struct iw_cm_id *cm_id, const void *pdata, u8 pdata_len)
+@@ -3224,7 +3224,7 @@ int nes_reject(struct iw_cm_id *cm_id, const void *pdata, u8 pdata_len)
struct nes_cm_core *cm_core;
u8 *start_buff;
@@ -41010,9 +40773,9 @@ index 24b9f1a..00fd004 100644
cm_node = (struct nes_cm_node *)cm_id->provider_data;
loopback = cm_node->loopbackpartner;
cm_core = cm_node->cm_core;
-@@ -3288,7 +3288,7 @@ int nes_connect(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param)
- ntohl(cm_id->local_addr.sin_addr.s_addr),
- ntohs(cm_id->local_addr.sin_port));
+@@ -3286,7 +3286,7 @@ int nes_connect(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param)
+ ntohs(raddr->sin_port), ntohl(laddr->sin_addr.s_addr),
+ ntohs(laddr->sin_port));
- atomic_inc(&cm_connects);
+ atomic_inc_unchecked(&cm_connects);
@@ -41028,7 +40791,7 @@ index 24b9f1a..00fd004 100644
}
cm_id->add_ref(cm_id);
-@@ -3499,7 +3499,7 @@ static void cm_event_connected(struct nes_cm_event *event)
+@@ -3505,7 +3505,7 @@ static void cm_event_connected(struct nes_cm_event *event)
if (nesqp->destroyed)
return;
@@ -41036,8 +40799,8 @@ index 24b9f1a..00fd004 100644
+ atomic_inc_unchecked(&cm_connecteds);
nes_debug(NES_DBG_CM, "QP%u attempting to connect to 0x%08X:0x%04X on"
" local port 0x%04X. jiffies = %lu.\n",
- nesqp->hwqp.qp_id,
-@@ -3679,7 +3679,7 @@ static void cm_event_reset(struct nes_cm_event *event)
+ nesqp->hwqp.qp_id, ntohl(raddr->sin_addr.s_addr),
+@@ -3686,7 +3686,7 @@ static void cm_event_reset(struct nes_cm_event *event)
cm_id->add_ref(cm_id);
ret = cm_id->event_handler(cm_id, &cm_event);
@@ -41046,7 +40809,7 @@ index 24b9f1a..00fd004 100644
cm_event.event = IW_CM_EVENT_CLOSE;
cm_event.status = 0;
cm_event.provider_data = cm_id->provider_data;
-@@ -3715,7 +3715,7 @@ static void cm_event_mpa_req(struct nes_cm_event *event)
+@@ -3726,7 +3726,7 @@ static void cm_event_mpa_req(struct nes_cm_event *event)
return;
cm_id = cm_node->cm_id;
@@ -41055,7 +40818,7 @@ index 24b9f1a..00fd004 100644
nes_debug(NES_DBG_CM, "cm_node = %p - cm_id = %p, jiffies = %lu\n",
cm_node, cm_id, jiffies);
-@@ -3755,7 +3755,7 @@ static void cm_event_mpa_reject(struct nes_cm_event *event)
+@@ -3770,7 +3770,7 @@ static void cm_event_mpa_reject(struct nes_cm_event *event)
return;
cm_id = cm_node->cm_id;
@@ -41162,7 +40925,7 @@ index 49eb511..a774366 100644
/**
diff --git a/drivers/infiniband/hw/nes/nes_verbs.c b/drivers/infiniband/hw/nes/nes_verbs.c
-index 8f67fe2..8960859 100644
+index 5b53ca5..443da3c 100644
--- a/drivers/infiniband/hw/nes/nes_verbs.c
+++ b/drivers/infiniband/hw/nes/nes_verbs.c
@@ -46,9 +46,9 @@
@@ -41187,7 +40950,7 @@ index 8f67fe2..8960859 100644
switch (init_attr->qp_type) {
case IB_QPT_RC:
if (nes_drv_opt & NES_DRV_OPT_NO_INLINE_DATA) {
-@@ -1465,7 +1465,7 @@ static int nes_destroy_qp(struct ib_qp *ibqp)
+@@ -1466,7 +1466,7 @@ static int nes_destroy_qp(struct ib_qp *ibqp)
struct iw_cm_event cm_event;
int ret = 0;
@@ -41197,19 +40960,19 @@ index 8f67fe2..8960859 100644
/* Blow away the connection if it exists. */
diff --git a/drivers/infiniband/hw/qib/qib.h b/drivers/infiniband/hw/qib/qib.h
-index 4d11575..3e890e5 100644
+index 1946101..09766d2 100644
--- a/drivers/infiniband/hw/qib/qib.h
+++ b/drivers/infiniband/hw/qib/qib.h
-@@ -51,6 +51,7 @@
- #include <linux/completion.h>
+@@ -52,6 +52,7 @@
#include <linux/kref.h>
#include <linux/sched.h>
+ #include <linux/kthread.h>
+#include <linux/slab.h>
#include "qib_common.h"
#include "qib_verbs.h"
diff --git a/drivers/input/gameport/gameport.c b/drivers/input/gameport/gameport.c
-index da739d9..da1c7f4 100644
+index 922a7fe..bb035db 100644
--- a/drivers/input/gameport/gameport.c
+++ b/drivers/input/gameport/gameport.c
@@ -487,14 +487,14 @@ EXPORT_SYMBOL(gameport_set_phys);
@@ -41230,27 +40993,27 @@ index da739d9..da1c7f4 100644
gameport->dev.release = gameport_release_port;
if (gameport->parent)
diff --git a/drivers/input/input.c b/drivers/input/input.c
-index c044699..174d71a 100644
+index e75d015..57d1c28 100644
--- a/drivers/input/input.c
+++ b/drivers/input/input.c
-@@ -2019,7 +2019,7 @@ static void devm_input_device_unregister(struct device *dev, void *res)
+@@ -1734,7 +1734,7 @@ EXPORT_SYMBOL_GPL(input_class);
*/
- int input_register_device(struct input_dev *dev)
+ struct input_dev *input_allocate_device(void)
{
- static atomic_t input_no = ATOMIC_INIT(0);
+ static atomic_unchecked_t input_no = ATOMIC_INIT(0);
- struct input_devres *devres = NULL;
- struct input_handler *handler;
- unsigned int packet_size;
-@@ -2074,7 +2074,7 @@ int input_register_device(struct input_dev *dev)
- dev->setkeycode = input_default_setkeycode;
+ struct input_dev *dev;
- dev_set_name(&dev->dev, "input%ld",
-- (unsigned long) atomic_inc_return(&input_no) - 1);
-+ (unsigned long) atomic_inc_return_unchecked(&input_no) - 1);
+ dev = kzalloc(sizeof(struct input_dev), GFP_KERNEL);
+@@ -1749,7 +1749,7 @@ struct input_dev *input_allocate_device(void)
+ INIT_LIST_HEAD(&dev->node);
- error = device_add(&dev->dev);
- if (error)
+ dev_set_name(&dev->dev, "input%ld",
+- (unsigned long) atomic_inc_return(&input_no) - 1);
++ (unsigned long) atomic_inc_return_unchecked(&input_no) - 1);
+
+ __module_get(THIS_MODULE);
+ }
diff --git a/drivers/input/joystick/sidewinder.c b/drivers/input/joystick/sidewinder.c
index 04c69af..5f92d00 100644
--- a/drivers/input/joystick/sidewinder.c
@@ -41264,10 +41027,10 @@ index 04c69af..5f92d00 100644
#include <linux/input.h>
#include <linux/gameport.h>
diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c
-index fa061d4..4a6957c 100644
+index 75e3b10..fb390fd 100644
--- a/drivers/input/joystick/xpad.c
+++ b/drivers/input/joystick/xpad.c
-@@ -735,7 +735,7 @@ static void xpad_led_set(struct led_classdev *led_cdev,
+@@ -736,7 +736,7 @@ static void xpad_led_set(struct led_classdev *led_cdev,
static int xpad_led_probe(struct usb_xpad *xpad)
{
@@ -41276,7 +41039,7 @@ index fa061d4..4a6957c 100644
long led_no;
struct xpad_led *led;
struct led_classdev *led_cdev;
-@@ -748,7 +748,7 @@ static int xpad_led_probe(struct usb_xpad *xpad)
+@@ -749,7 +749,7 @@ static int xpad_led_probe(struct usb_xpad *xpad)
if (!led)
return -ENOMEM;
@@ -41334,7 +41097,7 @@ index 4c842c3..590b0bf 100644
return count;
diff --git a/drivers/input/serio/serio.c b/drivers/input/serio/serio.c
-index 25fc597..558bf3b3 100644
+index 2b56855..5a55837 100644
--- a/drivers/input/serio/serio.c
+++ b/drivers/input/serio/serio.c
@@ -496,7 +496,7 @@ static void serio_release_port(struct device *dev)
@@ -41378,7 +41141,7 @@ index 59df2e7..8f1cafb 100644
INIT_LIST_HEAD(&serio_raw->client_list);
init_waitqueue_head(&serio_raw->wait);
diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c
-index d8f98b1..f62a640 100644
+index fbe9ca7..dbee61d 100644
--- a/drivers/iommu/iommu.c
+++ b/drivers/iommu/iommu.c
@@ -583,7 +583,7 @@ static struct notifier_block iommu_bus_nb = {
@@ -41391,10 +41154,10 @@ index d8f98b1..f62a640 100644
/**
diff --git a/drivers/iommu/irq_remapping.c b/drivers/iommu/irq_remapping.c
-index dcfea4e..f4226b2 100644
+index 39f81ae..2660096 100644
--- a/drivers/iommu/irq_remapping.c
+++ b/drivers/iommu/irq_remapping.c
-@@ -354,7 +354,7 @@ int setup_hpet_msi_remapped(unsigned int irq, unsigned int id)
+@@ -356,7 +356,7 @@ int setup_hpet_msi_remapped(unsigned int irq, unsigned int id)
void panic_if_irq_remap(const char *msg)
{
if (irq_remapping_enabled)
@@ -41403,7 +41166,7 @@ index dcfea4e..f4226b2 100644
}
static void ir_ack_apic_edge(struct irq_data *data)
-@@ -375,10 +375,12 @@ static void ir_print_prefix(struct irq_data *data, struct seq_file *p)
+@@ -377,10 +377,12 @@ static void ir_print_prefix(struct irq_data *data, struct seq_file *p)
void irq_remap_modify_chip_defaults(struct irq_chip *chip)
{
@@ -41421,7 +41184,7 @@ index dcfea4e..f4226b2 100644
bool setup_remapped_irq(int irq, struct irq_cfg *cfg, struct irq_chip *chip)
diff --git a/drivers/irqchip/irq-gic.c b/drivers/irqchip/irq-gic.c
-index 19ceaa6..3625818 100644
+index d0e9480..d2b6340 100644
--- a/drivers/irqchip/irq-gic.c
+++ b/drivers/irqchip/irq-gic.c
@@ -84,7 +84,7 @@ static u8 gic_cpu_map[NR_GIC_CPU_IF] __read_mostly;
@@ -41637,45 +41400,42 @@ index e74df7c..03a03ba 100644
return -EFAULT;
} else
memcpy(msg, buf, count);
-diff --git a/drivers/isdn/mISDN/dsp_core.c b/drivers/isdn/mISDN/dsp_core.c
-index 22b720e..77025f5 100644
---- a/drivers/isdn/mISDN/dsp_core.c
-+++ b/drivers/isdn/mISDN/dsp_core.c
-@@ -288,8 +288,10 @@ dsp_control_req(struct dsp *dsp, struct mISDNhead *hh, struct sk_buff *skb)
- u8 *data;
- int len;
+diff --git a/drivers/isdn/mISDN/dsp_cmx.c b/drivers/isdn/mISDN/dsp_cmx.c
+index a4f05c5..1433bc5 100644
+--- a/drivers/isdn/mISDN/dsp_cmx.c
++++ b/drivers/isdn/mISDN/dsp_cmx.c
+@@ -1628,7 +1628,7 @@ unsigned long dsp_spl_jiffies; /* calculate the next time to fire */
+ static u16 dsp_count; /* last sample count */
+ static int dsp_count_valid; /* if we have last sample count */
-- if (skb->len < sizeof(int))
-+ if (skb->len < sizeof(int)) {
- printk(KERN_ERR "%s: PH_CONTROL message too short\n", __func__);
-+ return -EINVAL;
-+ }
- cont = *((int *)skb->data);
- len = skb->len - sizeof(int);
- data = skb->data + sizeof(int);
+-void
++void __intentional_overflow(-1)
+ dsp_cmx_send(void *arg)
+ {
+ struct dsp_conf *conf;
diff --git a/drivers/leds/leds-clevo-mail.c b/drivers/leds/leds-clevo-mail.c
-index 6a8405d..0bd1c7e 100644
+index d93e245..e7ece6b 100644
--- a/drivers/leds/leds-clevo-mail.c
+++ b/drivers/leds/leds-clevo-mail.c
@@ -40,7 +40,7 @@ static int __init clevo_mail_led_dmi_callback(const struct dmi_system_id *id)
* detected as working, but in reality it is not) as low as
* possible.
*/
--static struct dmi_system_id __initdata clevo_mail_led_dmi_table[] = {
-+static const struct dmi_system_id __initconst clevo_mail_led_dmi_table[] = {
+-static struct dmi_system_id clevo_mail_led_dmi_table[] __initdata = {
++static struct dmi_system_id clevo_mail_led_dmi_table[] __initconst = {
{
.callback = clevo_mail_led_dmi_callback,
.ident = "Clevo D410J",
diff --git a/drivers/leds/leds-ss4200.c b/drivers/leds/leds-ss4200.c
-index 64e204e..c6bf189 100644
+index 5b8f938..b73d657 100644
--- a/drivers/leds/leds-ss4200.c
+++ b/drivers/leds/leds-ss4200.c
@@ -91,7 +91,7 @@ MODULE_PARM_DESC(nodetect, "Skip DMI-based hardware detection");
* detected as working, but in reality it is not) as low as
* possible.
*/
--static struct dmi_system_id __initdata nas_led_whitelist[] = {
-+static const struct dmi_system_id __initconst nas_led_whitelist[] = {
+-static struct dmi_system_id nas_led_whitelist[] __initdata = {
++static struct dmi_system_id nas_led_whitelist[] __initconst = {
{
.callback = ss4200_led_dmi_callback,
.ident = "Intel SS4200-E",
@@ -41711,7 +41471,7 @@ index 0bf1e4e..b4bf44e 100644
printk(KERN_INFO "lguest: mapped switcher at %p\n",
diff --git a/drivers/lguest/page_tables.c b/drivers/lguest/page_tables.c
-index 5b9ac32..2ef4f26 100644
+index bfb39bb..08a603b 100644
--- a/drivers/lguest/page_tables.c
+++ b/drivers/lguest/page_tables.c
@@ -559,7 +559,7 @@ void pin_page(struct lg_cpu *cpu, unsigned long vaddr)
@@ -41724,7 +41484,7 @@ index 5b9ac32..2ef4f26 100644
/* If the entry's not present, there's nothing to release. */
if (pmd_flags(*spmd) & _PAGE_PRESENT) {
diff --git a/drivers/lguest/x86/core.c b/drivers/lguest/x86/core.c
-index f0a3347..f6608b2 100644
+index 5169239..47cb4db 100644
--- a/drivers/lguest/x86/core.c
+++ b/drivers/lguest/x86/core.c
@@ -59,7 +59,7 @@ static struct {
@@ -41844,10 +41604,10 @@ index 0003992..854bbce 100644
cl->fn = fn;
cl->wq = wq;
diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c
-index b4713ce..b30139b 100644
+index 547c4c5..5be1de4 100644
--- a/drivers/md/bcache/super.c
+++ b/drivers/md/bcache/super.c
-@@ -1603,7 +1603,7 @@ err_unlock_gc:
+@@ -1644,7 +1644,7 @@ err_unlock_gc:
err:
closure_sync(&op.cl);
/* XXX: test this, it's broken */
@@ -41857,7 +41617,7 @@ index b4713ce..b30139b 100644
static bool can_attach_cache(struct cache *ca, struct cache_set *c)
diff --git a/drivers/md/bitmap.c b/drivers/md/bitmap.c
-index 5a2c754..0fa55db 100644
+index a7fd821..9dcf6c3 100644
--- a/drivers/md/bitmap.c
+++ b/drivers/md/bitmap.c
@@ -1779,7 +1779,7 @@ void bitmap_status(struct seq_file *seq, struct bitmap *bitmap)
@@ -41870,10 +41630,10 @@ index 5a2c754..0fa55db 100644
seq_printf(seq, "\n");
diff --git a/drivers/md/dm-ioctl.c b/drivers/md/dm-ioctl.c
-index 81a79b7..87a0f73 100644
+index afe0814..8cf3794 100644
--- a/drivers/md/dm-ioctl.c
+++ b/drivers/md/dm-ioctl.c
-@@ -1697,7 +1697,7 @@ static int validate_params(uint cmd, struct dm_ioctl *param)
+@@ -1745,7 +1745,7 @@ static int validate_params(uint cmd, struct dm_ioctl *param)
cmd == DM_LIST_VERSIONS_CMD)
return 0;
@@ -41883,7 +41643,7 @@ index 81a79b7..87a0f73 100644
DMWARN("name not supplied when creating device");
return -EINVAL;
diff --git a/drivers/md/dm-raid1.c b/drivers/md/dm-raid1.c
-index 699b5be..eac0a15 100644
+index 9584443..9fc9ac9 100644
--- a/drivers/md/dm-raid1.c
+++ b/drivers/md/dm-raid1.c
@@ -40,7 +40,7 @@ enum dm_raid1_error {
@@ -41949,7 +41709,7 @@ index 699b5be..eac0a15 100644
ms->mirror[mirror].error_type = 0;
ms->mirror[mirror].offset = offset;
-@@ -1340,7 +1340,7 @@ static void mirror_resume(struct dm_target *ti)
+@@ -1339,7 +1339,7 @@ static void mirror_resume(struct dm_target *ti)
*/
static char device_status_char(struct mirror *m)
{
@@ -41958,11 +41718,35 @@ index 699b5be..eac0a15 100644
return 'A';
return (test_bit(DM_RAID1_FLUSH_ERROR, &(m->error_type))) ? 'F' :
+diff --git a/drivers/md/dm-stats.c b/drivers/md/dm-stats.c
+index 3d404c1..b62af0e 100644
+--- a/drivers/md/dm-stats.c
++++ b/drivers/md/dm-stats.c
+@@ -382,7 +382,7 @@ do_sync_free:
+ synchronize_rcu_expedited();
+ dm_stat_free(&s->rcu_head);
+ } else {
+- ACCESS_ONCE(dm_stat_need_rcu_barrier) = 1;
++ ACCESS_ONCE_RW(dm_stat_need_rcu_barrier) = 1;
+ call_rcu(&s->rcu_head, dm_stat_free);
+ }
+ return 0;
+@@ -554,8 +554,8 @@ void dm_stats_account_io(struct dm_stats *stats, unsigned long bi_rw,
+ ((bi_rw & (REQ_WRITE | REQ_DISCARD)) ==
+ (ACCESS_ONCE(last->last_rw) & (REQ_WRITE | REQ_DISCARD)))
+ ));
+- ACCESS_ONCE(last->last_sector) = end_sector;
+- ACCESS_ONCE(last->last_rw) = bi_rw;
++ ACCESS_ONCE_RW(last->last_sector) = end_sector;
++ ACCESS_ONCE_RW(last->last_rw) = bi_rw;
+ }
+
+ rcu_read_lock();
diff --git a/drivers/md/dm-stripe.c b/drivers/md/dm-stripe.c
-index d907ca6..cfb8384 100644
+index 73c1712..7347292 100644
--- a/drivers/md/dm-stripe.c
+++ b/drivers/md/dm-stripe.c
-@@ -20,7 +20,7 @@ struct stripe {
+@@ -21,7 +21,7 @@ struct stripe {
struct dm_dev *dev;
sector_t physical_start;
@@ -41971,7 +41755,7 @@ index d907ca6..cfb8384 100644
};
struct stripe_c {
-@@ -185,7 +185,7 @@ static int stripe_ctr(struct dm_target *ti, unsigned int argc, char **argv)
+@@ -186,7 +186,7 @@ static int stripe_ctr(struct dm_target *ti, unsigned int argc, char **argv)
kfree(sc);
return r;
}
@@ -41980,7 +41764,7 @@ index d907ca6..cfb8384 100644
}
ti->private = sc;
-@@ -326,7 +326,7 @@ static void stripe_status(struct dm_target *ti, status_type_t type,
+@@ -327,7 +327,7 @@ static void stripe_status(struct dm_target *ti, status_type_t type,
DMEMIT("%d ", sc->stripes);
for (i = 0; i < sc->stripes; i++) {
DMEMIT("%s ", sc->stripe[i].dev->name);
@@ -41989,7 +41773,7 @@ index d907ca6..cfb8384 100644
'D' : 'A';
}
buffer[i] = '\0';
-@@ -371,8 +371,8 @@ static int stripe_end_io(struct dm_target *ti, struct bio *bio, int error)
+@@ -372,8 +372,8 @@ static int stripe_end_io(struct dm_target *ti, struct bio *bio, int error)
*/
for (i = 0; i < sc->stripes; i++)
if (!strcmp(sc->stripe[i].dev->name, major_minor)) {
@@ -42001,10 +41785,19 @@ index d907ca6..cfb8384 100644
schedule_work(&sc->trigger_event);
}
diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c
-index 9e3a045..9d0f95b 100644
+index 41d907b..34b87ee 100644
--- a/drivers/md/dm-table.c
+++ b/drivers/md/dm-table.c
-@@ -389,7 +389,7 @@ static int device_area_is_invalid(struct dm_target *ti, struct dm_dev *dev,
+@@ -286,7 +286,7 @@ static struct dm_dev_internal *find_device(struct list_head *l, dev_t dev)
+ static int open_dev(struct dm_dev_internal *d, dev_t dev,
+ struct mapped_device *md)
+ {
+- static char *_claim_ptr = "I belong to device-mapper";
++ static char _claim_ptr[] = "I belong to device-mapper";
+ struct block_device *bdev;
+
+ int r;
+@@ -354,7 +354,7 @@ static int device_area_is_invalid(struct dm_target *ti, struct dm_dev *dev,
if (!dev_size)
return 0;
@@ -42036,10 +41829,10 @@ index 60bce43..9b997d0 100644
pmd->bl_info.value_type.inc = data_block_inc;
pmd->bl_info.value_type.dec = data_block_dec;
diff --git a/drivers/md/dm.c b/drivers/md/dm.c
-index 1c13071..4bb0452 100644
+index b3e26c7..1efca94 100644
--- a/drivers/md/dm.c
+++ b/drivers/md/dm.c
-@@ -169,9 +169,9 @@ struct mapped_device {
+@@ -179,9 +179,9 @@ struct mapped_device {
/*
* Event handling.
*/
@@ -42051,8 +41844,8 @@ index 1c13071..4bb0452 100644
struct list_head uevent_list;
spinlock_t uevent_lock; /* Protect access to uevent_list */
-@@ -1884,8 +1884,8 @@ static struct mapped_device *alloc_dev(int minor)
- rwlock_init(&md->map_lock);
+@@ -1985,8 +1985,8 @@ static struct mapped_device *alloc_dev(int minor)
+ spin_lock_init(&md->deferred_lock);
atomic_set(&md->holders, 1);
atomic_set(&md->open_count, 0);
- atomic_set(&md->event_nr, 0);
@@ -42062,7 +41855,7 @@ index 1c13071..4bb0452 100644
INIT_LIST_HEAD(&md->uevent_list);
spin_lock_init(&md->uevent_lock);
-@@ -2033,7 +2033,7 @@ static void event_callback(void *context)
+@@ -2139,7 +2139,7 @@ static void event_callback(void *context)
dm_send_uevents(&uevents, &disk_to_dev(md->disk)->kobj);
@@ -42071,7 +41864,7 @@ index 1c13071..4bb0452 100644
wake_up(&md->eventq);
}
-@@ -2701,18 +2701,18 @@ int dm_kobject_uevent(struct mapped_device *md, enum kobject_action action,
+@@ -2832,18 +2832,18 @@ int dm_kobject_uevent(struct mapped_device *md, enum kobject_action action,
uint32_t dm_next_uevent_seq(struct mapped_device *md)
{
@@ -42094,7 +41887,7 @@ index 1c13071..4bb0452 100644
void dm_uevent_add(struct mapped_device *md, struct list_head *elist)
diff --git a/drivers/md/md.c b/drivers/md/md.c
-index 2290b95..77ca464 100644
+index ba46d97..f8f5019 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -234,10 +234,10 @@ EXPORT_SYMBOL_GPL(md_trim_bio);
@@ -42119,7 +41912,7 @@ index 2290b95..77ca464 100644
wake_up(&md_event_waiters);
}
-@@ -1501,7 +1501,7 @@ static int super_1_load(struct md_rdev *rdev, struct md_rdev *refdev, int minor_
+@@ -1502,7 +1502,7 @@ static int super_1_load(struct md_rdev *rdev, struct md_rdev *refdev, int minor_
if ((le32_to_cpu(sb->feature_map) & MD_FEATURE_RESHAPE_ACTIVE) &&
(le32_to_cpu(sb->feature_map) & MD_FEATURE_NEW_OFFSET))
rdev->new_data_offset += (s32)le32_to_cpu(sb->new_offset);
@@ -42128,7 +41921,7 @@ index 2290b95..77ca464 100644
rdev->sb_size = le32_to_cpu(sb->max_dev) * 2 + 256;
bmask = queue_logical_block_size(rdev->bdev->bd_disk->queue)-1;
-@@ -1745,7 +1745,7 @@ static void super_1_sync(struct mddev *mddev, struct md_rdev *rdev)
+@@ -1746,7 +1746,7 @@ static void super_1_sync(struct mddev *mddev, struct md_rdev *rdev)
else
sb->resync_offset = cpu_to_le64(0);
@@ -42137,7 +41930,7 @@ index 2290b95..77ca464 100644
sb->raid_disks = cpu_to_le32(mddev->raid_disks);
sb->size = cpu_to_le64(mddev->dev_sectors);
-@@ -2750,7 +2750,7 @@ __ATTR(state, S_IRUGO|S_IWUSR, state_show, state_store);
+@@ -2751,7 +2751,7 @@ __ATTR(state, S_IRUGO|S_IWUSR, state_show, state_store);
static ssize_t
errors_show(struct md_rdev *rdev, char *page)
{
@@ -42146,7 +41939,7 @@ index 2290b95..77ca464 100644
}
static ssize_t
-@@ -2759,7 +2759,7 @@ errors_store(struct md_rdev *rdev, const char *buf, size_t len)
+@@ -2760,7 +2760,7 @@ errors_store(struct md_rdev *rdev, const char *buf, size_t len)
char *e;
unsigned long n = simple_strtoul(buf, &e, 10);
if (*buf && (*e == 0 || *e == '\n')) {
@@ -42155,7 +41948,7 @@ index 2290b95..77ca464 100644
return len;
}
return -EINVAL;
-@@ -3207,8 +3207,8 @@ int md_rdev_init(struct md_rdev *rdev)
+@@ -3208,8 +3208,8 @@ int md_rdev_init(struct md_rdev *rdev)
rdev->sb_loaded = 0;
rdev->bb_page = NULL;
atomic_set(&rdev->nr_pending, 0);
@@ -42166,7 +41959,7 @@ index 2290b95..77ca464 100644
INIT_LIST_HEAD(&rdev->same_set);
init_waitqueue_head(&rdev->blocked_wait);
-@@ -7010,7 +7010,7 @@ static int md_seq_show(struct seq_file *seq, void *v)
+@@ -7043,7 +7043,7 @@ static int md_seq_show(struct seq_file *seq, void *v)
spin_unlock(&pers_lock);
seq_printf(seq, "\n");
@@ -42175,7 +41968,7 @@ index 2290b95..77ca464 100644
return 0;
}
if (v == (void*)2) {
-@@ -7113,7 +7113,7 @@ static int md_seq_open(struct inode *inode, struct file *file)
+@@ -7146,7 +7146,7 @@ static int md_seq_open(struct inode *inode, struct file *file)
return error;
seq = file->private_data;
@@ -42184,7 +41977,7 @@ index 2290b95..77ca464 100644
return error;
}
-@@ -7127,7 +7127,7 @@ static unsigned int mdstat_poll(struct file *filp, poll_table *wait)
+@@ -7160,7 +7160,7 @@ static unsigned int mdstat_poll(struct file *filp, poll_table *wait)
/* always allow read */
mask = POLLIN | POLLRDNORM;
@@ -42193,7 +41986,7 @@ index 2290b95..77ca464 100644
mask |= POLLERR | POLLPRI;
return mask;
}
-@@ -7171,7 +7171,7 @@ static int is_mddev_idle(struct mddev *mddev, int init)
+@@ -7204,7 +7204,7 @@ static int is_mddev_idle(struct mddev *mddev, int init)
struct gendisk *disk = rdev->bdev->bd_contains->bd_disk;
curr_events = (int)part_stat_read(&disk->part0, sectors[0]) +
(int)part_stat_read(&disk->part0, sectors[1]) -
@@ -42203,7 +41996,7 @@ index 2290b95..77ca464 100644
* as sync_io is counted when a request starts, and
* disk_stats is counted when it completes.
diff --git a/drivers/md/md.h b/drivers/md/md.h
-index 653f992b6..6af6c40 100644
+index 608050c..6e77db5d 100644
--- a/drivers/md/md.h
+++ b/drivers/md/md.h
@@ -94,13 +94,13 @@ struct md_rdev {
@@ -42222,7 +42015,7 @@ index 653f992b6..6af6c40 100644
* for reporting to userspace and storing
* in superblock.
*/
-@@ -434,7 +434,7 @@ static inline void rdev_dec_pending(struct md_rdev *rdev, struct mddev *mddev)
+@@ -446,7 +446,7 @@ static inline void rdev_dec_pending(struct md_rdev *rdev, struct mddev *mddev)
static inline void md_sync_acct(struct block_device *bdev, unsigned long nr_sectors)
{
@@ -42244,10 +42037,10 @@ index 3e6d115..ffecdeb 100644
/*----------------------------------------------------------------*/
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
-index afaa5d4..c139824 100644
+index aacf6bf..67d63f2 100644
--- a/drivers/md/raid1.c
+++ b/drivers/md/raid1.c
-@@ -1823,7 +1823,7 @@ static int fix_sync_read_error(struct r1bio *r1_bio)
+@@ -1824,7 +1824,7 @@ static int fix_sync_read_error(struct r1bio *r1_bio)
if (r1_sync_page_io(rdev, sect, s,
bio->bi_io_vec[idx].bv_page,
READ) != 0)
@@ -42256,7 +42049,7 @@ index afaa5d4..c139824 100644
}
sectors -= s;
sect += s;
-@@ -2050,7 +2050,7 @@ static void fix_read_error(struct r1conf *conf, int read_disk,
+@@ -2051,7 +2051,7 @@ static void fix_read_error(struct r1conf *conf, int read_disk,
test_bit(In_sync, &rdev->flags)) {
if (r1_sync_page_io(rdev, sect, s,
conf->tmppage, READ)) {
@@ -42266,10 +42059,10 @@ index afaa5d4..c139824 100644
"md/raid1:%s: read error corrected "
"(%d sectors at %llu on %s)\n",
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
-index 0add868..372c6ec 100644
+index 73dc8a3..bdd515a 100644
--- a/drivers/md/raid10.c
+++ b/drivers/md/raid10.c
-@@ -1941,7 +1941,7 @@ static void end_sync_read(struct bio *bio, int error)
+@@ -1963,7 +1963,7 @@ static void end_sync_read(struct bio *bio, int error)
/* The write handler will notice the lack of
* R10BIO_Uptodate and record any errors etc
*/
@@ -42278,7 +42071,7 @@ index 0add868..372c6ec 100644
&conf->mirrors[d].rdev->corrected_errors);
/* for reconstruct, we always reschedule after a read.
-@@ -2299,7 +2299,7 @@ static void check_decay_read_errors(struct mddev *mddev, struct md_rdev *rdev)
+@@ -2321,7 +2321,7 @@ static void check_decay_read_errors(struct mddev *mddev, struct md_rdev *rdev)
{
struct timespec cur_time_mon;
unsigned long hours_since_last;
@@ -42287,7 +42080,7 @@ index 0add868..372c6ec 100644
ktime_get_ts(&cur_time_mon);
-@@ -2321,9 +2321,9 @@ static void check_decay_read_errors(struct mddev *mddev, struct md_rdev *rdev)
+@@ -2343,9 +2343,9 @@ static void check_decay_read_errors(struct mddev *mddev, struct md_rdev *rdev)
* overflowing the shift of read_errors by hours_since_last.
*/
if (hours_since_last >= 8 * sizeof(read_errors))
@@ -42299,7 +42092,7 @@ index 0add868..372c6ec 100644
}
static int r10_sync_page_io(struct md_rdev *rdev, sector_t sector,
-@@ -2377,8 +2377,8 @@ static void fix_read_error(struct r10conf *conf, struct mddev *mddev, struct r10
+@@ -2399,8 +2399,8 @@ static void fix_read_error(struct r10conf *conf, struct mddev *mddev, struct r10
return;
check_decay_read_errors(mddev, rdev);
@@ -42310,7 +42103,7 @@ index 0add868..372c6ec 100644
char b[BDEVNAME_SIZE];
bdevname(rdev->bdev, b);
-@@ -2386,7 +2386,7 @@ static void fix_read_error(struct r10conf *conf, struct mddev *mddev, struct r10
+@@ -2408,7 +2408,7 @@ static void fix_read_error(struct r10conf *conf, struct mddev *mddev, struct r10
"md/raid10:%s: %s: Raid device exceeded "
"read_error threshold [cur %d:max %d]\n",
mdname(mddev), b,
@@ -42319,7 +42112,7 @@ index 0add868..372c6ec 100644
printk(KERN_NOTICE
"md/raid10:%s: %s: Failing raid device\n",
mdname(mddev), b);
-@@ -2541,7 +2541,7 @@ static void fix_read_error(struct r10conf *conf, struct mddev *mddev, struct r10
+@@ -2563,7 +2563,7 @@ static void fix_read_error(struct r10conf *conf, struct mddev *mddev, struct r10
sect +
choose_data_offset(r10_bio, rdev)),
bdevname(rdev->bdev, b));
@@ -42329,10 +42122,10 @@ index 0add868..372c6ec 100644
rdev_dec_pending(rdev, mddev);
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
-index 4bed545..8d22d0b 100644
+index 8a0665d..984c46d 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
-@@ -1776,21 +1776,21 @@ static void raid5_end_read_request(struct bio * bi, int error)
+@@ -1887,21 +1887,21 @@ static void raid5_end_read_request(struct bio * bi, int error)
mdname(conf->mddev), STRIPE_SECTORS,
(unsigned long long)s,
bdevname(rdev->bdev, b));
@@ -42358,7 +42151,7 @@ index 4bed545..8d22d0b 100644
if (test_bit(R5_ReadRepl, &sh->dev[i].flags))
printk_ratelimited(
KERN_WARNING
-@@ -1818,7 +1818,7 @@ static void raid5_end_read_request(struct bio * bi, int error)
+@@ -1929,7 +1929,7 @@ static void raid5_end_read_request(struct bio * bi, int error)
mdname(conf->mddev),
(unsigned long long)s,
bdn);
@@ -42394,7 +42187,7 @@ index 9b6c3bb..baeb5c7 100644
#if IS_ENABLED(CONFIG_DVB_DIB3000MB)
extern struct dvb_frontend* dib3000mb_attach(const struct dib3000_config* config,
diff --git a/drivers/media/pci/cx88/cx88-video.c b/drivers/media/pci/cx88/cx88-video.c
-index c7a9be1..683f6f8 100644
+index ecf21d9..b992428d 100644
--- a/drivers/media/pci/cx88/cx88-video.c
+++ b/drivers/media/pci/cx88/cx88-video.c
@@ -50,9 +50,9 @@ MODULE_VERSION(CX88_VERSION);
@@ -42411,10 +42204,10 @@ index c7a9be1..683f6f8 100644
module_param_array(video_nr, int, NULL, 0444);
module_param_array(vbi_nr, int, NULL, 0444);
diff --git a/drivers/media/pci/ivtv/ivtv-driver.c b/drivers/media/pci/ivtv/ivtv-driver.c
-index 07b8460..e6d7265 100644
+index c08ae3e..eb59af1 100644
--- a/drivers/media/pci/ivtv/ivtv-driver.c
+++ b/drivers/media/pci/ivtv/ivtv-driver.c
-@@ -84,7 +84,7 @@ static struct pci_device_id ivtv_pci_tbl[] = {
+@@ -83,7 +83,7 @@ static struct pci_device_id ivtv_pci_tbl[] = {
MODULE_DEVICE_TABLE(pci,ivtv_pci_tbl);
/* ivtv instance counter */
@@ -42424,7 +42217,7 @@ index 07b8460..e6d7265 100644
/* Parameter declarations */
static int cardtype[IVTV_MAX_CARDS];
diff --git a/drivers/media/platform/omap/omap_vout.c b/drivers/media/platform/omap/omap_vout.c
-index d338b19..aae4f9e 100644
+index dfd0a21..6bbb465 100644
--- a/drivers/media/platform/omap/omap_vout.c
+++ b/drivers/media/platform/omap/omap_vout.c
@@ -63,7 +63,6 @@ enum omap_vout_channels {
@@ -42435,7 +42228,7 @@ index d338b19..aae4f9e 100644
/* Variables configurable through module params*/
static u32 video1_numbuffers = 3;
static u32 video2_numbuffers = 3;
-@@ -1015,6 +1014,12 @@ static int omap_vout_open(struct file *file)
+@@ -1014,6 +1013,12 @@ static int omap_vout_open(struct file *file)
{
struct videobuf_queue *q;
struct omap_vout_device *vout = NULL;
@@ -42448,7 +42241,7 @@ index d338b19..aae4f9e 100644
vout = video_drvdata(file);
v4l2_dbg(1, debug, &vout->vid_dev->v4l2_dev, "Entering %s\n", __func__);
-@@ -1032,10 +1037,6 @@ static int omap_vout_open(struct file *file)
+@@ -1031,10 +1036,6 @@ static int omap_vout_open(struct file *file)
vout->type = V4L2_BUF_TYPE_VIDEO_OUTPUT;
q = &vout->vbq;
@@ -42499,10 +42292,10 @@ index b713403..53cb5ad 100644
if (done && done != layer->shadow_buf)
vb2_buffer_done(&done->vb, VB2_BUF_STATE_DONE);
diff --git a/drivers/media/platform/s5p-tv/mixer_video.c b/drivers/media/platform/s5p-tv/mixer_video.c
-index ef0efdf..8c78eb6 100644
+index 641b1f0..49cff30 100644
--- a/drivers/media/platform/s5p-tv/mixer_video.c
+++ b/drivers/media/platform/s5p-tv/mixer_video.c
-@@ -209,7 +209,7 @@ static void mxr_layer_default_geo(struct mxr_layer *layer)
+@@ -210,7 +210,7 @@ static void mxr_layer_default_geo(struct mxr_layer *layer)
layer->geo.src.height = layer->geo.src.full_height;
mxr_geometry_dump(mdev, &layer->geo);
@@ -42511,7 +42304,7 @@ index ef0efdf..8c78eb6 100644
mxr_geometry_dump(mdev, &layer->geo);
}
-@@ -227,7 +227,7 @@ static void mxr_layer_update_output(struct mxr_layer *layer)
+@@ -228,7 +228,7 @@ static void mxr_layer_update_output(struct mxr_layer *layer)
layer->geo.dst.full_width = mbus_fmt.width;
layer->geo.dst.full_height = mbus_fmt.height;
layer->geo.dst.field = mbus_fmt.field;
@@ -42520,7 +42313,7 @@ index ef0efdf..8c78eb6 100644
mxr_geometry_dump(mdev, &layer->geo);
}
-@@ -333,7 +333,7 @@ static int mxr_s_fmt(struct file *file, void *priv,
+@@ -334,7 +334,7 @@ static int mxr_s_fmt(struct file *file, void *priv,
/* set source size to highest accepted value */
geo->src.full_width = max(geo->dst.full_width, pix->width);
geo->src.full_height = max(geo->dst.full_height, pix->height);
@@ -42529,7 +42322,7 @@ index ef0efdf..8c78eb6 100644
mxr_geometry_dump(mdev, &layer->geo);
/* set cropping to total visible screen */
geo->src.width = pix->width;
-@@ -341,12 +341,12 @@ static int mxr_s_fmt(struct file *file, void *priv,
+@@ -342,12 +342,12 @@ static int mxr_s_fmt(struct file *file, void *priv,
geo->src.x_offset = 0;
geo->src.y_offset = 0;
/* assure consistency of geometry */
@@ -42544,7 +42337,7 @@ index ef0efdf..8c78eb6 100644
mxr_geometry_dump(mdev, &layer->geo);
/* returning results */
-@@ -473,7 +473,7 @@ static int mxr_s_selection(struct file *file, void *fh,
+@@ -474,7 +474,7 @@ static int mxr_s_selection(struct file *file, void *fh,
target->width = s->r.width;
target->height = s->r.height;
@@ -42553,7 +42346,7 @@ index ef0efdf..8c78eb6 100644
/* retrieve update selection rectangle */
res.left = target->x_offset;
-@@ -954,13 +954,13 @@ static int start_streaming(struct vb2_queue *vq, unsigned int count)
+@@ -955,13 +955,13 @@ static int start_streaming(struct vb2_queue *vq, unsigned int count)
mxr_output_get(mdev);
mxr_layer_update_output(layer);
@@ -42569,7 +42362,7 @@ index ef0efdf..8c78eb6 100644
mxr_streamer_get(mdev);
return 0;
-@@ -1030,7 +1030,7 @@ static int stop_streaming(struct vb2_queue *vq)
+@@ -1031,7 +1031,7 @@ static int stop_streaming(struct vb2_queue *vq)
spin_unlock_irqrestore(&layer->enq_slock, flags);
/* disabling layer in hardware */
@@ -42578,7 +42371,7 @@ index ef0efdf..8c78eb6 100644
/* remove one streamer */
mxr_streamer_put(mdev);
/* allow changes in output configuration */
-@@ -1069,8 +1069,8 @@ void mxr_base_layer_unregister(struct mxr_layer *layer)
+@@ -1070,8 +1070,8 @@ void mxr_base_layer_unregister(struct mxr_layer *layer)
void mxr_layer_release(struct mxr_layer *layer)
{
@@ -42589,7 +42382,7 @@ index ef0efdf..8c78eb6 100644
}
void mxr_base_layer_release(struct mxr_layer *layer)
-@@ -1096,7 +1096,7 @@ struct mxr_layer *mxr_base_layer_create(struct mxr_device *mdev,
+@@ -1097,7 +1097,7 @@ struct mxr_layer *mxr_base_layer_create(struct mxr_device *mdev,
layer->mdev = mdev;
layer->idx = idx;
@@ -42634,7 +42427,7 @@ index 545c04c..a14bded 100644
unlock:
mutex_unlock(&dev->lock);
diff --git a/drivers/media/radio/radio-maxiradio.c b/drivers/media/radio/radio-maxiradio.c
-index bd4d3a7..ffc0b9d 100644
+index 5236035..c622c74 100644
--- a/drivers/media/radio/radio-maxiradio.c
+++ b/drivers/media/radio/radio-maxiradio.c
@@ -61,7 +61,7 @@ MODULE_PARM_DESC(radio_nr, "Radio device number");
@@ -42647,7 +42440,7 @@ index bd4d3a7..ffc0b9d 100644
#define PCI_VENDOR_ID_GUILLEMOT 0x5046
#define PCI_DEVICE_ID_GUILLEMOT_MAXIRADIO 0x1001
diff --git a/drivers/media/radio/radio-shark.c b/drivers/media/radio/radio-shark.c
-index 8fa18ab..caee70f 100644
+index b914772..7ddbf9b 100644
--- a/drivers/media/radio/radio-shark.c
+++ b/drivers/media/radio/radio-shark.c
@@ -79,7 +79,7 @@ struct shark_device {
@@ -42673,10 +42466,10 @@ index 9fb6697..f167415 100644
static int shark_write_reg(struct radio_tea5777 *tea, u64 reg)
{
diff --git a/drivers/media/radio/radio-si476x.c b/drivers/media/radio/radio-si476x.c
-index 9dc8baf..796d52f 100644
+index 9c9084c..a9e8dfb 100644
--- a/drivers/media/radio/radio-si476x.c
+++ b/drivers/media/radio/radio-si476x.c
-@@ -1456,7 +1456,7 @@ static int si476x_radio_probe(struct platform_device *pdev)
+@@ -1445,7 +1445,7 @@ static int si476x_radio_probe(struct platform_device *pdev)
struct si476x_radio *radio;
struct v4l2_ctrl *ctrl;
@@ -42686,10 +42479,10 @@ index 9dc8baf..796d52f 100644
radio = devm_kzalloc(&pdev->dev, sizeof(*radio), GFP_KERNEL);
if (!radio)
diff --git a/drivers/media/rc/rc-main.c b/drivers/media/rc/rc-main.c
-index 1cf382a..c22998c 100644
+index 46da365..3ba4206 100644
--- a/drivers/media/rc/rc-main.c
+++ b/drivers/media/rc/rc-main.c
-@@ -1030,7 +1030,7 @@ EXPORT_SYMBOL_GPL(rc_free_device);
+@@ -1065,7 +1065,7 @@ EXPORT_SYMBOL_GPL(rc_free_device);
int rc_register_device(struct rc_dev *dev)
{
static bool raw_init = false; /* raw decoders loaded? */
@@ -42698,7 +42491,7 @@ index 1cf382a..c22998c 100644
struct rc_map *rc_map;
const char *path;
int rc;
-@@ -1061,7 +1061,7 @@ int rc_register_device(struct rc_dev *dev)
+@@ -1096,7 +1096,7 @@ int rc_register_device(struct rc_dev *dev)
*/
mutex_lock(&dev->lock);
@@ -42734,7 +42527,7 @@ index 71b22f5..a63b33f 100644
/* debug */
static int dvb_usb_dw2102_debug;
diff --git a/drivers/media/v4l2-core/v4l2-compat-ioctl32.c b/drivers/media/v4l2-core/v4l2-compat-ioctl32.c
-index f129551..ecf6514 100644
+index 8f7a6a4..59502dd 100644
--- a/drivers/media/v4l2-core/v4l2-compat-ioctl32.c
+++ b/drivers/media/v4l2-core/v4l2-compat-ioctl32.c
@@ -326,7 +326,7 @@ struct v4l2_buffer32 {
@@ -42765,10 +42558,10 @@ index f129551..ecf6514 100644
return 0;
}
diff --git a/drivers/media/v4l2-core/v4l2-device.c b/drivers/media/v4l2-core/v4l2-device.c
-index 8ed5da2..47fee46 100644
+index 02d1b63..5fd6b16 100644
--- a/drivers/media/v4l2-core/v4l2-device.c
+++ b/drivers/media/v4l2-core/v4l2-device.c
-@@ -74,9 +74,9 @@ int v4l2_device_put(struct v4l2_device *v4l2_dev)
+@@ -75,9 +75,9 @@ int v4l2_device_put(struct v4l2_device *v4l2_dev)
EXPORT_SYMBOL_GPL(v4l2_device_put);
int v4l2_device_set_name(struct v4l2_device *v4l2_dev, const char *basename,
@@ -42781,10 +42574,10 @@ index 8ed5da2..47fee46 100644
if (basename[len - 1] >= '0' && basename[len - 1] <= '9')
diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c
-index 7658586..1079260 100644
+index 68e6b5e..d8b923e 100644
--- a/drivers/media/v4l2-core/v4l2-ioctl.c
+++ b/drivers/media/v4l2-core/v4l2-ioctl.c
-@@ -1995,7 +1995,8 @@ struct v4l2_ioctl_info {
+@@ -1939,7 +1939,8 @@ struct v4l2_ioctl_info {
struct file *file, void *fh, void *p);
} u;
void (*debug)(const void *arg, bool write_only);
@@ -42794,7 +42587,7 @@ index 7658586..1079260 100644
/* This control needs a priority check */
#define INFO_FL_PRIO (1 << 0)
-@@ -2177,7 +2178,7 @@ static long __video_do_ioctl(struct file *file,
+@@ -2120,7 +2121,7 @@ static long __video_do_ioctl(struct file *file,
struct video_device *vfd = video_devdata(file);
const struct v4l2_ioctl_ops *ops = vfd->ioctl_ops;
bool write_only = false;
@@ -42803,7 +42596,7 @@ index 7658586..1079260 100644
const struct v4l2_ioctl_info *info;
void *fh = file->private_data;
struct v4l2_fh *vfh = NULL;
-@@ -2251,7 +2252,7 @@ done:
+@@ -2194,7 +2195,7 @@ done:
}
static int check_array_args(unsigned int cmd, void *parg, size_t *array_size,
@@ -42812,7 +42605,7 @@ index 7658586..1079260 100644
{
int ret = 0;
-@@ -2267,7 +2268,7 @@ static int check_array_args(unsigned int cmd, void *parg, size_t *array_size,
+@@ -2210,7 +2211,7 @@ static int check_array_args(unsigned int cmd, void *parg, size_t *array_size,
ret = -EINVAL;
break;
}
@@ -42821,7 +42614,7 @@ index 7658586..1079260 100644
*kernel_ptr = (void *)&buf->m.planes;
*array_size = sizeof(struct v4l2_plane) * buf->length;
ret = 1;
-@@ -2302,7 +2303,7 @@ static int check_array_args(unsigned int cmd, void *parg, size_t *array_size,
+@@ -2245,7 +2246,7 @@ static int check_array_args(unsigned int cmd, void *parg, size_t *array_size,
ret = -EINVAL;
break;
}
@@ -42925,13 +42718,12 @@ index 727819c..ad74694 100644
- if ((h->info_kbuf = kmalloc(0x1000 /* 4Kb */, GFP_KERNEL)) == NULL)
- return h->info_kbuf;
- h->info_kbuf[0] = '\0';
--
++ if (!h)
++ return NULL;
+
- mpt_print_ioc_summary(h->ioc, h->info_kbuf, &size, 0, 0);
- h->info_kbuf[size-1] = '\0';
- }
-+ if (!h)
-+ return NULL;
-+
+ if (h->info_kbuf == NULL)
+ if ((h->info_kbuf = kmalloc(0x1000 /* 4Kb */, GFP_KERNEL)) == NULL)
+ return h->info_kbuf;
@@ -42943,7 +42735,7 @@ index 727819c..ad74694 100644
return h->info_kbuf;
}
diff --git a/drivers/message/i2o/i2o_proc.c b/drivers/message/i2o/i2o_proc.c
-index b7d87cd..9890039 100644
+index b7d87cd..3fb36da 100644
--- a/drivers/message/i2o/i2o_proc.c
+++ b/drivers/message/i2o/i2o_proc.c
@@ -255,12 +255,6 @@ static char *scsi_devices[] = {
@@ -42959,6 +42751,19 @@ index b7d87cd..9890039 100644
static int i2o_report_query_status(struct seq_file *seq, int block_status,
char *group)
{
+@@ -707,9 +701,9 @@ static int i2o_seq_show_status(struct seq_file *seq, void *v)
+ static int i2o_seq_show_hw(struct seq_file *seq, void *v)
+ {
+ struct i2o_controller *c = (struct i2o_controller *)seq->private;
+- static u32 work32[5];
+- static u8 *work8 = (u8 *) work32;
+- static u16 *work16 = (u16 *) work32;
++ u32 work32[5];
++ u8 *work8 = (u8 *) work32;
++ u16 *work16 = (u16 *) work32;
+ int token;
+ u32 hwcap;
+
@@ -790,7 +784,6 @@ static int i2o_seq_show_ddm_table(struct seq_file *seq, void *v)
} *result;
@@ -42997,9 +42802,15 @@ index b7d87cd..9890039 100644
seq_printf(seq, "%8d ", dst->module_size);
seq_printf(seq, "%8d ", dst->mpb_size);
seq_printf(seq, "0x%04x", dst->module_flags);
-@@ -1250,7 +1240,6 @@ static int i2o_seq_show_dev_identity(struct seq_file *seq, void *v)
+@@ -1246,11 +1236,10 @@ static int i2o_seq_show_authorized_users(struct seq_file *seq, void *v)
+ static int i2o_seq_show_dev_identity(struct seq_file *seq, void *v)
+ {
+ struct i2o_device *d = (struct i2o_device *)seq->private;
+- static u32 work32[128]; // allow for "stuff" + up to 256 byte (max) serial number
++ u32 work32[128]; // allow for "stuff" + up to 256 byte (max) serial number
// == (allow) 512d bytes (max)
- static u16 *work16 = (u16 *) work32;
+- static u16 *work16 = (u16 *) work32;
++ u16 *work16 = (u16 *) work32;
int token;
- char tmp[16 + 1];
@@ -43074,6 +42885,19 @@ index b7d87cd..9890039 100644
return 0;
}
+@@ -1368,9 +1343,9 @@ static int i2o_seq_show_uinfo(struct seq_file *seq, void *v)
+ static int i2o_seq_show_sgl_limits(struct seq_file *seq, void *v)
+ {
+ struct i2o_device *d = (struct i2o_device *)seq->private;
+- static u32 work32[12];
+- static u16 *work16 = (u16 *) work32;
+- static u8 *work8 = (u8 *) work32;
++ u32 work32[12];
++ u16 *work16 = (u16 *) work32;
++ u8 *work8 = (u8 *) work32;
+ int token;
+
+ token = i2o_parm_field_get(d, 0xF103, -1, &work32, sizeof(work32));
diff --git a/drivers/message/i2o/iop.c b/drivers/message/i2o/iop.c
index a8c08f3..155fe3d 100644
--- a/drivers/message/i2o/iop.c
@@ -43102,7 +42926,7 @@ index a8c08f3..155fe3d 100644
#endif
diff --git a/drivers/mfd/janz-cmodio.c b/drivers/mfd/janz-cmodio.c
-index 45ece11..8efa218 100644
+index fcbb2e9..2635e11 100644
--- a/drivers/mfd/janz-cmodio.c
+++ b/drivers/mfd/janz-cmodio.c
@@ -13,6 +13,7 @@
@@ -43113,8 +42937,34 @@ index 45ece11..8efa218 100644
#include <linux/init.h>
#include <linux/pci.h>
#include <linux/interrupt.h>
+diff --git a/drivers/mfd/max8925-i2c.c b/drivers/mfd/max8925-i2c.c
+index de7fb80..7c1b931 100644
+--- a/drivers/mfd/max8925-i2c.c
++++ b/drivers/mfd/max8925-i2c.c
+@@ -152,7 +152,7 @@ static int max8925_probe(struct i2c_client *client,
+ const struct i2c_device_id *id)
+ {
+ struct max8925_platform_data *pdata = dev_get_platdata(&client->dev);
+- static struct max8925_chip *chip;
++ struct max8925_chip *chip;
+ struct device_node *node = client->dev.of_node;
+
+ if (node && !pdata) {
+diff --git a/drivers/mfd/tps65910.c b/drivers/mfd/tps65910.c
+index d792772..cd73ba3 100644
+--- a/drivers/mfd/tps65910.c
++++ b/drivers/mfd/tps65910.c
+@@ -229,7 +229,7 @@ static int tps65910_irq_init(struct tps65910 *tps65910, int irq,
+ struct tps65910_platform_data *pdata)
+ {
+ int ret = 0;
+- static struct regmap_irq_chip *tps6591x_irqs_chip;
++ struct regmap_irq_chip *tps6591x_irqs_chip;
+
+ if (!irq) {
+ dev_warn(tps65910->dev, "No interrupt support, no core IRQ\n");
diff --git a/drivers/mfd/twl4030-irq.c b/drivers/mfd/twl4030-irq.c
-index a5f9888..1c0ed56 100644
+index 9aa6d1e..1631bfc 100644
--- a/drivers/mfd/twl4030-irq.c
+++ b/drivers/mfd/twl4030-irq.c
@@ -35,6 +35,7 @@
@@ -43125,7 +42975,7 @@ index a5f9888..1c0ed56 100644
#include "twl-core.h"
-@@ -728,10 +729,12 @@ int twl4030_init_irq(struct device *dev, int irq_num)
+@@ -726,10 +727,12 @@ int twl4030_init_irq(struct device *dev, int irq_num)
* Install an irq handler for each of the SIH modules;
* clone dummy irq_chip since PIH can't *do* anything
*/
@@ -43141,42 +42991,21 @@ index a5f9888..1c0ed56 100644
for (i = irq_base; i < irq_end; i++) {
irq_set_chip_and_handler(i, &twl4030_irq_chip,
-diff --git a/drivers/mfd/twl6030-irq.c b/drivers/mfd/twl6030-irq.c
-index 277a8db..0e0b754 100644
---- a/drivers/mfd/twl6030-irq.c
-+++ b/drivers/mfd/twl6030-irq.c
-@@ -387,10 +387,12 @@ int twl6030_init_irq(struct device *dev, int irq_num)
- * install an irq handler for each of the modules;
- * clone dummy irq_chip since PIH can't *do* anything
- */
-- twl6030_irq_chip = dummy_irq_chip;
-- twl6030_irq_chip.name = "twl6030";
-- twl6030_irq_chip.irq_set_type = NULL;
-- twl6030_irq_chip.irq_set_wake = twl6030_irq_set_wake;
-+ pax_open_kernel();
-+ memcpy((void *)&twl6030_irq_chip, &dummy_irq_chip, sizeof twl6030_irq_chip);
-+ *(const char **)&twl6030_irq_chip.name = "twl6030";
-+ *(void **)&twl6030_irq_chip.irq_set_type = NULL;
-+ *(void **)&twl6030_irq_chip.irq_set_wake = twl6030_irq_set_wake;
-+ pax_close_kernel();
-
- for (i = irq_base; i < irq_end; i++) {
- irq_set_chip_and_handler(i, &twl6030_irq_chip,
diff --git a/drivers/misc/c2port/core.c b/drivers/misc/c2port/core.c
-index f32550a..e3e52a2 100644
+index 464419b..64bae8d 100644
--- a/drivers/misc/c2port/core.c
+++ b/drivers/misc/c2port/core.c
-@@ -920,7 +920,9 @@ struct c2port_device *c2port_device_register(char *name,
- mutex_init(&c2dev->mutex);
+@@ -922,7 +922,9 @@ struct c2port_device *c2port_device_register(char *name,
+ goto error_idr_alloc;
+ c2dev->id = ret;
- /* Create binary file */
-- c2port_bin_attrs.size = ops->blocks_num * ops->block_size;
+- bin_attr_flash_data.size = ops->blocks_num * ops->block_size;
+ pax_open_kernel();
-+ *(size_t *)&c2port_bin_attrs.size = ops->blocks_num * ops->block_size;
++ *(size_t *)&bin_attr_flash_data.size = ops->blocks_num * ops->block_size;
+ pax_close_kernel();
- ret = device_create_bin_file(c2dev->dev, &c2port_bin_attrs);
- if (unlikely(ret))
- goto error_device_create_bin_file;
+
+ c2dev->dev = device_create(c2port_class, NULL, 0, c2dev,
+ "c2port%d", c2dev->id);
diff --git a/drivers/misc/kgdbts.c b/drivers/misc/kgdbts.c
index 36f5d52..32311c3 100644
--- a/drivers/misc/kgdbts.c
@@ -43200,7 +43029,7 @@ index 36f5d52..32311c3 100644
if (memcmp(before, after, BREAK_INSTR_SIZE)) {
printk(KERN_CRIT "kgdbts: ERROR kgdb corrupted memory\n");
diff --git a/drivers/misc/lis3lv02d/lis3lv02d.c b/drivers/misc/lis3lv02d/lis3lv02d.c
-index 4cd4a3d..b48cbc7 100644
+index 036effe..b3a6336 100644
--- a/drivers/misc/lis3lv02d/lis3lv02d.c
+++ b/drivers/misc/lis3lv02d/lis3lv02d.c
@@ -498,7 +498,7 @@ static irqreturn_t lis302dl_interrupt(int irq, void *data)
@@ -43268,7 +43097,7 @@ index 2f30bad..c4c13d0 100644
mcs_op_statistics[op].max = nsec;
}
diff --git a/drivers/misc/sgi-gru/gruprocfs.c b/drivers/misc/sgi-gru/gruprocfs.c
-index 797d796..ae8f01e 100644
+index 4f76359..cdfcb2e 100644
--- a/drivers/misc/sgi-gru/gruprocfs.c
+++ b/drivers/misc/sgi-gru/gruprocfs.c
@@ -32,9 +32,9 @@
@@ -43353,31 +43182,6 @@ index 5c3ce24..4915ccb 100644
- atomic_long_t flush_tlb_gru;
- atomic_long_t flush_tlb_gru_tgh;
- atomic_long_t flush_tlb_gru_zero_asid;
--
-- atomic_long_t copy_gpa;
-- atomic_long_t read_gpa;
--
-- atomic_long_t mesq_receive;
-- atomic_long_t mesq_receive_none;
-- atomic_long_t mesq_send;
-- atomic_long_t mesq_send_failed;
-- atomic_long_t mesq_noop;
-- atomic_long_t mesq_send_unexpected_error;
-- atomic_long_t mesq_send_lb_overflow;
-- atomic_long_t mesq_send_qlimit_reached;
-- atomic_long_t mesq_send_amo_nacked;
-- atomic_long_t mesq_send_put_nacked;
-- atomic_long_t mesq_page_overflow;
-- atomic_long_t mesq_qf_locked;
-- atomic_long_t mesq_qf_noop_not_full;
-- atomic_long_t mesq_qf_switch_head_failed;
-- atomic_long_t mesq_qf_unexpected_error;
-- atomic_long_t mesq_noop_unexpected_error;
-- atomic_long_t mesq_noop_lb_overflow;
-- atomic_long_t mesq_noop_qlimit_reached;
-- atomic_long_t mesq_noop_amo_nacked;
-- atomic_long_t mesq_noop_put_nacked;
-- atomic_long_t mesq_noop_page_overflow;
+ atomic_long_unchecked_t vdata_alloc;
+ atomic_long_unchecked_t vdata_free;
+ atomic_long_unchecked_t gts_alloc;
@@ -43429,10 +43233,33 @@ index 5c3ce24..4915ccb 100644
+ atomic_long_unchecked_t flush_tlb_gru;
+ atomic_long_unchecked_t flush_tlb_gru_tgh;
+ atomic_long_unchecked_t flush_tlb_gru_zero_asid;
-+
+
+- atomic_long_t copy_gpa;
+- atomic_long_t read_gpa;
+ atomic_long_unchecked_t copy_gpa;
+ atomic_long_unchecked_t read_gpa;
-+
+
+- atomic_long_t mesq_receive;
+- atomic_long_t mesq_receive_none;
+- atomic_long_t mesq_send;
+- atomic_long_t mesq_send_failed;
+- atomic_long_t mesq_noop;
+- atomic_long_t mesq_send_unexpected_error;
+- atomic_long_t mesq_send_lb_overflow;
+- atomic_long_t mesq_send_qlimit_reached;
+- atomic_long_t mesq_send_amo_nacked;
+- atomic_long_t mesq_send_put_nacked;
+- atomic_long_t mesq_page_overflow;
+- atomic_long_t mesq_qf_locked;
+- atomic_long_t mesq_qf_noop_not_full;
+- atomic_long_t mesq_qf_switch_head_failed;
+- atomic_long_t mesq_qf_unexpected_error;
+- atomic_long_t mesq_noop_unexpected_error;
+- atomic_long_t mesq_noop_lb_overflow;
+- atomic_long_t mesq_noop_qlimit_reached;
+- atomic_long_t mesq_noop_amo_nacked;
+- atomic_long_t mesq_noop_put_nacked;
+- atomic_long_t mesq_noop_page_overflow;
+ atomic_long_unchecked_t mesq_receive;
+ atomic_long_unchecked_t mesq_receive_none;
+ atomic_long_unchecked_t mesq_send;
@@ -43512,7 +43339,7 @@ index b94d5f7..7f494c5 100644
extern int xpc_disengage_timedout;
extern int xpc_activate_IRQ_rcvd;
diff --git a/drivers/misc/sgi-xp/xpc_main.c b/drivers/misc/sgi-xp/xpc_main.c
-index d971817..33bdca5 100644
+index 82dc574..8539ab2 100644
--- a/drivers/misc/sgi-xp/xpc_main.c
+++ b/drivers/misc/sgi-xp/xpc_main.c
@@ -166,7 +166,7 @@ static struct notifier_block xpc_die_notifier = {
@@ -43534,10 +43361,10 @@ index d971817..33bdca5 100644
break;
diff --git a/drivers/mmc/core/mmc_ops.c b/drivers/mmc/core/mmc_ops.c
-index 49f04bc..65660c2 100644
+index ef18348..1b53cf0 100644
--- a/drivers/mmc/core/mmc_ops.c
+++ b/drivers/mmc/core/mmc_ops.c
-@@ -247,7 +247,7 @@ mmc_send_cxd_data(struct mmc_card *card, struct mmc_host *host,
+@@ -213,7 +213,7 @@ mmc_send_cxd_data(struct mmc_card *card, struct mmc_host *host,
void *data_buf;
int is_on_stack;
@@ -43547,21 +43374,36 @@ index 49f04bc..65660c2 100644
/*
* dma onto stack is unsafe/nonportable, but callers to this
diff --git a/drivers/mmc/host/dw_mmc.h b/drivers/mmc/host/dw_mmc.h
-index 0b74189..818358f 100644
+index 81b2994..dce857e 100644
--- a/drivers/mmc/host/dw_mmc.h
+++ b/drivers/mmc/host/dw_mmc.h
-@@ -202,5 +202,5 @@ struct dw_mci_drv_data {
+@@ -203,5 +203,5 @@ struct dw_mci_drv_data {
void (*prepare_command)(struct dw_mci *host, u32 *cmdr);
void (*set_ios)(struct dw_mci *host, struct mmc_ios *ios);
int (*parse_dt)(struct dw_mci *host);
-};
+} __do_const;
#endif /* _DW_MMC_H_ */
+diff --git a/drivers/mmc/host/mmci.c b/drivers/mmc/host/mmci.c
+index c3785ed..1984c44 100644
+--- a/drivers/mmc/host/mmci.c
++++ b/drivers/mmc/host/mmci.c
+@@ -1482,7 +1482,9 @@ static int mmci_probe(struct amba_device *dev,
+ }
+
+ if (variant->busy_detect) {
+- mmci_ops.card_busy = mmci_card_busy;
++ pax_open_kernel();
++ *(void **)&mmci_ops.card_busy = mmci_card_busy;
++ pax_close_kernel();
+ mmci_write_datactrlreg(host, MCI_ST_DPSM_BUSYMODE);
+ }
+
diff --git a/drivers/mmc/host/sdhci-s3c.c b/drivers/mmc/host/sdhci-s3c.c
-index c6f6246..60760a8 100644
+index 6debda9..2ba7427 100644
--- a/drivers/mmc/host/sdhci-s3c.c
+++ b/drivers/mmc/host/sdhci-s3c.c
-@@ -664,9 +664,11 @@ static int sdhci_s3c_probe(struct platform_device *pdev)
+@@ -668,9 +668,11 @@ static int sdhci_s3c_probe(struct platform_device *pdev)
* we can use overriding functions instead of default.
*/
if (host->quirks & SDHCI_QUIRK_NONSTANDARD_CLOCK) {
@@ -43576,8 +43418,21 @@ index c6f6246..60760a8 100644
}
/* It supports additional host capabilities if needed */
+diff --git a/drivers/mtd/chips/cfi_cmdset_0020.c b/drivers/mtd/chips/cfi_cmdset_0020.c
+index 096993f..f02c23b 100644
+--- a/drivers/mtd/chips/cfi_cmdset_0020.c
++++ b/drivers/mtd/chips/cfi_cmdset_0020.c
+@@ -669,7 +669,7 @@ cfi_staa_writev(struct mtd_info *mtd, const struct kvec *vecs,
+ size_t totlen = 0, thislen;
+ int ret = 0;
+ size_t buflen = 0;
+- static char *buffer;
++ char *buffer;
+
+ if (!ECCBUF_SIZE) {
+ /* We should fall back to a general writev implementation.
diff --git a/drivers/mtd/nand/denali.c b/drivers/mtd/nand/denali.c
-index 0c8bb6b..6f35deb 100644
+index 2ed2bb3..2d0b82e 100644
--- a/drivers/mtd/nand/denali.c
+++ b/drivers/mtd/nand/denali.c
@@ -24,6 +24,7 @@
@@ -43601,12 +43456,12 @@ index 51b9d6a..52af9a7 100644
#include <linux/mtd/nand.h>
#include <linux/mtd/nftl.h>
diff --git a/drivers/mtd/sm_ftl.c b/drivers/mtd/sm_ftl.c
-index f9d5615..99dd95f 100644
+index 4b8e895..6b3c498 100644
--- a/drivers/mtd/sm_ftl.c
+++ b/drivers/mtd/sm_ftl.c
-@@ -56,7 +56,7 @@ ssize_t sm_attr_show(struct device *dev, struct device_attribute *attr,
+@@ -56,7 +56,7 @@ static ssize_t sm_attr_show(struct device *dev, struct device_attribute *attr,
#define SM_CIS_VENDOR_OFFSET 0x59
- struct attribute_group *sm_create_sysfs_attributes(struct sm_ftl *ftl)
+ static struct attribute_group *sm_create_sysfs_attributes(struct sm_ftl *ftl)
{
- struct attribute_group *attr_group;
+ attribute_group_no_const *attr_group;
@@ -43614,10 +43469,10 @@ index f9d5615..99dd95f 100644
struct sm_sysfs_attribute *vendor_attribute;
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
-index 8395b09..ff4d276 100644
+index dd8057d..22aaf36 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
-@@ -4883,7 +4883,7 @@ static unsigned int bond_get_num_tx_queues(void)
+@@ -4511,7 +4511,7 @@ static unsigned int bond_get_num_tx_queues(void)
return tx_queues;
}
@@ -43626,7 +43481,7 @@ index 8395b09..ff4d276 100644
.kind = "bond",
.priv_size = sizeof(struct bonding),
.setup = bond_setup,
-@@ -5008,8 +5008,8 @@ static void __exit bonding_exit(void)
+@@ -4636,8 +4636,8 @@ static void __exit bonding_exit(void)
bond_destroy_debugfs();
@@ -43637,7 +43492,7 @@ index 8395b09..ff4d276 100644
#ifdef CONFIG_NET_POLL_CONTROLLER
/*
diff --git a/drivers/net/ethernet/8390/ax88796.c b/drivers/net/ethernet/8390/ax88796.c
-index e1d2643..7f4133b 100644
+index f92f001..0b2f9bf 100644
--- a/drivers/net/ethernet/8390/ax88796.c
+++ b/drivers/net/ethernet/8390/ax88796.c
@@ -872,9 +872,11 @@ static int ax_probe(struct platform_device *pdev)
@@ -43654,10 +43509,10 @@ index e1d2643..7f4133b 100644
if (!request_mem_region(mem->start, mem_size, pdev->name)) {
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h
-index 151675d..0139a9d 100644
+index da8fcaa..f4b5d3b 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h
-@@ -1112,7 +1112,7 @@ static inline u8 bnx2x_get_path_func_num(struct bnx2x *bp)
+@@ -1138,7 +1138,7 @@ static inline u8 bnx2x_get_path_func_num(struct bnx2x *bp)
static inline void bnx2x_init_bp_objs(struct bnx2x *bp)
{
/* RX_MODE controlling object */
@@ -43666,47 +43521,11 @@ index 151675d..0139a9d 100644
/* multicast configuration controlling object */
bnx2x_init_mcast_obj(bp, &bp->mcast_obj, bp->fp->cl_id, bp->fp->cid,
-diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c
-index ce1a916..10b52b0 100644
---- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c
-+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c
-@@ -960,6 +960,9 @@ static int bnx2x_set_dump(struct net_device *dev, struct ethtool_dump *val)
- struct bnx2x *bp = netdev_priv(dev);
-
- /* Use the ethtool_dump "flag" field as the dump preset index */
-+ if (val->flag < 1 || val->flag > DUMP_MAX_PRESETS)
-+ return -EINVAL;
-+
- bp->dump_preset_idx = val->flag;
- return 0;
- }
-@@ -986,8 +989,6 @@ static int bnx2x_get_dump_data(struct net_device *dev,
- struct bnx2x *bp = netdev_priv(dev);
- struct dump_header dump_hdr = {0};
-
-- memset(p, 0, dump->len);
--
- /* Disable parity attentions as long as following dump may
- * cause false alarms by reading never written registers. We
- * will re-enable parity attentions right after the dump.
-diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
-index b4c9dea..2a9927f 100644
---- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
-+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
-@@ -11497,6 +11497,8 @@ static int bnx2x_init_bp(struct bnx2x *bp)
- bp->min_msix_vec_cnt = 2;
- BNX2X_DEV_INFO("bp->min_msix_vec_cnt %d", bp->min_msix_vec_cnt);
-
-+ bp->dump_preset_idx = 1;
-+
- return rc;
- }
-
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c
-index 32a9609..0b1c53a 100644
+index 9fbeee5..5e3e37a 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c
-@@ -2387,15 +2387,14 @@ int bnx2x_config_rx_mode(struct bnx2x *bp,
+@@ -2590,15 +2590,14 @@ int bnx2x_config_rx_mode(struct bnx2x *bp,
return rc;
}
@@ -43728,10 +43547,10 @@ index 32a9609..0b1c53a 100644
}
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.h b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.h
-index 43c00bc..dd1d03d 100644
+index 658f4e3..15074a6 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.h
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.h
-@@ -1321,8 +1321,7 @@ int bnx2x_vlan_mac_move(struct bnx2x *bp,
+@@ -1325,8 +1325,7 @@ int bnx2x_vlan_mac_move(struct bnx2x *bp,
/********************* RX MODE ****************/
@@ -43742,7 +43561,7 @@ index 43c00bc..dd1d03d 100644
/**
* bnx2x_config_rx_mode - Send and RX_MODE ramrod according to the provided parameters.
diff --git a/drivers/net/ethernet/broadcom/tg3.h b/drivers/net/ethernet/broadcom/tg3.h
-index ff6e30e..87e8452 100644
+index 7025780..e55a71c 100644
--- a/drivers/net/ethernet/broadcom/tg3.h
+++ b/drivers/net/ethernet/broadcom/tg3.h
@@ -147,6 +147,7 @@
@@ -43753,20 +43572,6 @@ index ff6e30e..87e8452 100644
#define CHIPREV_ID_5750_C2 0x4202
#define CHIPREV_ID_5752_A0_HW 0x5000
#define CHIPREV_ID_5752_A0 0x6000
-diff --git a/drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c b/drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c
-index 71497e8..b650951 100644
---- a/drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c
-+++ b/drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c
-@@ -3037,7 +3037,9 @@ static void t3_io_resume(struct pci_dev *pdev)
- CH_ALERT(adapter, "adapter recovering, PEX ERR 0x%x\n",
- t3_read_reg(adapter, A_PCIE_PEX_ERR));
-
-+ rtnl_lock();
- t3_resume_ports(adapter);
-+ rtnl_unlock();
- }
-
- static const struct pci_error_handlers t3_err_handler = {
diff --git a/drivers/net/ethernet/chelsio/cxgb3/l2t.h b/drivers/net/ethernet/chelsio/cxgb3/l2t.h
index 8cffcdf..aadf043 100644
--- a/drivers/net/ethernet/chelsio/cxgb3/l2t.h
@@ -43780,8 +43585,21 @@ index 8cffcdf..aadf043 100644
#define L2T_SKB_CB(skb) ((struct l2t_skb_cb *)(skb)->cb)
+diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
+index c73cabd..cd278b1 100644
+--- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
++++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c
+@@ -2186,7 +2186,7 @@ static void get_regs(struct net_device *dev, struct ethtool_regs *regs,
+
+ int i;
+ struct adapter *ap = netdev2adap(dev);
+- static const unsigned int *reg_ranges;
++ const unsigned int *reg_ranges;
+ int arr_size = 0, buf_size = 0;
+
+ if (is_t4(ap->chip)) {
diff --git a/drivers/net/ethernet/dec/tulip/de4x5.c b/drivers/net/ethernet/dec/tulip/de4x5.c
-index 4c83003..2a2a5b9 100644
+index 263b92c..f05134b 100644
--- a/drivers/net/ethernet/dec/tulip/de4x5.c
+++ b/drivers/net/ethernet/dec/tulip/de4x5.c
@@ -5388,7 +5388,7 @@ de4x5_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
@@ -43803,10 +43621,10 @@ index 4c83003..2a2a5b9 100644
break;
}
diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c
-index 7371626..2d90469 100644
+index 2c38cc4..0323f6e 100644
--- a/drivers/net/ethernet/emulex/benet/be_main.c
+++ b/drivers/net/ethernet/emulex/benet/be_main.c
-@@ -469,7 +469,7 @@ static void accumulate_16bit_val(u32 *acc, u16 val)
+@@ -470,7 +470,7 @@ static void accumulate_16bit_val(u32 *acc, u16 val)
if (wrapped)
newacc += 65536;
@@ -43814,9 +43632,9 @@ index 7371626..2d90469 100644
+ ACCESS_ONCE_RW(*acc) = newacc;
}
- void populate_erx_stats(struct be_adapter *adapter,
+ static void populate_erx_stats(struct be_adapter *adapter,
diff --git a/drivers/net/ethernet/faraday/ftgmac100.c b/drivers/net/ethernet/faraday/ftgmac100.c
-index 21b85fb..b49e5fc 100644
+index 212f44b..fb69959 100644
--- a/drivers/net/ethernet/faraday/ftgmac100.c
+++ b/drivers/net/ethernet/faraday/ftgmac100.c
@@ -31,6 +31,8 @@
@@ -43829,7 +43647,7 @@ index 21b85fb..b49e5fc 100644
#include "ftgmac100.h"
diff --git a/drivers/net/ethernet/faraday/ftmac100.c b/drivers/net/ethernet/faraday/ftmac100.c
-index a6eda8d..935d273 100644
+index 8be5b40..081bc1b 100644
--- a/drivers/net/ethernet/faraday/ftmac100.c
+++ b/drivers/net/ethernet/faraday/ftmac100.c
@@ -31,6 +31,8 @@
@@ -43842,7 +43660,7 @@ index a6eda8d..935d273 100644
#include "ftmac100.h"
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c
-index 331987d..3be1135 100644
+index 5184e2a..acb28c3 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c
@@ -776,7 +776,7 @@ void ixgbe_ptp_start_cyclecounter(struct ixgbe_adapter *adapter)
@@ -43880,13 +43698,13 @@ index fbe5363..266b4e3 100644
__vxge_hw_mempool_create(vpath->hldev,
fifo->config->memblock_size,
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_init.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_init.c
-index 5e7fb1d..f8d1810 100644
+index f09e787..f3916a8 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_init.c
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_init.c
-@@ -1948,7 +1948,9 @@ int qlcnic_83xx_config_default_opmode(struct qlcnic_adapter *adapter)
- op_mode = QLC_83XX_DEFAULT_OPMODE;
+@@ -2055,7 +2055,9 @@ int qlcnic_83xx_configure_opmode(struct qlcnic_adapter *adapter)
- if (op_mode == QLC_83XX_DEFAULT_OPMODE) {
+ } else if (ret == QLC_83XX_DEFAULT_OPMODE) {
+ ahw->nic_mode = QLC_83XX_DEFAULT_MODE;
- adapter->nic_ops->init_driver = qlcnic_83xx_init_default_driver;
+ pax_open_kernel();
+ *(void **)&adapter->nic_ops->init_driver = qlcnic_83xx_init_default_driver;
@@ -43895,70 +43713,54 @@ index 5e7fb1d..f8d1810 100644
} else {
return -EIO;
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_vnic.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_vnic.c
-index b0c3de9..fc5857e 100644
+index 0248a4c..9648d96 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_vnic.c
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_vnic.c
-@@ -200,15 +200,21 @@ int qlcnic_83xx_config_vnic_opmode(struct qlcnic_adapter *adapter)
- if (priv_level == QLCNIC_NON_PRIV_FUNC) {
+@@ -191,17 +191,23 @@ int qlcnic_83xx_config_vnic_opmode(struct qlcnic_adapter *adapter)
+ case QLCNIC_NON_PRIV_FUNC:
ahw->op_mode = QLCNIC_NON_PRIV_FUNC;
ahw->idc.state_entry = qlcnic_83xx_idc_ready_state_entry;
- nic_ops->init_driver = qlcnic_83xx_init_non_privileged_vnic;
+ pax_open_kernel();
+ *(void **)&nic_ops->init_driver = qlcnic_83xx_init_non_privileged_vnic;
+ pax_close_kernel();
- } else if (priv_level == QLCNIC_PRIV_FUNC) {
+ break;
+ case QLCNIC_PRIV_FUNC:
ahw->op_mode = QLCNIC_PRIV_FUNC;
ahw->idc.state_entry = qlcnic_83xx_idc_vnic_pf_entry;
- nic_ops->init_driver = qlcnic_83xx_init_privileged_vnic;
+ pax_open_kernel();
+ *(void **)&nic_ops->init_driver = qlcnic_83xx_init_privileged_vnic;
+ pax_close_kernel();
- } else if (priv_level == QLCNIC_MGMT_FUNC) {
+ break;
+ case QLCNIC_MGMT_FUNC:
ahw->op_mode = QLCNIC_MGMT_FUNC;
ahw->idc.state_entry = qlcnic_83xx_idc_ready_state_entry;
- nic_ops->init_driver = qlcnic_83xx_init_mgmt_vnic;
+ pax_open_kernel();
+ *(void **)&nic_ops->init_driver = qlcnic_83xx_init_mgmt_vnic;
+ pax_close_kernel();
- } else {
- return -EIO;
- }
-diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ctx.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ctx.c
-index 6acf82b..14b097e 100644
---- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ctx.c
-+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_ctx.c
-@@ -206,10 +206,10 @@ int qlcnic_fw_cmd_set_drv_version(struct qlcnic_adapter *adapter)
- if (err) {
- dev_info(&adapter->pdev->dev,
- "Failed to set driver version in firmware\n");
-- return -EIO;
-+ err = -EIO;
- }
--
-- return 0;
-+ qlcnic_free_mbx_args(&cmd);
-+ return err;
- }
-
- int
-diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c
-index d3f8797..82a03d3 100644
---- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c
-+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c
-@@ -262,7 +262,7 @@ void qlcnic_82xx_change_filter(struct qlcnic_adapter *adapter, u64 *uaddr,
-
- mac_req = (struct qlcnic_mac_req *)&(req->words[0]);
- mac_req->op = vlan_id ? QLCNIC_MAC_VLAN_ADD : QLCNIC_MAC_ADD;
-- memcpy(mac_req->mac_addr, &uaddr, ETH_ALEN);
-+ memcpy(mac_req->mac_addr, uaddr, ETH_ALEN);
-
- vlan_req = (struct qlcnic_vlan_req *)&req->words[1];
- vlan_req->vlan_id = cpu_to_le16(vlan_id);
+ break;
+ default:
+ dev_err(&adapter->pdev->dev, "Invalid Virtual NIC opmode\n");
+diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_minidump.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_minidump.c
+index 1551360..ed6510f 100644
+--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_minidump.c
++++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_minidump.c
+@@ -1108,7 +1108,7 @@ int qlcnic_dump_fw(struct qlcnic_adapter *adapter)
+ struct qlcnic_dump_entry *entry;
+ struct qlcnic_fw_dump *fw_dump = &adapter->ahw->fw_dump;
+ struct qlcnic_dump_template_hdr *tmpl_hdr = fw_dump->tmpl_hdr;
+- static const struct qlcnic_dump_operations *fw_dump_ops;
++ const struct qlcnic_dump_operations *fw_dump_ops;
+ struct device *dev = &adapter->pdev->dev;
+ struct qlcnic_hardware_context *ahw;
+ void *temp_buffer;
diff --git a/drivers/net/ethernet/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c
-index e9b5d77a..1898ba7 100644
+index fb3f8dc..9d2ff38 100644
--- a/drivers/net/ethernet/realtek/r8169.c
+++ b/drivers/net/ethernet/realtek/r8169.c
-@@ -753,22 +753,22 @@ struct rtl8169_private {
+@@ -759,22 +759,22 @@ struct rtl8169_private {
struct mdio_ops {
void (*write)(struct rtl8169_private *, int, int);
int (*read)(struct rtl8169_private *, int);
@@ -43986,18 +43788,18 @@ index e9b5d77a..1898ba7 100644
int (*set_speed)(struct net_device *, u8 aneg, u16 sp, u8 dpx, u32 adv);
int (*get_settings)(struct net_device *, struct ethtool_cmd *);
diff --git a/drivers/net/ethernet/sfc/ptp.c b/drivers/net/ethernet/sfc/ptp.c
-index 9a95abf..36df7f9 100644
+index 03acf57..e1251ff 100644
--- a/drivers/net/ethernet/sfc/ptp.c
+++ b/drivers/net/ethernet/sfc/ptp.c
-@@ -535,7 +535,7 @@ static int efx_ptp_synchronize(struct efx_nic *efx, unsigned int num_readings)
- (u32)((u64)ptp->start.dma_addr >> 32));
+@@ -539,7 +539,7 @@ static int efx_ptp_synchronize(struct efx_nic *efx, unsigned int num_readings)
+ ptp->start.dma_addr);
/* Clear flag that signals MC ready */
- ACCESS_ONCE(*start) = 0;
+ ACCESS_ONCE_RW(*start) = 0;
- efx_mcdi_rpc_start(efx, MC_CMD_PTP, synch_buf,
- MC_CMD_PTP_IN_SYNCHRONIZE_LEN);
-
+ rc = efx_mcdi_rpc_start(efx, MC_CMD_PTP, synch_buf,
+ MC_CMD_PTP_IN_SYNCHRONIZE_LEN);
+ EFX_BUG_ON_PARANOID(rc);
diff --git a/drivers/net/ethernet/stmicro/stmmac/mmc_core.c b/drivers/net/ethernet/stmicro/stmmac/mmc_core.c
index 50617c5..b13724c 100644
--- a/drivers/net/ethernet/stmicro/stmmac/mmc_core.c
@@ -44049,7 +43851,7 @@ index 0775f0a..d4fb316 100644
/* Ignore return since this msg is optional. */
rndis_filter_send_request(dev, request);
diff --git a/drivers/net/ieee802154/fakehard.c b/drivers/net/ieee802154/fakehard.c
-index bf0d55e..82bcfbd 100644
+index bf0d55e..82bcfbd1 100644
--- a/drivers/net/ieee802154/fakehard.c
+++ b/drivers/net/ieee802154/fakehard.c
@@ -364,7 +364,7 @@ static int ieee802154fake_probe(struct platform_device *pdev)
@@ -44062,10 +43864,10 @@ index bf0d55e..82bcfbd 100644
priv = netdev_priv(dev);
priv->phy = phy;
diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c
-index 06eba6e..a06bf31 100644
+index 9bf46bd..bfdaa84 100644
--- a/drivers/net/macvlan.c
+++ b/drivers/net/macvlan.c
-@@ -909,13 +909,15 @@ static const struct nla_policy macvlan_policy[IFLA_MACVLAN_MAX + 1] = {
+@@ -939,13 +939,15 @@ static const struct nla_policy macvlan_policy[IFLA_MACVLAN_MAX + 1] = {
int macvlan_link_register(struct rtnl_link_ops *ops)
{
/* common fields */
@@ -44088,7 +43890,7 @@ index 06eba6e..a06bf31 100644
return rtnl_link_register(ops);
};
-@@ -971,7 +973,7 @@ static int macvlan_device_event(struct notifier_block *unused,
+@@ -1001,7 +1003,7 @@ static int macvlan_device_event(struct notifier_block *unused,
return NOTIFY_DONE;
}
@@ -44098,10 +43900,10 @@ index 06eba6e..a06bf31 100644
};
diff --git a/drivers/net/macvtap.c b/drivers/net/macvtap.c
-index c70ff7d..10fcffc 100644
+index dc76670..e18f39c 100644
--- a/drivers/net/macvtap.c
+++ b/drivers/net/macvtap.c
-@@ -1116,7 +1116,7 @@ static int macvtap_device_event(struct notifier_block *unused,
+@@ -1189,7 +1189,7 @@ static int macvtap_device_event(struct notifier_block *unused,
return NOTIFY_DONE;
}
@@ -44158,10 +43960,10 @@ index 1252d9c..80e660b 100644
/* We've got a compressed packet; read the change byte */
diff --git a/drivers/net/team/team.c b/drivers/net/team/team.c
-index fe3fd77..b048392 100644
+index 6327df2..e6e1ebe 100644
--- a/drivers/net/team/team.c
+++ b/drivers/net/team/team.c
-@@ -2686,7 +2686,7 @@ static int team_device_event(struct notifier_block *unused,
+@@ -2873,7 +2873,7 @@ static int team_device_event(struct notifier_block *unused,
return NOTIFY_DONE;
}
@@ -44171,10 +43973,10 @@ index fe3fd77..b048392 100644
};
diff --git a/drivers/net/tun.c b/drivers/net/tun.c
-index 9ef85fe..64e88b0 100644
+index 782e38b..d076fdc 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
-@@ -1884,7 +1884,7 @@ unlock:
+@@ -1834,7 +1834,7 @@ unlock:
}
static long __tun_chr_ioctl(struct file *file, unsigned int cmd,
@@ -44183,8 +43985,8 @@ index 9ef85fe..64e88b0 100644
{
struct tun_file *tfile = file->private_data;
struct tun_struct *tun;
-@@ -1896,6 +1896,9 @@ static long __tun_chr_ioctl(struct file *file, unsigned int cmd,
- int vnet_hdr_sz;
+@@ -1847,6 +1847,9 @@ static long __tun_chr_ioctl(struct file *file, unsigned int cmd,
+ unsigned int ifindex;
int ret;
+ if (ifreq_len > sizeof ifr)
@@ -44194,7 +43996,7 @@ index 9ef85fe..64e88b0 100644
if (copy_from_user(&ifr, argp, ifreq_len))
return -EFAULT;
diff --git a/drivers/net/usb/hso.c b/drivers/net/usb/hso.c
-index cba1d46..f703766 100644
+index 86292e6..8d34433 100644
--- a/drivers/net/usb/hso.c
+++ b/drivers/net/usb/hso.c
@@ -71,7 +71,7 @@
@@ -44275,7 +44077,7 @@ index cba1d46..f703766 100644
/* Setup and send a ctrl req read on
* port i */
if (!serial->rx_urb_filled[0]) {
-@@ -3057,7 +3056,7 @@ static int hso_resume(struct usb_interface *iface)
+@@ -3062,7 +3061,7 @@ static int hso_resume(struct usb_interface *iface)
/* Start all serial ports */
for (i = 0; i < HSO_SERIAL_TTY_MINORS; i++) {
if (serial_table[i] && (serial_table[i]->interface == iface)) {
@@ -44307,10 +44109,10 @@ index a79e9d3..78cd4fa 100644
/* we will have to manufacture ethernet headers, prepare template */
diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
-index 054489f..aee050a 100644
+index 2ef5b62..6fa0ec3 100644
--- a/drivers/net/vxlan.c
+++ b/drivers/net/vxlan.c
-@@ -1579,7 +1579,7 @@ nla_put_failure:
+@@ -2615,7 +2615,7 @@ nla_put_failure:
return -EMSGSIZE;
}
@@ -44319,6 +44121,32 @@ index 054489f..aee050a 100644
.kind = "vxlan",
.maxtype = IFLA_VXLAN_MAX,
.policy = vxlan_policy,
+diff --git a/drivers/net/wimax/i2400m/rx.c b/drivers/net/wimax/i2400m/rx.c
+index 0b60295..b8bfa5b 100644
+--- a/drivers/net/wimax/i2400m/rx.c
++++ b/drivers/net/wimax/i2400m/rx.c
+@@ -1359,7 +1359,7 @@ int i2400m_rx_setup(struct i2400m *i2400m)
+ if (i2400m->rx_roq == NULL)
+ goto error_roq_alloc;
+
+- rd = kcalloc(I2400M_RO_CIN + 1, sizeof(*i2400m->rx_roq[0].log),
++ rd = kcalloc(sizeof(*i2400m->rx_roq[0].log), I2400M_RO_CIN + 1,
+ GFP_KERNEL);
+ if (rd == NULL) {
+ result = -ENOMEM;
+diff --git a/drivers/net/wireless/airo.c b/drivers/net/wireless/airo.c
+index 7fe1964..7016de0 100644
+--- a/drivers/net/wireless/airo.c
++++ b/drivers/net/wireless/airo.c
+@@ -7844,7 +7844,7 @@ static int writerids(struct net_device *dev, aironet_ioctl *comp) {
+ struct airo_info *ai = dev->ml_priv;
+ int ridcode;
+ int enabled;
+- static int (* writer)(struct airo_info *, u16 rid, const void *, int, int);
++ int (* writer)(struct airo_info *, u16 rid, const void *, int, int);
+ unsigned char *iobuf;
+
+ /* Only super-user can write RIDs */
diff --git a/drivers/net/wireless/at76c50x-usb.c b/drivers/net/wireless/at76c50x-usb.c
index 34c8a33..3261fdc 100644
--- a/drivers/net/wireless/at76c50x-usb.c
@@ -44332,6 +44160,50 @@ index 34c8a33..3261fdc 100644
{
return msecs_to_jiffies((s->poll_timeout[2] << 16)
| (s->poll_timeout[1] << 8)
+diff --git a/drivers/net/wireless/ath/ath10k/htc.c b/drivers/net/wireless/ath/ath10k/htc.c
+index ef3329e..c28ff5d 100644
+--- a/drivers/net/wireless/ath/ath10k/htc.c
++++ b/drivers/net/wireless/ath/ath10k/htc.c
+@@ -963,7 +963,10 @@ void ath10k_htc_stop(struct ath10k_htc *htc)
+ /* registered target arrival callback from the HIF layer */
+ int ath10k_htc_init(struct ath10k *ar)
+ {
+- struct ath10k_hif_cb htc_callbacks;
++ static struct ath10k_hif_cb htc_callbacks = {
++ .rx_completion = ath10k_htc_rx_completion_handler,
++ .tx_completion = ath10k_htc_tx_completion_handler,
++ };
+ struct ath10k_htc_ep *ep = NULL;
+ struct ath10k_htc *htc = &ar->htc;
+
+@@ -973,8 +976,6 @@ int ath10k_htc_init(struct ath10k *ar)
+ ath10k_htc_reset_endpoint_states(htc);
+
+ /* setup HIF layer callbacks */
+- htc_callbacks.rx_completion = ath10k_htc_rx_completion_handler;
+- htc_callbacks.tx_completion = ath10k_htc_tx_completion_handler;
+ htc->ar = ar;
+
+ /* Get HIF default pipe for HTC message exchange */
+diff --git a/drivers/net/wireless/ath/ath10k/htc.h b/drivers/net/wireless/ath/ath10k/htc.h
+index e1dd8c7..9f91b3f 100644
+--- a/drivers/net/wireless/ath/ath10k/htc.h
++++ b/drivers/net/wireless/ath/ath10k/htc.h
+@@ -271,12 +271,12 @@ enum ath10k_htc_ep_id {
+
+ struct ath10k_htc_ops {
+ void (*target_send_suspend_complete)(struct ath10k *ar);
+-};
++} __no_const;
+
+ struct ath10k_htc_ep_ops {
+ void (*ep_tx_complete)(struct ath10k *, struct sk_buff *);
+ void (*ep_rx_complete)(struct ath10k *, struct sk_buff *);
+-};
++} __no_const;
+
+ /* service connection information */
+ struct ath10k_htc_svc_conn_req {
diff --git a/drivers/net/wireless/ath/ath9k/ar9002_mac.c b/drivers/net/wireless/ath/ath9k/ar9002_mac.c
index 8d78253..bebbb68 100644
--- a/drivers/net/wireless/ath/ath9k/ar9002_mac.c
@@ -44416,7 +44288,7 @@ index 8d78253..bebbb68 100644
| set11nRateFlags(i->rates, 2)
| set11nRateFlags(i->rates, 3)
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_mac.c b/drivers/net/wireless/ath/ath9k/ar9003_mac.c
-index 301bf72..3f5654f 100644
+index f6c5c1b..6058354 100644
--- a/drivers/net/wireless/ath/ath9k/ar9003_mac.c
+++ b/drivers/net/wireless/ath/ath9k/ar9003_mac.c
@@ -39,47 +39,47 @@ ar9003_set_txdesc(struct ath_hw *ah, void *ds, struct ath_tx_info *i)
@@ -44538,10 +44410,10 @@ index 301bf72..3f5654f 100644
static u16 ar9003_calc_ptr_chksum(struct ar9003_txc *ads)
diff --git a/drivers/net/wireless/ath/ath9k/hw.h b/drivers/net/wireless/ath/ath9k/hw.h
-index ae30343..a117806 100644
+index 69a907b..91e071c 100644
--- a/drivers/net/wireless/ath/ath9k/hw.h
+++ b/drivers/net/wireless/ath/ath9k/hw.h
-@@ -652,7 +652,7 @@ struct ath_hw_private_ops {
+@@ -657,7 +657,7 @@ struct ath_hw_private_ops {
/* ANI */
void (*ani_cache_ini_regs)(struct ath_hw *ah);
@@ -44550,17 +44422,30 @@ index ae30343..a117806 100644
/**
* struct ath_spec_scan - parameters for Atheros spectral scan
-@@ -721,7 +721,7 @@ struct ath_hw_ops {
- struct ath_spec_scan *param);
- void (*spectral_scan_trigger)(struct ath_hw *ah);
- void (*spectral_scan_wait)(struct ath_hw *ah);
+@@ -729,7 +729,7 @@ struct ath_hw_ops {
+ #ifdef CONFIG_ATH9K_BTCOEX_SUPPORT
+ void (*set_bt_ant_diversity)(struct ath_hw *hw, bool enable);
+ #endif
-};
+} __no_const;
struct ath_nf_limits {
s16 max;
+diff --git a/drivers/net/wireless/b43/phy_lp.c b/drivers/net/wireless/b43/phy_lp.c
+index 92190da..f3a4c4c 100644
+--- a/drivers/net/wireless/b43/phy_lp.c
++++ b/drivers/net/wireless/b43/phy_lp.c
+@@ -2514,7 +2514,7 @@ static int lpphy_b2063_tune(struct b43_wldev *dev,
+ {
+ struct ssb_bus *bus = dev->dev->sdev->bus;
+
+- static const struct b206x_channel *chandata = NULL;
++ const struct b206x_channel *chandata = NULL;
+ u32 crystal_freq = bus->chipco.pmu.crystalfreq * 1000;
+ u32 freqref, vco_freq, val1, val2, val3, timeout, timeoutref, count;
+ u16 old_comm15, scale;
diff --git a/drivers/net/wireless/iwlegacy/3945-mac.c b/drivers/net/wireless/iwlegacy/3945-mac.c
-index b37a582..680835d 100644
+index 9581d07..84f6a76 100644
--- a/drivers/net/wireless/iwlegacy/3945-mac.c
+++ b/drivers/net/wireless/iwlegacy/3945-mac.c
@@ -3639,7 +3639,9 @@ il3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
@@ -44575,10 +44460,10 @@ index b37a582..680835d 100644
D_INFO("*** LOAD DRIVER ***\n");
diff --git a/drivers/net/wireless/iwlwifi/dvm/debugfs.c b/drivers/net/wireless/iwlwifi/dvm/debugfs.c
-index d532948..e0d8bb1 100644
+index d94f8ab..5b568c8 100644
--- a/drivers/net/wireless/iwlwifi/dvm/debugfs.c
+++ b/drivers/net/wireless/iwlwifi/dvm/debugfs.c
-@@ -203,7 +203,7 @@ static ssize_t iwl_dbgfs_sram_write(struct file *file,
+@@ -188,7 +188,7 @@ static ssize_t iwl_dbgfs_sram_write(struct file *file,
{
struct iwl_priv *priv = file->private_data;
char buf[64];
@@ -44587,7 +44472,7 @@ index d532948..e0d8bb1 100644
u32 offset, len;
memset(buf, 0, sizeof(buf));
-@@ -473,7 +473,7 @@ static ssize_t iwl_dbgfs_rx_handlers_write(struct file *file,
+@@ -458,7 +458,7 @@ static ssize_t iwl_dbgfs_rx_handlers_write(struct file *file,
struct iwl_priv *priv = file->private_data;
char buf[8];
@@ -44596,7 +44481,7 @@ index d532948..e0d8bb1 100644
u32 reset_flag;
memset(buf, 0, sizeof(buf));
-@@ -554,7 +554,7 @@ static ssize_t iwl_dbgfs_disable_ht40_write(struct file *file,
+@@ -539,7 +539,7 @@ static ssize_t iwl_dbgfs_disable_ht40_write(struct file *file,
{
struct iwl_priv *priv = file->private_data;
char buf[8];
@@ -44605,7 +44490,7 @@ index d532948..e0d8bb1 100644
int ht40;
memset(buf, 0, sizeof(buf));
-@@ -606,7 +606,7 @@ static ssize_t iwl_dbgfs_sleep_level_override_write(struct file *file,
+@@ -591,7 +591,7 @@ static ssize_t iwl_dbgfs_sleep_level_override_write(struct file *file,
{
struct iwl_priv *priv = file->private_data;
char buf[8];
@@ -44614,7 +44499,7 @@ index d532948..e0d8bb1 100644
int value;
memset(buf, 0, sizeof(buf));
-@@ -698,10 +698,10 @@ DEBUGFS_READ_FILE_OPS(temperature);
+@@ -683,10 +683,10 @@ DEBUGFS_READ_FILE_OPS(temperature);
DEBUGFS_READ_WRITE_FILE_OPS(sleep_level_override);
DEBUGFS_READ_FILE_OPS(current_sleep_command);
@@ -44629,7 +44514,7 @@ index d532948..e0d8bb1 100644
"%-32s current cumulative delta max\n";
static int iwl_statistics_flag(struct iwl_priv *priv, char *buf, int bufsz)
-@@ -1871,7 +1871,7 @@ static ssize_t iwl_dbgfs_clear_ucode_statistics_write(struct file *file,
+@@ -1856,7 +1856,7 @@ static ssize_t iwl_dbgfs_clear_ucode_statistics_write(struct file *file,
{
struct iwl_priv *priv = file->private_data;
char buf[8];
@@ -44638,7 +44523,7 @@ index d532948..e0d8bb1 100644
int clear;
memset(buf, 0, sizeof(buf));
-@@ -1916,7 +1916,7 @@ static ssize_t iwl_dbgfs_ucode_tracing_write(struct file *file,
+@@ -1901,7 +1901,7 @@ static ssize_t iwl_dbgfs_ucode_tracing_write(struct file *file,
{
struct iwl_priv *priv = file->private_data;
char buf[8];
@@ -44647,7 +44532,7 @@ index d532948..e0d8bb1 100644
int trace;
memset(buf, 0, sizeof(buf));
-@@ -1987,7 +1987,7 @@ static ssize_t iwl_dbgfs_missed_beacon_write(struct file *file,
+@@ -1972,7 +1972,7 @@ static ssize_t iwl_dbgfs_missed_beacon_write(struct file *file,
{
struct iwl_priv *priv = file->private_data;
char buf[8];
@@ -44656,7 +44541,7 @@ index d532948..e0d8bb1 100644
int missed;
memset(buf, 0, sizeof(buf));
-@@ -2028,7 +2028,7 @@ static ssize_t iwl_dbgfs_plcp_delta_write(struct file *file,
+@@ -2013,7 +2013,7 @@ static ssize_t iwl_dbgfs_plcp_delta_write(struct file *file,
struct iwl_priv *priv = file->private_data;
char buf[8];
@@ -44665,7 +44550,7 @@ index d532948..e0d8bb1 100644
int plcp;
memset(buf, 0, sizeof(buf));
-@@ -2088,7 +2088,7 @@ static ssize_t iwl_dbgfs_txfifo_flush_write(struct file *file,
+@@ -2073,7 +2073,7 @@ static ssize_t iwl_dbgfs_txfifo_flush_write(struct file *file,
struct iwl_priv *priv = file->private_data;
char buf[8];
@@ -44674,7 +44559,7 @@ index d532948..e0d8bb1 100644
int flush;
memset(buf, 0, sizeof(buf));
-@@ -2178,7 +2178,7 @@ static ssize_t iwl_dbgfs_protection_mode_write(struct file *file,
+@@ -2163,7 +2163,7 @@ static ssize_t iwl_dbgfs_protection_mode_write(struct file *file,
struct iwl_priv *priv = file->private_data;
char buf[8];
@@ -44683,7 +44568,7 @@ index d532948..e0d8bb1 100644
int rts;
if (!priv->cfg->ht_params)
-@@ -2220,7 +2220,7 @@ static ssize_t iwl_dbgfs_echo_test_write(struct file *file,
+@@ -2205,7 +2205,7 @@ static ssize_t iwl_dbgfs_echo_test_write(struct file *file,
{
struct iwl_priv *priv = file->private_data;
char buf[8];
@@ -44692,7 +44577,7 @@ index d532948..e0d8bb1 100644
memset(buf, 0, sizeof(buf));
buf_size = min(count, sizeof(buf) - 1);
-@@ -2254,7 +2254,7 @@ static ssize_t iwl_dbgfs_log_event_write(struct file *file,
+@@ -2239,7 +2239,7 @@ static ssize_t iwl_dbgfs_log_event_write(struct file *file,
struct iwl_priv *priv = file->private_data;
u32 event_log_flag;
char buf[8];
@@ -44701,7 +44586,7 @@ index d532948..e0d8bb1 100644
/* check that the interface is up */
if (!iwl_is_ready(priv))
-@@ -2308,7 +2308,7 @@ static ssize_t iwl_dbgfs_calib_disabled_write(struct file *file,
+@@ -2293,7 +2293,7 @@ static ssize_t iwl_dbgfs_calib_disabled_write(struct file *file,
struct iwl_priv *priv = file->private_data;
char buf[8];
u32 calib_disabled;
@@ -44711,10 +44596,10 @@ index d532948..e0d8bb1 100644
memset(buf, 0, sizeof(buf));
buf_size = min(count, sizeof(buf) - 1);
diff --git a/drivers/net/wireless/iwlwifi/dvm/main.c b/drivers/net/wireless/iwlwifi/dvm/main.c
-index a8afc7b..de058b2 100644
+index 7aad766..06addb4 100644
--- a/drivers/net/wireless/iwlwifi/dvm/main.c
+++ b/drivers/net/wireless/iwlwifi/dvm/main.c
-@@ -1189,7 +1189,7 @@ static void iwl_option_config(struct iwl_priv *priv)
+@@ -1123,7 +1123,7 @@ static void iwl_option_config(struct iwl_priv *priv)
static int iwl_eeprom_init_hw_params(struct iwl_priv *priv)
{
struct iwl_nvm_data *data = priv->nvm_data;
@@ -44723,7 +44608,7 @@ index a8afc7b..de058b2 100644
if (data->sku_cap_11n_enable &&
!priv->cfg->ht_params) {
-@@ -1203,7 +1203,6 @@ static int iwl_eeprom_init_hw_params(struct iwl_priv *priv)
+@@ -1137,7 +1137,6 @@ static int iwl_eeprom_init_hw_params(struct iwl_priv *priv)
return -EINVAL;
}
@@ -44732,10 +44617,10 @@ index a8afc7b..de058b2 100644
data->sku_cap_band_24GHz_enable ? "" : "NOT", "enabled",
data->sku_cap_band_52GHz_enable ? "" : "NOT", "enabled",
diff --git a/drivers/net/wireless/iwlwifi/pcie/trans.c b/drivers/net/wireless/iwlwifi/pcie/trans.c
-index aeb70e1..d7b5bb5 100644
+index c3f904d..4cadf83 100644
--- a/drivers/net/wireless/iwlwifi/pcie/trans.c
+++ b/drivers/net/wireless/iwlwifi/pcie/trans.c
-@@ -1329,7 +1329,7 @@ static ssize_t iwl_dbgfs_interrupt_write(struct file *file,
+@@ -1252,7 +1252,7 @@ static ssize_t iwl_dbgfs_interrupt_write(struct file *file,
struct isr_statistics *isr_stats = &trans_pcie->isr_stats;
char buf[8];
@@ -44744,7 +44629,7 @@ index aeb70e1..d7b5bb5 100644
u32 reset_flag;
memset(buf, 0, sizeof(buf));
-@@ -1350,7 +1350,7 @@ static ssize_t iwl_dbgfs_csr_write(struct file *file,
+@@ -1273,7 +1273,7 @@ static ssize_t iwl_dbgfs_csr_write(struct file *file,
{
struct iwl_trans *trans = file->private_data;
char buf[8];
@@ -44754,10 +44639,10 @@ index aeb70e1..d7b5bb5 100644
memset(buf, 0, sizeof(buf));
diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c
-index cb34c78..9fec0dc 100644
+index 2cd3f54..e936f90 100644
--- a/drivers/net/wireless/mac80211_hwsim.c
+++ b/drivers/net/wireless/mac80211_hwsim.c
-@@ -2195,25 +2195,19 @@ static int __init init_mac80211_hwsim(void)
+@@ -2196,25 +2196,19 @@ static int __init init_mac80211_hwsim(void)
if (channels > 1) {
hwsim_if_comb.num_different_channels = channels;
@@ -44810,10 +44695,10 @@ index 8169a85..7fa3b47 100644
tmp = cpu_to_le32(rts_threshold);
diff --git a/drivers/net/wireless/rt2x00/rt2x00.h b/drivers/net/wireless/rt2x00/rt2x00.h
-index 7510723..5ba37f5 100644
+index fe4c572..99dedfa 100644
--- a/drivers/net/wireless/rt2x00/rt2x00.h
+++ b/drivers/net/wireless/rt2x00/rt2x00.h
-@@ -386,7 +386,7 @@ struct rt2x00_intf {
+@@ -387,7 +387,7 @@ struct rt2x00_intf {
* for hardware which doesn't support hardware
* sequence counting.
*/
@@ -44823,7 +44708,7 @@ index 7510723..5ba37f5 100644
static inline struct rt2x00_intf* vif_to_intf(struct ieee80211_vif *vif)
diff --git a/drivers/net/wireless/rt2x00/rt2x00queue.c b/drivers/net/wireless/rt2x00/rt2x00queue.c
-index 1f17f5b..16cddd3 100644
+index 66a2db8..70cad04 100644
--- a/drivers/net/wireless/rt2x00/rt2x00queue.c
+++ b/drivers/net/wireless/rt2x00/rt2x00queue.c
@@ -252,9 +252,9 @@ static void rt2x00queue_create_tx_descriptor_seq(struct rt2x00_dev *rt2x00dev,
@@ -44891,10 +44776,10 @@ index 1c627da..69f7d17 100644
wlcore_set_min_fw_ver(wl, WL127X_CHIP_VER,
WL127X_IFTYPE_SR_VER, WL127X_MAJOR_SR_VER,
diff --git a/drivers/net/wireless/ti/wl18xx/main.c b/drivers/net/wireless/ti/wl18xx/main.c
-index 9fa692d..b31fee0 100644
+index 7aa0eb8..5a9ef38 100644
--- a/drivers/net/wireless/ti/wl18xx/main.c
+++ b/drivers/net/wireless/ti/wl18xx/main.c
-@@ -1687,8 +1687,10 @@ static int wl18xx_setup(struct wl1271 *wl)
+@@ -1730,8 +1730,10 @@ static int wl18xx_setup(struct wl1271 *wl)
}
if (!checksum_param) {
@@ -44920,6 +44805,19 @@ index 7ef0b4a..ff65c28 100644
u16 int_num;
ZD_ASSERT(in_interrupt());
+diff --git a/drivers/nfc/nfcwilink.c b/drivers/nfc/nfcwilink.c
+index 59f95d8..53e0e7f 100644
+--- a/drivers/nfc/nfcwilink.c
++++ b/drivers/nfc/nfcwilink.c
+@@ -513,7 +513,7 @@ static struct nci_ops nfcwilink_ops = {
+
+ static int nfcwilink_probe(struct platform_device *pdev)
+ {
+- static struct nfcwilink *drv;
++ struct nfcwilink *drv;
+ int rc;
+ __u32 protocols;
+
diff --git a/drivers/oprofile/buffer_sync.c b/drivers/oprofile/buffer_sync.c
index d93b2b6..ae50401 100644
--- a/drivers/oprofile/buffer_sync.c
@@ -44986,7 +44884,7 @@ index ed2c3ec..deda85a 100644
}
diff --git a/drivers/oprofile/oprofile_files.c b/drivers/oprofile/oprofile_files.c
-index 84a208d..d61b0a1 100644
+index ee2cfce..7f8f699 100644
--- a/drivers/oprofile/oprofile_files.c
+++ b/drivers/oprofile/oprofile_files.c
@@ -27,7 +27,7 @@ unsigned long oprofile_time_slice;
@@ -44999,7 +44897,7 @@ index 84a208d..d61b0a1 100644
{
return oprofilefs_ulong_to_user(jiffies_to_msecs(oprofile_time_slice),
diff --git a/drivers/oprofile/oprofile_stats.c b/drivers/oprofile/oprofile_stats.c
-index 917d28e..d62d981 100644
+index 59659ce..6c860a0 100644
--- a/drivers/oprofile/oprofile_stats.c
+++ b/drivers/oprofile/oprofile_stats.c
@@ -30,11 +30,11 @@ void oprofile_reset_stats(void)
@@ -45020,7 +44918,7 @@ index 917d28e..d62d981 100644
diff --git a/drivers/oprofile/oprofile_stats.h b/drivers/oprofile/oprofile_stats.h
-index 38b6fc0..b5cbfce 100644
+index 1fc622b..8c48fc3 100644
--- a/drivers/oprofile/oprofile_stats.h
+++ b/drivers/oprofile/oprofile_stats.h
@@ -13,11 +13,11 @@
@@ -45041,23 +44939,34 @@ index 38b6fc0..b5cbfce 100644
extern struct oprofile_stat_struct oprofile_stats;
diff --git a/drivers/oprofile/oprofilefs.c b/drivers/oprofile/oprofilefs.c
-index 7c12d9c..558bf3bb 100644
+index 3f49345..c750d0b 100644
--- a/drivers/oprofile/oprofilefs.c
+++ b/drivers/oprofile/oprofilefs.c
-@@ -190,7 +190,7 @@ static const struct file_operations atomic_ro_fops = {
+@@ -176,8 +176,8 @@ int oprofilefs_create_ro_ulong(struct dentry *root,
+
+ static ssize_t atomic_read_file(struct file *file, char __user *buf, size_t count, loff_t *offset)
+ {
+- atomic_t *val = file->private_data;
+- return oprofilefs_ulong_to_user(atomic_read(val), buf, count, offset);
++ atomic_unchecked_t *val = file->private_data;
++ return oprofilefs_ulong_to_user(atomic_read_unchecked(val), buf, count, offset);
+ }
+
+@@ -189,7 +189,7 @@ static const struct file_operations atomic_ro_fops = {
- int oprofilefs_create_ro_atomic(struct super_block *sb, struct dentry *root,
+
+ int oprofilefs_create_ro_atomic(struct dentry *root,
- char const *name, atomic_t *val)
+ char const *name, atomic_unchecked_t *val)
{
- return __oprofilefs_create_file(sb, root, name,
+ return __oprofilefs_create_file(root, name,
&atomic_ro_fops, 0444, val);
diff --git a/drivers/oprofile/timer_int.c b/drivers/oprofile/timer_int.c
-index 93404f7..4a313d8 100644
+index 61be1d9..dec05d7 100644
--- a/drivers/oprofile/timer_int.c
+++ b/drivers/oprofile/timer_int.c
-@@ -93,7 +93,7 @@ static int __cpuinit oprofile_cpu_notify(struct notifier_block *self,
+@@ -93,7 +93,7 @@ static int oprofile_cpu_notify(struct notifier_block *self,
return NOTIFY_OK;
}
@@ -45089,10 +44998,10 @@ index 92ed045..62d39bd7 100644
#endif /* IEEE1284.3 support. */
diff --git a/drivers/pci/hotplug/acpiphp_ibm.c b/drivers/pci/hotplug/acpiphp_ibm.c
-index c35e8ad..fc33beb 100644
+index 2f5786c..61ab4d1 100644
--- a/drivers/pci/hotplug/acpiphp_ibm.c
+++ b/drivers/pci/hotplug/acpiphp_ibm.c
-@@ -464,7 +464,9 @@ static int __init ibm_acpiphp_init(void)
+@@ -463,7 +463,9 @@ static int __init ibm_acpiphp_init(void)
goto init_cleanup;
}
@@ -45215,10 +45124,10 @@ index ec20f74..c1d961e 100644
mutex_lock(&pci_hp_mutex);
/*
diff --git a/drivers/pci/hotplug/pciehp_core.c b/drivers/pci/hotplug/pciehp_core.c
-index 7d72c5e..edce02c 100644
+index f4a18f5..ff2463c 100644
--- a/drivers/pci/hotplug/pciehp_core.c
+++ b/drivers/pci/hotplug/pciehp_core.c
-@@ -91,7 +91,7 @@ static int init_slot(struct controller *ctrl)
+@@ -92,7 +92,7 @@ static int init_slot(struct controller *ctrl)
struct slot *slot = ctrl->slot;
struct hotplug_slot *hotplug = NULL;
struct hotplug_slot_info *info = NULL;
@@ -45227,31 +45136,11 @@ index 7d72c5e..edce02c 100644
char name[SLOT_NAME_SIZE];
int retval = -ENOMEM;
-diff --git a/drivers/pci/hotplug/pciehp_hpc.c b/drivers/pci/hotplug/pciehp_hpc.c
-index 5127f3f..b225573 100644
---- a/drivers/pci/hotplug/pciehp_hpc.c
-+++ b/drivers/pci/hotplug/pciehp_hpc.c
-@@ -773,14 +773,12 @@ static void pcie_shutdown_notification(struct controller *ctrl)
- static int pcie_init_slot(struct controller *ctrl)
- {
- struct slot *slot;
-- char name[32];
-
- slot = kzalloc(sizeof(*slot), GFP_KERNEL);
- if (!slot)
- return -ENOMEM;
-
-- snprintf(name, sizeof(name), "pciehp-%u", PSN(ctrl));
-- slot->wq = alloc_workqueue(name, 0, 0);
-+ slot->wq = alloc_workqueue("pciehp-%u", 0, 0, PSN(ctrl));
- if (!slot->wq)
- goto abort;
-
diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c
-index 5b4a9d9..cd5ac1f 100644
+index 7128cfd..a0640d6 100644
--- a/drivers/pci/pci-sysfs.c
+++ b/drivers/pci/pci-sysfs.c
-@@ -1071,7 +1071,7 @@ static int pci_create_attr(struct pci_dev *pdev, int num, int write_combine)
+@@ -1083,7 +1083,7 @@ static int pci_create_attr(struct pci_dev *pdev, int num, int write_combine)
{
/* allocate attribute structure, piggyback attribute name */
int name_len = write_combine ? 13 : 10;
@@ -45260,7 +45149,7 @@ index 5b4a9d9..cd5ac1f 100644
int retval;
res_attr = kzalloc(sizeof(*res_attr) + name_len, GFP_ATOMIC);
-@@ -1256,7 +1256,7 @@ static struct device_attribute reset_attr = __ATTR(reset, 0200, NULL, reset_stor
+@@ -1268,7 +1268,7 @@ static struct device_attribute reset_attr = __ATTR(reset, 0200, NULL, reset_stor
static int pci_create_capabilities_sysfs(struct pci_dev *dev)
{
int retval;
@@ -45269,7 +45158,7 @@ index 5b4a9d9..cd5ac1f 100644
/* If the device has VPD, try to expose it in sysfs. */
if (dev->vpd) {
-@@ -1303,7 +1303,7 @@ int __must_check pci_create_sysfs_dev_files (struct pci_dev *pdev)
+@@ -1315,7 +1315,7 @@ int __must_check pci_create_sysfs_dev_files (struct pci_dev *pdev)
{
int retval;
int rom_size = 0;
@@ -45279,10 +45168,10 @@ index 5b4a9d9..cd5ac1f 100644
if (!sysfs_initialized)
return -EACCES;
diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h
-index d1182c4..2a138ec 100644
+index 8a00c06..18a9715 100644
--- a/drivers/pci/pci.h
+++ b/drivers/pci/pci.h
-@@ -92,7 +92,7 @@ struct pci_vpd_ops {
+@@ -95,7 +95,7 @@ struct pci_vpd_ops {
struct pci_vpd {
unsigned int len;
const struct pci_vpd_ops *ops;
@@ -45292,7 +45181,7 @@ index d1182c4..2a138ec 100644
int pci_vpd_pci22_init(struct pci_dev *dev);
diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c
-index d320df6..ca9a8f6 100644
+index 403a443..034e050 100644
--- a/drivers/pci/pcie/aspm.c
+++ b/drivers/pci/pcie/aspm.c
@@ -27,9 +27,9 @@
@@ -45309,11 +45198,11 @@ index d320df6..ca9a8f6 100644
#define ASPM_STATE_ALL (ASPM_STATE_L0S | ASPM_STATE_L1)
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
-index ea37072..10e58e5 100644
+index 7ef0f86..17b710f 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
-@@ -173,7 +173,7 @@ int __pci_read_base(struct pci_dev *dev, enum pci_bar_type type,
- struct pci_bus_region region;
+@@ -175,7 +175,7 @@ int __pci_read_base(struct pci_dev *dev, enum pci_bar_type type,
+ struct pci_bus_region region, inverted_region;
bool bar_too_big = false, bar_disabled = false;
- mask = type ? PCI_ROM_ADDRESS_MASK : ~0;
@@ -45322,10 +45211,10 @@ index ea37072..10e58e5 100644
/* No printks while decoding is disabled! */
if (!dev->mmio_always_on) {
diff --git a/drivers/pci/proc.c b/drivers/pci/proc.c
-index 0812608..b04018c 100644
+index cdc7836..528635c 100644
--- a/drivers/pci/proc.c
+++ b/drivers/pci/proc.c
-@@ -453,7 +453,16 @@ static const struct file_operations proc_bus_pci_dev_operations = {
+@@ -434,7 +434,16 @@ static const struct file_operations proc_bus_pci_dev_operations = {
static int __init pci_proc_init(void)
{
struct pci_dev *dev = NULL;
@@ -45356,7 +45245,7 @@ index 3e5b4497..dcdfb70 100644
.ident = "Samsung Series 5 550 - Touchpad",
.matches = {
diff --git a/drivers/platform/x86/msi-laptop.c b/drivers/platform/x86/msi-laptop.c
-index 6b22938..bc9700e 100644
+index 62f8030..c7f2a45 100644
--- a/drivers/platform/x86/msi-laptop.c
+++ b/drivers/platform/x86/msi-laptop.c
@@ -1000,12 +1000,14 @@ static int __init load_scm_model_init(struct platform_device *sdev)
@@ -45380,11 +45269,24 @@ index 6b22938..bc9700e 100644
}
/* disable hardware control by fn key */
+diff --git a/drivers/platform/x86/msi-wmi.c b/drivers/platform/x86/msi-wmi.c
+index 70222f2..8c8ce66 100644
+--- a/drivers/platform/x86/msi-wmi.c
++++ b/drivers/platform/x86/msi-wmi.c
+@@ -183,7 +183,7 @@ static const struct backlight_ops msi_backlight_ops = {
+ static void msi_wmi_notify(u32 value, void *context)
+ {
+ struct acpi_buffer response = { ACPI_ALLOCATE_BUFFER, NULL };
+- static struct key_entry *key;
++ struct key_entry *key;
+ union acpi_object *obj;
+ acpi_status status;
+
diff --git a/drivers/platform/x86/sony-laptop.c b/drivers/platform/x86/sony-laptop.c
-index 2ac045f..39c443d 100644
+index 3484dd2..13ee730 100644
--- a/drivers/platform/x86/sony-laptop.c
+++ b/drivers/platform/x86/sony-laptop.c
-@@ -2483,7 +2483,7 @@ static void sony_nc_gfx_switch_cleanup(struct platform_device *pd)
+@@ -2448,7 +2448,7 @@ static void sony_nc_gfx_switch_cleanup(struct platform_device *pd)
}
/* High speed charging function */
@@ -45394,10 +45296,10 @@ index 2ac045f..39c443d 100644
static ssize_t sony_nc_highspeed_charging_store(struct device *dev,
struct device_attribute *attr,
diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c
-index 54d31c0..3f896d3 100644
+index 4e86e97..04d50d1 100644
--- a/drivers/platform/x86/thinkpad_acpi.c
+++ b/drivers/platform/x86/thinkpad_acpi.c
-@@ -2093,7 +2093,7 @@ static int hotkey_mask_get(void)
+@@ -2091,7 +2091,7 @@ static int hotkey_mask_get(void)
return 0;
}
@@ -45406,7 +45308,7 @@ index 54d31c0..3f896d3 100644
{
/* log only what the user can fix... */
const u32 wantedmask = hotkey_driver_mask &
-@@ -2324,11 +2324,6 @@ static void hotkey_read_nvram(struct tp_nvram_state *n, const u32 m)
+@@ -2318,11 +2318,6 @@ static void hotkey_read_nvram(struct tp_nvram_state *n, const u32 m)
}
}
@@ -45418,7 +45320,7 @@ index 54d31c0..3f896d3 100644
#define TPACPI_COMPARE_KEY(__scancode, __member) \
do { \
if ((event_mask & (1 << __scancode)) && \
-@@ -2342,36 +2337,42 @@ static void hotkey_compare_and_issue_event(struct tp_nvram_state *oldn,
+@@ -2336,36 +2331,42 @@ static void hotkey_compare_and_issue_event(struct tp_nvram_state *oldn,
tpacpi_hotkey_send_key(__scancode); \
} while (0)
@@ -45485,7 +45387,7 @@ index 54d31c0..3f896d3 100644
TPACPI_COMPARE_KEY(TP_ACPI_HOTKEYSCAN_THINKPAD, thinkpad_toggle);
TPACPI_COMPARE_KEY(TP_ACPI_HOTKEYSCAN_FNSPACE, zoom_toggle);
TPACPI_COMPARE_KEY(TP_ACPI_HOTKEYSCAN_FNF7, display_toggle);
-@@ -2405,7 +2406,7 @@ static void hotkey_compare_and_issue_event(struct tp_nvram_state *oldn,
+@@ -2399,7 +2400,7 @@ static void hotkey_compare_and_issue_event(struct tp_nvram_state *oldn,
oldn->volume_level != newn->volume_level) {
/* recently muted, or repeated mute keypress, or
* multiple presses ending in mute */
@@ -45494,7 +45396,7 @@ index 54d31c0..3f896d3 100644
TPACPI_MAY_SEND_KEY(TP_ACPI_HOTKEYSCAN_MUTE);
}
} else {
-@@ -2415,7 +2416,7 @@ static void hotkey_compare_and_issue_event(struct tp_nvram_state *oldn,
+@@ -2409,7 +2410,7 @@ static void hotkey_compare_and_issue_event(struct tp_nvram_state *oldn,
TPACPI_MAY_SEND_KEY(TP_ACPI_HOTKEYSCAN_VOLUMEUP);
}
if (oldn->volume_level != newn->volume_level) {
@@ -45503,7 +45405,7 @@ index 54d31c0..3f896d3 100644
} else if (oldn->volume_toggle != newn->volume_toggle) {
/* repeated vol up/down keypress at end of scale ? */
if (newn->volume_level == 0)
-@@ -2428,7 +2429,8 @@ static void hotkey_compare_and_issue_event(struct tp_nvram_state *oldn,
+@@ -2422,7 +2423,8 @@ static void hotkey_compare_and_issue_event(struct tp_nvram_state *oldn,
/* handle brightness */
if (oldn->brightness_level != newn->brightness_level) {
issue_brightnesschange(oldn->brightness_level,
@@ -45513,7 +45415,7 @@ index 54d31c0..3f896d3 100644
} else if (oldn->brightness_toggle != newn->brightness_toggle) {
/* repeated key presses that didn't change state */
if (newn->brightness_level == 0)
-@@ -2437,10 +2439,10 @@ static void hotkey_compare_and_issue_event(struct tp_nvram_state *oldn,
+@@ -2431,10 +2433,10 @@ static void hotkey_compare_and_issue_event(struct tp_nvram_state *oldn,
&& !tp_features.bright_unkfw)
TPACPI_MAY_SEND_KEY(TP_ACPI_HOTKEYSCAN_FNHOME);
}
@@ -45525,19 +45427,6 @@ index 54d31c0..3f896d3 100644
/*
* Polling driver
-diff --git a/drivers/platform/x86/wmi.c b/drivers/platform/x86/wmi.c
-index e4ac38a..b13344c 100644
---- a/drivers/platform/x86/wmi.c
-+++ b/drivers/platform/x86/wmi.c
-@@ -743,7 +743,7 @@ static int wmi_create_device(const struct guid_block *gblock,
- wblock->dev.class = &wmi_class;
-
- wmi_gtoa(gblock->guid, guid_string);
-- dev_set_name(&wblock->dev, guid_string);
-+ dev_set_name(&wblock->dev, "%s", guid_string);
-
- dev_set_drvdata(&wblock->dev, wblock);
-
diff --git a/drivers/pnp/pnpbios/bioscalls.c b/drivers/pnp/pnpbios/bioscalls.c
index 769d265..a3a05ca 100644
--- a/drivers/pnp/pnpbios/bioscalls.c
@@ -45599,7 +45488,7 @@ index 769d265..a3a05ca 100644
+ pax_close_kernel();
}
diff --git a/drivers/pnp/resource.c b/drivers/pnp/resource.c
-index 3e6db1c..1fbbdae 100644
+index d95e101..67f0c3f 100644
--- a/drivers/pnp/resource.c
+++ b/drivers/pnp/resource.c
@@ -360,7 +360,7 @@ int pnp_check_irq(struct pnp_dev *dev, struct resource *res)
@@ -45665,7 +45554,7 @@ index cc439fd..8fa30df 100644
#endif /* CONFIG_SYSFS */
diff --git a/drivers/power/power_supply_core.c b/drivers/power/power_supply_core.c
-index 1c517c3..ffa2f17 100644
+index 00e6672..2642c08 100644
--- a/drivers/power/power_supply_core.c
+++ b/drivers/power/power_supply_core.c
@@ -24,7 +24,10 @@
@@ -45680,7 +45569,7 @@ index 1c517c3..ffa2f17 100644
static bool __power_supply_is_supplied_by(struct power_supply *supplier,
struct power_supply *supply)
-@@ -554,7 +557,7 @@ static int __init power_supply_class_init(void)
+@@ -584,7 +587,7 @@ static int __init power_supply_class_init(void)
return PTR_ERR(power_supply_class);
power_supply_class->dev_uevent = power_supply_uevent;
@@ -45690,7 +45579,7 @@ index 1c517c3..ffa2f17 100644
return 0;
}
diff --git a/drivers/power/power_supply_sysfs.c b/drivers/power/power_supply_sysfs.c
-index 29178f7..c65f324 100644
+index 44420d1..967126e 100644
--- a/drivers/power/power_supply_sysfs.c
+++ b/drivers/power/power_supply_sysfs.c
@@ -230,17 +230,15 @@ static struct attribute_group power_supply_attr_group = {
@@ -45714,10 +45603,10 @@ index 29178f7..c65f324 100644
__power_supply_attrs[i] = &power_supply_attrs[i].attr;
}
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
-index 815d6df..811633a 100644
+index a01b8b3..37c2afe 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
-@@ -3529,7 +3529,7 @@ regulator_register(const struct regulator_desc *regulator_desc,
+@@ -3307,7 +3307,7 @@ regulator_register(const struct regulator_desc *regulator_desc,
{
const struct regulation_constraints *constraints = NULL;
const struct regulator_init_data *init_data;
@@ -45726,7 +45615,7 @@ index 815d6df..811633a 100644
struct regulator_dev *rdev;
struct device *dev;
int ret, i;
-@@ -3599,7 +3599,7 @@ regulator_register(const struct regulator_desc *regulator_desc,
+@@ -3377,7 +3377,7 @@ regulator_register(const struct regulator_desc *regulator_desc,
rdev->dev.of_node = config->of_node;
rdev->dev.parent = dev;
dev_set_name(&rdev->dev, "regulator.%d",
@@ -45736,10 +45625,10 @@ index 815d6df..811633a 100644
if (ret != 0) {
put_device(&rdev->dev);
diff --git a/drivers/regulator/max8660.c b/drivers/regulator/max8660.c
-index d428ef9..fdc0357 100644
+index 144bcac..d20e7db 100644
--- a/drivers/regulator/max8660.c
+++ b/drivers/regulator/max8660.c
-@@ -333,8 +333,10 @@ static int max8660_probe(struct i2c_client *client,
+@@ -420,8 +420,10 @@ static int max8660_probe(struct i2c_client *client,
max8660->shadow_regs[MAX8660_OVER1] = 5;
} else {
/* Otherwise devices can be toggled via software */
@@ -45753,26 +45642,26 @@ index d428ef9..fdc0357 100644
/*
diff --git a/drivers/regulator/max8973-regulator.c b/drivers/regulator/max8973-regulator.c
-index adb1414..c13e0ce 100644
+index 5b77ab7..a62f061 100644
--- a/drivers/regulator/max8973-regulator.c
+++ b/drivers/regulator/max8973-regulator.c
-@@ -401,9 +401,11 @@ static int max8973_probe(struct i2c_client *client,
- if (!pdata->enable_ext_control) {
+@@ -406,9 +406,11 @@ static int max8973_probe(struct i2c_client *client,
+ if (!pdata || !pdata->enable_ext_control) {
max->desc.enable_reg = MAX8973_VOUT;
max->desc.enable_mask = MAX8973_VOUT_ENABLE;
-- max8973_dcdc_ops.enable = regulator_enable_regmap;
-- max8973_dcdc_ops.disable = regulator_disable_regmap;
-- max8973_dcdc_ops.is_enabled = regulator_is_enabled_regmap;
+- max->ops.enable = regulator_enable_regmap;
+- max->ops.disable = regulator_disable_regmap;
+- max->ops.is_enabled = regulator_is_enabled_regmap;
+ pax_open_kernel();
-+ *(void **)&max8973_dcdc_ops.enable = regulator_enable_regmap;
-+ *(void **)&max8973_dcdc_ops.disable = regulator_disable_regmap;
-+ *(void **)&max8973_dcdc_ops.is_enabled = regulator_is_enabled_regmap;
++ *(void **)&max->ops.enable = regulator_enable_regmap;
++ *(void **)&max->ops.disable = regulator_disable_regmap;
++ *(void **)&max->ops.is_enabled = regulator_is_enabled_regmap;
+ pax_close_kernel();
}
- max->enable_external_control = pdata->enable_ext_control;
+ if (pdata) {
diff --git a/drivers/regulator/mc13892-regulator.c b/drivers/regulator/mc13892-regulator.c
-index b716283..3cc4349 100644
+index 1037e07..e64dea1 100644
--- a/drivers/regulator/mc13892-regulator.c
+++ b/drivers/regulator/mc13892-regulator.c
@@ -582,10 +582,12 @@ static int mc13892_regulator_probe(struct platform_device *pdev)
@@ -45791,10 +45680,10 @@ index b716283..3cc4349 100644
mc13xxx_data = mc13xxx_parse_regulators_dt(pdev, mc13892_regulators,
ARRAY_SIZE(mc13892_regulators));
diff --git a/drivers/rtc/rtc-cmos.c b/drivers/rtc/rtc-cmos.c
-index f1cb706..4c7832a 100644
+index 24e733c..bfbaa3e 100644
--- a/drivers/rtc/rtc-cmos.c
+++ b/drivers/rtc/rtc-cmos.c
-@@ -724,7 +724,9 @@ cmos_do_probe(struct device *dev, struct resource *ports, int rtc_irq)
+@@ -731,7 +731,9 @@ cmos_do_probe(struct device *dev, struct resource *ports, int rtc_irq)
hpet_rtc_timer_init();
/* export at least the first block of NVRAM */
@@ -45827,7 +45716,7 @@ index d049393..bb20be0 100644
case RTC_PIE_ON:
diff --git a/drivers/rtc/rtc-ds1307.c b/drivers/rtc/rtc-ds1307.c
-index b53992a..776df84 100644
+index ca18fd1..055e42d 100644
--- a/drivers/rtc/rtc-ds1307.c
+++ b/drivers/rtc/rtc-ds1307.c
@@ -107,7 +107,7 @@ struct ds1307 {
@@ -45840,12 +45729,12 @@ index b53992a..776df84 100644
unsigned long flags;
#define HAS_NVRAM 0 /* bit 0 == sysfs file active */
diff --git a/drivers/rtc/rtc-m48t59.c b/drivers/rtc/rtc-m48t59.c
-index 130f29a..6179d03 100644
+index fcb0329..d77b7f2 100644
--- a/drivers/rtc/rtc-m48t59.c
+++ b/drivers/rtc/rtc-m48t59.c
-@@ -482,7 +482,9 @@ static int m48t59_rtc_probe(struct platform_device *pdev)
- goto out;
- }
+@@ -483,7 +483,9 @@ static int m48t59_rtc_probe(struct platform_device *pdev)
+ if (IS_ERR(m48t59->rtc))
+ return PTR_ERR(m48t59->rtc);
- m48t59_nvram_attr.size = pdata->offset;
+ pax_open_kernel();
@@ -45853,7 +45742,48 @@ index 130f29a..6179d03 100644
+ pax_close_kernel();
ret = sysfs_create_bin_file(&pdev->dev.kobj, &m48t59_nvram_attr);
- if (ret) {
+ if (ret)
+diff --git a/drivers/scsi/aic7xxx/aic79xx_pci.c b/drivers/scsi/aic7xxx/aic79xx_pci.c
+index 14b5f8d..cc9bd26 100644
+--- a/drivers/scsi/aic7xxx/aic79xx_pci.c
++++ b/drivers/scsi/aic7xxx/aic79xx_pci.c
+@@ -827,7 +827,7 @@ ahd_pci_intr(struct ahd_softc *ahd)
+ for (bit = 0; bit < 8; bit++) {
+
+ if ((pci_status[i] & (0x1 << bit)) != 0) {
+- static const char *s;
++ const char *s;
+
+ s = pci_status_strings[bit];
+ if (i == 7/*TARG*/ && bit == 3)
+@@ -887,23 +887,15 @@ ahd_pci_split_intr(struct ahd_softc *ahd, u_int intstat)
+
+ for (bit = 0; bit < 8; bit++) {
+
+- if ((split_status[i] & (0x1 << bit)) != 0) {
+- static const char *s;
+-
+- s = split_status_strings[bit];
+- printk(s, ahd_name(ahd),
++ if ((split_status[i] & (0x1 << bit)) != 0)
++ printk(split_status_strings[bit], ahd_name(ahd),
+ split_status_source[i]);
+- }
+
+ if (i > 1)
+ continue;
+
+- if ((sg_split_status[i] & (0x1 << bit)) != 0) {
+- static const char *s;
+-
+- s = split_status_strings[bit];
+- printk(s, ahd_name(ahd), "SG");
+- }
++ if ((sg_split_status[i] & (0x1 << bit)) != 0)
++ printk(split_status_strings[bit], ahd_name(ahd), "SG");
+ }
+ }
+ /*
diff --git a/drivers/scsi/bfa/bfa_fcpim.h b/drivers/scsi/bfa/bfa_fcpim.h
index e693af6..2e525b6 100644
--- a/drivers/scsi/bfa/bfa_fcpim.h
@@ -45868,7 +45798,7 @@ index e693af6..2e525b6 100644
void bfa_itn_create(struct bfa_s *bfa, struct bfa_rport_s *rport,
void (*isr)(struct bfa_s *bfa, struct bfi_msg_s *m));
diff --git a/drivers/scsi/bfa/bfa_ioc.h b/drivers/scsi/bfa/bfa_ioc.h
-index 23a90e7..9cf04ee 100644
+index 90814fe..4384138 100644
--- a/drivers/scsi/bfa/bfa_ioc.h
+++ b/drivers/scsi/bfa/bfa_ioc.h
@@ -258,7 +258,7 @@ struct bfa_ioc_cbfn_s {
@@ -45880,17 +45810,17 @@ index 23a90e7..9cf04ee 100644
/*
* IOC event notification mechanism.
-@@ -346,7 +346,7 @@ struct bfa_ioc_hwif_s {
- void (*ioc_sync_ack) (struct bfa_ioc_s *ioc);
- bfa_boolean_t (*ioc_sync_complete) (struct bfa_ioc_s *ioc);
- bfa_boolean_t (*ioc_lpu_read_stat) (struct bfa_ioc_s *ioc);
+@@ -352,7 +352,7 @@ struct bfa_ioc_hwif_s {
+ void (*ioc_set_alt_fwstate) (struct bfa_ioc_s *ioc,
+ enum bfi_ioc_state fwstate);
+ enum bfi_ioc_state (*ioc_get_alt_fwstate) (struct bfa_ioc_s *ioc);
-};
+} __no_const;
/*
* Queue element to wait for room in request queue. FIFO order is
diff --git a/drivers/scsi/fcoe/fcoe_sysfs.c b/drivers/scsi/fcoe/fcoe_sysfs.c
-index 8c05ae01..b2cf224 100644
+index c9382d6..6619864 100644
--- a/drivers/scsi/fcoe/fcoe_sysfs.c
+++ b/drivers/scsi/fcoe/fcoe_sysfs.c
@@ -33,8 +33,8 @@
@@ -45956,10 +45886,10 @@ index df0c3c7..b00e1d0 100644
/* These three are default values which can be overridden */
diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
-index 7f4f790..b75b92a 100644
+index 891c86b..dd1224a0 100644
--- a/drivers/scsi/hpsa.c
+++ b/drivers/scsi/hpsa.c
-@@ -554,7 +554,7 @@ static inline u32 next_command(struct ctlr_info *h, u8 q)
+@@ -578,7 +578,7 @@ static inline u32 next_command(struct ctlr_info *h, u8 q)
unsigned long flags;
if (unlikely(!(h->transMethod & CFGTBL_Trans_Performant)))
@@ -45968,7 +45898,7 @@ index 7f4f790..b75b92a 100644
if ((rq->head[rq->current_entry] & 1) == rq->wraparound) {
a = rq->head[rq->current_entry];
-@@ -3422,7 +3422,7 @@ static void start_io(struct ctlr_info *h)
+@@ -3444,7 +3444,7 @@ static void start_io(struct ctlr_info *h)
while (!list_empty(&h->reqQ)) {
c = list_entry(h->reqQ.next, struct CommandList, list);
/* can't do anything if fifo is full */
@@ -45977,7 +45907,7 @@ index 7f4f790..b75b92a 100644
dev_warn(&h->pdev->dev, "fifo full\n");
break;
}
-@@ -3444,7 +3444,7 @@ static void start_io(struct ctlr_info *h)
+@@ -3466,7 +3466,7 @@ static void start_io(struct ctlr_info *h)
/* Tell the controller execute command */
spin_unlock_irqrestore(&h->lock, flags);
@@ -45986,7 +45916,7 @@ index 7f4f790..b75b92a 100644
spin_lock_irqsave(&h->lock, flags);
}
spin_unlock_irqrestore(&h->lock, flags);
-@@ -3452,17 +3452,17 @@ static void start_io(struct ctlr_info *h)
+@@ -3474,17 +3474,17 @@ static void start_io(struct ctlr_info *h)
static inline unsigned long get_next_completion(struct ctlr_info *h, u8 q)
{
@@ -46007,7 +45937,7 @@ index 7f4f790..b75b92a 100644
(h->interrupts_enabled == 0);
}
-@@ -4364,7 +4364,7 @@ static int hpsa_pci_init(struct ctlr_info *h)
+@@ -4386,7 +4386,7 @@ static int hpsa_pci_init(struct ctlr_info *h)
if (prod_index < 0)
return -ENODEV;
h->product_name = products[prod_index].product_name;
@@ -46016,7 +45946,7 @@ index 7f4f790..b75b92a 100644
pci_disable_link_state(h->pdev, PCIE_LINK_STATE_L0S |
PCIE_LINK_STATE_L1 | PCIE_LINK_STATE_CLKPM);
-@@ -4646,7 +4646,7 @@ static void controller_lockup_detected(struct ctlr_info *h)
+@@ -4668,7 +4668,7 @@ static void controller_lockup_detected(struct ctlr_info *h)
assert_spin_locked(&lockup_detector_lock);
remove_ctlr_from_lockup_detector_list(h);
@@ -46025,7 +45955,7 @@ index 7f4f790..b75b92a 100644
spin_lock_irqsave(&h->lock, flags);
h->lockup_detected = readl(h->vaddr + SA5_SCRATCHPAD_OFFSET);
spin_unlock_irqrestore(&h->lock, flags);
-@@ -4823,7 +4823,7 @@ reinit_after_soft_reset:
+@@ -4845,7 +4845,7 @@ reinit_after_soft_reset:
}
/* make sure the board interrupts are off */
@@ -46034,7 +45964,7 @@ index 7f4f790..b75b92a 100644
if (hpsa_request_irq(h, do_hpsa_intr_msi, do_hpsa_intr_intx))
goto clean2;
-@@ -4857,7 +4857,7 @@ reinit_after_soft_reset:
+@@ -4879,7 +4879,7 @@ reinit_after_soft_reset:
* fake ones to scoop up any residual completions.
*/
spin_lock_irqsave(&h->lock, flags);
@@ -46043,7 +45973,7 @@ index 7f4f790..b75b92a 100644
spin_unlock_irqrestore(&h->lock, flags);
free_irqs(h);
rc = hpsa_request_irq(h, hpsa_msix_discard_completions,
-@@ -4876,9 +4876,9 @@ reinit_after_soft_reset:
+@@ -4898,9 +4898,9 @@ reinit_after_soft_reset:
dev_info(&h->pdev->dev, "Board READY.\n");
dev_info(&h->pdev->dev,
"Waiting for stale completions to drain.\n");
@@ -46055,7 +45985,7 @@ index 7f4f790..b75b92a 100644
rc = controller_reset_failed(h->cfgtable);
if (rc)
-@@ -4899,7 +4899,7 @@ reinit_after_soft_reset:
+@@ -4921,7 +4921,7 @@ reinit_after_soft_reset:
}
/* Turn the interrupts on so we can service requests */
@@ -46064,7 +45994,7 @@ index 7f4f790..b75b92a 100644
hpsa_hba_inquiry(h);
hpsa_register_scsi(h); /* hook ourselves into SCSI subsystem */
-@@ -4954,7 +4954,7 @@ static void hpsa_shutdown(struct pci_dev *pdev)
+@@ -4976,7 +4976,7 @@ static void hpsa_shutdown(struct pci_dev *pdev)
* To write all data in the battery backed cache to disks
*/
hpsa_flush_cache(h);
@@ -46073,7 +46003,7 @@ index 7f4f790..b75b92a 100644
hpsa_free_irqs_and_disable_msix(h);
}
-@@ -5122,7 +5122,7 @@ static void hpsa_enter_performant_mode(struct ctlr_info *h, u32 use_short_tags)
+@@ -5144,7 +5144,7 @@ static void hpsa_enter_performant_mode(struct ctlr_info *h, u32 use_short_tags)
return;
}
/* Change the access methods to the performant access methods */
@@ -46083,7 +46013,7 @@ index 7f4f790..b75b92a 100644
}
diff --git a/drivers/scsi/hpsa.h b/drivers/scsi/hpsa.h
-index 9816479..c5d4e97 100644
+index bc85e72..ae04a39 100644
--- a/drivers/scsi/hpsa.h
+++ b/drivers/scsi/hpsa.h
@@ -79,7 +79,7 @@ struct ctlr_info {
@@ -46096,7 +46026,7 @@ index 9816479..c5d4e97 100644
/* queue and queue Info */
struct list_head reqQ;
diff --git a/drivers/scsi/libfc/fc_exch.c b/drivers/scsi/libfc/fc_exch.c
-index 8b928c6..9c76300 100644
+index 5879929..32b241d 100644
--- a/drivers/scsi/libfc/fc_exch.c
+++ b/drivers/scsi/libfc/fc_exch.c
@@ -100,12 +100,12 @@ struct fc_exch_mgr {
@@ -46254,10 +46184,10 @@ index 161c98e..6d563b3 100644
.qc_issue = sas_ata_qc_issue,
.qc_fill_rtf = sas_ata_qc_fill_rtf,
diff --git a/drivers/scsi/lpfc/lpfc.h b/drivers/scsi/lpfc/lpfc.h
-index bcc56ca..6f4174a 100644
+index 4e1b75c..0bbdfa9 100644
--- a/drivers/scsi/lpfc/lpfc.h
+++ b/drivers/scsi/lpfc/lpfc.h
-@@ -431,7 +431,7 @@ struct lpfc_vport {
+@@ -432,7 +432,7 @@ struct lpfc_vport {
struct dentry *debug_nodelist;
struct dentry *vport_debugfs_root;
struct lpfc_debugfs_trc *disc_trc;
@@ -46287,7 +46217,7 @@ index bcc56ca..6f4174a 100644
struct dentry *idiag_root;
struct dentry *idiag_pci_cfg;
diff --git a/drivers/scsi/lpfc/lpfc_debugfs.c b/drivers/scsi/lpfc/lpfc_debugfs.c
-index f525ecb..32549a4 100644
+index 60084e6..0e2e700 100644
--- a/drivers/scsi/lpfc/lpfc_debugfs.c
+++ b/drivers/scsi/lpfc/lpfc_debugfs.c
@@ -106,7 +106,7 @@ MODULE_PARM_DESC(lpfc_debugfs_mask_disc_trc,
@@ -46351,7 +46281,7 @@ index f525ecb..32549a4 100644
dtp->jif = jiffies;
#endif
return;
-@@ -4182,7 +4182,7 @@ lpfc_debugfs_initialize(struct lpfc_vport *vport)
+@@ -4168,7 +4168,7 @@ lpfc_debugfs_initialize(struct lpfc_vport *vport)
"slow_ring buffer\n");
goto debug_failed;
}
@@ -46360,7 +46290,7 @@ index f525ecb..32549a4 100644
memset(phba->slow_ring_trc, 0,
(sizeof(struct lpfc_debugfs_trc) *
lpfc_debugfs_max_slow_ring_trc));
-@@ -4228,7 +4228,7 @@ lpfc_debugfs_initialize(struct lpfc_vport *vport)
+@@ -4214,7 +4214,7 @@ lpfc_debugfs_initialize(struct lpfc_vport *vport)
"buffer\n");
goto debug_failed;
}
@@ -46370,10 +46300,10 @@ index f525ecb..32549a4 100644
snprintf(name, sizeof(name), "discovery_trace");
vport->debug_disc_trc =
diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c
-index cb465b2..2e7b25f 100644
+index 647f5bf..d0068b9 100644
--- a/drivers/scsi/lpfc/lpfc_init.c
+++ b/drivers/scsi/lpfc/lpfc_init.c
-@@ -10950,8 +10950,10 @@ lpfc_init(void)
+@@ -10952,8 +10952,10 @@ lpfc_init(void)
"misc_register returned with status %d", error);
if (lpfc_enable_npiv) {
@@ -46387,10 +46317,10 @@ index cb465b2..2e7b25f 100644
lpfc_transport_template =
fc_attach_transport(&lpfc_transport_functions);
diff --git a/drivers/scsi/lpfc/lpfc_scsi.c b/drivers/scsi/lpfc/lpfc_scsi.c
-index 8523b278e..ce1d812 100644
+index c913e8c..d34a119 100644
--- a/drivers/scsi/lpfc/lpfc_scsi.c
+++ b/drivers/scsi/lpfc/lpfc_scsi.c
-@@ -331,7 +331,7 @@ lpfc_rampdown_queue_depth(struct lpfc_hba *phba)
+@@ -353,7 +353,7 @@ lpfc_rampdown_queue_depth(struct lpfc_hba *phba)
uint32_t evt_posted;
spin_lock_irqsave(&phba->hbalock, flags);
@@ -46399,7 +46329,7 @@ index 8523b278e..ce1d812 100644
phba->last_rsrc_error_time = jiffies;
if ((phba->last_ramp_down_time + QUEUE_RAMP_DOWN_INTERVAL) > jiffies) {
-@@ -372,7 +372,7 @@ lpfc_rampup_queue_depth(struct lpfc_vport *vport,
+@@ -394,7 +394,7 @@ lpfc_rampup_queue_depth(struct lpfc_vport *vport,
unsigned long flags;
struct lpfc_hba *phba = vport->phba;
uint32_t evt_posted;
@@ -46408,7 +46338,7 @@ index 8523b278e..ce1d812 100644
if (vport->cfg_lun_queue_depth <= queue_depth)
return;
-@@ -416,8 +416,8 @@ lpfc_ramp_down_queue_handler(struct lpfc_hba *phba)
+@@ -438,8 +438,8 @@ lpfc_ramp_down_queue_handler(struct lpfc_hba *phba)
unsigned long num_rsrc_err, num_cmd_success;
int i;
@@ -46419,7 +46349,7 @@ index 8523b278e..ce1d812 100644
/*
* The error and success command counters are global per
-@@ -445,8 +445,8 @@ lpfc_ramp_down_queue_handler(struct lpfc_hba *phba)
+@@ -467,8 +467,8 @@ lpfc_ramp_down_queue_handler(struct lpfc_hba *phba)
}
}
lpfc_destroy_vport_work_array(phba, vports);
@@ -46430,7 +46360,7 @@ index 8523b278e..ce1d812 100644
}
/**
-@@ -480,8 +480,8 @@ lpfc_ramp_up_queue_handler(struct lpfc_hba *phba)
+@@ -502,8 +502,8 @@ lpfc_ramp_up_queue_handler(struct lpfc_hba *phba)
}
}
lpfc_destroy_vport_work_array(phba, vports);
@@ -46441,8 +46371,48 @@ index 8523b278e..ce1d812 100644
}
/**
+diff --git a/drivers/scsi/mpt2sas/mpt2sas_scsih.c b/drivers/scsi/mpt2sas/mpt2sas_scsih.c
+index 7f0af4f..193ac3e 100644
+--- a/drivers/scsi/mpt2sas/mpt2sas_scsih.c
++++ b/drivers/scsi/mpt2sas/mpt2sas_scsih.c
+@@ -1557,7 +1557,7 @@ _scsih_get_resync(struct device *dev)
+ {
+ struct scsi_device *sdev = to_scsi_device(dev);
+ struct MPT2SAS_ADAPTER *ioc = shost_priv(sdev->host);
+- static struct _raid_device *raid_device;
++ struct _raid_device *raid_device;
+ unsigned long flags;
+ Mpi2RaidVolPage0_t vol_pg0;
+ Mpi2ConfigReply_t mpi_reply;
+@@ -1609,7 +1609,7 @@ _scsih_get_state(struct device *dev)
+ {
+ struct scsi_device *sdev = to_scsi_device(dev);
+ struct MPT2SAS_ADAPTER *ioc = shost_priv(sdev->host);
+- static struct _raid_device *raid_device;
++ struct _raid_device *raid_device;
+ unsigned long flags;
+ Mpi2RaidVolPage0_t vol_pg0;
+ Mpi2ConfigReply_t mpi_reply;
+@@ -6637,7 +6637,7 @@ _scsih_sas_ir_operation_status_event(struct MPT2SAS_ADAPTER *ioc,
+ struct fw_event_work *fw_event)
+ {
+ Mpi2EventDataIrOperationStatus_t *event_data = fw_event->event_data;
+- static struct _raid_device *raid_device;
++ struct _raid_device *raid_device;
+ unsigned long flags;
+ u16 handle;
+
+@@ -7108,7 +7108,7 @@ _scsih_scan_for_devices_after_reset(struct MPT2SAS_ADAPTER *ioc)
+ u64 sas_address;
+ struct _sas_device *sas_device;
+ struct _sas_node *expander_device;
+- static struct _raid_device *raid_device;
++ struct _raid_device *raid_device;
+ u8 retry_count;
+ unsigned long flags;
+
diff --git a/drivers/scsi/pmcraid.c b/drivers/scsi/pmcraid.c
-index 8e1b737..50ff510 100644
+index 1eb7b028..b2a6080 100644
--- a/drivers/scsi/pmcraid.c
+++ b/drivers/scsi/pmcraid.c
@@ -200,8 +200,8 @@ static int pmcraid_slave_alloc(struct scsi_device *scsi_dev)
@@ -46549,10 +46519,10 @@ index e1d150f..6c6df44 100644
/* To indicate add/delete/modify during CCN */
u8 change_detected;
diff --git a/drivers/scsi/qla2xxx/qla_attr.c b/drivers/scsi/qla2xxx/qla_attr.c
-index bf60c63..74d4dce 100644
+index 5f174b8..98d32b0 100644
--- a/drivers/scsi/qla2xxx/qla_attr.c
+++ b/drivers/scsi/qla2xxx/qla_attr.c
-@@ -2001,7 +2001,7 @@ qla24xx_vport_disable(struct fc_vport *fc_vport, bool disable)
+@@ -2040,7 +2040,7 @@ qla24xx_vport_disable(struct fc_vport *fc_vport, bool disable)
return 0;
}
@@ -46561,7 +46531,7 @@ index bf60c63..74d4dce 100644
.show_host_node_name = 1,
.show_host_port_name = 1,
-@@ -2048,7 +2048,7 @@ struct fc_function_template qla2xxx_transport_functions = {
+@@ -2088,7 +2088,7 @@ struct fc_function_template qla2xxx_transport_functions = {
.bsg_timeout = qla24xx_bsg_timeout,
};
@@ -46571,10 +46541,10 @@ index bf60c63..74d4dce 100644
.show_host_node_name = 1,
.show_host_port_name = 1,
diff --git a/drivers/scsi/qla2xxx/qla_gbl.h b/drivers/scsi/qla2xxx/qla_gbl.h
-index 026bfde..90c4018 100644
+index 4446bf5..9a3574d 100644
--- a/drivers/scsi/qla2xxx/qla_gbl.h
+++ b/drivers/scsi/qla2xxx/qla_gbl.h
-@@ -528,8 +528,8 @@ extern void qla2x00_get_sym_node_name(scsi_qla_host_t *, uint8_t *);
+@@ -538,8 +538,8 @@ extern void qla2x00_get_sym_node_name(scsi_qla_host_t *, uint8_t *);
struct device_attribute;
extern struct device_attribute *qla2x00_host_attrs[];
struct fc_function_template;
@@ -46586,10 +46556,10 @@ index 026bfde..90c4018 100644
extern void qla2x00_free_sysfs_attr(scsi_qla_host_t *);
extern void qla2x00_init_host_attr(scsi_qla_host_t *);
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
-index ad72c1d..afc9a98 100644
+index 9f01bbb..5e1dcee 100644
--- a/drivers/scsi/qla2xxx/qla_os.c
+++ b/drivers/scsi/qla2xxx/qla_os.c
-@@ -1571,8 +1571,10 @@ qla2x00_config_dma_addressing(struct qla_hw_data *ha)
+@@ -1572,8 +1572,10 @@ qla2x00_config_dma_addressing(struct qla_hw_data *ha)
!pci_set_consistent_dma_mask(ha->pdev, DMA_BIT_MASK(64))) {
/* Ok, a 64bit DMA mask is applicable. */
ha->flags.enable_64bit_addressing = 1;
@@ -46603,10 +46573,10 @@ index ad72c1d..afc9a98 100644
}
}
diff --git a/drivers/scsi/qla4xxx/ql4_def.h b/drivers/scsi/qla4xxx/ql4_def.h
-index ddf16a8..80f4dd0 100644
+index 41327d4..feb03d479 100644
--- a/drivers/scsi/qla4xxx/ql4_def.h
+++ b/drivers/scsi/qla4xxx/ql4_def.h
-@@ -291,7 +291,7 @@ struct ddb_entry {
+@@ -296,7 +296,7 @@ struct ddb_entry {
* (4000 only) */
atomic_t relogin_timer; /* Max Time to wait for
* relogin to complete */
@@ -46616,10 +46586,10 @@ index ddf16a8..80f4dd0 100644
uint32_t default_time2wait; /* Default Min time between
* relogins (+aens) */
diff --git a/drivers/scsi/qla4xxx/ql4_os.c b/drivers/scsi/qla4xxx/ql4_os.c
-index 4d231c1..2892c37 100644
+index f8a0a26..ec03cee 100644
--- a/drivers/scsi/qla4xxx/ql4_os.c
+++ b/drivers/scsi/qla4xxx/ql4_os.c
-@@ -2971,12 +2971,12 @@ static void qla4xxx_check_relogin_flash_ddb(struct iscsi_cls_session *cls_sess)
+@@ -3066,12 +3066,12 @@ static void qla4xxx_check_relogin_flash_ddb(struct iscsi_cls_session *cls_sess)
*/
if (!iscsi_is_session_online(cls_sess)) {
/* Reset retry relogin timer */
@@ -46634,7 +46604,7 @@ index 4d231c1..2892c37 100644
ddb_entry->default_time2wait + 4));
set_bit(DPC_RELOGIN_DEVICE, &ha->dpc_flags);
atomic_set(&ddb_entry->retry_relogin_timer,
-@@ -5081,7 +5081,7 @@ static void qla4xxx_setup_flash_ddb_entry(struct scsi_qla_host *ha,
+@@ -5209,7 +5209,7 @@ static void qla4xxx_setup_flash_ddb_entry(struct scsi_qla_host *ha,
atomic_set(&ddb_entry->retry_relogin_timer, INVALID_ENTRY);
atomic_set(&ddb_entry->relogin_timer, 0);
@@ -46657,10 +46627,10 @@ index eaa808e..95f8841 100644
/* check if the device is still usable */
if (unlikely(cmd->device->sdev_state == SDEV_DEL)) {
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
-index 86d5220..f22c51a 100644
+index d1549b7..2f60767 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
-@@ -1458,7 +1458,7 @@ static void scsi_kill_request(struct request *req, struct request_queue *q)
+@@ -1474,7 +1474,7 @@ static void scsi_kill_request(struct request *req, struct request_queue *q)
shost = sdev->host;
scsi_init_cmd_errh(cmd);
cmd->result = DID_NO_CONNECT << 16;
@@ -46669,7 +46639,7 @@ index 86d5220..f22c51a 100644
/*
* SCSI request completion path will do scsi_device_unbusy(),
-@@ -1484,9 +1484,9 @@ static void scsi_softirq_done(struct request *rq)
+@@ -1500,9 +1500,9 @@ static void scsi_softirq_done(struct request *rq)
INIT_LIST_HEAD(&cmd->eh_entry);
@@ -46682,10 +46652,10 @@ index 86d5220..f22c51a 100644
disposition = scsi_decide_disposition(cmd);
if (disposition != SUCCESS &&
diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c
-index 931a7d9..0c2a754 100644
+index 40c6394..62356c2 100644
--- a/drivers/scsi/scsi_sysfs.c
+++ b/drivers/scsi/scsi_sysfs.c
-@@ -658,7 +658,7 @@ show_iostat_##field(struct device *dev, struct device_attribute *attr, \
+@@ -687,7 +687,7 @@ show_iostat_##field(struct device *dev, struct device_attribute *attr, \
char *buf) \
{ \
struct scsi_device *sdev = to_scsi_device(dev); \
@@ -46708,7 +46678,7 @@ index 84a1fdf..693b0d6 100644
/*
* TODO: need to fixup sg_tablesize, max_segment_size,
diff --git a/drivers/scsi/scsi_transport_fc.c b/drivers/scsi/scsi_transport_fc.c
-index e106c27..11a380e 100644
+index 4628fd5..a94a1c2 100644
--- a/drivers/scsi/scsi_transport_fc.c
+++ b/drivers/scsi/scsi_transport_fc.c
@@ -497,7 +497,7 @@ static DECLARE_TRANSPORT_CLASS(fc_vport_class,
@@ -46748,10 +46718,10 @@ index e106c27..11a380e 100644
/*
* Check for overflow; dev_loss_tmo is u32
diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c
-index 133926b..903000d 100644
+index e4a989f..293090c 100644
--- a/drivers/scsi/scsi_transport_iscsi.c
+++ b/drivers/scsi/scsi_transport_iscsi.c
-@@ -80,7 +80,7 @@ struct iscsi_internal {
+@@ -79,7 +79,7 @@ struct iscsi_internal {
struct transport_container session_cont;
};
@@ -46760,7 +46730,7 @@ index 133926b..903000d 100644
static struct workqueue_struct *iscsi_eh_timer_workq;
static DEFINE_IDA(iscsi_sess_ida);
-@@ -1738,7 +1738,7 @@ int iscsi_add_session(struct iscsi_cls_session *session, unsigned int target_id)
+@@ -1737,7 +1737,7 @@ int iscsi_add_session(struct iscsi_cls_session *session, unsigned int target_id)
int err;
ihost = shost->shost_data;
@@ -46769,7 +46739,7 @@ index 133926b..903000d 100644
if (target_id == ISCSI_MAX_TARGET) {
id = ida_simple_get(&iscsi_sess_ida, 0, 0, GFP_KERNEL);
-@@ -3944,7 +3944,7 @@ static __init int iscsi_transport_init(void)
+@@ -4077,7 +4077,7 @@ static __init int iscsi_transport_init(void)
printk(KERN_INFO "Loading iSCSI transport class v%s.\n",
ISCSI_TRANSPORT_VERSION);
@@ -46810,10 +46780,10 @@ index f379c7f..e8fc69c 100644
transport_setup_device(&rport->dev);
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
-index 734a29a..6b06e4a 100644
+index 5693f6d7..b0bf05a 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
-@@ -2923,7 +2923,7 @@ static int sd_probe(struct device *dev)
+@@ -2934,7 +2934,7 @@ static int sd_probe(struct device *dev)
sdkp->disk = gd;
sdkp->index = index;
atomic_set(&sdkp->openers, 0);
@@ -46822,15 +46792,6 @@ index 734a29a..6b06e4a 100644
if (!sdp->request_queue->rq_timeout) {
if (sdp->type != TYPE_MOD)
-@@ -2936,7 +2936,7 @@ static int sd_probe(struct device *dev)
- device_initialize(&sdkp->dev);
- sdkp->dev.parent = dev;
- sdkp->dev.class = &sd_disk_class;
-- dev_set_name(&sdkp->dev, dev_name(dev));
-+ dev_set_name(&sdkp->dev, "%s", dev_name(dev));
-
- if (device_add(&sdkp->dev))
- goto out_free_index;
diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c
index df5e961..df6b97f 100644
--- a/drivers/scsi/sg.c
@@ -46845,10 +46806,10 @@ index df5e961..df6b97f 100644
return blk_trace_startstop(sdp->device->request_queue, 1);
case BLKTRACESTOP:
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
-index 32b7bb1..2f1c4bd 100644
+index 9e039c6..ae9e800 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
-@@ -1631,7 +1631,7 @@ int spi_bus_unlock(struct spi_master *master)
+@@ -1762,7 +1762,7 @@ int spi_bus_unlock(struct spi_master *master)
EXPORT_SYMBOL_GPL(spi_bus_unlock);
/* portable code must never pass more than 32 bytes */
@@ -46858,7 +46819,7 @@ index 32b7bb1..2f1c4bd 10