aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2013-08-05 10:28:35 +0200
committerNatanael Copa <ncopa@alpinelinux.org>2013-08-05 09:28:36 +0000
commit46a1495797a89ae9d3f767848f334ae0b2c633ce (patch)
tree63818bd5f75c514e879e65d0290d7cf85cf47db2
parent10a5acfaf661d81a2eccec1328322ed02922d316 (diff)
downloadaports-46a1495797a89ae9d3f767848f334ae0b2c633ce.tar.bz2
aports-46a1495797a89ae9d3f767848f334ae0b2c633ce.tar.xz
main/linux-grsec: upgrade to 3.10.4
-rw-r--r--main/linux-grsec/APKBUILD36
-rw-r--r--main/linux-grsec/grsecurity-2.9.1-3.10.4-201308030031.patch (renamed from main/linux-grsec/grsecurity-2.9.1-3.9.11-unofficial-2.patch)13060
-rw-r--r--main/linux-grsec/kernelconfig.x86199
-rw-r--r--main/linux-grsec/kernelconfig.x86_64206
4 files changed, 6465 insertions, 7036 deletions
diff --git a/main/linux-grsec/APKBUILD b/main/linux-grsec/APKBUILD
index d8f6ebdcaf..00e9958e2e 100644
--- a/main/linux-grsec/APKBUILD
+++ b/main/linux-grsec/APKBUILD
@@ -2,12 +2,12 @@
_flavor=grsec
pkgname=linux-${_flavor}
-pkgver=3.9.11
+pkgver=3.10.4
case $pkgver in
*.*.*) _kernver=${pkgver%.*};;
*.*) _kernver=${pkgver};;
esac
-pkgrel=2
+pkgrel=0
pkgdesc="Linux kernel with grsecurity"
url=http://grsecurity.net
depends="mkinitfs linux-firmware"
@@ -17,7 +17,7 @@ _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-3.9.11-unofficial-2.patch
+ grsecurity-2.9.1-3.10.4-201308030031.patch
0001-net-inform-NETDEV_CHANGE-callbacks-which-flags-were-.patch
0002-arp-flush-arp-cache-on-IFF_NOARP-change.patch
@@ -148,36 +148,36 @@ dev() {
"$subpkgdir"/lib/modules/${_abi_release}/build
}
-md5sums="4348c9b6b2eb3144d601e87c19d5d909 linux-3.9.tar.xz
-552146435b7ecc414bf8e3cd8bb6ac4a patch-3.9.11.xz
-808e4e5dd176692d62ccfbf5988a88fa grsecurity-2.9.1-3.9.11-unofficial-2.patch
+md5sums="4f25cd5bec5f8d5a7d935b3f2ccb8481 linux-3.10.tar.xz
+2e46ab138670b3171b52b849568cb42f patch-3.10.4.xz
+62bb9b34f874425600ada2817ddf23b6 grsecurity-2.9.1-3.10.4-201308030031.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
-d89089b3c7eb94dd9f65cf8a357fc36d kernelconfig.x86
-eb147f09fef5996a488c247790205cd6 kernelconfig.x86_64"
-sha256sums="60bc3e64ee5dc778de2cd7cd7640abf518a4c9d4f31b8ed624e16fad53f54541 linux-3.9.tar.xz
-29be11d16ef152ae1858d567cbf45f0da0193adf364826f5e3fa8b2fcd839682 patch-3.9.11.xz
-bd672d212020b5a7a00b3e0f6df39efbba6d0a1cbad88e0bf65cbaf8f8045204 grsecurity-2.9.1-3.9.11-unofficial-2.patch
+1a111abaeb381bf47d9e979a85fba2ee kernelconfig.x86
+1312267644d0c729bd7c7af979b29c8d kernelconfig.x86_64"
+sha256sums="df27fa92d27a9c410bfe6c4a89f141638500d7eadcca5cce578954efc2ad3544 linux-3.10.tar.xz
+d8ef39930663cc916e57e06b308a1654f2a03903a3c5a0d3a5503c6d58e2b2b8 patch-3.10.4.xz
+3acf56b31b85298c56cee026fd01f3b0643c44743bd61476db85f15d9209c72b grsecurity-2.9.1-3.10.4-201308030031.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
-de3c17420664ae4e52826c6e602aade0deeae94f72253f85b3e48771491ed5d6 kernelconfig.x86
-e1cce320f207cc2ba72b9d154c7060c8cbed52c664319dfd21f24e8956d0bf3e kernelconfig.x86_64"
-sha512sums="77fa521f42380409f8ab400c26f7b00e225cb075ef40834bb263325cfdcc3e65aef8511ec2fc2b50bbf4f50e226fb5ab07d7a479aaf09162adbbf318325d0790 linux-3.9.tar.xz
-c3a0be102d816ae06d7dfdd2738915fc2114cb9bb488b03b34e4f52f2367dcba4d8cb8ba203687bf694c2dcad36d70bb9d3121ac739a28e2c7fb2c44f08a9c71 patch-3.9.11.xz
-730e24dffc70250945d873358a2fbe19f1c9249befeaba6e53ce8c1b4ebb19583d51d6a437b6d9a39b705f48001f4a645f92560ef6b4db88ee8fbf9f17bafd41 grsecurity-2.9.1-3.9.11-unofficial-2.patch
+1ef74cf3703dd26201970a2d9f043fed7e03ad2540a20f810cec8add93f81ccd kernelconfig.x86
+1c4b4a74d982fdc8d3baddcdaa674ae4b4a3390daba024fca55e85604af74507 kernelconfig.x86_64"
+sha512sums="5fb109fcbd59bf3dffc911b853894f0a84afa75151368f783a1252c5ff60c7a1504de216c0012be446df983e2dea400ad8eeed3ce04f24dc61d0ef76c174dc35 linux-3.10.tar.xz
+382adb3faf7feda6c5dd8f401c0ad0a2dbbc62e33d5f85d4181a56567abdec3be5b5279d35829a3a9a53a54949ea10de3f31c4256eba1f132fda79197af46819 patch-3.10.4.xz
+e39d89f2c5e20e642488234a7a0967f8f46239e267eb73a1ab2375b4cf58528ebb239e4a47a102b674e0deb7b0aa713a1d037f97a47a77f87dcca8217ffe00ad grsecurity-2.9.1-3.10.4-201308030031.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
-c51ac429c3e811976318a7ca2a4f7fc48bcf290e885ceeb09a1a56ee32c37b673f6e789789cf36876747bd54e4dc55d340ad888ba0eb8e7f45f60e8ef7ea67b4 kernelconfig.x86
-584e778f96a05388051b05eb6f1c20377bc8aad72d0cd678323af7aaaab85ecc992244fe6bf3f27ab88131903490fd8af3c3fb56062490dd90dca1ba91d4da21 kernelconfig.x86_64"
+5d2057cb27362175d85cbe1b79586a3daaa16c1b36baa0bf433b594a85284a02460b28e90ee9dc3f5a8c973a7e8316e0be83099a40a039913e6f1c7036570196 kernelconfig.x86
+89b5fe8a4930ef19deb00e18bb8a4ae4c87105bcf29b7e15c677f7e6a4d2618bb5c378da485aed573b5a2342e0cdff4d0ceae60f2b89cde603988de9f3c36929 kernelconfig.x86_64"
diff --git a/main/linux-grsec/grsecurity-2.9.1-3.9.11-unofficial-2.patch b/main/linux-grsec/grsecurity-2.9.1-3.10.4-201308030031.patch
index cb0d943df0..9cf4026039 100644
--- a/main/linux-grsec/grsecurity-2.9.1-3.9.11-unofficial-2.patch
+++ b/main/linux-grsec/grsecurity-2.9.1-3.10.4-201308030031.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 8ccbf27..afffeb4 100644
+index 2fe6e76..df58221 100644
--- a/Documentation/kernel-parameters.txt
+++ b/Documentation/kernel-parameters.txt
-@@ -948,6 +948,10 @@ bytes respectively. Such letter suffixes can also be entirely omitted.
+@@ -976,6 +976,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 8ccbf27..afffeb4 100644
hashdist= [KNL,NUMA] Large hashes allocated during boot
are distributed across NUMA nodes. Defaults on
for 64-bit NUMA, off otherwise.
-@@ -2147,6 +2151,18 @@ bytes respectively. Such letter suffixes can also be entirely omitted.
+@@ -2195,6 +2199,22 @@ 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.
@@ -252,6 +252,10 @@ index 8ccbf27..afffeb4 100644
+ expand down segment used by UDEREF on X86-32 or the frequent
+ page table updates on X86-64.
+
++ pax_sanitize_slab=
++ 0/1 to disable/enable slab object sanitization (enabled by
++ default).
++
+ pax_softmode= 0/1 to disable/enable PaX softmode on boot already.
+
+ pax_extra_latent_entropy
@@ -263,7 +267,7 @@ index 8ccbf27..afffeb4 100644
pcd. [PARIDE]
diff --git a/Makefile b/Makefile
-index ad368cd..96b21c3 100644
+index b4df9b2..256e7cc 100644
--- a/Makefile
+++ b/Makefile
@@ -241,8 +241,9 @@ CONFIG_SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \
@@ -364,7 +368,7 @@ index ad368cd..96b21c3 100644
vmlinux-dirs := $(patsubst %/,%,$(filter %/, $(init-y) $(init-m) \
$(core-y) $(core-m) $(drivers-y) $(drivers-m) \
-@@ -780,6 +840,8 @@ endif
+@@ -782,6 +842,8 @@ endif
# The actual objects are generated when descending,
# make sure no implicit rule kicks in
@@ -373,7 +377,7 @@ index ad368cd..96b21c3 100644
$(sort $(vmlinux-deps)): $(vmlinux-dirs) ;
# Handle descending into subdirectories listed in $(vmlinux-dirs)
-@@ -789,7 +851,7 @@ $(sort $(vmlinux-deps)): $(vmlinux-dirs) ;
+@@ -791,7 +853,7 @@ $(sort $(vmlinux-deps)): $(vmlinux-dirs) ;
# Error messages still appears in the original language
PHONY += $(vmlinux-dirs)
@@ -382,7 +386,7 @@ index ad368cd..96b21c3 100644
$(Q)$(MAKE) $(build)=$@
# Store (new) KERNELRELASE string in include/config/kernel.release
-@@ -833,6 +895,7 @@ prepare0: archprepare FORCE
+@@ -835,6 +897,7 @@ prepare0: archprepare FORCE
$(Q)$(MAKE) $(build)=.
# All the preparing..
@@ -390,7 +394,7 @@ index ad368cd..96b21c3 100644
prepare: prepare0
# Generate some files
-@@ -940,6 +1003,8 @@ all: modules
+@@ -942,6 +1005,8 @@ all: modules
# using awk while concatenating to the final file.
PHONY += modules
@@ -399,7 +403,7 @@ index ad368cd..96b21c3 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.';
-@@ -955,7 +1020,7 @@ modules.builtin: $(vmlinux-dirs:%=%/modules.builtin)
+@@ -957,7 +1022,7 @@ modules.builtin: $(vmlinux-dirs:%=%/modules.builtin)
# Target to prepare building external modules
PHONY += modules_prepare
@@ -408,7 +412,7 @@ index ad368cd..96b21c3 100644
# Target to install modules
PHONY += modules_install
-@@ -1021,7 +1086,7 @@ MRPROPER_FILES += .config .config.old .version .old_version $(version_h) \
+@@ -1023,7 +1088,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 \
@@ -417,7 +421,7 @@ index ad368cd..96b21c3 100644
# clean - Delete most, but leave enough to build external modules
#
-@@ -1061,6 +1126,7 @@ distclean: mrproper
+@@ -1063,6 +1128,7 @@ distclean: mrproper
\( -name '*.orig' -o -name '*.rej' -o -name '*~' \
-o -name '*.bak' -o -name '#*#' -o -name '.*.orig' \
-o -name '.*.rej' \
@@ -425,7 +429,7 @@ index ad368cd..96b21c3 100644
-o -name '*%' -o -name '.*.cmd' -o -name 'core' \) \
-type f -print | xargs rm -f
-@@ -1221,6 +1287,8 @@ PHONY += $(module-dirs) modules
+@@ -1223,6 +1289,8 @@ PHONY += $(module-dirs) modules
$(module-dirs): crmodverdir $(objtree)/Module.symvers
$(Q)$(MAKE) $(build)=$(patsubst _module_%,%,$@)
@@ -434,7 +438,7 @@ index ad368cd..96b21c3 100644
modules: $(module-dirs)
@$(kecho) ' Building modules, stage 2.';
$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost
-@@ -1357,17 +1425,21 @@ else
+@@ -1359,17 +1427,21 @@ else
target-dir = $(if $(KBUILD_EXTMOD),$(dir $<),$(dir $@))
endif
@@ -460,7 +464,7 @@ index ad368cd..96b21c3 100644
$(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
%.symtypes: %.c prepare scripts FORCE
$(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
-@@ -1377,11 +1449,15 @@ endif
+@@ -1379,11 +1451,15 @@ endif
$(cmd_crmodverdir)
$(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1) \
$(build)=$(build-dir)
@@ -811,10 +815,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 70cd012..71b82cd 100644
+index 136f263..f471277 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
-@@ -1860,7 +1860,7 @@ config ALIGNMENT_TRAP
+@@ -1766,7 +1766,7 @@ config ALIGNMENT_TRAP
config UACCESS_WITH_MEMCPY
bool "Use kernel mem{cpy,set}() for {copy_to,clear}_user()"
@@ -824,7 +828,7 @@ index 70cd012..71b82cd 100644
help
Implement faster copy_to_user and clear_user methods for CPU
diff --git a/arch/arm/include/asm/atomic.h b/arch/arm/include/asm/atomic.h
-index c79f61f..9ac0642 100644
+index da1c77d..2ee6056 100644
--- a/arch/arm/include/asm/atomic.h
+++ b/arch/arm/include/asm/atomic.h
@@ -17,17 +17,35 @@
@@ -1129,8 +1133,44 @@ index c79f61f..9ac0642 100644
+
#define ATOMIC64_INIT(i) { (i) }
+ #ifdef CONFIG_ARM_LPAE
+@@ -257,6 +452,19 @@ static inline u64 atomic64_read(const atomic64_t *v)
+ return result;
+ }
+
++static inline u64 atomic64_read_unchecked(const atomic64_unchecked_t *v)
++{
++ u64 result;
++
++ __asm__ __volatile__("@ atomic64_read_unchecked\n"
++" ldrd %0, %H0, [%1]"
++ : "=&r" (result)
++ : "r" (&v->counter), "Qo" (v->counter)
++ );
++
++ return result;
++}
++
+ static inline void atomic64_set(atomic64_t *v, u64 i)
+ {
+ __asm__ __volatile__("@ atomic64_set\n"
+@@ -265,6 +473,15 @@ static inline void atomic64_set(atomic64_t *v, u64 i)
+ : "r" (&v->counter), "r" (i)
+ );
+ }
++
++static inline void atomic64_set_unchecked(atomic64_unchecked_t *v, u64 i)
++{
++ __asm__ __volatile__("@ atomic64_set_unchecked\n"
++" strd %2, %H2, [%1]"
++ : "=Qo" (v->counter)
++ : "r" (&v->counter), "r" (i)
++ );
++}
+ #else
static inline u64 atomic64_read(const atomic64_t *v)
-@@ -256,6 +451,19 @@ static inline u64 atomic64_read(const atomic64_t *v)
+ {
+@@ -279,6 +496,19 @@ static inline u64 atomic64_read(const atomic64_t *v)
return result;
}
@@ -1150,10 +1190,11 @@ index c79f61f..9ac0642 100644
static inline void atomic64_set(atomic64_t *v, u64 i)
{
u64 tmp;
-@@ -270,6 +478,20 @@ static inline void atomic64_set(atomic64_t *v, u64 i)
+@@ -292,6 +522,21 @@ static inline void atomic64_set(atomic64_t *v, u64 i)
+ : "r" (&v->counter), "r" (i)
: "cc");
}
-
++
+static inline void atomic64_set_unchecked(atomic64_unchecked_t *v, u64 i)
+{
+ u64 tmp;
@@ -1168,10 +1209,10 @@ index c79f61f..9ac0642 100644
+ : "cc");
+}
+
+ #endif
+
static inline void atomic64_add(u64 i, atomic64_t *v)
- {
- u64 result;
-@@ -278,6 +500,36 @@ static inline void atomic64_add(u64 i, atomic64_t *v)
+@@ -302,6 +547,36 @@ static inline void atomic64_add(u64 i, atomic64_t *v)
__asm__ __volatile__("@ atomic64_add\n"
"1: ldrexd %0, %H0, [%3]\n"
" adds %0, %0, %4\n"
@@ -1208,15 +1249,17 @@ index c79f61f..9ac0642 100644
" adc %H0, %H0, %H4\n"
" strexd %1, %0, %H0, [%3]\n"
" teq %1, #0\n"
-@@ -289,12 +541,49 @@ static inline void atomic64_add(u64 i, atomic64_t *v)
+@@ -313,12 +588,49 @@ static inline void atomic64_add(u64 i, atomic64_t *v)
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"
@@ -1249,21 +1292,19 @@ index c79f61f..9ac0642 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"
-@@ -318,23 +607,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
@@ -1272,46 +1313,45 @@ index c79f61f..9ac0642 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"
-@@ -344,6 +644,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"
@@ -1324,22 +1364,19 @@ index c79f61f..9ac0642 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();
-
-@@ -374,6 +707,30 @@ static inline u64 atomic64_cmpxchg(atomic64_t *ptr, u64 old, u64 new)
+ : "=&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;
}
@@ -1370,7 +1407,7 @@ index c79f61f..9ac0642 100644
static inline u64 atomic64_xchg(atomic64_t *ptr, u64 new)
{
u64 result;
-@@ -397,21 +754,34 @@ static inline u64 atomic64_xchg(atomic64_t *ptr, u64 new)
+@@ -421,21 +801,34 @@ static inline u64 atomic64_xchg(atomic64_t *ptr, u64 new)
static inline u64 atomic64_dec_if_positive(atomic64_t *v)
{
@@ -1412,7 +1449,7 @@ index c79f61f..9ac0642 100644
: "=&r" (result), "=&r" (tmp), "+Qo" (v->counter)
: "r" (&v->counter)
: "cc");
-@@ -434,13 +804,25 @@ static inline int atomic64_add_unless(atomic64_t *v, u64 a, u64 u)
+@@ -458,13 +851,25 @@ static inline int atomic64_add_unless(atomic64_t *v, u64 a, u64 u)
" teq %0, %5\n"
" teqeq %H0, %H5\n"
" moveq %1, #0\n"
@@ -1441,7 +1478,7 @@ index c79f61f..9ac0642 100644
: "=&r" (val), "+r" (ret), "=&r" (tmp), "+Qo" (v->counter)
: "r" (&v->counter), "r" (u), "r" (a)
: "cc");
-@@ -453,10 +835,13 @@ static inline int atomic64_add_unless(atomic64_t *v, u64 a, u64 u)
+@@ -477,10 +882,13 @@ static inline int atomic64_add_unless(atomic64_t *v, u64 a, u64 u)
#define atomic64_add_negative(a, v) (atomic64_add_return((a), (v)) < 0)
#define atomic64_inc(v) atomic64_add(1LL, (v))
@@ -1479,7 +1516,7 @@ index 75fe66b..ba3dee4 100644
#endif
diff --git a/arch/arm/include/asm/cacheflush.h b/arch/arm/include/asm/cacheflush.h
-index 738fcba..7a43500 100644
+index 17d0ae8..014e350 100644
--- a/arch/arm/include/asm/cacheflush.h
+++ b/arch/arm/include/asm/cacheflush.h
@@ -116,7 +116,7 @@ struct cpu_cache_fns {
@@ -1543,15 +1580,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
@@ -1562,8 +1599,8 @@ index 6ddbe44..b5e38b1 100644
+#endif
+#define DOMAIN_KERNELCLIENT 1
+
-+#endif
-+
+ #endif
+
#define domain_val(dom,type) ((type) << (2*(dom)))
#ifndef __ASSEMBLY__
@@ -2063,7 +2100,7 @@ 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 cddda1f..ff357f7 100644
+index 1995d1a..76693a2 100644
--- a/arch/arm/include/asm/thread_info.h
+++ b/arch/arm/include/asm/thread_info.h
@@ -77,9 +77,9 @@ struct thread_info {
@@ -2079,20 +2116,20 @@ index cddda1f..ff357f7 100644
.restart_block = { \
.fn = do_no_restart_syscall, \
}, \
-@@ -152,6 +152,12 @@ extern int vfp_restore_user_hwstate(struct user_vfp __user *,
+@@ -152,7 +152,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 */
-+
+-#define TIF_NOHZ 12 /* in adaptive nohz mode */
+/* within 8 bits of TIF_SYSCALL_TRACE
+ * to meet flexible second operand requirements
+ */
+#define TIF_GRSEC_SETXID 12
-+
++#define TIF_NOHZ 13 /* in adaptive nohz mode */
#define TIF_USING_IWMMXT 17
#define TIF_MEMDIE 18 /* is terminating due to OOM killer */
#define TIF_RESTORE_SIGMASK 20
-@@ -165,10 +171,11 @@ extern int vfp_restore_user_hwstate(struct user_vfp __user *,
+@@ -166,10 +170,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)
@@ -2106,7 +2143,7 @@ index cddda1f..ff357f7 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..510061e 100644
+index 7e1f760..d42d7f8 100644
--- a/arch/arm/include/asm/uaccess.h
+++ b/arch/arm/include/asm/uaccess.h
@@ -18,6 +18,7 @@
@@ -2131,7 +2168,7 @@ index 7e1f760..510061e 100644
+{
+
+#ifdef CONFIG_PAX_MEMORY_UDEREF
-+ if (segment_eq(get_fs(), USER_DS) {
++ if (segment_eq(get_fs(), USER_DS)) {
+ BUG_ON(test_domain(DOMAIN_USER, DOMAIN_UDEREF));
+ modify_domain(DOMAIN_USER, DOMAIN_UDEREF);
+ }
@@ -2143,7 +2180,7 @@ index 7e1f760..510061e 100644
+{
+
+#ifdef CONFIG_PAX_MEMORY_UDEREF
-+ if (segment_eq(get_fs(), USER_DS) {
++ if (segment_eq(get_fs(), USER_DS)) {
+ BUG_ON(test_domain(DOMAIN_USER, DOMAIN_NOACCESS));
+ modify_domain(DOMAIN_USER, DOMAIN_NOACCESS);
+ }
@@ -2326,7 +2363,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 0f82098..fb3d3d5 100644
+index 582b405..a78366b 100644
--- a/arch/arm/kernel/entry-armv.S
+++ b/arch/arm/kernel/entry-armv.S
@@ -47,6 +47,87 @@
@@ -2458,7 +2495,7 @@ index 0f82098..fb3d3d5 100644
SPFIX( addeq r2, r2, #4 )
str r3, [sp, #-4]! @ save the "real" r0 copied
@ from the exception stack
-@@ -359,6 +453,9 @@ ENDPROC(__pabt_svc)
+@@ -316,6 +410,9 @@ ENDPROC(__pabt_svc)
.macro usr_entry
UNWIND(.fnstart )
UNWIND(.cantunwind ) @ don't unwind the user space
@@ -2468,7 +2505,7 @@ index 0f82098..fb3d3d5 100644
sub sp, sp, #S_FRAME_SIZE
ARM( stmib sp, {r1 - r12} )
THUMB( stmia sp, {r0 - r12} )
-@@ -456,7 +553,9 @@ __und_usr:
+@@ -414,7 +511,9 @@ __und_usr:
tst r3, #PSR_T_BIT @ Thumb mode?
bne __und_usr_thumb
sub r4, r2, #4 @ ARM instr at LR - 4
@@ -2478,7 +2515,7 @@ index 0f82098..fb3d3d5 100644
#ifdef CONFIG_CPU_ENDIAN_BE8
rev r0, r0 @ little endian instruction
#endif
-@@ -491,10 +590,14 @@ __und_usr_thumb:
+@@ -449,10 +548,14 @@ __und_usr_thumb:
*/
.arch armv6t2
#endif
@@ -2493,7 +2530,17 @@ index 0f82098..fb3d3d5 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
-@@ -733,7 +836,7 @@ ENTRY(__switch_to)
+@@ -481,7 +584,8 @@ ENDPROC(__und_usr)
+ */
+ .pushsection .fixup, "ax"
+ .align 2
+-4: mov pc, r9
++4: pax_close_userland
++ mov pc, r9
+ .popsection
+ .pushsection __ex_table,"a"
+ .long 1b, 4b
+@@ -690,7 +794,7 @@ ENTRY(__switch_to)
THUMB( stmia ip!, {r4 - sl, fp} ) @ Store most regs on stack
THUMB( str sp, [ip], #4 )
THUMB( str lr, [ip], #4 )
@@ -2502,7 +2549,7 @@ index 0f82098..fb3d3d5 100644
ldr r6, [r2, #TI_CPU_DOMAIN]
#endif
set_tls r3, r4, r5
-@@ -742,7 +845,7 @@ ENTRY(__switch_to)
+@@ -699,7 +803,7 @@ ENTRY(__switch_to)
ldr r8, =__stack_chk_guard
ldr r7, [r7, #TSK_STACK_CANARY]
#endif
@@ -2512,7 +2559,7 @@ index 0f82098..fb3d3d5 100644
#endif
mov r5, r0
diff --git a/arch/arm/kernel/entry-common.S b/arch/arm/kernel/entry-common.S
-index fefd7f9..e6f250e 100644
+index bc5bc0a..d0998ca 100644
--- a/arch/arm/kernel/entry-common.S
+++ b/arch/arm/kernel/entry-common.S
@@ -10,18 +10,46 @@
@@ -2565,7 +2612,7 @@ index fefd7f9..e6f250e 100644
.align 5
/*
* This is the fast syscall return path. We do as little as
-@@ -351,6 +379,7 @@ ENDPROC(ftrace_stub)
+@@ -350,6 +378,7 @@ ENDPROC(ftrace_stub)
.align 5
ENTRY(vector_swi)
@@ -2573,7 +2620,7 @@ index fefd7f9..e6f250e 100644
sub sp, sp, #S_FRAME_SIZE
stmia sp, {r0 - r12} @ Calling r0 - r12
ARM( add r8, sp, #S_PC )
-@@ -400,6 +429,12 @@ ENTRY(vector_swi)
+@@ -399,6 +428,12 @@ ENTRY(vector_swi)
ldr scno, [lr, #-4] @ get SWI instruction
#endif
@@ -2587,10 +2634,10 @@ index fefd7f9..e6f250e 100644
ldr ip, __cr_alignment
ldr ip, [ip]
diff --git a/arch/arm/kernel/entry-header.S b/arch/arm/kernel/entry-header.S
-index 9a8531e..812e287 100644
+index 160f337..db67ee4 100644
--- a/arch/arm/kernel/entry-header.S
+++ b/arch/arm/kernel/entry-header.S
-@@ -73,9 +73,66 @@
+@@ -73,6 +73,60 @@
msr cpsr_c, \rtemp @ switch back to the SVC mode
.endm
@@ -2649,18 +2696,22 @@ index 9a8531e..812e287 100644
+ .endm
+
#ifndef CONFIG_THUMB2_KERNEL
- .macro svc_exit, rpsr
- msr spsr_cxsf, \rpsr
+ .macro svc_exit, rpsr, irq = 0
+ .if \irq != 0
+@@ -92,6 +146,9 @@
+ blne trace_hardirqs_off
+ #endif
+ .endif
+
+ pax_exit_kernel
+
+ msr spsr_cxsf, \rpsr
#if defined(CONFIG_CPU_V6)
ldr r0, [sp]
- strex r1, r2, [sp] @ clear the exclusive monitor
-@@ -121,6 +178,9 @@
- .endm
- #else /* CONFIG_THUMB2_KERNEL */
- .macro svc_exit, rpsr
+@@ -155,6 +212,9 @@
+ blne trace_hardirqs_off
+ #endif
+ .endif
+
+ pax_exit_kernel
+
@@ -2796,7 +2847,7 @@ index 1f2740e..b36e225 100644
};
diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c
-index 047d3e4..7e96107 100644
+index 6e8931c..82ec6a5 100644
--- a/arch/arm/kernel/process.c
+++ b/arch/arm/kernel/process.c
@@ -28,7 +28,6 @@
@@ -2807,22 +2858,27 @@ index 047d3e4..7e96107 100644
#include <linux/hw_breakpoint.h>
#include <linux/cpuidle.h>
#include <linux/leds.h>
-@@ -251,9 +250,10 @@ void machine_power_off(void)
- machine_shutdown();
+@@ -223,6 +222,7 @@ void machine_power_off(void)
+
if (pm_power_off)
pm_power_off();
+ BUG();
}
+ /*
+@@ -236,7 +236,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)
{
- machine_shutdown();
+ smp_send_stop();
+
+@@ -258,8 +258,8 @@ void __show_regs(struct pt_regs *regs)
+
+ show_regs_print_info(KERN_DEFAULT);
-@@ -278,8 +278,8 @@ void __show_regs(struct pt_regs *regs)
- init_utsname()->release,
- (int)strcspn(init_utsname()->version, " "),
- init_utsname()->version);
- print_symbol("PC is at %s\n", instruction_pointer(regs));
- print_symbol("LR is at %s\n", regs->ARM_lr);
+ printk("PC is at %pA\n", instruction_pointer(regs));
@@ -2830,7 +2886,7 @@ index 047d3e4..7e96107 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,
-@@ -447,12 +447,6 @@ unsigned long get_wchan(struct task_struct *p)
+@@ -426,12 +426,6 @@ unsigned long get_wchan(struct task_struct *p)
return 0;
}
@@ -2843,14 +2899,17 @@ index 047d3e4..7e96107 100644
#ifdef CONFIG_MMU
/*
* The vectors page is always readable from user space for the
-@@ -465,9 +459,8 @@ static int __init gate_vma_init(void)
- {
- gate_vma.vm_start = 0xffff0000;
- gate_vma.vm_end = 0xffff0000 + PAGE_SIZE;
-- gate_vma.vm_page_prot = PAGE_READONLY_EXEC;
-- gate_vma.vm_flags = VM_READ | VM_EXEC |
-- VM_MAYREAD | VM_MAYEXEC;
-+ gate_vma.vm_flags = VM_NONE;
+@@ -441,12 +435,12 @@ unsigned long arch_randomize_brk(struct mm_struct *mm)
+ static struct vm_area_struct gate_vma = {
+ .vm_start = 0xffff0000,
+ .vm_end = 0xffff0000 + PAGE_SIZE,
+- .vm_flags = VM_READ | VM_EXEC | VM_MAYREAD | VM_MAYEXEC,
++ .vm_flags = VM_NONE,
+ };
+
+ static int __init gate_vma_init(void)
+ {
+- gate_vma.vm_page_prot = PAGE_READONLY_EXEC;
+ gate_vma.vm_page_prot = vm_get_page_prot(gate_vma.vm_flags);
return 0;
}
@@ -2893,10 +2952,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 234e339..81264a1 100644
+index b4b1d39..efdc9be 100644
--- a/arch/arm/kernel/setup.c
+++ b/arch/arm/kernel/setup.c
-@@ -96,21 +96,23 @@ EXPORT_SYMBOL(system_serial_high);
+@@ -97,21 +97,23 @@ EXPORT_SYMBOL(system_serial_high);
unsigned int elf_hwcap __read_mostly;
EXPORT_SYMBOL(elf_hwcap);
@@ -2925,7 +2984,7 @@ index 234e339..81264a1 100644
EXPORT_SYMBOL(outer_cache);
#endif
-@@ -235,9 +237,13 @@ static int __get_cpu_architecture(void)
+@@ -236,9 +238,13 @@ static int __get_cpu_architecture(void)
asm("mrc p15, 0, %0, c0, c1, 4"
: "=r" (mmfr0));
if ((mmfr0 & 0x0000000f) >= 0x00000003 ||
@@ -2941,7 +3000,7 @@ index 234e339..81264a1 100644
(mmfr0 & 0x000000f0) == 0x00000020)
cpu_arch = CPU_ARCH_ARMv6;
else
-@@ -478,7 +484,7 @@ static void __init setup_processor(void)
+@@ -479,7 +485,7 @@ static void __init setup_processor(void)
__cpu_architecture = __get_cpu_architecture();
#ifdef MULTI_CPU
@@ -2971,22 +3030,21 @@ index 296786b..a8d4dd5 100644
- */
- flush_icache_range((unsigned long)rc,
- (unsigned long)(rc + 2));
--
-- retcode = ((unsigned long)rc) + thumb;
-- }
+ /*
+ * Ensure that the instruction cache sees
+ * the return code written onto the stack.
+ */
+ flush_icache_range((unsigned long)rc,
+ (unsigned long)(rc + 2));
-+
+
+- retcode = ((unsigned long)rc) + thumb;
+- }
+ retcode = ((unsigned long)rc) + thumb;
}
regs->ARM_r0 = map_sig(ksig->sig);
diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c
-index 1f2cccc..f40c02e 100644
+index 5919eb4..b5d6dfe 100644
--- a/arch/arm/kernel/smp.c
+++ b/arch/arm/kernel/smp.c
@@ -70,7 +70,7 @@ enum ipi_msg_type {
@@ -2999,7 +3057,7 @@ index 1f2cccc..f40c02e 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 1c08911..264f009 100644
+index 18b32e8..b0c8dca 100644
--- a/arch/arm/kernel/traps.c
+++ b/arch/arm/kernel/traps.c
@@ -57,7 +57,7 @@ static void dump_mem(const char *, const char *, unsigned long, unsigned long);
@@ -3011,7 +3069,7 @@ index 1c08911..264f009 100644
#else
printk("Function entered at [<%08lx>] from [<%08lx>]\n", where, from);
#endif
-@@ -266,6 +266,8 @@ static arch_spinlock_t die_lock = __ARCH_SPIN_LOCK_UNLOCKED;
+@@ -259,6 +259,8 @@ static arch_spinlock_t die_lock = __ARCH_SPIN_LOCK_UNLOCKED;
static int die_owner = -1;
static unsigned int die_nest_count;
@@ -3020,7 +3078,7 @@ index 1c08911..264f009 100644
static unsigned long oops_begin(void)
{
int cpu;
-@@ -308,6 +310,9 @@ static void oops_end(unsigned long flags, struct pt_regs *regs, int signr)
+@@ -301,6 +303,9 @@ static void oops_end(unsigned long flags, struct pt_regs *regs, int signr)
panic("Fatal exception in interrupt");
if (panic_on_oops)
panic("Fatal exception");
@@ -3030,7 +3088,7 @@ index 1c08911..264f009 100644
if (signr)
do_exit(signr);
}
-@@ -601,7 +606,9 @@ asmlinkage int arm_syscall(int no, struct pt_regs *regs)
+@@ -594,7 +599,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)
*/
@@ -3040,7 +3098,7 @@ index 1c08911..264f009 100644
}
return 0;
-@@ -841,13 +848,10 @@ void __init early_trap_init(void *vectors_base)
+@@ -834,13 +841,10 @@ void __init early_trap_init(void *vectors_base)
*/
kuser_get_tls_init(vectors);
@@ -3060,7 +3118,7 @@ index 1c08911..264f009 100644
+
}
diff --git a/arch/arm/kernel/vmlinux.lds.S b/arch/arm/kernel/vmlinux.lds.S
-index b571484..4b2fc9b 100644
+index a871b8e..123b00a 100644
--- a/arch/arm/kernel/vmlinux.lds.S
+++ b/arch/arm/kernel/vmlinux.lds.S
@@ -8,7 +8,11 @@
@@ -3258,10 +3316,10 @@ index 025f742..8432b08 100644
/*
* This test is stubbed out of the main function above to keep
diff --git a/arch/arm/mach-kirkwood/common.c b/arch/arm/mach-kirkwood/common.c
-index 49792a0..f192052 100644
+index f389228..592ef66 100644
--- a/arch/arm/mach-kirkwood/common.c
+++ b/arch/arm/mach-kirkwood/common.c
-@@ -150,7 +150,16 @@ static void clk_gate_fn_disable(struct clk_hw *hw)
+@@ -149,7 +149,16 @@ static void clk_gate_fn_disable(struct clk_hw *hw)
clk_gate_ops.disable(hw);
}
@@ -3279,7 +3337,7 @@ index 49792a0..f192052 100644
static struct clk __init *clk_register_gate_fn(struct device *dev,
const char *name,
-@@ -184,14 +193,6 @@ static struct clk __init *clk_register_gate_fn(struct device *dev,
+@@ -183,14 +192,6 @@ static struct clk __init *clk_register_gate_fn(struct device *dev,
gate_fn->fn_en = fn_en;
gate_fn->fn_dis = fn_dis;
@@ -3308,10 +3366,10 @@ index f6eeb87..cc90868 100644
};
diff --git a/arch/arm/mach-omap2/gpmc.c b/arch/arm/mach-omap2/gpmc.c
-index 410e1ba..1d2dd59 100644
+index 6c4da12..d9ca72d 100644
--- a/arch/arm/mach-omap2/gpmc.c
+++ b/arch/arm/mach-omap2/gpmc.c
-@@ -145,7 +145,6 @@ struct omap3_gpmc_regs {
+@@ -147,7 +147,6 @@ struct omap3_gpmc_regs {
};
static struct gpmc_client_irq gpmc_client_irq[GPMC_NR_IRQ];
@@ -3319,7 +3377,7 @@ index 410e1ba..1d2dd59 100644
static unsigned gpmc_irq_start;
static struct resource gpmc_mem_root;
-@@ -707,6 +706,18 @@ static void gpmc_irq_noop(struct irq_data *data) { }
+@@ -711,6 +710,18 @@ static void gpmc_irq_noop(struct irq_data *data) { }
static unsigned int gpmc_irq_noop_ret(struct irq_data *data) { return 0; }
@@ -3338,7 +3396,7 @@ index 410e1ba..1d2dd59 100644
static int gpmc_setup_irq(void)
{
int i;
-@@ -721,15 +732,6 @@ static int gpmc_setup_irq(void)
+@@ -725,15 +736,6 @@ static int gpmc_setup_irq(void)
return gpmc_irq_start;
}
@@ -3368,7 +3426,7 @@ index f8bb3b9..831e7b8 100644
};
diff --git a/arch/arm/mach-omap2/omap_device.c b/arch/arm/mach-omap2/omap_device.c
-index 381be7a..89b9c7e 100644
+index e6d2307..d057195 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)
@@ -3409,10 +3467,10 @@ 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 3a750de..4c9b88f 100644
+index 7341eff..fd75e34 100644
--- a/arch/arm/mach-omap2/omap_hwmod.c
+++ b/arch/arm/mach-omap2/omap_hwmod.c
-@@ -191,10 +191,10 @@ struct omap_hwmod_soc_ops {
+@@ -194,10 +194,10 @@ struct omap_hwmod_soc_ops {
int (*init_clkdm)(struct omap_hwmod *oh);
void (*update_context_lost)(struct omap_hwmod *oh);
int (*get_context_lost)(struct omap_hwmod *oh);
@@ -3449,10 +3507,23 @@ index d15c7bb..b2d1f0c 100644
pdev = omap_device_build(dev_name, id, oh, &pdata,
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-ux500/include/mach/setup.h b/arch/arm/mach-ux500/include/mach/setup.h
-index bddce2b..3eb04e2 100644
---- a/arch/arm/mach-ux500/include/mach/setup.h
-+++ b/arch/arm/mach-ux500/include/mach/setup.h
+diff --git a/arch/arm/mach-tegra/cpuidle-tegra20.c b/arch/arm/mach-tegra/cpuidle-tegra20.c
+index 0cdba8d..297993e 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,
+ bool entered_lp2 = false;
+
+ if (tegra_pending_sgi())
+- ACCESS_ONCE(abort_flag) = true;
++ ACCESS_ONCE_RW(abort_flag) = true;
+
+ cpuidle_coupled_parallel_barrier(dev, &abort_barrier);
+
+diff --git a/arch/arm/mach-ux500/setup.h b/arch/arm/mach-ux500/setup.h
+index cad3ca86..1d79e0f 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);
.type = MT_DEVICE, \
}
@@ -3468,10 +3539,10 @@ index bddce2b..3eb04e2 100644
extern void ux500_cpu_die(unsigned int cpu);
diff --git a/arch/arm/mm/Kconfig b/arch/arm/mm/Kconfig
-index 4045c49..0263c07 100644
+index 35955b5..b475042 100644
--- a/arch/arm/mm/Kconfig
+++ b/arch/arm/mm/Kconfig
-@@ -425,7 +425,7 @@ config CPU_32v5
+@@ -432,7 +432,7 @@ config CPU_32v5
config CPU_32v6
bool
@@ -3480,7 +3551,7 @@ index 4045c49..0263c07 100644
select TLS_REG_EMUL if !CPU_32v6K && !MMU
config CPU_32v6K
-@@ -574,6 +574,7 @@ config CPU_CP15_MPU
+@@ -581,6 +581,7 @@ config CPU_CP15_MPU
config CPU_USE_DOMAINS
bool
@@ -3489,7 +3560,7 @@ index 4045c49..0263c07 100644
This option enables or disables the use of domain switching
via the set_fs() function.
diff --git a/arch/arm/mm/alignment.c b/arch/arm/mm/alignment.c
-index db26e2e..ee44569 100644
+index 6f4585b..7b6f52b 100644
--- a/arch/arm/mm/alignment.c
+++ b/arch/arm/mm/alignment.c
@@ -211,10 +211,12 @@ union offset_union {
@@ -3738,7 +3809,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 ad722f1..763fdd3 100644
+index 0ecc43f..190b956 100644
--- a/arch/arm/mm/init.c
+++ b/arch/arm/mm/init.c
@@ -30,6 +30,8 @@
@@ -3750,12 +3821,12 @@ index ad722f1..763fdd3 100644
#include <asm/mach/arch.h>
#include <asm/mach/map.h>
-@@ -736,7 +738,46 @@ void free_initmem(void)
+@@ -726,7 +728,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;
@@ -3792,11 +3863,11 @@ index ad722f1..763fdd3 100644
+ }
+ }
+#endif
-
++
+#ifdef CONFIG_HAVE_TCM
poison_init_mem(&__tcm_start, &__tcm_end - &__tcm_start);
- totalram_pages += free_area(__phys_to_pfn(__pa(&__tcm_start)),
- __phys_to_pfn(__pa(&__tcm_end)),
+ free_reserved_area(&__tcm_start, &__tcm_end, 0, "TCM link");
+ #endif
diff --git a/arch/arm/mm/ioremap.c b/arch/arm/mm/ioremap.c
index 04d9006..c547d85 100644
--- a/arch/arm/mm/ioremap.c
@@ -3926,7 +3997,7 @@ index 10062ce..8695745 100644
mm->unmap_area = arch_unmap_area_topdown;
}
diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c
-index a84ff76..f221c1d 100644
+index 4d409e6..f375351 100644
--- a/arch/arm/mm/mmu.c
+++ b/arch/arm/mm/mmu.c
@@ -36,6 +36,22 @@
@@ -3952,9 +4023,9 @@ index a84ff76..f221c1d 100644
/*
* empty_zero_page is a special page that is used for
* zero-initialized data and COW.
-@@ -211,10 +227,18 @@ void adjust_cr(unsigned long mask, unsigned long set)
- }
- #endif
+@@ -228,10 +244,18 @@ __setup("noalign", noalign_setup);
+
+ #endif /* ifdef CONFIG_CPU_CP15 / else */
-#define PROT_PTE_DEVICE L_PTE_PRESENT|L_PTE_YOUNG|L_PTE_DIRTY|L_PTE_XN
+#define PROT_PTE_DEVICE L_PTE_PRESENT|L_PTE_YOUNG|L_PTE_DIRTY
@@ -3973,7 +4044,7 @@ index a84ff76..f221c1d 100644
[MT_DEVICE] = { /* Strongly ordered / ARMv6 shared device */
.prot_pte = PROT_PTE_DEVICE | L_PTE_MT_DEV_SHARED |
L_PTE_SHARED,
-@@ -243,16 +267,16 @@ static struct mem_type mem_types[] = {
+@@ -260,16 +284,16 @@ static struct mem_type mem_types[] = {
[MT_UNCACHED] = {
.prot_pte = PROT_PTE_DEVICE,
.prot_l1 = PMD_TYPE_TABLE,
@@ -3993,7 +4064,7 @@ index a84ff76..f221c1d 100644
.domain = DOMAIN_KERNEL,
},
#endif
-@@ -260,36 +284,54 @@ static struct mem_type mem_types[] = {
+@@ -277,36 +301,65 @@ static struct mem_type mem_types[] = {
.prot_pte = L_PTE_PRESENT | L_PTE_YOUNG | L_PTE_DIRTY |
L_PTE_RDONLY,
.prot_l1 = PMD_TYPE_TABLE,
@@ -4001,9 +4072,21 @@ index a84ff76..f221c1d 100644
+ .domain = DOMAIN_VECTORS,
},
[MT_HIGH_VECTORS] = {
- .prot_pte = L_PTE_PRESENT | L_PTE_YOUNG | L_PTE_DIRTY |
+- .prot_pte = L_PTE_PRESENT | L_PTE_YOUNG | L_PTE_DIRTY |
- L_PTE_USER | L_PTE_RDONLY,
-+ L_PTE_RDONLY,
++ /* we always want the vector page to be noaccess for userland on archs with
++ XN where we can enforce some reasonable measure of security
++ therefore, when kernexec is disabled, instead of L_PTE_USER | L_PTE_RDONLY
++ which turns into supervisor rwx, userland rx, we instead omit that entirely,
++ leaving it as supervisor rwx only
++ */
++#ifdef CONFIG_PAX_KERNEXEC
++ .prot_pte = L_PTE_PRESENT | L_PTE_YOUNG | L_PTE_DIRTY | L_PTE_RDONLY,
++#elif __LINUX_ARM_ARCH__ >= 6
++ .prot_pte = L_PTE_PRESENT | L_PTE_YOUNG | L_PTE_DIRTY,
++#else
++ .prot_pte = L_PTE_PRESENT | L_PTE_YOUNG | L_PTE_DIRTY | L_PTE_USER | L_PTE_RDONLY,
++#endif
.prot_l1 = PMD_TYPE_TABLE,
- .domain = DOMAIN_USER,
+ .domain = DOMAIN_VECTORS,
@@ -4057,7 +4140,7 @@ index a84ff76..f221c1d 100644
.domain = DOMAIN_KERNEL,
},
[MT_MEMORY_ITCM] = {
-@@ -299,10 +341,10 @@ static struct mem_type mem_types[] = {
+@@ -316,10 +369,10 @@ static struct mem_type mem_types[] = {
},
[MT_MEMORY_SO] = {
.prot_pte = L_PTE_PRESENT | L_PTE_YOUNG | L_PTE_DIRTY |
@@ -4070,7 +4153,7 @@ index a84ff76..f221c1d 100644
.domain = DOMAIN_KERNEL,
},
[MT_MEMORY_DMA_READY] = {
-@@ -388,9 +430,35 @@ static void __init build_mem_type_table(void)
+@@ -405,9 +458,35 @@ static void __init build_mem_type_table(void)
* to prevent speculative instruction fetches.
*/
mem_types[MT_DEVICE].prot_sect |= PMD_SECT_XN;
@@ -4106,7 +4189,7 @@ index a84ff76..f221c1d 100644
}
if (cpu_arch >= CPU_ARCH_ARMv7 && (cr & CR_TRE)) {
/*
-@@ -451,6 +519,9 @@ static void __init build_mem_type_table(void)
+@@ -468,6 +547,9 @@ static void __init build_mem_type_table(void)
* from SVC mode and no access from userspace.
*/
mem_types[MT_ROM].prot_sect |= PMD_SECT_APX|PMD_SECT_AP_WRITE;
@@ -4116,7 +4199,7 @@ index a84ff76..f221c1d 100644
mem_types[MT_MINICLEAN].prot_sect |= PMD_SECT_APX|PMD_SECT_AP_WRITE;
mem_types[MT_CACHECLEAN].prot_sect |= PMD_SECT_APX|PMD_SECT_AP_WRITE;
#endif
-@@ -468,11 +539,17 @@ static void __init build_mem_type_table(void)
+@@ -485,11 +567,17 @@ static void __init build_mem_type_table(void)
mem_types[MT_DEVICE_WC].prot_pte |= L_PTE_SHARED;
mem_types[MT_DEVICE_CACHED].prot_sect |= PMD_SECT_S;
mem_types[MT_DEVICE_CACHED].prot_pte |= L_PTE_SHARED;
@@ -4138,7 +4221,7 @@ index a84ff76..f221c1d 100644
}
}
-@@ -483,15 +560,20 @@ static void __init build_mem_type_table(void)
+@@ -500,15 +588,20 @@ static void __init build_mem_type_table(void)
if (cpu_arch >= CPU_ARCH_ARMv6) {
if (cpu_arch >= CPU_ARCH_ARMv7 && (cr & CR_TRE)) {
/* Non-cacheable Normal is XCB = 001 */
@@ -4162,7 +4245,7 @@ index a84ff76..f221c1d 100644
}
#ifdef CONFIG_ARM_LPAE
-@@ -507,6 +589,8 @@ static void __init build_mem_type_table(void)
+@@ -524,6 +617,8 @@ static void __init build_mem_type_table(void)
vecs_pgprot |= PTE_EXT_AF;
#endif
@@ -4171,7 +4254,7 @@ index a84ff76..f221c1d 100644
for (i = 0; i < 16; i++) {
pteval_t v = pgprot_val(protection_map[i]);
protection_map[i] = __pgprot(v | user_pgprot);
-@@ -524,10 +608,15 @@ static void __init build_mem_type_table(void)
+@@ -541,10 +636,15 @@ static void __init build_mem_type_table(void)
mem_types[MT_LOW_VECTORS].prot_l1 |= ecc_mask;
mem_types[MT_HIGH_VECTORS].prot_l1 |= ecc_mask;
@@ -4190,7 +4273,7 @@ index a84ff76..f221c1d 100644
mem_types[MT_ROM].prot_sect |= cp->pmd;
switch (cp->pmd) {
-@@ -1147,18 +1236,15 @@ void __init arm_mm_memblock_reserve(void)
+@@ -1166,18 +1266,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.
*/
@@ -4202,18 +4285,18 @@ index a84ff76..f221c1d 100644
struct map_desc map;
unsigned long addr;
- void *vectors;
--
+
- /*
- * Allocate the vector page early.
- */
- vectors = early_alloc(PAGE_SIZE);
-
+-
- early_trap_init(vectors);
+ early_trap_init(&vectors);
for (addr = VMALLOC_START; addr; addr += PMD_SIZE)
pmd_clear(pmd_off_k(addr));
-@@ -1198,7 +1284,7 @@ static void __init devicemaps_init(struct machine_desc *mdesc)
+@@ -1217,7 +1314,7 @@ static void __init devicemaps_init(struct machine_desc *mdesc)
* location (0xffff0000). If we aren't using high-vectors, also
* create a mapping at the low-vectors virtual address.
*/
@@ -4222,7 +4305,7 @@ index a84ff76..f221c1d 100644
map.virtual = 0xffff0000;
map.length = PAGE_SIZE;
map.type = MT_HIGH_VECTORS;
-@@ -1256,8 +1342,39 @@ static void __init map_lowmem(void)
+@@ -1275,8 +1372,39 @@ static void __init map_lowmem(void)
map.pfn = __phys_to_pfn(start);
map.virtual = __phys_to_virt(start);
map.length = end - start;
@@ -4264,7 +4347,7 @@ index a84ff76..f221c1d 100644
}
}
diff --git a/arch/arm/mm/proc-v7-2level.S b/arch/arm/mm/proc-v7-2level.S
-index 78f520b..31f0cb6 100644
+index 9704097..3e36dde 100644
--- a/arch/arm/mm/proc-v7-2level.S
+++ b/arch/arm/mm/proc-v7-2level.S
@@ -99,6 +99,9 @@ ENTRY(cpu_v7_set_pte_ext)
@@ -4291,10 +4374,10 @@ index a5bc92d..0bb4730 100644
+ pax_close_kernel();
}
diff --git a/arch/arm/plat-samsung/include/plat/dma-ops.h b/arch/arm/plat-samsung/include/plat/dma-ops.h
-index 1141782..0959d64 100644
+index ce6d763..cfea917 100644
--- a/arch/arm/plat-samsung/include/plat/dma-ops.h
+++ b/arch/arm/plat-samsung/include/plat/dma-ops.h
-@@ -48,7 +48,7 @@ struct samsung_dma_ops {
+@@ -47,7 +47,7 @@ struct samsung_dma_ops {
int (*started)(unsigned ch);
int (*flush)(unsigned ch);
int (*stop)(unsigned ch);
@@ -4893,10 +4976,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 79521d5..43dddff 100644
+index 2b3c2d7..a318d84 100644
--- a/arch/ia64/kernel/palinfo.c
+++ b/arch/ia64/kernel/palinfo.c
-@@ -1006,7 +1006,7 @@ static int __cpuinit palinfo_cpu_callback(struct notifier_block *nfb,
+@@ -980,7 +980,7 @@ static int __cpuinit palinfo_cpu_callback(struct notifier_block *nfb,
return NOTIFY_OK;
}
@@ -4906,10 +4989,10 @@ index 79521d5..43dddff 100644
.notifier_call = palinfo_cpu_callback,
.priority = 0,
diff --git a/arch/ia64/kernel/salinfo.c b/arch/ia64/kernel/salinfo.c
-index aa527d7..f237752 100644
+index 4bc580a..7767f24 100644
--- a/arch/ia64/kernel/salinfo.c
+++ b/arch/ia64/kernel/salinfo.c
-@@ -616,7 +616,7 @@ salinfo_cpu_callback(struct notifier_block *nb, unsigned long action, void *hcpu
+@@ -609,7 +609,7 @@ salinfo_cpu_callback(struct notifier_block *nb, unsigned long action, void *hcpu
return NOTIFY_OK;
}
@@ -5050,7 +5133,7 @@ index 76069c1..c2aa816 100644
}
diff --git a/arch/ia64/mm/init.c b/arch/ia64/mm/init.c
-index 20bc967..a26993e 100644
+index d1fe4b4..2628f37 100644
--- a/arch/ia64/mm/init.c
+++ b/arch/ia64/mm/init.c
@@ -120,6 +120,19 @@ ia64_init_addr_space (void)
@@ -5247,10 +5330,10 @@ index c1f6afa..38cc6e9 100644
#endif /* _ASM_EXEC_H */
diff --git a/arch/mips/include/asm/page.h b/arch/mips/include/asm/page.h
-index eab99e5..607c98e 100644
+index f59552f..3abe9b9 100644
--- a/arch/mips/include/asm/page.h
+++ b/arch/mips/include/asm/page.h
-@@ -96,7 +96,7 @@ extern void copy_user_highpage(struct page *to, struct page *from,
+@@ -95,7 +95,7 @@ extern void copy_user_highpage(struct page *to, struct page *from,
#ifdef CONFIG_CPU_MIPS32
typedef struct { unsigned long pte_low, pte_high; } pte_t;
#define pte_val(x) ((x).pte_low | ((unsigned long long)(x).pte_high << 32))
@@ -5276,10 +5359,10 @@ index 881d18b..cea38bc 100644
/*
diff --git a/arch/mips/include/asm/thread_info.h b/arch/mips/include/asm/thread_info.h
-index 178f792..8ebc510 100644
+index 895320e..bf63e10 100644
--- a/arch/mips/include/asm/thread_info.h
+++ b/arch/mips/include/asm/thread_info.h
-@@ -111,6 +111,8 @@ register struct thread_info *__current_thread_info __asm__("$28");
+@@ -115,6 +115,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 */
@@ -5288,7 +5371,7 @@ index 178f792..8ebc510 100644
#define TIF_SYSCALL_TRACE 31 /* syscall trace active */
#define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE)
-@@ -126,15 +128,18 @@ register struct thread_info *__current_thread_info __asm__("$28");
+@@ -130,15 +132,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)
@@ -5310,7 +5393,7 @@ index 178f792..8ebc510 100644
#endif /* __KERNEL__ */
diff --git a/arch/mips/kernel/binfmt_elfn32.c b/arch/mips/kernel/binfmt_elfn32.c
-index e06f777..3244284 100644
+index 1188e00..41cf144 100644
--- a/arch/mips/kernel/binfmt_elfn32.c
+++ b/arch/mips/kernel/binfmt_elfn32.c
@@ -50,6 +50,13 @@ typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG];
@@ -5328,10 +5411,10 @@ index e06f777..3244284 100644
#include <linux/module.h>
#include <linux/elfcore.h>
diff --git a/arch/mips/kernel/binfmt_elfo32.c b/arch/mips/kernel/binfmt_elfo32.c
-index 556a435..b4fd2e3 100644
+index 202e581..689ca79 100644
--- a/arch/mips/kernel/binfmt_elfo32.c
+++ b/arch/mips/kernel/binfmt_elfo32.c
-@@ -52,6 +52,13 @@ typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG];
+@@ -56,6 +56,13 @@ typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG];
#undef ELF_ET_DYN_BASE
#define ELF_ET_DYN_BASE (TASK32_SIZE / 3 * 2)
@@ -5346,10 +5429,10 @@ index 556a435..b4fd2e3 100644
/*
diff --git a/arch/mips/kernel/process.c b/arch/mips/kernel/process.c
-index 3be4405..a799827 100644
+index c6a041d..b3e7318 100644
--- a/arch/mips/kernel/process.c
+++ b/arch/mips/kernel/process.c
-@@ -461,15 +461,3 @@ unsigned long get_wchan(struct task_struct *task)
+@@ -563,15 +563,3 @@ unsigned long get_wchan(struct task_struct *task)
out:
return pc;
}
@@ -5393,7 +5476,7 @@ index 9c6299c..2fb4c22 100644
goto out;
diff --git a/arch/mips/kernel/scall32-o32.S b/arch/mips/kernel/scall32-o32.S
-index 9ea2964..c4329c3 100644
+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)
@@ -5406,7 +5489,7 @@ index 9ea2964..c4329c3 100644
bnez t0, syscall_trace_entry # -> yes
diff --git a/arch/mips/kernel/scall64-64.S b/arch/mips/kernel/scall64-64.S
-index 36cfd40..b1436e0 100644
+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)
@@ -5419,7 +5502,7 @@ index 36cfd40..b1436e0 100644
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 693d60b..ae0ba75 100644
+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)
@@ -5432,7 +5515,7 @@ index 693d60b..ae0ba75 100644
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 af8887f..611ccb6 100644
+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)
@@ -5640,12 +5723,12 @@ index 4ce7a01..449202a 100644
#endif /* __ASM_OPENRISC_CACHE_H */
diff --git a/arch/parisc/include/asm/atomic.h b/arch/parisc/include/asm/atomic.h
-index f38e198..4179e38 100644
+index 472886c..00e7df9 100644
--- a/arch/parisc/include/asm/atomic.h
+++ b/arch/parisc/include/asm/atomic.h
-@@ -229,6 +229,16 @@ static __inline__ int atomic64_add_unless(atomic64_t *v, long a, long u)
-
- #define atomic64_inc_not_zero(v) atomic64_add_unless((v), 1, 0)
+@@ -252,6 +252,16 @@ static inline long atomic64_dec_if_positive(atomic64_t *v)
+ return dec;
+ }
+#define atomic64_read_unchecked(v) atomic64_read(v)
+#define atomic64_set_unchecked(v, i) atomic64_set((v), (i))
@@ -5947,10 +6030,10 @@ index 5dfd248..64914ac 100644
return addr;
}
diff --git a/arch/parisc/kernel/traps.c b/arch/parisc/kernel/traps.c
-index c6ae9f5..e9c3cf4 100644
+index 04e47c6..7a8faf6 100644
--- a/arch/parisc/kernel/traps.c
+++ b/arch/parisc/kernel/traps.c
-@@ -733,9 +733,7 @@ void notrace handle_interruption(int code, struct pt_regs *regs)
+@@ -727,9 +727,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]);
@@ -6177,7 +6260,7 @@ index 9e495c9..b6878e5 100644
#define SMP_CACHE_BYTES L1_CACHE_BYTES
diff --git a/arch/powerpc/include/asm/elf.h b/arch/powerpc/include/asm/elf.h
-index ac9790f..6d30741 100644
+index cc0655a..13eac2e 100644
--- a/arch/powerpc/include/asm/elf.h
+++ b/arch/powerpc/include/asm/elf.h
@@ -28,8 +28,19 @@
@@ -6202,7 +6285,7 @@ index ac9790f..6d30741 100644
/*
* Our registers are always unsigned longs, whether we're a 32 bit
-@@ -122,10 +133,6 @@ extern int arch_setup_additional_pages(struct linux_binprm *bprm,
+@@ -123,10 +134,6 @@ extern int arch_setup_additional_pages(struct linux_binprm *bprm,
(0x7ff >> (PAGE_SHIFT - 12)) : \
(0x3ffff >> (PAGE_SHIFT - 12)))
@@ -6252,7 +6335,7 @@ index 8565c25..2865190 100644
return (vm_flags & VM_SAO) ? __pgprot(_PAGE_SAO) : __pgprot(0);
}
diff --git a/arch/powerpc/include/asm/page.h b/arch/powerpc/include/asm/page.h
-index f072e97..b436dee 100644
+index 988c812..63c7d70 100644
--- a/arch/powerpc/include/asm/page.h
+++ b/arch/powerpc/include/asm/page.h
@@ -220,8 +220,9 @@ extern long long virt_phys_offset;
@@ -6274,14 +6357,14 @@ index f072e97..b436dee 100644
+#define ktla_ktva(addr) (addr)
+#define ktva_ktla(addr) (addr)
+
+ #ifndef CONFIG_PPC_BOOK3S_64
/*
* Use the top bit of the higher-level page table entries to indicate whether
- * the entries we point to contain hugepages. This works because we know that
diff --git a/arch/powerpc/include/asm/page_64.h b/arch/powerpc/include/asm/page_64.h
-index cd915d6..c10cee8 100644
+index 88693ce..ac6f9ab 100644
--- a/arch/powerpc/include/asm/page_64.h
+++ b/arch/powerpc/include/asm/page_64.h
-@@ -154,15 +154,18 @@ do { \
+@@ -153,15 +153,18 @@ do { \
* stack by default, so in the absence of a PT_GNU_STACK program header
* we turn execute permission off.
*/
@@ -6303,10 +6386,10 @@ index cd915d6..c10cee8 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 292725c..f87ae14 100644
+index b66ae72..4a378cd 100644
--- a/arch/powerpc/include/asm/pgalloc-64.h
+++ b/arch/powerpc/include/asm/pgalloc-64.h
-@@ -50,6 +50,7 @@ static inline void pgd_free(struct mm_struct *mm, pgd_t *pgd)
+@@ -53,6 +53,7 @@ static inline void pgd_free(struct mm_struct *mm, pgd_t *pgd)
#ifndef CONFIG_PPC_64K_PAGES
#define pgd_populate(MM, PGD, PUD) pgd_set(PGD, PUD)
@@ -6314,7 +6397,7 @@ index 292725c..f87ae14 100644
static inline pud_t *pud_alloc_one(struct mm_struct *mm, unsigned long addr)
{
-@@ -67,6 +68,11 @@ static inline void pud_populate(struct mm_struct *mm, pud_t *pud, pmd_t *pmd)
+@@ -70,6 +71,11 @@ static inline void pud_populate(struct mm_struct *mm, pud_t *pud, pmd_t *pmd)
pud_set(pud, (unsigned long)pmd);
}
@@ -6326,8 +6409,8 @@ index 292725c..f87ae14 100644
#define pmd_populate(mm, pmd, pte_page) \
pmd_populate_kernel(mm, pmd, page_address(pte_page))
#define pmd_populate_kernel(mm, pmd, pte) pmd_set(pmd, (unsigned long)(pte))
-@@ -76,6 +82,7 @@ static inline void pud_populate(struct mm_struct *mm, pud_t *pud, pmd_t *pmd)
- #else /* CONFIG_PPC_64K_PAGES */
+@@ -171,6 +177,7 @@ extern void __tlb_remove_table(void *_table);
+ #endif
#define pud_populate(mm, pud, pmd) pud_set(pud, (unsigned long)pmd)
+#define pud_populate_kernel(mm, pud, pmd) pud_populate((mm), (pud), (pmd))
@@ -6335,7 +6418,7 @@ index 292725c..f87ae14 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 a9cbd3b..3b67efa 100644
+index 7aeb955..19f748e 100644
--- a/arch/powerpc/include/asm/pgtable.h
+++ b/arch/powerpc/include/asm/pgtable.h
@@ -2,6 +2,7 @@
@@ -6359,7 +6442,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 3b097a8..8f8c774 100644
+index 362142b..8b22c1b 100644
--- a/arch/powerpc/include/asm/reg.h
+++ b/arch/powerpc/include/asm/reg.h
@@ -234,6 +234,7 @@
@@ -6371,7 +6454,7 @@ index 3b097a8..8f8c774 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 195ce2a..ab5c614 100644
+index ffbaabe..eabe843 100644
--- a/arch/powerpc/include/asm/smp.h
+++ b/arch/powerpc/include/asm/smp.h
@@ -50,7 +50,7 @@ struct smp_ops_t {
@@ -6384,36 +6467,36 @@ index 195ce2a..ab5c614 100644
extern void smp_send_debugger_break(void);
extern void start_secondary_resume(void);
diff --git a/arch/powerpc/include/asm/thread_info.h b/arch/powerpc/include/asm/thread_info.h
-index 406b7b9..af63426 100644
+index ba7b197..d292e26 100644
--- a/arch/powerpc/include/asm/thread_info.h
+++ b/arch/powerpc/include/asm/thread_info.h
-@@ -97,7 +97,6 @@ static inline struct thread_info *current_thread_info(void)
+@@ -93,7 +93,6 @@ static inline struct thread_info *current_thread_info(void)
+ #define TIF_POLLING_NRFLAG 3 /* true if poll_idle() is polling
+ TIF_NEED_RESCHED */
+ #define TIF_32BIT 4 /* 32 bit binary */
+-#define TIF_PERFMON_WORK 5 /* work for pfm_handle_work() */
#define TIF_PERFMON_CTXSW 6 /* perfmon needs ctxsw calls */
#define TIF_SYSCALL_AUDIT 7 /* syscall auditing active */
#define TIF_SINGLESTEP 8 /* singlestepping active */
--#define TIF_MEMDIE 9 /* is terminating due to OOM killer */
- #define TIF_SECCOMP 10 /* secure computing */
- #define TIF_RESTOREALL 11 /* Restore all regs (implies NOERROR) */
- #define TIF_NOERROR 12 /* Force successful syscall return */
-@@ -106,6 +105,9 @@ static inline struct thread_info *current_thread_info(void)
- #define TIF_SYSCALL_TRACEPOINT 15 /* syscall tracepoint instrumentation */
+@@ -107,6 +106,9 @@ static inline struct thread_info *current_thread_info(void)
#define TIF_EMULATE_STACK_STORE 16 /* Is an instruction emulation
for stack store? */
-+#define TIF_MEMDIE 17 /* is terminating due to OOM killer */
+ #define TIF_MEMDIE 17 /* is terminating due to OOM killer */
++#define TIF_PERFMON_WORK 18 /* work for pfm_handle_work() */
+/* mask must be expressable within 16 bits to satisfy 'andi' instruction reqs */
-+#define TIF_GRSEC_SETXID 9 /* update credentials on syscall entry/exit */
++#define TIF_GRSEC_SETXID 5 /* update credentials on syscall entry/exit */
/* as above, but as bit values */
#define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE)
-@@ -124,8 +126,10 @@ static inline struct thread_info *current_thread_info(void)
- #define _TIF_UPROBE (1<<TIF_UPROBE)
+@@ -126,9 +128,10 @@ static inline struct thread_info *current_thread_info(void)
#define _TIF_SYSCALL_TRACEPOINT (1<<TIF_SYSCALL_TRACEPOINT)
#define _TIF_EMULATE_STACK_STORE (1<<TIF_EMULATE_STACK_STORE)
+ #define _TIF_NOHZ (1<<TIF_NOHZ)
+#define _TIF_GRSEC_SETXID (1<<TIF_GRSEC_SETXID)
#define _TIF_SYSCALL_T_OR_A (_TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT | \
-- _TIF_SECCOMP | _TIF_SYSCALL_TRACEPOINT)
-+ _TIF_SECCOMP | _TIF_SYSCALL_TRACEPOINT | \
-+ _TIF_GRSEC_SETXID)
+ _TIF_SECCOMP | _TIF_SYSCALL_TRACEPOINT | \
+- _TIF_NOHZ)
++ _TIF_NOHZ | _TIF_GRSEC_SETXID)
#define _TIF_USER_WORK_MASK (_TIF_SIGPENDING | _TIF_NEED_RESCHED | \
_TIF_NOTIFY_RESUME | _TIF_UPROBE)
@@ -6590,10 +6673,10 @@ 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 ae54553..cf2184d 100644
+index 645170a..6cf0271 100644
--- a/arch/powerpc/kernel/exceptions-64e.S
+++ b/arch/powerpc/kernel/exceptions-64e.S
-@@ -716,6 +716,7 @@ storage_fault_common:
+@@ -757,6 +757,7 @@ storage_fault_common:
std r14,_DAR(r1)
std r15,_DSISR(r1)
addi r3,r1,STACK_FRAME_OVERHEAD
@@ -6601,7 +6684,7 @@ index ae54553..cf2184d 100644
mr r4,r14
mr r5,r15
ld r14,PACA_EXGEN+EX_R14(r13)
-@@ -724,8 +725,7 @@ storage_fault_common:
+@@ -765,8 +766,7 @@ storage_fault_common:
cmpdi r3,0
bne- 1f
b .ret_from_except_lite
@@ -6612,10 +6695,10 @@ index ae54553..cf2184d 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 644378e..b6f2c26 100644
+index 4e00d22..b26abcc 100644
--- a/arch/powerpc/kernel/exceptions-64s.S
+++ b/arch/powerpc/kernel/exceptions-64s.S
-@@ -1390,10 +1390,10 @@ handle_page_fault:
+@@ -1356,10 +1356,10 @@ handle_page_fault:
11: ld r4,_DAR(r1)
ld r5,_DSISR(r1)
addi r3,r1,STACK_FRAME_OVERHEAD
@@ -6661,10 +6744,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 0d86c8a..df4c5f2 100644
+index 076d124..6cb2cbf 100644
--- a/arch/powerpc/kernel/process.c
+++ b/arch/powerpc/kernel/process.c
-@@ -871,8 +871,8 @@ void show_regs(struct pt_regs * regs)
+@@ -874,8 +874,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
*/
@@ -6675,7 +6758,7 @@ index 0d86c8a..df4c5f2 100644
#endif
#ifdef CONFIG_PPC_TRANSACTIONAL_MEM
printk("PACATMSCRATCH [%llx]\n", get_paca()->tm_scratch);
-@@ -1331,10 +1331,10 @@ void show_stack(struct task_struct *tsk, unsigned long *stack)
+@@ -1335,10 +1335,10 @@ void show_stack(struct task_struct *tsk, unsigned long *stack)
newsp = stack[0];
ip = stack[STACK_FRAME_LR_SAVE];
if (!firstframe || ip != lr) {
@@ -6688,7 +6771,7 @@ index 0d86c8a..df4c5f2 100644
(void *)current->ret_stack[curr_frame].ret);
curr_frame--;
}
-@@ -1354,7 +1354,7 @@ void show_stack(struct task_struct *tsk, unsigned long *stack)
+@@ -1358,7 +1358,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;
@@ -6697,7 +6780,7 @@ index 0d86c8a..df4c5f2 100644
regs->trap, (void *)regs->nip, (void *)lr);
firstframe = 1;
}
-@@ -1396,58 +1396,3 @@ void notrace __ppc64_runlatch_off(void)
+@@ -1394,58 +1394,3 @@ void notrace __ppc64_runlatch_off(void)
mtspr(SPRN_CTRLT, ctrl);
}
#endif /* CONFIG_PPC64 */
@@ -6757,10 +6840,10 @@ index 0d86c8a..df4c5f2 100644
- return ret;
-}
diff --git a/arch/powerpc/kernel/ptrace.c b/arch/powerpc/kernel/ptrace.c
-index f9b30c6..d72e7a3 100644
+index 64f7bd5..8dd550f 100644
--- a/arch/powerpc/kernel/ptrace.c
+++ b/arch/powerpc/kernel/ptrace.c
-@@ -1771,6 +1771,10 @@ long arch_ptrace(struct task_struct *child, long request,
+@@ -1783,6 +1783,10 @@ long arch_ptrace(struct task_struct *child, long request,
return ret;
}
@@ -6771,7 +6854,7 @@ index f9b30c6..d72e7a3 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.
-@@ -1781,6 +1785,11 @@ long do_syscall_trace_enter(struct pt_regs *regs)
+@@ -1795,6 +1799,11 @@ long do_syscall_trace_enter(struct pt_regs *regs)
secure_computing_strict(regs->gpr[0]);
@@ -6783,7 +6866,7 @@ index f9b30c6..d72e7a3 100644
if (test_thread_flag(TIF_SYSCALL_TRACE) &&
tracehook_report_syscall_entry(regs))
/*
-@@ -1815,6 +1824,11 @@ void do_syscall_trace_leave(struct pt_regs *regs)
+@@ -1829,6 +1838,11 @@ void do_syscall_trace_leave(struct pt_regs *regs)
{
int step;
@@ -6796,10 +6879,10 @@ index f9b30c6..d72e7a3 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 201385c..0f01828 100644
+index 0f83122..c0aca6a 100644
--- a/arch/powerpc/kernel/signal_32.c
+++ b/arch/powerpc/kernel/signal_32.c
-@@ -976,7 +976,7 @@ int handle_rt_signal32(unsigned long sig, struct k_sigaction *ka,
+@@ -987,7 +987,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;
@@ -6809,10 +6892,10 @@ index 201385c..0f01828 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 3459473..2d40783 100644
+index 887e99d..310bc11 100644
--- a/arch/powerpc/kernel/signal_64.c
+++ b/arch/powerpc/kernel/signal_64.c
-@@ -749,7 +749,7 @@ int handle_rt_signal64(int signr, struct k_sigaction *ka, siginfo_t *info,
+@@ -751,7 +751,7 @@ int handle_rt_signal64(int signr, struct k_sigaction *ka, siginfo_t *info,
#endif
/* Set up to return from userspace. */
@@ -6822,7 +6905,7 @@ index 3459473..2d40783 100644
} 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 3ce1f86..c30e629 100644
+index e68a845..8b140e6 100644
--- a/arch/powerpc/kernel/sysfs.c
+++ b/arch/powerpc/kernel/sysfs.c
@@ -522,7 +522,7 @@ static int __cpuinit sysfs_cpu_notify(struct notifier_block *self,
@@ -6835,10 +6918,10 @@ index 3ce1f86..c30e629 100644
};
diff --git a/arch/powerpc/kernel/traps.c b/arch/powerpc/kernel/traps.c
-index bf33ace..e836d8b 100644
+index e4f205a..8bfffb8 100644
--- a/arch/powerpc/kernel/traps.c
+++ b/arch/powerpc/kernel/traps.c
-@@ -142,6 +142,8 @@ static unsigned __kprobes long oops_begin(struct pt_regs *regs)
+@@ -143,6 +143,8 @@ static unsigned __kprobes long oops_begin(struct pt_regs *regs)
return flags;
}
@@ -6847,7 +6930,7 @@ index bf33ace..e836d8b 100644
static void __kprobes oops_end(unsigned long flags, struct pt_regs *regs,
int signr)
{
-@@ -191,6 +193,9 @@ static void __kprobes oops_end(unsigned long flags, struct pt_regs *regs,
+@@ -192,6 +194,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");
@@ -6858,7 +6941,7 @@ index bf33ace..e836d8b 100644
}
diff --git a/arch/powerpc/kernel/vdso.c b/arch/powerpc/kernel/vdso.c
-index 1b2076f..835e4be 100644
+index d4f463a..8fb7431 100644
--- a/arch/powerpc/kernel/vdso.c
+++ b/arch/powerpc/kernel/vdso.c
@@ -34,6 +34,7 @@
@@ -6869,7 +6952,7 @@ index 1b2076f..835e4be 100644
#include "setup.h"
-@@ -218,7 +219,7 @@ int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp)
+@@ -222,7 +223,7 @@ int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp)
vdso_base = VDSO32_MBASE;
#endif
@@ -6878,7 +6961,7 @@ index 1b2076f..835e4be 100644
/* vDSO has a problem and was disabled, just don't "enable" it for the
* process
-@@ -238,7 +239,7 @@ int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp)
+@@ -242,7 +243,7 @@ int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp)
vdso_base = get_unmapped_area(NULL, vdso_base,
(vdso_pages << PAGE_SHIFT) +
((VDSO_ALIGNMENT - 1) & PAGE_MASK),
@@ -6923,13 +7006,13 @@ index 5eea6f3..5d10396 100644
EXPORT_SYMBOL(copy_in_user);
diff --git a/arch/powerpc/mm/fault.c b/arch/powerpc/mm/fault.c
-index 229951f..cdeca42 100644
+index 8726779..a33c512 100644
--- a/arch/powerpc/mm/fault.c
+++ b/arch/powerpc/mm/fault.c
-@@ -32,6 +32,10 @@
- #include <linux/perf_event.h>
+@@ -33,6 +33,10 @@
#include <linux/magic.h>
#include <linux/ratelimit.h>
+ #include <linux/context_tracking.h>
+#include <linux/slab.h>
+#include <linux/pagemap.h>
+#include <linux/compiler.h>
@@ -6937,7 +7020,7 @@ index 229951f..cdeca42 100644
#include <asm/firmware.h>
#include <asm/page.h>
-@@ -68,6 +72,33 @@ static inline int notify_page_fault(struct pt_regs *regs)
+@@ -69,6 +73,33 @@ static inline int notify_page_fault(struct pt_regs *regs)
}
#endif
@@ -6971,7 +7054,7 @@ index 229951f..cdeca42 100644
/*
* Check whether the instruction at regs->nip is a store using
* an update addressing form which will update r1.
-@@ -213,7 +244,7 @@ int __kprobes do_page_fault(struct pt_regs *regs, unsigned long address,
+@@ -216,7 +247,7 @@ int __kprobes do_page_fault(struct pt_regs *regs, unsigned long address,
* indicate errors in DSISR but can validly be set in SRR1.
*/
if (trap == 0x400)
@@ -6980,7 +7063,7 @@ index 229951f..cdeca42 100644
else
is_write = error_code & DSISR_ISSTORE;
#else
-@@ -364,7 +395,7 @@ good_area:
+@@ -371,7 +402,7 @@ good_area:
* "undefined". Of those that can be set, this is the only
* one which seems bad.
*/
@@ -6989,7 +7072,7 @@ index 229951f..cdeca42 100644
/* Guarded storage error. */
goto bad_area;
#endif /* CONFIG_8xx */
-@@ -379,7 +410,7 @@ good_area:
+@@ -386,7 +417,7 @@ good_area:
* processors use the same I/D cache coherency mechanism
* as embedded.
*/
@@ -6998,7 +7081,7 @@ index 229951f..cdeca42 100644
goto bad_area;
#endif /* CONFIG_PPC_STD_MMU */
-@@ -462,6 +493,23 @@ bad_area:
+@@ -471,6 +502,23 @@ bad_area:
bad_area_nosemaphore:
/* User mode accesses cause a SIGSEGV */
if (user_mode(regs)) {
@@ -7020,7 +7103,7 @@ index 229951f..cdeca42 100644
+#endif
+
_exception(SIGSEGV, regs, code, address);
- return 0;
+ goto bail;
}
diff --git a/arch/powerpc/mm/mmap_64.c b/arch/powerpc/mm/mmap_64.c
index 67a42ed..cd463e0 100644
@@ -7074,10 +7157,10 @@ index e779642..e5bb889 100644
};
diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c
-index 6a252c4..3024d81 100644
+index 2859a1f..74f9a6e 100644
--- a/arch/powerpc/mm/numa.c
+++ b/arch/powerpc/mm/numa.c
-@@ -932,7 +932,7 @@ static void __init *careful_zallocation(int nid, unsigned long size,
+@@ -919,7 +919,7 @@ static void __init *careful_zallocation(int nid, unsigned long size,
return ret;
}
@@ -7087,7 +7170,7 @@ index 6a252c4..3024d81 100644
.priority = 1 /* Must run before sched domains notifier. */
};
diff --git a/arch/powerpc/mm/slice.c b/arch/powerpc/mm/slice.c
-index cf9dada..241529f 100644
+index 3e99c14..f00953c 100644
--- a/arch/powerpc/mm/slice.c
+++ b/arch/powerpc/mm/slice.c
@@ -103,7 +103,7 @@ static int slice_area_is_free(struct mm_struct *mm, unsigned long addr,
@@ -7099,52 +7182,20 @@ index cf9dada..241529f 100644
}
static int slice_low_has_vma(struct mm_struct *mm, unsigned long slice)
-@@ -272,7 +272,7 @@ full_search:
- addr = _ALIGN_UP(addr + 1, 1ul << SLICE_HIGH_SHIFT);
- continue;
- }
-- if (!vma || addr + len <= vma->vm_start) {
-+ if (check_heap_stack_gap(vma, addr, len, 0)) {
- /*
- * Remember the place where we stopped the search:
- */
-@@ -329,10 +329,14 @@ static unsigned long slice_find_area_topdown(struct mm_struct *mm,
- }
- }
+@@ -277,6 +277,12 @@ static unsigned long slice_find_area_bottomup(struct mm_struct *mm,
+ info.align_offset = 0;
-- addr = mm->mmap_base;
-- while (addr > len) {
-+ if (mm->mmap_base < len)
-+ addr = -ENOMEM;
-+ else
-+ addr = mm->mmap_base - len;
+ addr = TASK_UNMAPPED_BASE;
+
-+ while (!IS_ERR_VALUE(addr)) {
- /* Go down by chunk size */
-- addr = _ALIGN_DOWN(addr - len, 1ul << pshift);
-+ addr = _ALIGN_DOWN(addr, 1ul << pshift);
-
- /* Check for hit with different page size */
- mask = slice_range_to_mask(addr, len);
-@@ -352,7 +356,7 @@ static unsigned long slice_find_area_topdown(struct mm_struct *mm,
- * return with success:
- */
- vma = find_vma(mm, addr);
-- if (!vma || (addr + len) <= vma->vm_start) {
-+ if (check_heap_stack_gap(vma, addr, len, 0)) {
- /* remember the address as a hint for next time */
- if (use_cache)
- mm->free_area_cache = addr;
-@@ -364,7 +368,7 @@ static unsigned long slice_find_area_topdown(struct mm_struct *mm,
- mm->cached_hole_size = vma->vm_start - addr;
-
- /* try just below the current vma->vm_start */
-- addr = vma->vm_start;
-+ addr = skip_heap_stack_gap(vma, len, 0);
- }
-
- /*
-@@ -442,6 +446,11 @@ unsigned long slice_get_unmapped_area(unsigned long addr, unsigned long len,
++#ifdef CONFIG_PAX_RANDMMAP
++ if (mm->pax_flags & MF_PAX_RANDMMAP)
++ addr += mm->delta_mmap;
++#endif
++
+ while (addr < TASK_SIZE) {
+ info.low_limit = addr;
+ if (!slice_scan_available(addr, available, 1, &addr))
+@@ -410,6 +416,11 @@ unsigned long slice_get_unmapped_area(unsigned long addr, unsigned long len,
if (fixed && addr > (mm->task_size - len))
return -EINVAL;
@@ -7157,10 +7208,10 @@ index cf9dada..241529f 100644
if (!fixed && addr) {
addr = _ALIGN_UP(addr, 1ul << pshift);
diff --git a/arch/powerpc/platforms/cell/spufs/file.c b/arch/powerpc/platforms/cell/spufs/file.c
-index 68c57d3..1fdcfb2 100644
+index 9098692..3d54cd1 100644
--- a/arch/powerpc/platforms/cell/spufs/file.c
+++ b/arch/powerpc/platforms/cell/spufs/file.c
-@@ -281,9 +281,9 @@ spufs_mem_mmap_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
+@@ -280,9 +280,9 @@ spufs_mem_mmap_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
return VM_FAULT_NOPAGE;
}
@@ -7223,10 +7274,10 @@ index 4d7ccac..d03d0ad 100644
#define __read_mostly __attribute__((__section__(".data..read_mostly")))
diff --git a/arch/s390/include/asm/elf.h b/arch/s390/include/asm/elf.h
-index 1bfdf24..9c9ab2e 100644
+index 78f4f87..598ce39 100644
--- a/arch/s390/include/asm/elf.h
+++ b/arch/s390/include/asm/elf.h
-@@ -160,8 +160,14 @@ extern unsigned int vdso_enabled;
+@@ -162,8 +162,14 @@ extern unsigned int vdso_enabled;
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. */
@@ -7243,7 +7294,7 @@ index 1bfdf24..9c9ab2e 100644
/* This yields a mask that user programs can use to figure out what
instruction set this CPU supports. */
-@@ -207,9 +213,6 @@ struct linux_binprm;
+@@ -222,9 +228,6 @@ struct linux_binprm;
#define ARCH_HAS_SETUP_ADDITIONAL_PAGES 1
int arch_setup_additional_pages(struct linux_binprm *, int);
@@ -7383,10 +7434,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 536d645..4a5bd9e 100644
+index 2bc3edd..ab9d598 100644
--- a/arch/s390/kernel/process.c
+++ b/arch/s390/kernel/process.c
-@@ -250,39 +250,3 @@ unsigned long get_wchan(struct task_struct *p)
+@@ -236,39 +236,3 @@ unsigned long get_wchan(struct task_struct *p)
}
return 0;
}
@@ -7504,10 +7555,10 @@ index f9f3cd5..58ff438 100644
#endif /* _ASM_SCORE_EXEC_H */
diff --git a/arch/score/kernel/process.c b/arch/score/kernel/process.c
-index 7956846..5f37677 100644
+index f4c6d02..e9355c3 100644
--- a/arch/score/kernel/process.c
+++ b/arch/score/kernel/process.c
-@@ -134,8 +134,3 @@ unsigned long get_wchan(struct task_struct *task)
+@@ -116,8 +116,3 @@ unsigned long get_wchan(struct task_struct *task)
return task_pt_regs(task)->cp0_epc;
}
@@ -8053,7 +8104,7 @@ index 9689176..63c18ea 100644
unsigned long mask, tmp1, tmp2, result;
diff --git a/arch/sparc/include/asm/thread_info_32.h b/arch/sparc/include/asm/thread_info_32.h
-index 25849ae..924c54b 100644
+index dd38075..e7cac83 100644
--- a/arch/sparc/include/asm/thread_info_32.h
+++ b/arch/sparc/include/asm/thread_info_32.h
@@ -49,6 +49,8 @@ struct thread_info {
@@ -8066,7 +8117,7 @@ index 25849ae..924c54b 100644
/*
diff --git a/arch/sparc/include/asm/thread_info_64.h b/arch/sparc/include/asm/thread_info_64.h
-index 269bd92..e46a9b8 100644
+index d5e5042..9bfee76 100644
--- a/arch/sparc/include/asm/thread_info_64.h
+++ b/arch/sparc/include/asm/thread_info_64.h
@@ -63,6 +63,8 @@ struct thread_info {
@@ -8211,19 +8262,19 @@ 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 6cf591b..b49e65a 100644
+index d432fb2..6056af1 100644
--- a/arch/sparc/kernel/Makefile
+++ b/arch/sparc/kernel/Makefile
@@ -3,7 +3,7 @@
@@ -8235,11 +8286,32 @@ index 6cf591b..b49e65a 100644
extra-y := head_$(BITS).o
+diff --git a/arch/sparc/kernel/ds.c b/arch/sparc/kernel/ds.c
+index 5ef48da..11d460f 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 62eede1..9c5b904 100644
+index fdd819d..5af08c8 100644
--- a/arch/sparc/kernel/process_32.c
+++ b/arch/sparc/kernel/process_32.c
-@@ -125,14 +125,14 @@ void show_regs(struct pt_regs *r)
+@@ -116,14 +116,14 @@ void show_regs(struct pt_regs *r)
printk("PSR: %08lx PC: %08lx NPC: %08lx Y: %08lx %s\n",
r->psr, r->pc, r->npc, r->y, print_tainted());
@@ -8256,7 +8328,7 @@ index 62eede1..9c5b904 100644
printk("%%L: %08lx %08lx %08lx %08lx %08lx %08lx %08lx %08lx\n",
rw->locals[0], rw->locals[1], rw->locals[2], rw->locals[3],
-@@ -167,7 +167,7 @@ void show_stack(struct task_struct *tsk, unsigned long *_ksp)
+@@ -160,7 +160,7 @@ void show_stack(struct task_struct *tsk, unsigned long *_ksp)
rw = (struct reg_window32 *) fp;
pc = rw->ins[7];
printk("[%08lx : ", pc);
@@ -8266,10 +8338,10 @@ index 62eede1..9c5b904 100644
} while (++count < 16);
printk("\n");
diff --git a/arch/sparc/kernel/process_64.c b/arch/sparc/kernel/process_64.c
-index cdb80b2..5ca141d 100644
+index baebab2..9cd13b1 100644
--- a/arch/sparc/kernel/process_64.c
+++ b/arch/sparc/kernel/process_64.c
-@@ -181,14 +181,14 @@ static void show_regwindow(struct pt_regs *regs)
+@@ -158,7 +158,7 @@ static void show_regwindow(struct pt_regs *regs)
printk("i4: %016lx i5: %016lx i6: %016lx i7: %016lx\n",
rwk->ins[4], rwk->ins[5], rwk->ins[6], rwk->ins[7]);
if (regs->tstate & TSTATE_PRIV)
@@ -8278,7 +8350,8 @@ index cdb80b2..5ca141d 100644
}
void show_regs(struct pt_regs *regs)
- {
+@@ -167,7 +167,7 @@ void show_regs(struct pt_regs *regs)
+
printk("TSTATE: %016lx TPC: %016lx TNPC: %016lx Y: %08x %s\n", regs->tstate,
regs->tpc, regs->tnpc, regs->y, print_tainted());
- printk("TPC: <%pS>\n", (void *) regs->tpc);
@@ -8286,7 +8359,7 @@ index cdb80b2..5ca141d 100644
printk("g0: %016lx g1: %016lx g2: %016lx g3: %016lx\n",
regs->u_regs[0], regs->u_regs[1], regs->u_regs[2],
regs->u_regs[3]);
-@@ -201,7 +201,7 @@ void show_regs(struct pt_regs *regs)
+@@ -180,7 +180,7 @@ void show_regs(struct pt_regs *regs)
printk("o4: %016lx o5: %016lx sp: %016lx ret_pc: %016lx\n",
regs->u_regs[12], regs->u_regs[13], regs->u_regs[14],
regs->u_regs[15]);
@@ -8295,7 +8368,7 @@ index cdb80b2..5ca141d 100644
show_regwindow(regs);
show_stack(current, (unsigned long *) regs->u_regs[UREG_FP]);
}
-@@ -290,7 +290,7 @@ void arch_trigger_all_cpu_backtrace(void)
+@@ -269,7 +269,7 @@ void arch_trigger_all_cpu_backtrace(void)
((tp && tp->task) ? tp->task->pid : -1));
if (gp->tstate & TSTATE_PRIV) {
@@ -8305,10 +8378,10 @@ index cdb80b2..5ca141d 100644
(void *) gp->o7,
(void *) gp->i7,
diff --git a/arch/sparc/kernel/prom_common.c b/arch/sparc/kernel/prom_common.c
-index 9f20566..67eb41b 100644
+index 79cc0d1..ec62734 100644
--- a/arch/sparc/kernel/prom_common.c
+++ b/arch/sparc/kernel/prom_common.c
-@@ -143,7 +143,7 @@ static int __init prom_common_nextprop(phandle node, char *prev, char *buf)
+@@ -144,7 +144,7 @@ static int __init prom_common_nextprop(phandle node, char *prev, char *buf)
unsigned int prom_early_allocated __initdata;
@@ -8370,7 +8443,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 708bc29..6bfdfad 100644
+index 2daaaa6..4fb84dc 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
@@ -8491,7 +8564,12 @@ index 708bc29..6bfdfad 100644
info.high_limit = STACK_TOP32;
addr = vm_unmapped_area(&info);
}
-@@ -264,6 +286,10 @@ static unsigned long mmap_rnd(void)
+@@ -260,10 +282,14 @@ unsigned long get_fb_unmapped_area(struct file *filp, unsigned long orig_addr, u
+ EXPORT_SYMBOL(get_fb_unmapped_area);
+
+ /* Essentially the same as PowerPC. */
+-static unsigned long mmap_rnd(void)
++static unsigned long mmap_rnd(struct mm_struct *mm)
{
unsigned long rnd = 0UL;
@@ -8502,6 +8580,15 @@ index 708bc29..6bfdfad 100644
if (current->flags & PF_RANDOMIZE) {
unsigned long val = get_random_int();
if (test_thread_flag(TIF_32BIT))
+@@ -276,7 +302,7 @@ static unsigned long mmap_rnd(void)
+
+ void arch_pick_mmap_layout(struct mm_struct *mm)
+ {
+- unsigned long random_factor = mmap_rnd();
++ unsigned long random_factor = mmap_rnd(mm);
+ unsigned long gap;
+
+ /*
@@ -289,6 +315,12 @@ void arch_pick_mmap_layout(struct mm_struct *mm)
gap == RLIM_INFINITY ||
sysctl_legacy_va_layout) {
@@ -8615,7 +8702,7 @@ index 6629829..036032d 100644
}
diff --git a/arch/sparc/kernel/traps_64.c b/arch/sparc/kernel/traps_64.c
-index 8d38ca9..845b1d6 100644
+index b3f833a..ac74b2d 100644
--- a/arch/sparc/kernel/traps_64.c
+++ b/arch/sparc/kernel/traps_64.c
@@ -76,7 +76,7 @@ static void dump_tl1_traplog(struct tl1_traplog *p)
@@ -8725,7 +8812,7 @@ index 8d38ca9..845b1d6 100644
graph++;
}
}
-@@ -2367,6 +2378,8 @@ static inline struct reg_window *kernel_stack_up(struct reg_window *rw)
+@@ -2360,6 +2371,8 @@ static inline struct reg_window *kernel_stack_up(struct reg_window *rw)
return (struct reg_window *) (fp + STACK_BIAS);
}
@@ -8734,7 +8821,7 @@ index 8d38ca9..845b1d6 100644
void die_if_kernel(char *str, struct pt_regs *regs)
{
static int die_counter;
-@@ -2395,7 +2408,7 @@ void die_if_kernel(char *str, struct pt_regs *regs)
+@@ -2388,7 +2401,7 @@ void die_if_kernel(char *str, struct pt_regs *regs)
while (rw &&
count++ < 30 &&
kstack_valid(tp, (unsigned long) rw)) {
@@ -8743,7 +8830,7 @@ index 8d38ca9..845b1d6 100644
(void *) rw->ins[7]);
rw = kernel_stack_up(rw);
-@@ -2408,8 +2421,10 @@ void die_if_kernel(char *str, struct pt_regs *regs)
+@@ -2401,8 +2414,10 @@ void die_if_kernel(char *str, struct pt_regs *regs)
}
user_instruction_dump ((unsigned int __user *) regs->tpc);
}
@@ -8768,117 +8855,8 @@ index 8201c25e..072a2a7 100644
regs->tpc, (void *) regs->tpc);
}
}
-diff --git a/arch/sparc/kernel/us3_cpufreq.c b/arch/sparc/kernel/us3_cpufreq.c
-index eb1624b..55100de 100644
---- a/arch/sparc/kernel/us3_cpufreq.c
-+++ b/arch/sparc/kernel/us3_cpufreq.c
-@@ -18,14 +18,12 @@
- #include <asm/head.h>
- #include <asm/timer.h>
-
--static struct cpufreq_driver *cpufreq_us3_driver;
--
- struct us3_freq_percpu_info {
- struct cpufreq_frequency_table table[4];
- };
-
- /* Indexed by cpu number. */
--static struct us3_freq_percpu_info *us3_freq_table;
-+static struct us3_freq_percpu_info us3_freq_table[NR_CPUS];
-
- /* UltraSPARC-III has three dividers: 1, 2, and 32. These are controlled
- * in the Safari config register.
-@@ -191,12 +189,25 @@ static int __init us3_freq_cpu_init(struct cpufreq_policy *policy)
-
- static int us3_freq_cpu_exit(struct cpufreq_policy *policy)
- {
-- if (cpufreq_us3_driver)
-- us3_set_cpu_divider_index(policy->cpu, 0);
-+ us3_set_cpu_divider_index(policy->cpu, 0);
-
- return 0;
- }
-
-+static int __init us3_freq_init(void);
-+static void __exit us3_freq_exit(void);
-+
-+static struct cpufreq_driver cpufreq_us3_driver = {
-+ .init = us3_freq_cpu_init,
-+ .verify = us3_freq_verify,
-+ .target = us3_freq_target,
-+ .get = us3_freq_get,
-+ .exit = us3_freq_cpu_exit,
-+ .owner = THIS_MODULE,
-+ .name = "UltraSPARC-III",
-+
-+};
-+
- static int __init us3_freq_init(void)
- {
- unsigned long manuf, impl, ver;
-@@ -213,57 +224,15 @@ static int __init us3_freq_init(void)
- (impl == CHEETAH_IMPL ||
- impl == CHEETAH_PLUS_IMPL ||
- impl == JAGUAR_IMPL ||
-- impl == PANTHER_IMPL)) {
-- struct cpufreq_driver *driver;
--
-- ret = -ENOMEM;
-- driver = kzalloc(sizeof(struct cpufreq_driver), GFP_KERNEL);
-- if (!driver)
-- goto err_out;
--
-- us3_freq_table = kzalloc(
-- (NR_CPUS * sizeof(struct us3_freq_percpu_info)),
-- GFP_KERNEL);
-- if (!us3_freq_table)
-- goto err_out;
--
-- driver->init = us3_freq_cpu_init;
-- driver->verify = us3_freq_verify;
-- 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;
-- ret = cpufreq_register_driver(driver);
-- if (ret)
-- goto err_out;
--
-- return 0;
--
--err_out:
-- if (driver) {
-- kfree(driver);
-- cpufreq_us3_driver = NULL;
-- }
-- kfree(us3_freq_table);
-- us3_freq_table = NULL;
-- return ret;
-- }
-+ impl == PANTHER_IMPL))
-+ return cpufreq_register_driver(&cpufreq_us3_driver);
-
- return -ENODEV;
- }
-
- static void __exit us3_freq_exit(void)
- {
-- if (cpufreq_us3_driver) {
-- cpufreq_unregister_driver(cpufreq_us3_driver);
-- kfree(cpufreq_us3_driver);
-- cpufreq_us3_driver = NULL;
-- kfree(us3_freq_table);
-- us3_freq_table = NULL;
-- }
-+ cpufreq_unregister_driver(&cpufreq_us3_driver);
- }
-
- MODULE_AUTHOR("David S. Miller <davem@redhat.com>");
diff --git a/arch/sparc/lib/Makefile b/arch/sparc/lib/Makefile
-index 8410065f2..4fd4ca22 100644
+index dbe119b..089c7c1 100644
--- a/arch/sparc/lib/Makefile
+++ b/arch/sparc/lib/Makefile
@@ -2,7 +2,7 @@
@@ -10041,20 +10019,6 @@ index d2b5944..bd813f2 100644
return addr;
}
if (mm->get_unmapped_area == arch_get_unmapped_area)
-diff --git a/arch/sparc/mm/tlb.c b/arch/sparc/mm/tlb.c
-index 83d89bc..37e7bc4 100644
---- a/arch/sparc/mm/tlb.c
-+++ b/arch/sparc/mm/tlb.c
-@@ -85,8 +85,8 @@ static void tlb_batch_add_one(struct mm_struct *mm, unsigned long vaddr,
- }
-
- if (!tb->active) {
-- global_flush_tlb_page(mm, vaddr);
- flush_tsb_user_page(mm, vaddr);
-+ global_flush_tlb_page(mm, vaddr);
- goto out;
- }
-
diff --git a/arch/tile/include/asm/atomic_64.h b/arch/tile/include/asm/atomic_64.h
index f4500c6..889656c 100644
--- a/arch/tile/include/asm/atomic_64.h
@@ -10095,10 +10059,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 9ab078a..d6635c2 100644
+index 8a082bc..7a6bf87 100644
--- a/arch/tile/include/asm/uaccess.h
+++ b/arch/tile/include/asm/uaccess.h
-@@ -403,9 +403,9 @@ static inline unsigned long __must_check copy_from_user(void *to,
+@@ -408,9 +408,9 @@ static inline unsigned long __must_check copy_from_user(void *to,
const void __user *from,
unsigned long n)
{
@@ -10216,10 +10180,10 @@ index 0032f92..cd151e0 100644
#ifdef CONFIG_64BIT
#define set_pud(pudptr, pudval) set_64bit((u64 *) (pudptr), pud_val(pudval))
diff --git a/arch/um/kernel/process.c b/arch/um/kernel/process.c
-index b462b13..e7a19aa 100644
+index bbcef52..6a2a483 100644
--- a/arch/um/kernel/process.c
+++ b/arch/um/kernel/process.c
-@@ -386,22 +386,6 @@ int singlestepping(void * t)
+@@ -367,22 +367,6 @@ int singlestepping(void * t)
return 2;
}
@@ -10260,10 +10224,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 de80b33..c0f0899 100644
+index fe120da..24177f7 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
-@@ -243,7 +243,7 @@ config X86_HT
+@@ -239,7 +239,7 @@ config X86_HT
config X86_32_LAZY_GS
def_bool y
@@ -10272,7 +10236,7 @@ index de80b33..c0f0899 100644
config ARCH_HWEIGHT_CFLAGS
string
-@@ -1076,6 +1076,7 @@ config MICROCODE_EARLY
+@@ -1073,6 +1073,7 @@ config MICROCODE_EARLY
config X86_MSR
tristate "/dev/cpu/*/msr - Model-specific register support"
@@ -10280,7 +10244,7 @@ index de80b33..c0f0899 100644
---help---
This device gives privileged processes access to the x86
Model-Specific Registers (MSRs). It is a character device with
-@@ -1099,7 +1100,7 @@ choice
+@@ -1096,7 +1097,7 @@ choice
config NOHIGHMEM
bool "off"
@@ -10289,7 +10253,7 @@ index de80b33..c0f0899 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
-@@ -1136,7 +1137,7 @@ config NOHIGHMEM
+@@ -1133,7 +1134,7 @@ config NOHIGHMEM
config HIGHMEM4G
bool "4GB"
@@ -10298,7 +10262,7 @@ index de80b33..c0f0899 100644
---help---
Select this if you have a 32-bit processor and between 1 and 4
gigabytes of physical RAM.
-@@ -1189,7 +1190,7 @@ config PAGE_OFFSET
+@@ -1186,7 +1187,7 @@ config PAGE_OFFSET
hex
default 0xB0000000 if VMSPLIT_3G_OPT
default 0x80000000 if VMSPLIT_2G
@@ -10307,7 +10271,7 @@ index de80b33..c0f0899 100644
default 0x40000000 if VMSPLIT_1G
default 0xC0000000
depends on X86_32
-@@ -1587,6 +1588,7 @@ config SECCOMP
+@@ -1584,6 +1585,7 @@ config SECCOMP
config CC_STACKPROTECTOR
bool "Enable -fstack-protector buffer overflow detection"
@@ -10315,7 +10279,7 @@ index de80b33..c0f0899 100644
---help---
This option turns on the -fstack-protector GCC feature. This
feature puts, at the beginning of functions, a canary value on
-@@ -1706,6 +1708,8 @@ config X86_NEED_RELOCS
+@@ -1703,6 +1705,8 @@ config X86_NEED_RELOCS
config PHYSICAL_ALIGN
hex "Alignment value to which kernel should be aligned" if X86_32
default "0x1000000"
@@ -10324,7 +10288,7 @@ index de80b33..c0f0899 100644
range 0x2000 0x1000000
---help---
This value puts the alignment restrictions on physical address
-@@ -1781,9 +1785,10 @@ config DEBUG_HOTPLUG_CPU0
+@@ -1778,9 +1782,10 @@ config DEBUG_HOTPLUG_CPU0
If unsure, say N.
config COMPAT_VDSO
@@ -10368,7 +10332,7 @@ index c026cca..14657ae 100644
config X86_MINIMUM_CPU_FAMILY
int
diff --git a/arch/x86/Kconfig.debug b/arch/x86/Kconfig.debug
-index b322f12..652d0d9 100644
+index c198b7e..63eea60 100644
--- a/arch/x86/Kconfig.debug
+++ b/arch/x86/Kconfig.debug
@@ -84,7 +84,7 @@ config X86_PTDUMP
@@ -10389,15 +10353,6 @@ index b322f12..652d0d9 100644
---help---
This option helps catch unintended modifications to loadable
kernel module's text and read-only data. It also prevents execution
-@@ -294,7 +294,7 @@ config OPTIMIZE_INLINING
-
- config DEBUG_STRICT_USER_COPY_CHECKS
- bool "Strict copy size checks"
-- depends on DEBUG_KERNEL && !TRACE_BRANCH_PROFILING
-+ depends on DEBUG_KERNEL && !TRACE_BRANCH_PROFILING && !PAX_SIZE_OVERFLOW
- ---help---
- Enabling this option turns a certain set of sanity checks for user
- copy operations into compile time failures.
diff --git a/arch/x86/Makefile b/arch/x86/Makefile
index 5c47726..8c4fa67 100644
--- a/arch/x86/Makefile
@@ -10496,7 +10451,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 c205035..5853587 100644
+index d606463..b887794 100644
--- a/arch/x86/boot/compressed/eboot.c
+++ b/arch/x86/boot/compressed/eboot.c
@@ -150,7 +150,6 @@ again:
@@ -10590,7 +10545,7 @@ index 1e3184f..0d11e2e 100644
jmp 1b
2:
diff --git a/arch/x86/boot/compressed/head_64.S b/arch/x86/boot/compressed/head_64.S
-index c1d383d..57ab51c 100644
+index 16f24e6..47491a3 100644
--- a/arch/x86/boot/compressed/head_64.S
+++ b/arch/x86/boot/compressed/head_64.S
@@ -97,7 +97,7 @@ ENTRY(startup_32)
@@ -10824,7 +10779,7 @@ index 9105655..5e37f27 100644
movq r1,r2; \
movq r3,r4; \
diff --git a/arch/x86/crypto/aesni-intel_asm.S b/arch/x86/crypto/aesni-intel_asm.S
-index 04b7977..402f223 100644
+index 477e9d7..3ab339f 100644
--- a/arch/x86/crypto/aesni-intel_asm.S
+++ b/arch/x86/crypto/aesni-intel_asm.S
@@ -31,6 +31,7 @@
@@ -10835,7 +10790,7 @@ index 04b7977..402f223 100644
#ifdef __x86_64__
.data
-@@ -1435,6 +1436,7 @@ _return_T_done_decrypt:
+@@ -1441,6 +1442,7 @@ _return_T_done_decrypt:
pop %r14
pop %r13
pop %r12
@@ -10843,7 +10798,7 @@ index 04b7977..402f223 100644
ret
ENDPROC(aesni_gcm_dec)
-@@ -1699,6 +1701,7 @@ _return_T_done_encrypt:
+@@ -1705,6 +1707,7 @@ _return_T_done_encrypt:
pop %r14
pop %r13
pop %r12
@@ -10851,7 +10806,7 @@ index 04b7977..402f223 100644
ret
ENDPROC(aesni_gcm_enc)
-@@ -1716,6 +1719,7 @@ _key_expansion_256a:
+@@ -1722,6 +1725,7 @@ _key_expansion_256a:
pxor %xmm1, %xmm0
movaps %xmm0, (TKEYP)
add $0x10, TKEYP
@@ -10859,7 +10814,7 @@ index 04b7977..402f223 100644
ret
ENDPROC(_key_expansion_128)
ENDPROC(_key_expansion_256a)
-@@ -1742,6 +1746,7 @@ _key_expansion_192a:
+@@ -1748,6 +1752,7 @@ _key_expansion_192a:
shufps $0b01001110, %xmm2, %xmm1
movaps %xmm1, 0x10(TKEYP)
add $0x20, TKEYP
@@ -10867,7 +10822,7 @@ index 04b7977..402f223 100644
ret
ENDPROC(_key_expansion_192a)
-@@ -1762,6 +1767,7 @@ _key_expansion_192b:
+@@ -1768,6 +1773,7 @@ _key_expansion_192b:
movaps %xmm0, (TKEYP)
add $0x10, TKEYP
@@ -10875,7 +10830,7 @@ index 04b7977..402f223 100644
ret
ENDPROC(_key_expansion_192b)
-@@ -1775,6 +1781,7 @@ _key_expansion_256b:
+@@ -1781,6 +1787,7 @@ _key_expansion_256b:
pxor %xmm1, %xmm2
movaps %xmm2, (TKEYP)
add $0x10, TKEYP
@@ -10883,7 +10838,7 @@ index 04b7977..402f223 100644
ret
ENDPROC(_key_expansion_256b)
-@@ -1888,6 +1895,7 @@ ENTRY(aesni_set_key)
+@@ -1894,6 +1901,7 @@ ENTRY(aesni_set_key)
#ifndef __x86_64__
popl KEYP
#endif
@@ -10891,7 +10846,7 @@ index 04b7977..402f223 100644
ret
ENDPROC(aesni_set_key)
-@@ -1910,6 +1918,7 @@ ENTRY(aesni_enc)
+@@ -1916,6 +1924,7 @@ ENTRY(aesni_enc)
popl KLEN
popl KEYP
#endif
@@ -10899,7 +10854,7 @@ index 04b7977..402f223 100644
ret
ENDPROC(aesni_enc)
-@@ -1968,6 +1977,7 @@ _aesni_enc1:
+@@ -1974,6 +1983,7 @@ _aesni_enc1:
AESENC KEY STATE
movaps 0x70(TKEYP), KEY
AESENCLAST KEY STATE
@@ -10907,7 +10862,7 @@ index 04b7977..402f223 100644
ret
ENDPROC(_aesni_enc1)
-@@ -2077,6 +2087,7 @@ _aesni_enc4:
+@@ -2083,6 +2093,7 @@ _aesni_enc4:
AESENCLAST KEY STATE2
AESENCLAST KEY STATE3
AESENCLAST KEY STATE4
@@ -10915,7 +10870,7 @@ index 04b7977..402f223 100644
ret
ENDPROC(_aesni_enc4)
-@@ -2100,6 +2111,7 @@ ENTRY(aesni_dec)
+@@ -2106,6 +2117,7 @@ ENTRY(aesni_dec)
popl KLEN
popl KEYP
#endif
@@ -10923,7 +10878,7 @@ index 04b7977..402f223 100644
ret
ENDPROC(aesni_dec)
-@@ -2158,6 +2170,7 @@ _aesni_dec1:
+@@ -2164,6 +2176,7 @@ _aesni_dec1:
AESDEC KEY STATE
movaps 0x70(TKEYP), KEY
AESDECLAST KEY STATE
@@ -10931,7 +10886,7 @@ index 04b7977..402f223 100644
ret
ENDPROC(_aesni_dec1)
-@@ -2267,6 +2280,7 @@ _aesni_dec4:
+@@ -2273,6 +2286,7 @@ _aesni_dec4:
AESDECLAST KEY STATE2
AESDECLAST KEY STATE3
AESDECLAST KEY STATE4
@@ -10939,7 +10894,7 @@ index 04b7977..402f223 100644
ret
ENDPROC(_aesni_dec4)
-@@ -2325,6 +2339,7 @@ ENTRY(aesni_ecb_enc)
+@@ -2331,6 +2345,7 @@ ENTRY(aesni_ecb_enc)
popl KEYP
popl LEN
#endif
@@ -10947,7 +10902,7 @@ index 04b7977..402f223 100644
ret
ENDPROC(aesni_ecb_enc)
-@@ -2384,6 +2399,7 @@ ENTRY(aesni_ecb_dec)
+@@ -2390,6 +2405,7 @@ ENTRY(aesni_ecb_dec)
popl KEYP
popl LEN
#endif
@@ -10955,7 +10910,7 @@ index 04b7977..402f223 100644
ret
ENDPROC(aesni_ecb_dec)
-@@ -2426,6 +2442,7 @@ ENTRY(aesni_cbc_enc)
+@@ -2432,6 +2448,7 @@ ENTRY(aesni_cbc_enc)
popl LEN
popl IVP
#endif
@@ -10963,7 +10918,7 @@ index 04b7977..402f223 100644
ret
ENDPROC(aesni_cbc_enc)
-@@ -2517,6 +2534,7 @@ ENTRY(aesni_cbc_dec)
+@@ -2523,6 +2540,7 @@ ENTRY(aesni_cbc_dec)
popl LEN
popl IVP
#endif
@@ -10971,7 +10926,7 @@ index 04b7977..402f223 100644
ret
ENDPROC(aesni_cbc_dec)
-@@ -2544,6 +2562,7 @@ _aesni_inc_init:
+@@ -2550,6 +2568,7 @@ _aesni_inc_init:
mov $1, TCTR_LOW
MOVQ_R64_XMM TCTR_LOW INC
MOVQ_R64_XMM CTR TCTR_LOW
@@ -10979,7 +10934,7 @@ index 04b7977..402f223 100644
ret
ENDPROC(_aesni_inc_init)
-@@ -2573,6 +2592,7 @@ _aesni_inc:
+@@ -2579,6 +2598,7 @@ _aesni_inc:
.Linc_low:
movaps CTR, IV
PSHUFB_XMM BSWAP_MASK IV
@@ -10987,14 +10942,22 @@ index 04b7977..402f223 100644
ret
ENDPROC(_aesni_inc)
-@@ -2634,6 +2654,7 @@ ENTRY(aesni_ctr_enc)
+@@ -2640,6 +2660,7 @@ ENTRY(aesni_ctr_enc)
.Lctr_enc_ret:
movups IV, (IVP)
.Lctr_enc_just_ret:
+ pax_force_retaddr 0, 1
ret
ENDPROC(aesni_ctr_enc)
- #endif
+
+@@ -2766,6 +2787,7 @@ ENTRY(aesni_xts_crypt8)
+ pxor INC, STATE4
+ movdqu STATE4, 0x70(OUTP)
+
++ pax_force_retaddr 0, 1
+ ret
+ ENDPROC(aesni_xts_crypt8)
+
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
@@ -11168,7 +11131,7 @@ index c35fd5d..c1ee236 100644
ret;
ENDPROC(cast5_ctr_16way)
diff --git a/arch/x86/crypto/cast6-avx-x86_64-asm_64.S b/arch/x86/crypto/cast6-avx-x86_64-asm_64.S
-index f93b610..c09bf40 100644
+index e3531f8..18ded3a 100644
--- a/arch/x86/crypto/cast6-avx-x86_64-asm_64.S
+++ b/arch/x86/crypto/cast6-avx-x86_64-asm_64.S
@@ -24,6 +24,7 @@
@@ -11179,7 +11142,7 @@ index f93b610..c09bf40 100644
#include "glue_helper-asm-avx.S"
.file "cast6-avx-x86_64-asm_64.S"
-@@ -293,6 +294,7 @@ __cast6_enc_blk8:
+@@ -295,6 +296,7 @@ __cast6_enc_blk8:
outunpack_blocks(RA1, RB1, RC1, RD1, RTMP, RX, RKRF, RKM);
outunpack_blocks(RA2, RB2, RC2, RD2, RTMP, RX, RKRF, RKM);
@@ -11187,7 +11150,7 @@ index f93b610..c09bf40 100644
ret;
ENDPROC(__cast6_enc_blk8)
-@@ -338,6 +340,7 @@ __cast6_dec_blk8:
+@@ -340,6 +342,7 @@ __cast6_dec_blk8:
outunpack_blocks(RA1, RB1, RC1, RD1, RTMP, RX, RKRF, RKM);
outunpack_blocks(RA2, RB2, RC2, RD2, RTMP, RX, RKRF, RKM);
@@ -11195,7 +11158,7 @@ index f93b610..c09bf40 100644
ret;
ENDPROC(__cast6_dec_blk8)
-@@ -356,6 +359,7 @@ ENTRY(cast6_ecb_enc_8way)
+@@ -358,6 +361,7 @@ ENTRY(cast6_ecb_enc_8way)
store_8way(%r11, RA1, RB1, RC1, RD1, RA2, RB2, RC2, RD2);
@@ -11203,7 +11166,7 @@ index f93b610..c09bf40 100644
ret;
ENDPROC(cast6_ecb_enc_8way)
-@@ -374,6 +378,7 @@ ENTRY(cast6_ecb_dec_8way)
+@@ -376,6 +380,7 @@ ENTRY(cast6_ecb_dec_8way)
store_8way(%r11, RA1, RB1, RC1, RD1, RA2, RB2, RC2, RD2);
@@ -11211,7 +11174,7 @@ index f93b610..c09bf40 100644
ret;
ENDPROC(cast6_ecb_dec_8way)
-@@ -397,6 +402,7 @@ ENTRY(cast6_cbc_dec_8way)
+@@ -399,6 +404,7 @@ ENTRY(cast6_cbc_dec_8way)
popq %r12;
@@ -11219,13 +11182,29 @@ index f93b610..c09bf40 100644
ret;
ENDPROC(cast6_cbc_dec_8way)
-@@ -422,5 +428,6 @@ ENTRY(cast6_ctr_8way)
+@@ -424,6 +430,7 @@ ENTRY(cast6_ctr_8way)
popq %r12;
+ pax_force_retaddr
ret;
ENDPROC(cast6_ctr_8way)
+
+@@ -446,6 +453,7 @@ ENTRY(cast6_xts_enc_8way)
+ /* dst <= regs xor IVs(in dst) */
+ store_xts_8way(%r11, RA1, RB1, RC1, RD1, RA2, RB2, RC2, RD2);
+
++ pax_force_retaddr
+ ret;
+ ENDPROC(cast6_xts_enc_8way)
+
+@@ -468,5 +476,6 @@ ENTRY(cast6_xts_dec_8way)
+ /* dst <= regs xor IVs(in dst) */
+ store_xts_8way(%r11, RA1, RB1, RC1, RD1, RA2, RB2, RC2, RD2);
+
++ pax_force_retaddr
+ ret;
+ ENDPROC(cast6_xts_dec_8way)
diff --git a/arch/x86/crypto/salsa20-x86_64-asm_64.S b/arch/x86/crypto/salsa20-x86_64-asm_64.S
index 9279e0b..9270820 100644
--- a/arch/x86/crypto/salsa20-x86_64-asm_64.S
@@ -11260,10 +11239,10 @@ index 9279e0b..9270820 100644
ret
ENDPROC(salsa20_ivsetup)
diff --git a/arch/x86/crypto/serpent-avx-x86_64-asm_64.S b/arch/x86/crypto/serpent-avx-x86_64-asm_64.S
-index 43c9386..a0e2d60 100644
+index 2f202f4..d9164d6 100644
--- a/arch/x86/crypto/serpent-avx-x86_64-asm_64.S
+++ b/arch/x86/crypto/serpent-avx-x86_64-asm_64.S
-@@ -25,6 +25,7 @@
+@@ -24,6 +24,7 @@
*/
#include <linux/linkage.h>
@@ -11271,7 +11250,7 @@ index 43c9386..a0e2d60 100644
#include "glue_helper-asm-avx.S"
.file "serpent-avx-x86_64-asm_64.S"
-@@ -617,6 +618,7 @@ __serpent_enc_blk8_avx:
+@@ -618,6 +619,7 @@ __serpent_enc_blk8_avx:
write_blocks(RA1, RB1, RC1, RD1, RK0, RK1, RK2);
write_blocks(RA2, RB2, RC2, RD2, RK0, RK1, RK2);
@@ -11279,7 +11258,7 @@ index 43c9386..a0e2d60 100644
ret;
ENDPROC(__serpent_enc_blk8_avx)
-@@ -671,6 +673,7 @@ __serpent_dec_blk8_avx:
+@@ -672,6 +674,7 @@ __serpent_dec_blk8_avx:
write_blocks(RC1, RD1, RB1, RE1, RK0, RK1, RK2);
write_blocks(RC2, RD2, RB2, RE2, RK0, RK1, RK2);
@@ -11287,7 +11266,7 @@ index 43c9386..a0e2d60 100644
ret;
ENDPROC(__serpent_dec_blk8_avx)
-@@ -687,6 +690,7 @@ ENTRY(serpent_ecb_enc_8way_avx)
+@@ -688,6 +691,7 @@ ENTRY(serpent_ecb_enc_8way_avx)
store_8way(%rsi, RA1, RB1, RC1, RD1, RA2, RB2, RC2, RD2);
@@ -11295,7 +11274,7 @@ index 43c9386..a0e2d60 100644
ret;
ENDPROC(serpent_ecb_enc_8way_avx)
-@@ -703,6 +707,7 @@ ENTRY(serpent_ecb_dec_8way_avx)
+@@ -704,6 +708,7 @@ ENTRY(serpent_ecb_dec_8way_avx)
store_8way(%rsi, RC1, RD1, RB1, RE1, RC2, RD2, RB2, RE2);
@@ -11303,7 +11282,7 @@ index 43c9386..a0e2d60 100644
ret;
ENDPROC(serpent_ecb_dec_8way_avx)
-@@ -719,6 +724,7 @@ ENTRY(serpent_cbc_dec_8way_avx)
+@@ -720,6 +725,7 @@ ENTRY(serpent_cbc_dec_8way_avx)
store_cbc_8way(%rdx, %rsi, RC1, RD1, RB1, RE1, RC2, RD2, RB2, RE2);
@@ -11311,13 +11290,29 @@ index 43c9386..a0e2d60 100644
ret;
ENDPROC(serpent_cbc_dec_8way_avx)
-@@ -737,5 +743,6 @@ ENTRY(serpent_ctr_8way_avx)
+@@ -738,6 +744,7 @@ ENTRY(serpent_ctr_8way_avx)
store_ctr_8way(%rdx, %rsi, RA1, RB1, RC1, RD1, RA2, RB2, RC2, RD2);
+ pax_force_retaddr
ret;
ENDPROC(serpent_ctr_8way_avx)
+
+@@ -758,6 +765,7 @@ ENTRY(serpent_xts_enc_8way_avx)
+ /* dst <= regs xor IVs(in dst) */
+ store_xts_8way(%rsi, RA1, RB1, RC1, RD1, RA2, RB2, RC2, RD2);
+
++ pax_force_retaddr
+ ret;
+ ENDPROC(serpent_xts_enc_8way_avx)
+
+@@ -778,5 +786,6 @@ ENTRY(serpent_xts_dec_8way_avx)
+ /* dst <= regs xor IVs(in dst) */
+ store_xts_8way(%rsi, RC1, RD1, RB1, RE1, RC2, RD2, RB2, RE2);
+
++ pax_force_retaddr
+ ret;
+ ENDPROC(serpent_xts_dec_8way_avx)
diff --git a/arch/x86/crypto/serpent-sse2-x86_64-asm_64.S b/arch/x86/crypto/serpent-sse2-x86_64-asm_64.S
index acc066c..1559cc4 100644
--- a/arch/x86/crypto/serpent-sse2-x86_64-asm_64.S
@@ -11373,7 +11368,7 @@ index a410950..3356d42 100644
ENDPROC(\name)
diff --git a/arch/x86/crypto/twofish-avx-x86_64-asm_64.S b/arch/x86/crypto/twofish-avx-x86_64-asm_64.S
-index 8d3e113..898b161 100644
+index 0505813..63b1d00 100644
--- a/arch/x86/crypto/twofish-avx-x86_64-asm_64.S
+++ b/arch/x86/crypto/twofish-avx-x86_64-asm_64.S
@@ -24,6 +24,7 @@
@@ -11384,7 +11379,7 @@ index 8d3e113..898b161 100644
#include "glue_helper-asm-avx.S"
.file "twofish-avx-x86_64-asm_64.S"
-@@ -282,6 +283,7 @@ __twofish_enc_blk8:
+@@ -284,6 +285,7 @@ __twofish_enc_blk8:
outunpack_blocks(RC1, RD1, RA1, RB1, RK1, RX0, RY0, RK2);
outunpack_blocks(RC2, RD2, RA2, RB2, RK1, RX0, RY0, RK2);
@@ -11392,7 +11387,7 @@ index 8d3e113..898b161 100644
ret;
ENDPROC(__twofish_enc_blk8)
-@@ -322,6 +324,7 @@ __twofish_dec_blk8:
+@@ -324,6 +326,7 @@ __twofish_dec_blk8:
outunpack_blocks(RA1, RB1, RC1, RD1, RK1, RX0, RY0, RK2);
outunpack_blocks(RA2, RB2, RC2, RD2, RK1, RX0, RY0, RK2);
@@ -11400,7 +11395,7 @@ index 8d3e113..898b161 100644
ret;
ENDPROC(__twofish_dec_blk8)
-@@ -340,6 +343,7 @@ ENTRY(twofish_ecb_enc_8way)
+@@ -342,6 +345,7 @@ ENTRY(twofish_ecb_enc_8way)
store_8way(%r11, RC1, RD1, RA1, RB1, RC2, RD2, RA2, RB2);
@@ -11408,7 +11403,7 @@ index 8d3e113..898b161 100644
ret;
ENDPROC(twofish_ecb_enc_8way)
-@@ -358,6 +362,7 @@ ENTRY(twofish_ecb_dec_8way)
+@@ -360,6 +364,7 @@ ENTRY(twofish_ecb_dec_8way)
store_8way(%r11, RA1, RB1, RC1, RD1, RA2, RB2, RC2, RD2);
@@ -11416,7 +11411,7 @@ index 8d3e113..898b161 100644
ret;
ENDPROC(twofish_ecb_dec_8way)
-@@ -381,6 +386,7 @@ ENTRY(twofish_cbc_dec_8way)
+@@ -383,6 +388,7 @@ ENTRY(twofish_cbc_dec_8way)
popq %r12;
@@ -11424,13 +11419,29 @@ index 8d3e113..898b161 100644
ret;
ENDPROC(twofish_cbc_dec_8way)
-@@ -406,5 +412,6 @@ ENTRY(twofish_ctr_8way)
+@@ -408,6 +414,7 @@ ENTRY(twofish_ctr_8way)
popq %r12;
+ pax_force_retaddr 0, 1
ret;
ENDPROC(twofish_ctr_8way)
+
+@@ -430,6 +437,7 @@ ENTRY(twofish_xts_enc_8way)
+ /* dst <= regs xor IVs(in dst) */
+ store_xts_8way(%r11, RC1, RD1, RA1, RB1, RC2, RD2, RA2, RB2);
+
++ pax_force_retaddr 0, 1
+ ret;
+ ENDPROC(twofish_xts_enc_8way)
+
+@@ -452,5 +460,6 @@ ENTRY(twofish_xts_dec_8way)
+ /* dst <= regs xor IVs(in dst) */
+ store_xts_8way(%r11, RA1, RB1, RC1, RD1, RA2, RB2, RC2, RD2);
+
++ pax_force_retaddr 0, 1
+ ret;
+ ENDPROC(twofish_xts_dec_8way)
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
@@ -11494,7 +11505,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 03abf9b..a42ba29 100644
+index 52ff81c..98af645 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,
@@ -11872,7 +11883,7 @@ index 474dc1b..24aaa3e 100644
END(ia32_syscall)
diff --git a/arch/x86/ia32/sys_ia32.c b/arch/x86/ia32/sys_ia32.c
-index ad7a20c..1ffa3c1 100644
+index 8e0ceec..af13504 100644
--- a/arch/x86/ia32/sys_ia32.c
+++ b/arch/x86/ia32/sys_ia32.c
@@ -69,8 +69,8 @@ asmlinkage long sys32_ftruncate64(unsigned int fd, unsigned long offset_low,
@@ -11886,15 +11897,6 @@ index ad7a20c..1ffa3c1 100644
SET_UID(uid, from_kuid_munged(current_user_ns(), stat->uid));
SET_GID(gid, from_kgid_munged(current_user_ns(), stat->gid));
if (!access_ok(VERIFY_WRITE, ubuf, sizeof(struct stat64)) ||
-@@ -205,7 +205,7 @@ asmlinkage long sys32_sendfile(int out_fd, int in_fd,
- return -EFAULT;
-
- set_fs(KERNEL_DS);
-- ret = sys_sendfile(out_fd, in_fd, offset ? (off_t __user *)&of : NULL,
-+ ret = sys_sendfile(out_fd, in_fd, offset ? (off_t __force_user *)&of : NULL,
- count);
- set_fs(old_fs);
-
diff --git a/arch/x86/include/asm/alternative-asm.h b/arch/x86/include/asm/alternative-asm.h
index 372231c..a5aa1a1 100644
--- a/arch/x86/include/asm/alternative-asm.h
@@ -12394,11 +12396,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"
@@ -12406,7 +12403,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"
@@ -13033,7 +13034,7 @@ index 46fc474..b02b0f9 100644
if (len)
diff --git a/arch/x86/include/asm/cmpxchg.h b/arch/x86/include/asm/cmpxchg.h
-index 8d871ea..c1a0dc9 100644
+index d47786a..ce1b05d 100644
--- a/arch/x86/include/asm/cmpxchg.h
+++ b/arch/x86/include/asm/cmpxchg.h
@@ -14,8 +14,12 @@ extern void __cmpxchg_wrong_size(void)
@@ -13108,10 +13109,10 @@ 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 93fe929..90858b7 100644
+index e99ac27..e89e28c 100644
--- a/arch/x86/include/asm/cpufeature.h
+++ b/arch/x86/include/asm/cpufeature.h
-@@ -207,7 +207,7 @@
+@@ -211,7 +211,7 @@
#define X86_FEATURE_BMI1 (9*32+ 3) /* 1st group bit manipulation extensions */
#define X86_FEATURE_HLE (9*32+ 4) /* Hardware Lock Elision */
#define X86_FEATURE_AVX2 (9*32+ 5) /* AVX2 instructions */
@@ -13120,7 +13121,7 @@ index 93fe929..90858b7 100644
#define X86_FEATURE_BMI2 (9*32+ 8) /* 2nd group bit manipulation extensions */
#define X86_FEATURE_ERMS (9*32+ 9) /* Enhanced REP MOVSB/STOSB */
#define X86_FEATURE_INVPCID (9*32+10) /* Invalidate Processor Context ID */
-@@ -377,7 +377,7 @@ static __always_inline __pure bool __static_cpu_has(u16 bit)
+@@ -394,7 +394,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"
@@ -13537,10 +13538,10 @@ index be27ba1..8f13ff9 100644
: "memory"
);
diff --git a/arch/x86/include/asm/hw_irq.h b/arch/x86/include/asm/hw_irq.h
-index 10a78c3..cc77143 100644
+index 1da97ef..9c2ebff 100644
--- a/arch/x86/include/asm/hw_irq.h
+++ b/arch/x86/include/asm/hw_irq.h
-@@ -147,8 +147,8 @@ extern void setup_ioapic_dest(void);
+@@ -148,8 +148,8 @@ extern void setup_ioapic_dest(void);
extern void enable_IO_APIC(void);
/* Statistics */
@@ -14039,9 +14040,9 @@ index cdbf367..adb37ac 100644
+#endif
+
}
-- }
- #endif
-+ }
++#endif
+ }
+-#endif
}
#define activate_mm(prev, next) \
@@ -14081,10 +14082,10 @@ index e3b7819..b257c64 100644
+
#endif /* _ASM_X86_MODULE_H */
diff --git a/arch/x86/include/asm/nmi.h b/arch/x86/include/asm/nmi.h
-index c0fa356..07a498a 100644
+index 86f9301..b365cda 100644
--- a/arch/x86/include/asm/nmi.h
+++ b/arch/x86/include/asm/nmi.h
-@@ -42,11 +42,11 @@ struct nmiaction {
+@@ -40,11 +40,11 @@ struct nmiaction {
nmi_handler_t handler;
unsigned long flags;
const char *name;
@@ -14098,7 +14099,7 @@ index c0fa356..07a498a 100644
.handler = (fn), \
.name = (n), \
.flags = (fg), \
-@@ -54,7 +54,7 @@ struct nmiaction {
+@@ -52,7 +52,7 @@ struct nmiaction {
__register_nmi_handler((t), &fn##_na); \
})
@@ -14136,10 +14137,10 @@ 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 7361e47..16dc226 100644
+index cfdc9ee..3f7b5d6 100644
--- a/arch/x86/include/asm/paravirt.h
+++ b/arch/x86/include/asm/paravirt.h
-@@ -564,7 +564,7 @@ static inline pmd_t __pmd(pmdval_t val)
+@@ -560,7 +560,7 @@ static inline pmd_t __pmd(pmdval_t val)
return (pmd_t) { ret };
}
@@ -14148,7 +14149,7 @@ index 7361e47..16dc226 100644
{
pmdval_t ret;
-@@ -630,6 +630,18 @@ static inline void set_pgd(pgd_t *pgdp, pgd_t pgd)
+@@ -626,6 +626,18 @@ static inline void set_pgd(pgd_t *pgdp, pgd_t pgd)
val);
}
@@ -14167,7 +14168,7 @@ index 7361e47..16dc226 100644
static inline void pgd_clear(pgd_t *pgdp)
{
set_pgd(pgdp, __pgd(0));
-@@ -714,6 +726,21 @@ static inline void __set_fixmap(unsigned /* enum fixed_addresses */ idx,
+@@ -710,6 +722,21 @@ static inline void __set_fixmap(unsigned /* enum fixed_addresses */ idx,
pv_mmu_ops.set_fixmap(idx, phys, flags);
}
@@ -14189,7 +14190,7 @@ index 7361e47..16dc226 100644
#if defined(CONFIG_SMP) && defined(CONFIG_PARAVIRT_SPINLOCKS)
static inline int arch_spin_is_locked(struct arch_spinlock *lock)
-@@ -930,7 +957,7 @@ extern void default_banner(void);
+@@ -926,7 +953,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)
@@ -14198,7 +14199,7 @@ index 7361e47..16dc226 100644
#endif
#define INTERRUPT_RETURN \
-@@ -1005,6 +1032,21 @@ extern void default_banner(void);
+@@ -1001,6 +1028,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))
@@ -14221,7 +14222,7 @@ index 7361e47..16dc226 100644
#endif /* __ASSEMBLY__ */
diff --git a/arch/x86/include/asm/paravirt_types.h b/arch/x86/include/asm/paravirt_types.h
-index b3b0ec1..b1cd3eb 100644
+index 0db1fca..52310cc 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 {
@@ -14743,7 +14744,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 567b5d0..bd91d64 100644
+index e642300..0ef8f31 100644
--- a/arch/x86/include/asm/pgtable_types.h
+++ b/arch/x86/include/asm/pgtable_types.h
@@ -16,13 +16,12 @@
@@ -14858,10 +14859,10 @@ index 567b5d0..bd91d64 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 3270116..8d99d82 100644
+index 22224b3..4080dab 100644
--- a/arch/x86/include/asm/processor.h
+++ b/arch/x86/include/asm/processor.h
-@@ -285,7 +285,7 @@ struct tss_struct {
+@@ -282,7 +282,7 @@ struct tss_struct {
} ____cacheline_aligned;
@@ -14870,7 +14871,7 @@ index 3270116..8d99d82 100644
/*
* Save the original ist values for checking stack pointers during debugging
-@@ -826,11 +826,18 @@ static inline void spin_lock_prefetch(const void *x)
+@@ -823,11 +823,18 @@ static inline void spin_lock_prefetch(const void *x)
*/
#define TASK_SIZE PAGE_OFFSET
#define TASK_SIZE_MAX TASK_SIZE
@@ -14891,7 +14892,7 @@ index 3270116..8d99d82 100644
.vm86_info = NULL, \
.sysenter_cs = __KERNEL_CS, \
.io_bitmap_ptr = NULL, \
-@@ -844,7 +851,7 @@ static inline void spin_lock_prefetch(const void *x)
+@@ -841,7 +848,7 @@ static inline void spin_lock_prefetch(const void *x)
*/
#define INIT_TSS { \
.x86_tss = { \
@@ -14900,7 +14901,7 @@ index 3270116..8d99d82 100644
.ss0 = __KERNEL_DS, \
.ss1 = __KERNEL_CS, \
.io_bitmap_base = INVALID_IO_BITMAP_OFFSET, \
-@@ -855,11 +862,7 @@ static inline void spin_lock_prefetch(const void *x)
+@@ -852,11 +859,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))
@@ -14913,7 +14914,7 @@ index 3270116..8d99d82 100644
/*
* The below -8 is to reserve 8 bytes on top of the ring0 stack.
-@@ -874,7 +877,7 @@ extern unsigned long thread_saved_pc(struct task_struct *tsk);
+@@ -871,7 +874,7 @@ extern unsigned long thread_saved_pc(struct task_struct *tsk);
#define task_pt_regs(task) \
({ \
struct pt_regs *__regs__; \
@@ -14922,7 +14923,7 @@ index 3270116..8d99d82 100644
__regs__ - 1; \
})
-@@ -884,13 +887,13 @@ extern unsigned long thread_saved_pc(struct task_struct *tsk);
+@@ -881,13 +884,13 @@ extern unsigned long thread_saved_pc(struct task_struct *tsk);
/*
* User space process size. 47bits minus one guard page.
*/
@@ -14938,7 +14939,7 @@ index 3270116..8d99d82 100644
#define TASK_SIZE (test_thread_flag(TIF_ADDR32) ? \
IA32_PAGE_OFFSET : TASK_SIZE_MAX)
-@@ -901,11 +904,11 @@ extern unsigned long thread_saved_pc(struct task_struct *tsk);
+@@ -898,11 +901,11 @@ extern unsigned long thread_saved_pc(struct task_struct *tsk);
#define STACK_TOP_MAX TASK_SIZE_MAX
#define INIT_THREAD { \
@@ -14952,7 +14953,7 @@ index 3270116..8d99d82 100644
}
/*
-@@ -933,6 +936,10 @@ extern void start_thread(struct pt_regs *regs, unsigned long new_ip,
+@@ -930,6 +933,10 @@ extern void start_thread(struct pt_regs *regs, unsigned long new_ip,
*/
#define TASK_UNMAPPED_BASE (PAGE_ALIGN(TASK_SIZE / 3))
@@ -14963,16 +14964,16 @@ index 3270116..8d99d82 100644
#define KSTK_EIP(task) (task_pt_regs(task)->ip)
/* Get/set a process' ability to use the timestamp counter instruction */
-@@ -993,7 +1000,7 @@ extern bool cpu_has_amd_erratum(const int *);
- #define cpu_has_amd_erratum(x) (false)
- #endif /* CONFIG_CPU_SUP_AMD */
+@@ -970,7 +977,7 @@ unsigned long calc_aperfmperf_ratio(struct aperfmperf *old,
+ return ratio;
+ }
-extern unsigned long arch_align_stack(unsigned long sp);
+#define arch_align_stack(x) ((x) & ~0xfUL)
extern void free_init_pages(char *what, unsigned long begin, unsigned long end);
void default_idle(void);
-@@ -1003,6 +1010,6 @@ bool xen_set_default_idle(void);
+@@ -980,6 +987,6 @@ bool xen_set_default_idle(void);
#define xen_set_default_idle 0
#endif
@@ -15100,7 +15101,7 @@ index a82c4f1..ac45053 100644
extern struct machine_ops machine_ops;
diff --git a/arch/x86/include/asm/rwsem.h b/arch/x86/include/asm/rwsem.h
-index 2dbe4a7..ce1db00 100644
+index cad82c9..2e5c5c1 100644
--- a/arch/x86/include/asm/rwsem.h
+++ b/arch/x86/include/asm/rwsem.h
@@ -64,6 +64,14 @@ static inline void __down_read(struct rw_semaphore *sem)
@@ -15146,9 +15147,9 @@ index 2dbe4a7..ce1db00 100644
+#endif
+
/* adds 0xffff0001, returns the old value */
- " test %1,%1\n\t"
- /* was the count 0 before? */
-@@ -141,6 +165,14 @@ static inline void __up_read(struct rw_semaphore *sem)
+ " test " __ASM_SEL(%w1,%k1) "," __ASM_SEL(%w1,%k1) "\n\t"
+ /* was the active mask 0 before? */
+@@ -155,6 +179,14 @@ static inline void __up_read(struct rw_semaphore *sem)
long tmp;
asm volatile("# beginning __up_read\n\t"
LOCK_PREFIX " xadd %1,(%2)\n\t"
@@ -15163,7 +15164,7 @@ index 2dbe4a7..ce1db00 100644
/* subtracts 1, returns the old value */
" jns 1f\n\t"
" call call_rwsem_wake\n" /* expects old value in %edx */
-@@ -159,6 +191,14 @@ static inline void __up_write(struct rw_semaphore *sem)
+@@ -173,6 +205,14 @@ static inline void __up_write(struct rw_semaphore *sem)
long tmp;
asm volatile("# beginning __up_write\n\t"
LOCK_PREFIX " xadd %1,(%2)\n\t"
@@ -15178,7 +15179,7 @@ index 2dbe4a7..ce1db00 100644
/* subtracts 0xffff0001, returns the old value */
" jns 1f\n\t"
" call call_rwsem_wake\n" /* expects old value in %edx */
-@@ -176,6 +216,14 @@ static inline void __downgrade_write(struct rw_semaphore *sem)
+@@ -190,6 +230,14 @@ static inline void __downgrade_write(struct rw_semaphore *sem)
{
asm volatile("# beginning __downgrade_write\n\t"
LOCK_PREFIX _ASM_ADD "%2,(%1)\n\t"
@@ -15193,7 +15194,7 @@ index 2dbe4a7..ce1db00 100644
/*
* transitions 0xZZZZ0001 -> 0xYYYY0001 (i386)
* 0xZZZZZZZZ00000001 -> 0xYYYYYYYY00000001 (x86_64)
-@@ -194,7 +242,15 @@ static inline void __downgrade_write(struct rw_semaphore *sem)
+@@ -208,7 +256,15 @@ static inline void __downgrade_write(struct rw_semaphore *sem)
*/
static inline void rwsem_atomic_add(long delta, struct rw_semaphore *sem)
{
@@ -15210,7 +15211,7 @@ index 2dbe4a7..ce1db00 100644
: "+m" (sem->count)
: "er" (delta));
}
-@@ -204,7 +260,7 @@ static inline void rwsem_atomic_add(long delta, struct rw_semaphore *sem)
+@@ -218,7 +274,7 @@ static inline void rwsem_atomic_add(long delta, struct rw_semaphore *sem)
*/
static inline long rwsem_atomic_update(long delta, struct rw_semaphore *sem)
{
@@ -15444,7 +15445,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,
@@ -15456,15 +15465,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;
@@ -15502,7 +15502,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 2cd056e..0224df8 100644
+index a1df6e8..e002940 100644
--- a/arch/x86/include/asm/thread_info.h
+++ b/arch/x86/include/asm/thread_info.h
@@ -10,6 +10,7 @@
@@ -15590,38 +15590,24 @@ index 2cd056e..0224df8 100644
/* Only used for 64 bit */
#define _TIF_DO_NOTIFY_MASK \
-@@ -158,6 +154,23 @@ struct thread_info {
+@@ -158,45 +154,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)
-{
@@ -15631,15 +15617,40 @@ index 2cd056e..0224df8 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 */
@@ -15680,7 +15691,7 @@ index 2cd056e..0224df8 100644
#endif
#endif /* !X86_32 */
-@@ -285,5 +257,12 @@ static inline bool is_ia32_task(void)
+@@ -283,5 +255,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);
@@ -16004,18 +16015,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")
@@ -16055,14 +16066,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.
@@ -16087,7 +16097,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)
@@ -16636,7 +16647,7 @@ 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 0532f5d..36afc0a 100644
+index b44577b..27d8443 100644
--- a/arch/x86/kernel/acpi/sleep.c
+++ b/arch/x86/kernel/acpi/sleep.c
@@ -74,8 +74,12 @@ int acpi_suspend_lowlevel(void)
@@ -16653,10 +16664,10 @@ index 0532f5d..36afc0a 100644
#endif
initial_code = (unsigned long)wakeup_long64;
diff --git a/arch/x86/kernel/acpi/wakeup_32.S b/arch/x86/kernel/acpi/wakeup_32.S
-index 13ab720..95d5442 100644
+index d1daa66..59fecba 100644
--- a/arch/x86/kernel/acpi/wakeup_32.S
+++ b/arch/x86/kernel/acpi/wakeup_32.S
-@@ -30,13 +30,11 @@ wakeup_pmode_return:
+@@ -29,13 +29,11 @@ wakeup_pmode_return:
# and restore the stack ... but you need gdt for this to work
movl saved_context_esp, %esp
@@ -16673,7 +16684,7 @@ index 13ab720..95d5442 100644
bogus_magic:
jmp bogus_magic
diff --git a/arch/x86/kernel/alternative.c b/arch/x86/kernel/alternative.c
-index ef5ccca..bd83949 100644
+index c15cf9a..0e63558 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,
@@ -17031,10 +17042,10 @@ index 794f6eb..67e1db2 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 66b5faf..3442423 100644
+index 53a4e27..038760a 100644
--- a/arch/x86/kernel/apm_32.c
+++ b/arch/x86/kernel/apm_32.c
-@@ -434,7 +434,7 @@ static DEFINE_MUTEX(apm_mutex);
+@@ -433,7 +433,7 @@ static DEFINE_MUTEX(apm_mutex);
* This is for buggy BIOS's that refer to (real mode) segment 0x40
* even though they are called in protected mode.
*/
@@ -17043,7 +17054,7 @@ index 66b5faf..3442423 100644
(unsigned long)__va(0x400UL), PAGE_SIZE - 0x400 - 1);
static const char driver_version[] = "1.16ac"; /* no spaces */
-@@ -612,7 +612,10 @@ static long __apm_bios_call(void *_call)
+@@ -611,7 +611,10 @@ static long __apm_bios_call(void *_call)
BUG_ON(cpu != 0);
gdt = get_cpu_gdt_table(cpu);
save_desc_40 = gdt[0x40 / 8];
@@ -17054,7 +17065,7 @@ index 66b5faf..3442423 100644
apm_irq_save(flags);
APM_DO_SAVE_SEGS;
-@@ -621,7 +624,11 @@ static long __apm_bios_call(void *_call)
+@@ -620,7 +623,11 @@ static long __apm_bios_call(void *_call)
&call->esi);
APM_DO_RESTORE_SEGS;
apm_irq_restore(flags);
@@ -17066,7 +17077,7 @@ index 66b5faf..3442423 100644
put_cpu();
return call->eax & 0xff;
-@@ -688,7 +695,10 @@ static long __apm_bios_call_simple(void *_call)
+@@ -687,7 +694,10 @@ static long __apm_bios_call_simple(void *_call)
BUG_ON(cpu != 0);
gdt = get_cpu_gdt_table(cpu);
save_desc_40 = gdt[0x40 / 8];
@@ -17077,7 +17088,7 @@ index 66b5faf..3442423 100644
apm_irq_save(flags);
APM_DO_SAVE_SEGS;
-@@ -696,7 +706,11 @@ static long __apm_bios_call_simple(void *_call)
+@@ -695,7 +705,11 @@ static long __apm_bios_call_simple(void *_call)
&call->eax);
APM_DO_RESTORE_SEGS;
apm_irq_restore(flags);
@@ -17089,7 +17100,7 @@ index 66b5faf..3442423 100644
put_cpu();
return error;
}
-@@ -2363,12 +2377,15 @@ static int __init apm_init(void)
+@@ -2362,12 +2376,15 @@ static int __init apm_init(void)
* code to that CPU.
*/
gdt = get_cpu_gdt_table(0);
@@ -17125,16 +17136,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();
@@ -17146,10 +17157,10 @@ index 2861082..6d4718e 100644
BLANK();
OFFSET(XEN_vcpu_info_mask, vcpu_info, evtchn_upcall_mask);
diff --git a/arch/x86/kernel/asm-offsets_64.c b/arch/x86/kernel/asm-offsets_64.c
-index 1b4754f..fbb4227 100644
+index e7c798b..2b2019b 100644
--- a/arch/x86/kernel/asm-offsets_64.c
+++ b/arch/x86/kernel/asm-offsets_64.c
-@@ -76,6 +76,7 @@ int main(void)
+@@ -77,6 +77,7 @@ int main(void)
BLANK();
#undef ENTRY
@@ -17158,7 +17169,7 @@ index 1b4754f..fbb4227 100644
BLANK();
diff --git a/arch/x86/kernel/cpu/Makefile b/arch/x86/kernel/cpu/Makefile
-index a0e067d..9c7db16 100644
+index b0684e4..22ccfd7 100644
--- a/arch/x86/kernel/cpu/Makefile
+++ b/arch/x86/kernel/cpu/Makefile
@@ -8,10 +8,6 @@ CFLAGS_REMOVE_common.o = -pg
@@ -17171,12 +17182,12 @@ index a0e067d..9c7db16 100644
-
obj-y := intel_cacheinfo.o scattered.o topology.o
obj-y += proc.o capflags.o powerflags.o common.o
- obj-y += vmware.o hypervisor.o mshyperv.o
+ obj-y += rdrand.o
diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c
-index fa96eb0..03efe73 100644
+index 5013a48..0782c53 100644
--- a/arch/x86/kernel/cpu/amd.c
+++ b/arch/x86/kernel/cpu/amd.c
-@@ -737,7 +737,7 @@ static unsigned int __cpuinit amd_size_cache(struct cpuinfo_x86 *c,
+@@ -744,7 +744,7 @@ static unsigned int __cpuinit amd_size_cache(struct cpuinfo_x86 *c,
unsigned int size)
{
/* AMD errata T13 (order #21922) */
@@ -17186,7 +17197,7 @@ index fa96eb0..03efe73 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 d814772..c615653 100644
+index 22018f7..bc6f5e3 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 = {
@@ -17270,7 +17281,7 @@ index d814772..c615653 100644
/* If the model name is still unset, do table lookup. */
if (!c->x86_model_id[0]) {
const char *p;
-@@ -1065,10 +1015,12 @@ static __init int setup_disablecpuid(char *arg)
+@@ -1069,10 +1019,12 @@ static __init int setup_disablecpuid(char *arg)
}
__setup("clearcpuid=", setup_disablecpuid);
@@ -17285,7 +17296,7 @@ index d814772..c615653 100644
DEFINE_PER_CPU_FIRST(union irq_stack_union,
irq_stack_union) __aligned(PAGE_SIZE);
-@@ -1082,7 +1034,7 @@ DEFINE_PER_CPU(struct task_struct *, current_task) ____cacheline_aligned =
+@@ -1086,7 +1038,7 @@ DEFINE_PER_CPU(struct task_struct *, current_task) ____cacheline_aligned =
EXPORT_PER_CPU_SYMBOL(current_task);
DEFINE_PER_CPU(unsigned long, kernel_stack) =
@@ -17294,7 +17305,7 @@ index d814772..c615653 100644
EXPORT_PER_CPU_SYMBOL(kernel_stack);
DEFINE_PER_CPU(char *, irq_stack_ptr) =
-@@ -1227,7 +1179,7 @@ void __cpuinit cpu_init(void)
+@@ -1231,7 +1183,7 @@ void __cpuinit cpu_init(void)
load_ucode_ap();
cpu = stack_smp_processor_id();
@@ -17303,7 +17314,7 @@ index d814772..c615653 100644
oist = &per_cpu(orig_ist, cpu);
#ifdef CONFIG_NUMA
-@@ -1253,7 +1205,7 @@ void __cpuinit cpu_init(void)
+@@ -1257,7 +1209,7 @@ void __cpuinit cpu_init(void)
switch_to_new_gdt(cpu);
loadsegment(fs, 0);
@@ -17312,7 +17323,7 @@ index d814772..c615653 100644
memset(me->thread.tls_array, 0, GDT_ENTRY_TLS_ENTRIES * 8);
syscall_init();
-@@ -1262,7 +1214,6 @@ void __cpuinit cpu_init(void)
+@@ -1266,7 +1218,6 @@ void __cpuinit cpu_init(void)
wrmsrl(MSR_KERNEL_GS_BASE, 0);
barrier();
@@ -17320,7 +17331,7 @@ index d814772..c615653 100644
enable_x2apic();
/*
-@@ -1314,7 +1265,7 @@ void __cpuinit cpu_init(void)
+@@ -1318,7 +1269,7 @@ void __cpuinit cpu_init(void)
{
int cpu = smp_processor_id();
struct task_struct *curr = current;
@@ -17329,19 +17340,6 @@ index d814772..c615653 100644
struct thread_struct *thread = &curr->thread;
show_ucode_info_early();
-diff --git a/arch/x86/kernel/cpu/intel.c b/arch/x86/kernel/cpu/intel.c
-index 1905ce9..a7ac587 100644
---- a/arch/x86/kernel/cpu/intel.c
-+++ b/arch/x86/kernel/cpu/intel.c
-@@ -173,7 +173,7 @@ static void __cpuinit trap_init_f00f_bug(void)
- * Update the IDT descriptor and reload the IDT so that
- * it uses the read-only mapped virtual address.
- */
-- idt_descr.address = fix_to_virt(FIX_F00F_IDT);
-+ idt_descr.address = (struct desc_struct *)fix_to_virt(FIX_F00F_IDT);
- load_idt(&idt_descr);
- }
- #endif
diff --git a/arch/x86/kernel/cpu/intel_cacheinfo.c b/arch/x86/kernel/cpu/intel_cacheinfo.c
index 7c6f7d5..8cac382 100644
--- a/arch/x86/kernel/cpu/intel_cacheinfo.c
@@ -17443,7 +17441,7 @@ index 7c6f7d5..8cac382 100644
};
diff --git a/arch/x86/kernel/cpu/mcheck/mce.c b/arch/x86/kernel/cpu/mcheck/mce.c
-index 7bc1263..bff5686 100644
+index 9239504..b2471ce 100644
--- a/arch/x86/kernel/cpu/mcheck/mce.c
+++ b/arch/x86/kernel/cpu/mcheck/mce.c
@@ -45,6 +45,7 @@
@@ -17678,10 +17676,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 bf0f01a..9adfee1 100644
+index 1025f3c..824f677 100644
--- a/arch/x86/kernel/cpu/perf_event.c
+++ b/arch/x86/kernel/cpu/perf_event.c
-@@ -1305,7 +1305,7 @@ static void __init pmu_check_apic(void)
+@@ -1311,7 +1311,7 @@ static void __init pmu_check_apic(void)
pr_info("no hardware sampling interrupt available.\n");
}
@@ -17690,7 +17688,7 @@ index bf0f01a..9adfee1 100644
.name = "format",
.attrs = NULL,
};
-@@ -1374,7 +1374,7 @@ static struct attribute *events_attr[] = {
+@@ -1410,7 +1410,7 @@ static struct attribute *events_attr[] = {
NULL,
};
@@ -17699,7 +17697,7 @@ index bf0f01a..9adfee1 100644
.name = "events",
.attrs = events_attr,
};
-@@ -1873,7 +1873,7 @@ static unsigned long get_segment_base(unsigned int segment)
+@@ -1920,7 +1920,7 @@ static unsigned long get_segment_base(unsigned int segment)
if (idx > GDT_ENTRIES)
return 0;
@@ -17708,7 +17706,7 @@ index bf0f01a..9adfee1 100644
}
return get_desc_base(desc + idx);
-@@ -1963,7 +1963,7 @@ perf_callchain_user(struct perf_callchain_entry *entry, struct pt_regs *regs)
+@@ -2010,7 +2010,7 @@ perf_callchain_user(struct perf_callchain_entry *entry, struct pt_regs *regs)
break;
perf_callchain_store(entry, frame.return_address);
@@ -17718,10 +17716,10 @@ index bf0f01a..9adfee1 100644
}
diff --git a/arch/x86/kernel/cpu/perf_event_intel.c b/arch/x86/kernel/cpu/perf_event_intel.c
-index 4a0a462..be3b204 100644
+index a9e2207..d70c83a 100644
--- a/arch/x86/kernel/cpu/perf_event_intel.c
+++ b/arch/x86/kernel/cpu/perf_event_intel.c
-@@ -1994,10 +1994,10 @@ __init int intel_pmu_init(void)
+@@ -2022,10 +2022,10 @@ __init int intel_pmu_init(void)
* v2 and above have a perf capabilities MSR
*/
if (version > 1) {
@@ -17736,10 +17734,10 @@ index 4a0a462..be3b204 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 3e091f0..d2dc8d6 100644
+index 52441a2..f94fae8 100644
--- a/arch/x86/kernel/cpu/perf_event_intel_uncore.c
+++ b/arch/x86/kernel/cpu/perf_event_intel_uncore.c
-@@ -2428,7 +2428,7 @@ static void __init uncore_types_exit(struct intel_uncore_type **types)
+@@ -3093,7 +3093,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;
@@ -17748,7 +17746,7 @@ index 3e091f0..d2dc8d6 100644
struct attribute **attrs;
int i, j;
-@@ -2826,7 +2826,7 @@ static int
+@@ -3518,7 +3518,7 @@ static int
return NOTIFY_OK;
}
@@ -17758,10 +17756,10 @@ index 3e091f0..d2dc8d6 100644
/*
* 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 e68a455..975a932 100644
+index f952891..4722ad4 100644
--- a/arch/x86/kernel/cpu/perf_event_intel_uncore.h
+++ b/arch/x86/kernel/cpu/perf_event_intel_uncore.h
-@@ -428,7 +428,7 @@ struct intel_uncore_box {
+@@ -488,7 +488,7 @@ struct intel_uncore_box {
struct uncore_event_desc {
struct kobj_attribute attr;
const char *config;
@@ -17813,7 +17811,7 @@ index afa64ad..dce67dd 100644
return -EFAULT;
}
diff --git a/arch/x86/kernel/doublefault_32.c b/arch/x86/kernel/doublefault_32.c
-index 37250fe..bf2ec74 100644
+index 155a13f..1672b9b 100644
--- a/arch/x86/kernel/doublefault_32.c
+++ b/arch/x86/kernel/doublefault_32.c
@@ -11,7 +11,7 @@
@@ -17828,7 +17826,7 @@ index 37250fe..bf2ec74 100644
@@ -21,7 +21,7 @@ static void doublefault_fn(void)
unsigned long gdt, tss;
- store_gdt(&gdt_desc);
+ native_store_gdt(&gdt_desc);
- gdt = gdt_desc.address;
+ gdt = (unsigned long)gdt_desc.address;
@@ -17848,7 +17846,7 @@ index 37250fe..bf2ec74 100644
.__cr3 = __pa_nodebug(swapper_pg_dir),
diff --git a/arch/x86/kernel/dumpstack.c b/arch/x86/kernel/dumpstack.c
-index c8797d5..c605e53 100644
+index deb6421..76bbc12 100644
--- a/arch/x86/kernel/dumpstack.c
+++ b/arch/x86/kernel/dumpstack.c
@@ -2,6 +2,9 @@
@@ -17953,16 +17951,16 @@ index c8797d5..c605e53 100644
}
return (unsigned long)frame;
-@@ -189,7 +188,7 @@ void dump_stack(void)
+@@ -150,7 +149,7 @@ static int print_trace_stack(void *data, char *name)
+ static void print_trace_address(void *data, unsigned long addr, int reliable)
+ {
+ touch_nmi_watchdog();
+- printk(data);
++ printk("%s", (char *)data);
+ printk_address(addr, reliable);
+ }
- bp = stack_frame(current, NULL);
- printk("Pid: %d, comm: %.20s %s %s %.*s\n",
-- current->pid, current->comm, print_tainted(),
-+ task_pid_nr(current), current->comm, print_tainted(),
- init_utsname()->release,
- (int)strcspn(init_utsname()->version, " "),
- init_utsname()->version);
-@@ -225,6 +224,8 @@ unsigned __kprobes long oops_begin(void)
+@@ -219,6 +218,8 @@ unsigned __kprobes long oops_begin(void)
}
EXPORT_SYMBOL_GPL(oops_begin);
@@ -17971,7 +17969,7 @@ index c8797d5..c605e53 100644
void __kprobes oops_end(unsigned long flags, struct pt_regs *regs, int signr)
{
if (regs && kexec_should_crash(current))
-@@ -246,7 +247,10 @@ void __kprobes oops_end(unsigned long flags, struct pt_regs *regs, int signr)
+@@ -240,7 +241,10 @@ void __kprobes oops_end(unsigned long flags, struct pt_regs *regs, int signr)
panic("Fatal exception in interrupt");
if (panic_on_oops)
panic("Fatal exception");
@@ -17983,7 +17981,7 @@ index c8797d5..c605e53 100644
}
int __kprobes __die(const char *str, struct pt_regs *regs, long err)
-@@ -274,7 +278,7 @@ int __kprobes __die(const char *str, struct pt_regs *regs, long err)
+@@ -268,7 +272,7 @@ int __kprobes __die(const char *str, struct pt_regs *regs, long err)
print_modules();
show_regs(regs);
#ifdef CONFIG_X86_32
@@ -17992,7 +17990,7 @@ index c8797d5..c605e53 100644
sp = regs->sp;
ss = regs->ss & 0xffff;
} else {
-@@ -302,7 +306,7 @@ void die(const char *str, struct pt_regs *regs, long err)
+@@ -296,7 +300,7 @@ void die(const char *str, struct pt_regs *regs, long err)
unsigned long flags = oops_begin();
int sig = SIGSEGV;
@@ -18002,7 +18000,7 @@ index c8797d5..c605e53 100644
if (__die(str, regs, err))
diff --git a/arch/x86/kernel/dumpstack_32.c b/arch/x86/kernel/dumpstack_32.c
-index 1038a41..db2c12b 100644
+index f2a1770..540657f 100644
--- a/arch/x86/kernel/dumpstack_32.c
+++ b/arch/x86/kernel/dumpstack_32.c
@@ -38,15 +38,13 @@ void dump_trace(struct task_struct *task, struct pt_regs *regs,
@@ -18025,16 +18023,14 @@ index 1038a41..db2c12b 100644
if (ops->stack(data, "IRQ") < 0)
break;
touch_nmi_watchdog();
-@@ -86,7 +84,7 @@ void show_regs(struct pt_regs *regs)
- {
+@@ -87,27 +85,28 @@ void show_regs(struct pt_regs *regs)
int i;
+ show_regs_print_info(KERN_EMERG);
- __show_regs(regs, !user_mode_vm(regs));
+ __show_regs(regs, !user_mode(regs));
- pr_emerg("Process %.*s (pid: %d, ti=%p task=%p task.ti=%p)\n",
- TASK_COMM_LEN, current->comm, task_pid_nr(current),
-@@ -95,21 +93,22 @@ void show_regs(struct pt_regs *regs)
+ /*
* When in-kernel, we also print out the stack and code at the
* time of the fault..
*/
@@ -18060,7 +18056,7 @@ index 1038a41..db2c12b 100644
code_len = code_len - code_prologue + 1;
}
for (i = 0; i < code_len; i++, ip++) {
-@@ -118,7 +117,7 @@ void show_regs(struct pt_regs *regs)
+@@ -116,7 +115,7 @@ void show_regs(struct pt_regs *regs)
pr_cont(" Bad EIP value.");
break;
}
@@ -18069,7 +18065,7 @@ index 1038a41..db2c12b 100644
pr_cont(" <%02x>", c);
else
pr_cont(" %02x", c);
-@@ -131,6 +130,7 @@ int is_valid_bugaddr(unsigned long ip)
+@@ -129,6 +128,7 @@ int is_valid_bugaddr(unsigned long ip)
{
unsigned short ud2;
@@ -18077,7 +18073,7 @@ index 1038a41..db2c12b 100644
if (ip < PAGE_OFFSET)
return 0;
if (probe_kernel_address((unsigned short *)ip, ud2))
-@@ -138,3 +138,15 @@ int is_valid_bugaddr(unsigned long ip)
+@@ -136,3 +136,15 @@ int is_valid_bugaddr(unsigned long ip)
return ud2 == 0x0b0f;
}
@@ -18094,7 +18090,7 @@ index 1038a41..db2c12b 100644
+EXPORT_SYMBOL(pax_check_alloca);
+#endif
diff --git a/arch/x86/kernel/dumpstack_64.c b/arch/x86/kernel/dumpstack_64.c
-index b653675..51cc8c0 100644
+index addb207..99635fa 100644
--- a/arch/x86/kernel/dumpstack_64.c
+++ b/arch/x86/kernel/dumpstack_64.c
@@ -119,9 +119,9 @@ void dump_trace(struct task_struct *task, struct pt_regs *regs,
@@ -18158,16 +18154,7 @@ index b653675..51cc8c0 100644
put_cpu();
}
EXPORT_SYMBOL(dump_trace);
-@@ -249,7 +253,7 @@ void show_regs(struct pt_regs *regs)
- {
- int i;
- unsigned long sp;
-- const int cpu = smp_processor_id();
-+ const int cpu = raw_smp_processor_id();
- struct task_struct *cur = current;
-
- sp = regs->sp;
-@@ -304,3 +308,50 @@ int is_valid_bugaddr(unsigned long ip)
+@@ -300,3 +304,50 @@ int is_valid_bugaddr(unsigned long ip)
return ud2 == 0x0b0f;
}
@@ -18234,7 +18221,7 @@ index d32abea..74daf4f 100644
static int userdef __initdata;
diff --git a/arch/x86/kernel/early_printk.c b/arch/x86/kernel/early_printk.c
-index 9b9f18b..9fcaa04 100644
+index d15f575..d692043 100644
--- a/arch/x86/kernel/early_printk.c
+++ b/arch/x86/kernel/early_printk.c
@@ -7,6 +7,7 @@
@@ -19006,7 +18993,7 @@ index 8f3e2de..caecc4e 100644
/*
diff --git a/arch/x86/kernel/entry_64.S b/arch/x86/kernel/entry_64.S
-index c1d01e6..a88cf02 100644
+index 7272089..6204f9c5 100644
--- a/arch/x86/kernel/entry_64.S
+++ b/arch/x86/kernel/entry_64.S
@@ -59,6 +59,8 @@
@@ -19742,7 +19729,7 @@ index c1d01e6..a88cf02 100644
.endm
#ifdef CONFIG_SMP
-@@ -1203,12 +1554,22 @@ ENTRY(\sym)
+@@ -1208,12 +1559,22 @@ ENTRY(\sym)
CFI_ADJUST_CFA_OFFSET ORIG_RAX-R15
call error_entry
DEFAULT_FRAME 0
@@ -19766,7 +19753,7 @@ index c1d01e6..a88cf02 100644
.endm
.macro paranoidzeroentry sym do_sym
-@@ -1221,15 +1582,25 @@ ENTRY(\sym)
+@@ -1226,15 +1587,25 @@ ENTRY(\sym)
CFI_ADJUST_CFA_OFFSET ORIG_RAX-R15
call save_paranoid
TRACE_IRQS_OFF
@@ -19794,7 +19781,7 @@ index c1d01e6..a88cf02 100644
.macro paranoidzeroentry_ist sym do_sym ist
ENTRY(\sym)
INTR_FRAME
-@@ -1240,14 +1611,30 @@ ENTRY(\sym)
+@@ -1245,14 +1616,30 @@ ENTRY(\sym)
CFI_ADJUST_CFA_OFFSET ORIG_RAX-R15
call save_paranoid
TRACE_IRQS_OFF_DEBUG
@@ -19826,7 +19813,7 @@ index c1d01e6..a88cf02 100644
.endm
.macro errorentry sym do_sym
-@@ -1259,13 +1646,23 @@ ENTRY(\sym)
+@@ -1264,13 +1651,23 @@ ENTRY(\sym)
CFI_ADJUST_CFA_OFFSET ORIG_RAX-R15
call error_entry
DEFAULT_FRAME 0
@@ -19851,7 +19838,7 @@ index c1d01e6..a88cf02 100644
.endm
/* error code is on the stack already */
-@@ -1279,13 +1676,23 @@ ENTRY(\sym)
+@@ -1284,13 +1681,23 @@ ENTRY(\sym)
call save_paranoid
DEFAULT_FRAME 0
TRACE_IRQS_OFF
@@ -19876,7 +19863,7 @@ index c1d01e6..a88cf02 100644
.endm
zeroentry divide_error do_divide_error
-@@ -1315,9 +1722,10 @@ gs_change:
+@@ -1320,9 +1727,10 @@ gs_change:
2: mfence /* workaround */
SWAPGS
popfq_cfi
@@ -19888,7 +19875,7 @@ index c1d01e6..a88cf02 100644
_ASM_EXTABLE(gs_change,bad_gs)
.section .fixup,"ax"
-@@ -1345,9 +1753,10 @@ ENTRY(call_softirq)
+@@ -1350,9 +1758,10 @@ ENTRY(call_softirq)
CFI_DEF_CFA_REGISTER rsp
CFI_ADJUST_CFA_OFFSET -8
decl PER_CPU_VAR(irq_count)
@@ -19900,7 +19887,7 @@ index c1d01e6..a88cf02 100644
#ifdef CONFIG_XEN
zeroentry xen_hypervisor_callback xen_do_hypervisor_callback
-@@ -1385,7 +1794,7 @@ ENTRY(xen_do_hypervisor_callback) # do_hypervisor_callback(struct *pt_regs)
+@@ -1390,7 +1799,7 @@ ENTRY(xen_do_hypervisor_callback) # do_hypervisor_callback(struct *pt_regs)
decl PER_CPU_VAR(irq_count)
jmp error_exit
CFI_ENDPROC
@@ -19909,7 +19896,7 @@ index c1d01e6..a88cf02 100644
/*
* Hypervisor uses this for application faults while it executes.
-@@ -1444,7 +1853,7 @@ ENTRY(xen_failsafe_callback)
+@@ -1449,7 +1858,7 @@ ENTRY(xen_failsafe_callback)
SAVE_ALL
jmp error_exit
CFI_ENDPROC
@@ -19918,7 +19905,7 @@ index c1d01e6..a88cf02 100644
apicinterrupt HYPERVISOR_CALLBACK_VECTOR \
xen_hvm_callback_vector xen_evtchn_do_upcall
-@@ -1496,18 +1905,33 @@ ENTRY(paranoid_exit)
+@@ -1501,18 +1910,33 @@ ENTRY(paranoid_exit)
DEFAULT_FRAME
DISABLE_INTERRUPTS(CLBR_NONE)
TRACE_IRQS_OFF_DEBUG
@@ -19954,7 +19941,7 @@ index c1d01e6..a88cf02 100644
jmp irq_return
paranoid_userspace:
GET_THREAD_INFO(%rcx)
-@@ -1536,7 +1960,7 @@ paranoid_schedule:
+@@ -1541,7 +1965,7 @@ paranoid_schedule:
TRACE_IRQS_OFF
jmp paranoid_userspace
CFI_ENDPROC
@@ -19963,7 +19950,7 @@ index c1d01e6..a88cf02 100644
/*
* Exception entry point. This expects an error code/orig_rax on the stack.
-@@ -1563,12 +1987,13 @@ ENTRY(error_entry)
+@@ -1568,12 +1992,13 @@ ENTRY(error_entry)
movq_cfi r14, R14+8
movq_cfi r15, R15+8
xorl %ebx,%ebx
@@ -19978,7 +19965,7 @@ index c1d01e6..a88cf02 100644
ret
/*
-@@ -1595,7 +2020,7 @@ bstep_iret:
+@@ -1600,7 +2025,7 @@ bstep_iret:
movq %rcx,RIP+8(%rsp)
jmp error_swapgs
CFI_ENDPROC
@@ -19987,7 +19974,7 @@ index c1d01e6..a88cf02 100644
/* ebx: no swapgs flag (1: don't need swapgs, 0: need it) */
-@@ -1606,7 +2031,7 @@ ENTRY(error_exit)
+@@ -1611,7 +2036,7 @@ ENTRY(error_exit)
DISABLE_INTERRUPTS(CLBR_NONE)
TRACE_IRQS_OFF
GET_THREAD_INFO(%rcx)
@@ -19996,7 +19983,7 @@ index c1d01e6..a88cf02 100644
jne retint_kernel
LOCKDEP_SYS_EXIT_IRQ
movl TI_flags(%rcx),%edx
-@@ -1615,7 +2040,7 @@ ENTRY(error_exit)
+@@ -1620,7 +2045,7 @@ ENTRY(error_exit)
jnz retint_careful
jmp retint_swapgs
CFI_ENDPROC
@@ -20005,7 +19992,7 @@ index c1d01e6..a88cf02 100644
/*
* Test if a given stack is an NMI stack or not.
-@@ -1673,9 +2098,11 @@ ENTRY(nmi)
+@@ -1678,9 +2103,11 @@ ENTRY(nmi)
* If %cs was not the kernel segment, then the NMI triggered in user
* space, which means it is definitely not nested.
*/
@@ -20018,7 +20005,7 @@ index c1d01e6..a88cf02 100644
/*
* Check the special variable on the stack to see if NMIs are
* executing.
-@@ -1709,8 +2136,7 @@ nested_nmi:
+@@ -1714,8 +2141,7 @@ nested_nmi:
1:
/* Set up the interrupted NMIs stack to jump to repeat_nmi */
@@ -20028,7 +20015,7 @@ index c1d01e6..a88cf02 100644
CFI_ADJUST_CFA_OFFSET 1*8
leaq -10*8(%rsp), %rdx
pushq_cfi $__KERNEL_DS
-@@ -1728,6 +2154,7 @@ nested_nmi_out:
+@@ -1733,6 +2159,7 @@ nested_nmi_out:
CFI_RESTORE rdx
/* No need to check faults here */
@@ -20036,7 +20023,7 @@ index c1d01e6..a88cf02 100644
INTERRUPT_RETURN
CFI_RESTORE_STATE
-@@ -1844,6 +2271,8 @@ end_repeat_nmi:
+@@ -1849,6 +2276,8 @@ end_repeat_nmi:
*/
movq %cr2, %r12
@@ -20045,7 +20032,7 @@ index c1d01e6..a88cf02 100644
/* paranoidentry do_nmi, 0; without TRACE_IRQS_OFF */
movq %rsp,%rdi
movq $-1,%rsi
-@@ -1856,26 +2285,31 @@ end_repeat_nmi:
+@@ -1861,26 +2290,31 @@ end_repeat_nmi:
movq %r12, %cr2
1:
@@ -20148,7 +20135,7 @@ index 42a392a..fbbd930 100644
return -EFAULT;
diff --git a/arch/x86/kernel/head64.c b/arch/x86/kernel/head64.c
-index 8f3201d..6898c0c 100644
+index 55b6761..a6456fc 100644
--- a/arch/x86/kernel/head64.c
+++ b/arch/x86/kernel/head64.c
@@ -67,12 +67,12 @@ again:
@@ -20633,7 +20620,7 @@ index 73afd11..d1670f5 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 321d65e..ad8817d 100644
+index 321d65e..863089b 100644
--- a/arch/x86/kernel/head_64.S
+++ b/arch/x86/kernel/head_64.S
@@ -20,6 +20,8 @@
@@ -20674,10 +20661,10 @@ index 321d65e..ad8817d 100644
+#ifndef CONFIG_XEN
+ addq %rbp, level3_ident_pgt + (1*8)(%rip)
+#endif
-+
-+ addq %rbp, level3_vmemmap_pgt + (L3_VMEMMAP_START*8)(%rip)
- addq %rbp, level2_fixmap_pgt + (506*8)(%rip)
++ addq %rbp, level3_vmemmap_pgt + (L3_VMEMMAP_START*8)(%rip)
++
+ addq %rbp, level3_kernel_pgt + (L3_START_KERNEL*8)(%rip)
+ addq %rbp, level3_kernel_pgt + ((L3_START_KERNEL+1)*8)(%rip)
+
@@ -20749,10 +20736,10 @@ index 321d65e..ad8817d 100644
+ .section .rodata,"a",@progbits
-#ifndef CONFIG_XEN
--NEXT_PAGE(init_level4_pgt)
+ NEXT_PAGE(init_level4_pgt)
- .fill 512,8,0
-#else
- NEXT_PAGE(init_level4_pgt)
+-NEXT_PAGE(init_level4_pgt)
- .quad level3_ident_pgt - __START_KERNEL_map + _KERNPG_TABLE
.org init_level4_pgt + L4_PAGE_OFFSET*8, 0
.quad level3_ident_pgt - __START_KERNEL_map + _KERNPG_TABLE
@@ -20875,21 +20862,26 @@ index 321d65e..ad8817d 100644
#include "../../x86/xen/xen-head.S"
-
- .section .bss, "aw", @nobits
-+
-+ .section .rodata,"a",@progbits
- .align L1_CACHE_BYTES
- ENTRY(idt_table)
+- .align L1_CACHE_BYTES
+-ENTRY(idt_table)
- .skip IDT_ENTRIES * 16
-+ .fill 512,8,0
- .align L1_CACHE_BYTES
- ENTRY(nmi_idt_table)
+- .align L1_CACHE_BYTES
+-ENTRY(nmi_idt_table)
- .skip IDT_ENTRIES * 16
-+ .fill 512,8,0
-
+-
- __PAGE_ALIGNED_BSS
++ .section .rodata,"a",@progbits
NEXT_PAGE(empty_zero_page)
.skip PAGE_SIZE
++
++ .align L1_CACHE_BYTES
++ENTRY(idt_table)
++ .fill 512,8,0
++
++ .align L1_CACHE_BYTES
++ENTRY(nmi_idt_table)
++ .fill 512,8,0
diff --git a/arch/x86/kernel/i386_ksyms_32.c b/arch/x86/kernel/i386_ksyms_32.c
index 0fa6912..37fce70 100644
--- a/arch/x86/kernel/i386_ksyms_32.c
@@ -21030,7 +21022,7 @@ index 4ddaf66..6292f4e 100644
return -EPERM;
}
diff --git a/arch/x86/kernel/irq.c b/arch/x86/kernel/irq.c
-index 84b7789..e65e8be 100644
+index ac0631d..ff7cb62 100644
--- a/arch/x86/kernel/irq.c
+++ b/arch/x86/kernel/irq.c
@@ -18,7 +18,7 @@
@@ -21333,7 +21325,7 @@ index 836f832..a8bda67 100644
}
diff --git a/arch/x86/kernel/kprobes/core.c b/arch/x86/kernel/kprobes/core.c
-index 7bfe318..383d238 100644
+index 211bce4..6e2580a 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)
@@ -21381,9 +21373,9 @@ index 7bfe318..383d238 100644
#ifdef CONFIG_X86_64
if (insn_rip_relative(&insn)) {
-@@ -355,7 +360,9 @@ int __kprobes __copy_instruction(u8 *dest, u8 *src)
- newdisp = (u8 *) src + (s64) insn.displacement.value - (u8 *) dest;
- BUG_ON((s64) (s32) newdisp != newdisp); /* Sanity check. */
+@@ -359,7 +364,9 @@ int __kprobes __copy_instruction(u8 *dest, u8 *src)
+ return 0;
+ }
disp = (u8 *) dest + insn_offset_displacement(&insn);
+ pax_open_kernel();
*(s32 *) disp = (s32) newdisp;
@@ -21391,7 +21383,7 @@ index 7bfe318..383d238 100644
}
#endif
return insn.length;
-@@ -488,7 +495,7 @@ setup_singlestep(struct kprobe *p, struct pt_regs *regs, struct kprobe_ctlblk *k
+@@ -498,7 +505,7 @@ setup_singlestep(struct kprobe *p, struct pt_regs *regs, struct kprobe_ctlblk *k
* nor set current_kprobe, because it doesn't use single
* stepping.
*/
@@ -21400,7 +21392,7 @@ index 7bfe318..383d238 100644
preempt_enable_no_resched();
return;
}
-@@ -505,9 +512,9 @@ setup_singlestep(struct kprobe *p, struct pt_regs *regs, struct kprobe_ctlblk *k
+@@ -515,9 +522,9 @@ setup_singlestep(struct kprobe *p, struct pt_regs *regs, struct kprobe_ctlblk *k
regs->flags &= ~X86_EFLAGS_IF;
/* single step inline if the instruction is an int3 */
if (p->opcode == BREAKPOINT_INSTRUCTION)
@@ -21412,7 +21404,7 @@ index 7bfe318..383d238 100644
}
/*
-@@ -586,7 +593,7 @@ static int __kprobes kprobe_handler(struct pt_regs *regs)
+@@ -596,7 +603,7 @@ static int __kprobes kprobe_handler(struct pt_regs *regs)
setup_singlestep(p, regs, kcb, 0);
return 1;
}
@@ -21421,7 +21413,7 @@ index 7bfe318..383d238 100644
/*
* The breakpoint instruction was removed right
* after we hit it. Another cpu has removed
-@@ -632,6 +639,9 @@ static void __used __kprobes kretprobe_trampoline_holder(void)
+@@ -642,6 +649,9 @@ static void __used __kprobes kretprobe_trampoline_holder(void)
" movq %rax, 152(%rsp)\n"
RESTORE_REGS_STRING
" popfq\n"
@@ -21431,7 +21423,7 @@ index 7bfe318..383d238 100644
#else
" pushf\n"
SAVE_REGS_STRING
-@@ -769,7 +779,7 @@ static void __kprobes
+@@ -779,7 +789,7 @@ static void __kprobes
resume_execution(struct kprobe *p, struct pt_regs *regs, struct kprobe_ctlblk *kcb)
{
unsigned long *tos = stack_addr(regs);
@@ -21440,7 +21432,7 @@ index 7bfe318..383d238 100644
unsigned long orig_ip = (unsigned long)p->addr;
kprobe_opcode_t *insn = p->ainsn.insn;
-@@ -951,7 +961,7 @@ kprobe_exceptions_notify(struct notifier_block *self, unsigned long val, void *d
+@@ -961,7 +971,7 @@ kprobe_exceptions_notify(struct notifier_block *self, unsigned long val, void *d
struct die_args *args = data;
int ret = NOTIFY_DONE;
@@ -21519,10 +21511,10 @@ index 76dc6f0..66bdfc3 100644
reset_current_kprobe();
preempt_enable_no_resched();
diff --git a/arch/x86/kernel/kvm.c b/arch/x86/kernel/kvm.c
-index b686a90..60d36fb 100644
+index cd6d9a5..16245a4 100644
--- a/arch/x86/kernel/kvm.c
+++ b/arch/x86/kernel/kvm.c
-@@ -453,7 +453,7 @@ static int __cpuinit kvm_cpu_notify(struct notifier_block *self,
+@@ -455,7 +455,7 @@ static int __cpuinit kvm_cpu_notify(struct notifier_block *self,
return NOTIFY_OK;
}
@@ -21901,7 +21893,7 @@ index 676b8c7..870ba04 100644
.spin_is_locked = __ticket_spin_is_locked,
.spin_is_contended = __ticket_spin_is_contended,
diff --git a/arch/x86/kernel/paravirt.c b/arch/x86/kernel/paravirt.c
-index 8bfb335..c1463c6 100644
+index cd6de64..27c6af0 100644
--- a/arch/x86/kernel/paravirt.c
+++ b/arch/x86/kernel/paravirt.c
@@ -55,6 +55,9 @@ u64 _paravirt_ident_64(u64 x)
@@ -21929,10 +21921,10 @@ index 8bfb335..c1463c6 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) ||
@@ -21984,7 +21976,7 @@ index 8bfb335..c1463c6 100644
.cpuid = native_cpuid,
.get_debugreg = native_get_debugreg,
.set_debugreg = native_set_debugreg,
-@@ -395,21 +402,26 @@ struct pv_cpu_ops pv_cpu_ops = {
+@@ -394,21 +401,26 @@ struct pv_cpu_ops pv_cpu_ops = {
.end_context_switch = paravirt_nop,
};
@@ -22014,7 +22006,7 @@ index 8bfb335..c1463c6 100644
.read_cr2 = native_read_cr2,
.write_cr2 = native_write_cr2,
-@@ -459,6 +471,7 @@ struct pv_mmu_ops pv_mmu_ops = {
+@@ -458,6 +470,7 @@ struct pv_mmu_ops pv_mmu_ops = {
.make_pud = PTE_IDENT,
.set_pgd = native_set_pgd,
@@ -22022,7 +22014,7 @@ index 8bfb335..c1463c6 100644
#endif
#endif /* PAGETABLE_LEVELS >= 3 */
-@@ -479,6 +492,12 @@ struct pv_mmu_ops pv_mmu_ops = {
+@@ -478,6 +491,12 @@ struct pv_mmu_ops pv_mmu_ops = {
},
.set_fixmap = native_set_fixmap,
@@ -22075,7 +22067,7 @@ 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 14ae100..752a4f6 100644
+index 81a5f5e..20f8b58 100644
--- a/arch/x86/kernel/process.c
+++ b/arch/x86/kernel/process.c
@@ -36,7 +36,8 @@
@@ -22106,16 +22098,7 @@ index 14ae100..752a4f6 100644
t->io_bitmap_ptr = NULL;
clear_thread_flag(TIF_IO_BITMAP);
-@@ -136,7 +137,7 @@ void show_regs_common(void)
- board = dmi_get_system_info(DMI_BOARD_NAME);
-
- printk(KERN_DEFAULT "Pid: %d, comm: %.20s %s %s %.*s %s %s%s%s\n",
-- current->pid, current->comm, print_tainted(),
-+ task_pid_nr(current), current->comm, print_tainted(),
- init_utsname()->release,
- (int)strcspn(init_utsname()->version, " "),
- init_utsname()->version,
-@@ -149,6 +150,9 @@ void flush_thread(void)
+@@ -125,6 +126,9 @@ void flush_thread(void)
{
struct task_struct *tsk = current;
@@ -22125,7 +22108,7 @@ index 14ae100..752a4f6 100644
flush_ptrace_hw_breakpoint(tsk);
memset(tsk->thread.tls_array, 0, sizeof(tsk->thread.tls_array));
drop_init_fpu(tsk);
-@@ -295,7 +299,7 @@ static void __exit_idle(void)
+@@ -271,7 +275,7 @@ static void __exit_idle(void)
void exit_idle(void)
{
/* idle loop has pid 0 */
@@ -22134,7 +22117,7 @@ index 14ae100..752a4f6 100644
return;
__exit_idle();
}
-@@ -398,7 +402,7 @@ bool xen_set_default_idle(void)
+@@ -327,7 +331,7 @@ bool xen_set_default_idle(void)
return ret;
}
#endif
@@ -22143,7 +22126,7 @@ index 14ae100..752a4f6 100644
{
local_irq_disable();
/*
-@@ -544,16 +548,37 @@ static int __init idle_setup(char *str)
+@@ -456,16 +460,37 @@ static int __init idle_setup(char *str)
}
early_param("idle", idle_setup);
@@ -22192,7 +22175,7 @@ index 14ae100..752a4f6 100644
+}
+#endif
diff --git a/arch/x86/kernel/process_32.c b/arch/x86/kernel/process_32.c
-index b5a8905..d9cacac 100644
+index 7305f7d..22f73d6 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");
@@ -22203,7 +22186,7 @@ index b5a8905..d9cacac 100644
}
void __show_regs(struct pt_regs *regs, int all)
-@@ -74,21 +75,20 @@ void __show_regs(struct pt_regs *regs, int all)
+@@ -74,19 +75,18 @@ void __show_regs(struct pt_regs *regs, int all)
unsigned long sp;
unsigned short ss, gs;
@@ -22219,8 +22202,6 @@ index b5a8905..d9cacac 100644
}
+ gs = get_user_gs(regs);
- show_regs_common();
-
printk(KERN_DEFAULT "EIP: %04x:[<%08lx>] EFLAGS: %08lx CPU: %d\n",
(u16)regs->cs, regs->ip, regs->flags,
- smp_processor_id());
@@ -22228,7 +22209,7 @@ index b5a8905..d9cacac 100644
print_symbol("EIP is at %s\n", regs->ip);
printk(KERN_DEFAULT "EAX: %08lx EBX: %08lx ECX: %08lx EDX: %08lx\n",
-@@ -130,20 +130,21 @@ void release_thread(struct task_struct *dead_task)
+@@ -128,20 +128,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)
{
@@ -22254,7 +22235,7 @@ index b5a8905..d9cacac 100644
childregs->fs = __KERNEL_PERCPU;
childregs->bx = sp; /* function */
childregs->bp = arg;
-@@ -250,7 +251,7 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p)
+@@ -248,7 +249,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();
@@ -22263,7 +22244,7 @@ index b5a8905..d9cacac 100644
fpu_switch_t fpu;
/* never put a printk in __switch_to... printk() calls wake_up*() indirectly */
-@@ -274,6 +275,10 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p)
+@@ -272,6 +273,10 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p)
*/
lazy_save_gs(prev->gs);
@@ -22274,7 +22255,7 @@ index b5a8905..d9cacac 100644
/*
* Load the per-thread Thread-Local Storage descriptor.
*/
-@@ -304,6 +309,9 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p)
+@@ -302,6 +307,9 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p)
*/
arch_end_context_switch(next_p);
@@ -22284,7 +22265,7 @@ index b5a8905..d9cacac 100644
/*
* Restore %gs if needed (which is common)
*/
-@@ -312,8 +320,6 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p)
+@@ -310,8 +318,6 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p)
switch_fpu_finish(next_p, fpu);
@@ -22293,16 +22274,16 @@ index b5a8905..d9cacac 100644
return prev_p;
}
-@@ -343,4 +349,3 @@ unsigned long get_wchan(struct task_struct *p)
+@@ -341,4 +347,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 0f49677..fcbf88c 100644
+index 355ae06..4530766 100644
--- a/arch/x86/kernel/process_64.c
+++ b/arch/x86/kernel/process_64.c
-@@ -152,10 +152,11 @@ int copy_thread(unsigned long clone_flags, unsigned long sp,
+@@ -151,10 +151,11 @@ int copy_thread(unsigned long clone_flags, unsigned long sp,
struct pt_regs *childregs;
struct task_struct *me = current;
@@ -22315,7 +22296,7 @@ index 0f49677..fcbf88c 100644
set_tsk_thread_flag(p, TIF_FORK);
p->fpu_counter = 0;
p->thread.io_bitmap_ptr = NULL;
-@@ -274,7 +275,7 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p)
+@@ -273,7 +274,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();
@@ -22324,7 +22305,7 @@ index 0f49677..fcbf88c 100644
unsigned fsindex, gsindex;
fpu_switch_t fpu;
-@@ -356,10 +357,9 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p)
+@@ -355,10 +356,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);
@@ -22337,7 +22318,7 @@ index 0f49677..fcbf88c 100644
/*
* Now maybe reload the debug registers and handle I/O bitmaps
-@@ -428,12 +428,11 @@ unsigned long get_wchan(struct task_struct *p)
+@@ -427,12 +427,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);
@@ -22624,6 +22605,19 @@ index 76fa1e9..abf09ea 100644
.power_off = native_machine_power_off,
.shutdown = native_machine_shutdown,
.emergency_restart = native_machine_emergency_restart,
+diff --git a/arch/x86/kernel/reboot_fixups_32.c b/arch/x86/kernel/reboot_fixups_32.c
+index c8e41e9..64049ef 100644
+--- a/arch/x86/kernel/reboot_fixups_32.c
++++ b/arch/x86/kernel/reboot_fixups_32.c
+@@ -57,7 +57,7 @@ struct device_fixup {
+ unsigned int vendor;
+ unsigned int device;
+ void (*reboot_fixup)(struct pci_dev *);
+-};
++} __do_const;
+
+ /*
+ * 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
--- a/arch/x86/kernel/relocate_kernel_64.S
@@ -22645,10 +22639,10 @@ index f2bb9c9..bed145d7 100644
1:
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
-index fae9134..8fcd87c 100644
+index 56f7fcf..fa229f4 100644
--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
-@@ -111,6 +111,7 @@
+@@ -110,6 +110,7 @@
#include <asm/mce.h>
#include <asm/alternative.h>
#include <asm/prom.h>
@@ -22656,7 +22650,7 @@ index fae9134..8fcd87c 100644
/*
* max_low_pfn_mapped: highest direct mapped pfn under 4GB
-@@ -447,7 +448,7 @@ static void __init parse_setup_data(void)
+@@ -444,7 +445,7 @@ static void __init parse_setup_data(void)
switch (data->type) {
case SETUP_E820_EXT:
@@ -22665,7 +22659,7 @@ index fae9134..8fcd87c 100644
break;
case SETUP_DTB:
add_dtb(pa_data);
-@@ -774,7 +775,7 @@ static void __init trim_bios_range(void)
+@@ -771,7 +772,7 @@ static void __init trim_bios_range(void)
* area (640->1Mb) as ram even though it is not.
* take them out.
*/
@@ -22674,7 +22668,7 @@ index fae9134..8fcd87c 100644
sanitize_e820_map(e820.map, ARRAY_SIZE(e820.map), &e820.nr_map);
}
-@@ -782,7 +783,7 @@ static void __init trim_bios_range(void)
+@@ -779,7 +780,7 @@ static void __init trim_bios_range(void)
/* called before trim_bios_range() to spare extra sanitize */
static void __init e820_add_kernel_range(void)
{
@@ -22683,7 +22677,7 @@ index fae9134..8fcd87c 100644
u64 size = __pa_symbol(_end) - start;
/*
-@@ -844,8 +845,12 @@ static void __init trim_low_memory_range(void)
+@@ -841,8 +842,12 @@ static void __init trim_low_memory_range(void)
void __init setup_arch(char **cmdline_p)
{
@@ -22696,7 +22690,7 @@ index fae9134..8fcd87c 100644
early_reserve_initrd();
-@@ -937,14 +942,14 @@ void __init setup_arch(char **cmdline_p)
+@@ -934,14 +939,14 @@ void __init setup_arch(char **cmdline_p)
if (!boot_params.hdr.root_flags)
root_mountflags &= ~MS_RDONLY;
@@ -22884,7 +22878,7 @@ 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 9f190a2..90a0688 100644
+index bfd348e..4816ad8 100644
--- a/arch/x86/kernel/smpboot.c
+++ b/arch/x86/kernel/smpboot.c
@@ -748,6 +748,7 @@ static int __cpuinit do_boot_cpu(int apicid, int cpu, struct task_struct *idle)
@@ -23349,7 +23343,7 @@ index 24d3c91..d06b473 100644
return pc;
}
diff --git a/arch/x86/kernel/tls.c b/arch/x86/kernel/tls.c
-index 9d9d2f9..cad418a 100644
+index f7fec09..9991981 100644
--- a/arch/x86/kernel/tls.c
+++ b/arch/x86/kernel/tls.c
@@ -84,6 +84,11 @@ int do_set_thread_area(struct task_struct *p, int idx,
@@ -23364,7 +23358,7 @@ index 9d9d2f9..cad418a 100644
set_tls_desc(p, idx, &info, 1);
return 0;
-@@ -204,7 +209,7 @@ int regset_tls_set(struct task_struct *target, const struct user_regset *regset,
+@@ -200,7 +205,7 @@ int regset_tls_set(struct task_struct *target, const struct user_regset *regset,
if (kbuf)
info = kbuf;
@@ -23374,7 +23368,7 @@ index 9d9d2f9..cad418a 100644
else
info = infobuf;
diff --git a/arch/x86/kernel/traps.c b/arch/x86/kernel/traps.c
-index 68bda7a..3ec7bb7 100644
+index 772e2a8..bad5bf6 100644
--- a/arch/x86/kernel/traps.c
+++ b/arch/x86/kernel/traps.c
@@ -68,12 +68,6 @@
@@ -23448,7 +23442,7 @@ index 68bda7a..3ec7bb7 100644
regs->ip, regs->sp, error_code);
print_vma_addr(" in ", regs->ip);
pr_cont("\n");
-@@ -266,7 +272,7 @@ do_general_protection(struct pt_regs *regs, long error_code)
+@@ -273,7 +279,7 @@ do_general_protection(struct pt_regs *regs, long error_code)
conditional_sti(regs);
#ifdef CONFIG_X86_32
@@ -23457,7 +23451,7 @@ index 68bda7a..3ec7bb7 100644
local_irq_enable();
handle_vm86_fault((struct kernel_vm86_regs *) regs, error_code);
goto exit;
-@@ -274,18 +280,42 @@ do_general_protection(struct pt_regs *regs, long error_code)
+@@ -281,18 +287,42 @@ do_general_protection(struct pt_regs *regs, long error_code)
#endif
tsk = current;
@@ -23502,7 +23496,7 @@ index 68bda7a..3ec7bb7 100644
tsk->thread.error_code = error_code;
tsk->thread.trap_nr = X86_TRAP_GP;
-@@ -440,7 +470,7 @@ dotraplinkage void __kprobes do_debug(struct pt_regs *regs, long error_code)
+@@ -450,7 +480,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);
@@ -23511,7 +23505,7 @@ index 68bda7a..3ec7bb7 100644
handle_vm86_trap((struct kernel_vm86_regs *) regs, error_code,
X86_TRAP_DB);
preempt_conditional_cli(regs);
-@@ -455,7 +485,7 @@ dotraplinkage void __kprobes do_debug(struct pt_regs *regs, long error_code)
+@@ -465,7 +495,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.
*/
@@ -23520,7 +23514,7 @@ index 68bda7a..3ec7bb7 100644
tsk->thread.debugreg6 &= ~DR_STEP;
set_tsk_thread_flag(tsk, TIF_SINGLESTEP);
regs->flags &= ~X86_EFLAGS_TF;
-@@ -487,7 +517,7 @@ void math_error(struct pt_regs *regs, int error_code, int trapnr)
+@@ -497,7 +527,7 @@ void math_error(struct pt_regs *regs, int error_code, int trapnr)
return;
conditional_sti(regs);
@@ -23530,7 +23524,7 @@ index 68bda7a..3ec7bb7 100644
if (!fixup_exception(regs)) {
task->thread.error_code = error_code;
diff --git a/arch/x86/kernel/uprobes.c b/arch/x86/kernel/uprobes.c
-index 0ba4cfb..4596bec 100644
+index 2ed8459..7cf329f 100644
--- a/arch/x86/kernel/uprobes.c
+++ b/arch/x86/kernel/uprobes.c
@@ -629,7 +629,7 @@ int arch_uprobe_exception_notify(struct notifier_block *self, unsigned long val,
@@ -23542,6 +23536,15 @@ index 0ba4cfb..4596bec 100644
return NOTIFY_DONE;
switch (val) {
+@@ -719,7 +719,7 @@ arch_uretprobe_hijack_return_addr(unsigned long trampoline_vaddr, struct pt_regs
+
+ if (ncopied != rasize) {
+ pr_err("uprobe: return address clobbered: pid=%d, %%sp=%#lx, "
+- "%%ip=%#lx\n", current->pid, regs->sp, regs->ip);
++ "%%ip=%#lx\n", task_pid_nr(current), regs->sp, regs->ip);
+
+ force_sig_info(SIGSEGV, SEND_SIG_FORCED, current);
+ }
diff --git a/arch/x86/kernel/verify_cpu.S b/arch/x86/kernel/verify_cpu.S
index b9242ba..50c5edd 100644
--- a/arch/x86/kernel/verify_cpu.S
@@ -23555,7 +23558,7 @@ index b9242ba..50c5edd 100644
* verify_cpu, returns the status of longmode and SSE in register %eax.
* 0: Success 1: Failure
diff --git a/arch/x86/kernel/vm86_32.c b/arch/x86/kernel/vm86_32.c
-index 3dbdd9c..888b14e 100644
+index e8edcf5..27f9344 100644
--- a/arch/x86/kernel/vm86_32.c
+++ b/arch/x86/kernel/vm86_32.c
@@ -44,6 +44,7 @@
@@ -23578,34 +23581,33 @@ index 3dbdd9c..888b14e 100644
@@ -214,6 +215,14 @@ SYSCALL_DEFINE1(vm86old, struct vm86_struct __user *, v86)
if (tsk->thread.saved_sp0)
- goto out;
+ return -EPERM;
+
+#ifdef CONFIG_GRKERNSEC_VM86
+ if (!capable(CAP_SYS_RAWIO)) {
+ gr_handle_vm86();
-+ goto out;
++ return -EPERM;
+ }
+#endif
+
tmp = copy_vm86_regs_from_user(&info.regs, &v86->regs,
offsetof(struct kernel_vm86_struct, vm86plus) -
sizeof(info.regs));
-@@ -242,6 +251,14 @@ SYSCALL_DEFINE2(vm86, unsigned long, cmd, unsigned long, arg)
- int tmp, ret;
+@@ -238,6 +247,13 @@ SYSCALL_DEFINE2(vm86, unsigned long, cmd, unsigned long, arg)
+ int tmp;
struct vm86plus_struct __user *v86;
+#ifdef CONFIG_GRKERNSEC_VM86
+ if (!capable(CAP_SYS_RAWIO)) {
+ gr_handle_vm86();
-+ ret = -EPERM;
-+ goto out;
++ return -EPERM;
+ }
+#endif
+
tsk = current;
switch (cmd) {
case VM86_REQUEST_IRQ:
-@@ -329,7 +346,7 @@ static void do_sys_vm86(struct kernel_vm86_struct *info, struct task_struct *tsk
+@@ -318,7 +334,7 @@ static void do_sys_vm86(struct kernel_vm86_struct *info, struct task_struct *tsk
tsk->thread.saved_fs = info->regs32->fs;
tsk->thread.saved_gs = get_user_gs(info->regs32);
@@ -23614,7 +23616,7 @@ index 3dbdd9c..888b14e 100644
tsk->thread.sp0 = (unsigned long) &info->VM86_TSS_ESP0;
if (cpu_has_sep)
tsk->thread.sysenter_cs = 0;
-@@ -536,7 +553,7 @@ static void do_int(struct kernel_vm86_regs *regs, int i,
+@@ -525,7 +541,7 @@ static void do_int(struct kernel_vm86_regs *regs, int i,
goto cannot_handle;
if (i == 0x21 && is_revectored(AH(regs), &KVM86->int21_revectored))
goto cannot_handle;
@@ -23624,7 +23626,7 @@ index 3dbdd9c..888b14e 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 22a1530..5efafbf 100644
+index 10c4f30..57377c2 100644
--- a/arch/x86/kernel/vmlinux.lds.S
+++ b/arch/x86/kernel/vmlinux.lds.S
@@ -26,6 +26,13 @@
@@ -23691,9 +23693,9 @@ index 22a1530..5efafbf 100644
+ __LOAD_PHYSICAL_ADDR = . - LOAD_OFFSET + __KERNEL_TEXT_OFFSET;
+ _text = .;
HEAD_TEXT
- #ifdef CONFIG_X86_32
- . = ALIGN(PAGE_SIZE);
-@@ -108,13 +128,48 @@ SECTIONS
+ . = ALIGN(8);
+ _stext = .;
+@@ -104,13 +124,48 @@ SECTIONS
IRQENTRY_TEXT
*(.fixup)
*(.gnu.warning)
@@ -23746,7 +23748,7 @@ index 22a1530..5efafbf 100644
#if defined(CONFIG_DEBUG_RODATA)
/* .text should occupy whole number of pages */
-@@ -126,16 +181,20 @@ SECTIONS
+@@ -122,16 +177,20 @@ SECTIONS
/* Data */
.data : AT(ADDR(.data) - LOAD_OFFSET) {
@@ -23770,7 +23772,7 @@ index 22a1530..5efafbf 100644
PAGE_ALIGNED_DATA(PAGE_SIZE)
-@@ -176,12 +235,19 @@ SECTIONS
+@@ -172,12 +231,19 @@ SECTIONS
#endif /* CONFIG_X86_64 */
/* Init code and data - will be freed after init */
@@ -23793,7 +23795,7 @@ index 22a1530..5efafbf 100644
/*
* percpu offsets are zero-based on SMP. PERCPU_VADDR() changes the
* output PHDR, so the next output section - .init.text - should
-@@ -190,12 +256,27 @@ SECTIONS
+@@ -186,12 +252,27 @@ SECTIONS
PERCPU_VADDR(INTERNODE_CACHE_BYTES, 0, :percpu)
#endif
@@ -23826,7 +23828,7 @@ index 22a1530..5efafbf 100644
.x86_cpu_dev.init : AT(ADDR(.x86_cpu_dev.init) - LOAD_OFFSET) {
__x86_cpu_dev_start = .;
-@@ -257,19 +338,12 @@ SECTIONS
+@@ -253,19 +334,12 @@ SECTIONS
}
. = ALIGN(8);
@@ -23847,7 +23849,7 @@ index 22a1530..5efafbf 100644
PERCPU_SECTION(INTERNODE_CACHE_BYTES)
#endif
-@@ -288,16 +362,10 @@ SECTIONS
+@@ -284,16 +358,10 @@ SECTIONS
.smp_locks : AT(ADDR(.smp_locks) - LOAD_OFFSET) {
__smp_locks = .;
*(.smp_locks)
@@ -23865,7 +23867,7 @@ index 22a1530..5efafbf 100644
/* BSS */
. = ALIGN(PAGE_SIZE);
.bss : AT(ADDR(.bss) - LOAD_OFFSET) {
-@@ -313,6 +381,7 @@ SECTIONS
+@@ -309,6 +377,7 @@ SECTIONS
__brk_base = .;
. += 64 * 1024; /* 64k alignment slop space */
*(.brk_reservation) /* areas brk users have reserved */
@@ -23873,7 +23875,7 @@ index 22a1530..5efafbf 100644
__brk_limit = .;
}
-@@ -339,13 +408,12 @@ SECTIONS
+@@ -335,13 +404,12 @@ SECTIONS
* for the boot processor.
*/
#define INIT_PER_CPU(x) init_per_cpu__##x = x + __per_cpu_load
@@ -24056,10 +24058,10 @@ index a20ecb5..d0e2194 100644
out:
diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c
-index 698eece..776b682 100644
+index 5953dce..f11a7d2 100644
--- a/arch/x86/kvm/emulate.c
+++ b/arch/x86/kvm/emulate.c
-@@ -328,6 +328,7 @@ static void invalidate_registers(struct x86_emulate_ctxt *ctxt)
+@@ -329,6 +329,7 @@ static void invalidate_registers(struct x86_emulate_ctxt *ctxt)
#define ____emulate_2op(ctxt, _op, _x, _y, _suffix, _dsttype) \
do { \
@@ -24067,7 +24069,7 @@ index 698eece..776b682 100644
__asm__ __volatile__ ( \
_PRE_EFLAGS("0", "4", "2") \
_op _suffix " %"_x"3,%1; " \
-@@ -342,8 +343,6 @@ static void invalidate_registers(struct x86_emulate_ctxt *ctxt)
+@@ -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 { \
@@ -24076,7 +24078,7 @@ index 698eece..776b682 100644
switch ((ctxt)->dst.bytes) { \
case 2: \
____emulate_2op(ctxt,_op,_wx,_wy,"w",u16); \
-@@ -359,7 +358,6 @@ static void invalidate_registers(struct x86_emulate_ctxt *ctxt)
+@@ -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 { \
@@ -24085,7 +24087,7 @@ index 698eece..776b682 100644
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 f77df1c..6f20690 100644
+index 0eee2c8..94a32c3 100644
--- a/arch/x86/kvm/lapic.c
+++ b/arch/x86/kvm/lapic.c
@@ -55,7 +55,7 @@
@@ -24098,7 +24100,7 @@ index f77df1c..6f20690 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 105dd5b..1b0ccc2 100644
+index da20860..d19fdf5 100644
--- a/arch/x86/kvm/paging_tmpl.h
+++ b/arch/x86/kvm/paging_tmpl.h
@@ -208,7 +208,7 @@ retry_walk:
@@ -24111,10 +24113,10 @@ index 105dd5b..1b0ccc2 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 e1b1ce2..f7b4b43 100644
+index a14a6ea..dc86cf0 100644
--- a/arch/x86/kvm/svm.c
+++ b/arch/x86/kvm/svm.c
-@@ -3507,7 +3507,11 @@ static void reload_tss(struct kvm_vcpu *vcpu)
+@@ -3493,7 +3493,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);
@@ -24126,7 +24128,7 @@ index e1b1ce2..f7b4b43 100644
load_TR_desc();
}
-@@ -3901,6 +3905,10 @@ static void svm_vcpu_run(struct kvm_vcpu *vcpu)
+@@ -3894,6 +3898,10 @@ static void svm_vcpu_run(struct kvm_vcpu *vcpu)
#endif
#endif
@@ -24138,10 +24140,10 @@ index e1b1ce2..f7b4b43 100644
local_irq_disable();
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
-index 0e2f2a4..4331db2 100644
+index 5402c94..c3bdeee 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
-@@ -1184,12 +1184,12 @@ static void vmcs_write64(unsigned long field, u64 value)
+@@ -1311,12 +1311,12 @@ static void vmcs_write64(unsigned long field, u64 value)
#endif
}
@@ -24156,7 +24158,7 @@ index 0e2f2a4..4331db2 100644
{
vmcs_writel(field, vmcs_readl(field) | mask);
}
-@@ -1390,7 +1390,11 @@ static void reload_tss(void)
+@@ -1517,7 +1517,11 @@ static void reload_tss(void)
struct desc_struct *descs;
descs = (void *)gdt->address;
@@ -24168,7 +24170,7 @@ index 0e2f2a4..4331db2 100644
load_TR_desc();
}
-@@ -1614,6 +1618,10 @@ static void vmx_vcpu_load(struct kvm_vcpu *vcpu, int cpu)
+@@ -1741,6 +1745,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 */
@@ -24179,7 +24181,7 @@ index 0e2f2a4..4331db2 100644
rdmsrl(MSR_IA32_SYSENTER_ESP, sysenter_esp);
vmcs_writel(HOST_IA32_SYSENTER_ESP, sysenter_esp); /* 22.2.3 */
vmx->loaded_vmcs->cpu = cpu;
-@@ -2779,8 +2787,11 @@ static __init int hardware_setup(void)
+@@ -2935,8 +2943,11 @@ static __init int hardware_setup(void)
if (!cpu_has_vmx_flexpriority())
flexpriority_enabled = 0;
@@ -24193,22 +24195,27 @@ index 0e2f2a4..4331db2 100644
if (enable_ept && !cpu_has_vmx_ept_2m_page())
kvm_disable_largepages();
-@@ -2792,10 +2803,12 @@ static __init int hardware_setup(void)
- !cpu_has_vmx_virtual_intr_delivery())
- enable_apicv_reg_vid = 0;
+@@ -2947,13 +2958,15 @@ static __init int hardware_setup(void)
+ if (!cpu_has_vmx_apicv())
+ enable_apicv = 0;
+ pax_open_kernel();
- if (enable_apicv_reg_vid)
+ if (enable_apicv)
- kvm_x86_ops->update_cr8_intercept = NULL;
+ *(void **)&kvm_x86_ops->update_cr8_intercept = NULL;
- else
+ else {
- kvm_x86_ops->hwapic_irr_update = NULL;
+- kvm_x86_ops->deliver_posted_interrupt = NULL;
+- kvm_x86_ops->sync_pir_to_irr = vmx_sync_pir_to_irr_dummy;
+ *(void **)&kvm_x86_ops->hwapic_irr_update = NULL;
++ *(void **)&kvm_x86_ops->deliver_posted_interrupt = NULL;
++ *(void **)&kvm_x86_ops->sync_pir_to_irr = vmx_sync_pir_to_irr_dummy;
+ }
+ pax_close_kernel();
if (nested)
nested_vmx_setup_ctls_msrs();
-@@ -3890,7 +3903,10 @@ static void vmx_set_constant_host_state(void)
+@@ -4076,7 +4089,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 */
@@ -24219,16 +24226,16 @@ index 0e2f2a4..4331db2 100644
vmcs_write16(HOST_CS_SELECTOR, __KERNEL_CS); /* 22.2.4 */
#ifdef CONFIG_X86_64
-@@ -3911,7 +3927,7 @@ static void vmx_set_constant_host_state(void)
- native_store_idt(&dt);
+@@ -4098,7 +4114,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;
- vmcs_writel(HOST_RIP, vmx_return); /* 22.2.5 */
+ vmcs_writel(HOST_RIP, ktla_ktva(vmx_return)); /* 22.2.5 */
rdmsr(MSR_IA32_SYSENTER_CS, low32, high32);
vmcs_write32(HOST_IA32_SYSENTER_CS, low32);
-@@ -6587,6 +6603,12 @@ static void __noclone vmx_vcpu_run(struct kvm_vcpu *vcpu)
+@@ -7030,6 +7046,12 @@ static void __noclone vmx_vcpu_run(struct kvm_vcpu *vcpu)
"jmp 2f \n\t"
"1: " __ex(ASM_VMX_VMRESUME) "\n\t"
"2: "
@@ -24241,7 +24248,7 @@ index 0e2f2a4..4331db2 100644
/* Save guest registers, load host registers, keep flags */
"mov %0, %c[wordsize](%%" _ASM_SP ") \n\t"
"pop %0 \n\t"
-@@ -6639,6 +6661,11 @@ static void __noclone vmx_vcpu_run(struct kvm_vcpu *vcpu)
+@@ -7082,6 +7104,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))
@@ -24253,7 +24260,7 @@ index 0e2f2a4..4331db2 100644
: "cc", "memory"
#ifdef CONFIG_X86_64
, "rax", "rbx", "rdi", "rsi"
-@@ -6652,7 +6679,7 @@ static void __noclone vmx_vcpu_run(struct kvm_vcpu *vcpu)
+@@ -7095,7 +7122,7 @@ static void __noclone vmx_vcpu_run(struct kvm_vcpu *vcpu)
if (debugctlmsr)
update_debugctlmsr(debugctlmsr);
@@ -24262,7 +24269,7 @@ index 0e2f2a4..4331db2 100644
/*
* The sysexit path does not restore ds/es, so we must set them to
* a reasonable value ourselves.
-@@ -6661,8 +6688,18 @@ static void __noclone vmx_vcpu_run(struct kvm_vcpu *vcpu)
+@@ -7104,8 +7131,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.
*/
@@ -24284,10 +24291,10 @@ index 0e2f2a4..4331db2 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 8563b45..272f1fe 100644
+index e8ba99c..ee9d7d9 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
-@@ -1685,8 +1685,8 @@ static int xen_hvm_config(struct kvm_vcpu *vcpu, u64 data)
+@@ -1725,8 +1725,8 @@ static int xen_hvm_config(struct kvm_vcpu *vcpu, u64 data)
{
struct kvm *kvm = vcpu->kvm;
int lm = is_long_mode(vcpu);
@@ -24298,7 +24305,7 @@ index 8563b45..272f1fe 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;
-@@ -2566,6 +2566,8 @@ long kvm_arch_dev_ioctl(struct file *filp,
+@@ -2609,6 +2609,8 @@ long kvm_arch_dev_ioctl(struct file *filp,
if (n < msr_list.nmsrs)
goto out;
r = -EFAULT;
@@ -24307,16 +24314,7 @@ index 8563b45..272f1fe 100644
if (copy_to_user(user_msr_list->indices, &msrs_to_save,
num_msrs_to_save * sizeof(u32)))
goto out;
-@@ -2695,7 +2697,7 @@ static int kvm_vcpu_ioctl_set_lapic(struct kvm_vcpu *vcpu,
- static int kvm_vcpu_ioctl_interrupt(struct kvm_vcpu *vcpu,
- struct kvm_interrupt *irq)
- {
-- if (irq->irq < 0 || irq->irq >= KVM_NR_INTERRUPTS)
-+ if (irq->irq >= KVM_NR_INTERRUPTS)
- return -EINVAL;
- if (irqchip_in_kernel(vcpu->kvm))
- return -ENXIO;
-@@ -5246,7 +5248,7 @@ static struct notifier_block pvclock_gtod_notifier = {
+@@ -5297,7 +5299,7 @@ static struct notifier_block pvclock_gtod_notifier = {
};
#endif
@@ -24826,7 +24824,7 @@ index f5cc9eb..51fa319 100644
CFI_ENDPROC
ENDPROC(atomic64_inc_not_zero_cx8)
diff --git a/arch/x86/lib/checksum_32.S b/arch/x86/lib/checksum_32.S
-index 2af5df3..62b1a5a 100644
+index e78b8ee..7e173a8 100644
--- a/arch/x86/lib/checksum_32.S
+++ b/arch/x86/lib/checksum_32.S
@@ -29,7 +29,8 @@
@@ -25447,7 +25445,7 @@ index 25b7ae8..169fafc 100644
}
EXPORT_SYMBOL(csum_partial_copy_to_user);
diff --git a/arch/x86/lib/getuser.S b/arch/x86/lib/getuser.S
-index a451235..79fb5cf 100644
+index a451235..1daa956 100644
--- a/arch/x86/lib/getuser.S
+++ b/arch/x86/lib/getuser.S
@@ -33,17 +33,40 @@
@@ -25573,8 +25571,14 @@ index a451235..79fb5cf 100644
ret
#else
add $7,%_ASM_AX
-@@ -102,6 +163,7 @@ ENTRY(__get_user_8)
- 5: movl -3(%_ASM_AX),%ecx
+@@ -98,10 +159,11 @@ ENTRY(__get_user_8)
+ cmp TI_addr_limit(%_ASM_DX),%_ASM_AX
+ jae bad_get_user_8
+ ASM_STAC
+-4: movl -7(%_ASM_AX),%edx
+-5: movl -3(%_ASM_AX),%ecx
++4: __copyuser_seg movl -7(%_ASM_AX),%edx
++5: __copyuser_seg movl -3(%_ASM_AX),%ecx
xor %eax,%eax
ASM_CLAC
+ pax_force_retaddr
@@ -25644,7 +25648,7 @@ index 05a95e7..326f2fa 100644
CFI_ENDPROC
ENDPROC(__iowrite32_copy)
diff --git a/arch/x86/lib/memcpy_64.S b/arch/x86/lib/memcpy_64.S
-index 1c273be..da9cc0e 100644
+index 56313a3..aa84a79 100644
--- a/arch/x86/lib/memcpy_64.S
+++ b/arch/x86/lib/memcpy_64.S
@@ -33,6 +33,7 @@
@@ -25735,7 +25739,7 @@ index 1c273be..da9cc0e 100644
CFI_ENDPROC
ENDPROC(memcpy)
diff --git a/arch/x86/lib/memmove_64.S b/arch/x86/lib/memmove_64.S
-index ee16461..c39c199 100644
+index 65268a6..c9518d1 100644
--- a/arch/x86/lib/memmove_64.S
+++ b/arch/x86/lib/memmove_64.S
@@ -61,13 +61,13 @@ ENTRY(memmove)
@@ -26552,7 +26556,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 f0312d7..9c39d63 100644
+index 3eb18ac..6890bc3 100644
--- a/arch/x86/lib/usercopy_32.c
+++ b/arch/x86/lib/usercopy_32.c
@@ -42,11 +42,13 @@ do { \
@@ -27070,7 +27074,7 @@ index f0312d7..9c39d63 100644
clac();
return n;
}
-@@ -632,66 +743,51 @@ unsigned long __copy_from_user_ll_nocache_nozero(void *to, const void __user *fr
+@@ -632,60 +743,38 @@ unsigned long __copy_from_user_ll_nocache_nozero(void *to, const void __user *fr
if (n > 64 && cpu_has_xmm2)
n = __copy_user_intel_nocache(to, from, n);
else
@@ -27100,15 +27104,28 @@ index f0312d7..9c39d63 100644
- */
-unsigned long
-copy_to_user(void __user *to, const void *from, unsigned long n)
-+void copy_from_user_overflow(void)
++#ifdef CONFIG_PAX_MEMORY_UDEREF
++void __set_fs(mm_segment_t x)
{
- if (access_ok(VERIFY_WRITE, to, n))
- n = __copy_to_user(to, from, n);
- return n;
-+ WARN(1, "Buffer overflow detected!\n");
++ switch (x.seg) {
++ case 0:
++ loadsegment(gs, 0);
++ break;
++ case TASK_SIZE_MAX:
++ loadsegment(gs, __USER_DS);
++ break;
++ case -1UL:
++ loadsegment(gs, __KERNEL_DS);
++ break;
++ default:
++ BUG();
++ }
}
-EXPORT_SYMBOL(copy_to_user);
-+EXPORT_SYMBOL(copy_from_user_overflow);
++EXPORT_SYMBOL(__set_fs);
-/**
- * copy_from_user: - Copy a block of data from user space.
@@ -27128,50 +27145,21 @@ index f0312d7..9c39d63 100644
- */
-unsigned long
-_copy_from_user(void *to, const void __user *from, unsigned long n)
-+void copy_to_user_overflow(void)
++void set_fs(mm_segment_t x)
{
- if (access_ok(VERIFY_READ, from, n))
- n = __copy_from_user(to, from, n);
- else
- memset(to, 0, n);
- return n;
-+ WARN(1, "Buffer overflow detected!\n");
- }
--EXPORT_SYMBOL(_copy_from_user);
-+EXPORT_SYMBOL(copy_to_user_overflow);
-
--void copy_from_user_overflow(void)
-+#ifdef CONFIG_PAX_MEMORY_UDEREF
-+void __set_fs(mm_segment_t x)
- {
-- WARN(1, "Buffer overflow detected!\n");
-+ switch (x.seg) {
-+ case 0:
-+ loadsegment(gs, 0);
-+ break;
-+ case TASK_SIZE_MAX:
-+ loadsegment(gs, __USER_DS);
-+ break;
-+ case -1UL:
-+ loadsegment(gs, __KERNEL_DS);
-+ break;
-+ default:
-+ BUG();
-+ }
-+ return;
- }
--EXPORT_SYMBOL(copy_from_user_overflow);
-+EXPORT_SYMBOL(__set_fs);
-+
-+void set_fs(mm_segment_t x)
-+{
+ current_thread_info()->addr_limit = x;
+ __set_fs(x);
-+}
+ }
+-EXPORT_SYMBOL(_copy_from_user);
+EXPORT_SYMBOL(set_fs);
+#endif
diff --git a/arch/x86/lib/usercopy_64.c b/arch/x86/lib/usercopy_64.c
-index 906fea3..ee8a097 100644
+index 906fea3..5646695 100644
--- a/arch/x86/lib/usercopy_64.c
+++ b/arch/x86/lib/usercopy_64.c
@@ -39,7 +39,7 @@ unsigned long __clear_user(void __user *addr, unsigned long size)
@@ -27209,22 +27197,6 @@ index 906fea3..ee8a097 100644
{
char c;
unsigned zero_len;
-@@ -87,3 +86,15 @@ copy_user_handle_tail(char *to, char *from, unsigned len, unsigned zerorest)
- clac();
- return len;
- }
-+
-+void copy_from_user_overflow(void)
-+{
-+ WARN(1, "Buffer overflow detected!\n");
-+}
-+EXPORT_SYMBOL(copy_from_user_overflow);
-+
-+void copy_to_user_overflow(void)
-+{
-+ WARN(1, "Buffer overflow detected!\n");
-+}
-+EXPORT_SYMBOL(copy_to_user_overflow);
diff --git a/arch/x86/mm/extable.c b/arch/x86/mm/extable.c
index 903ec1e..c4166b2 100644
--- a/arch/x86/mm/extable.c
@@ -27280,13 +27252,13 @@ index 903ec1e..c4166b2 100644
}
diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c
-index 0e88336..2bb9777 100644
+index 654be4a..d36985f 100644
--- a/arch/x86/mm/fault.c
+++ b/arch/x86/mm/fault.c
-@@ -13,12 +13,19 @@
- #include <linux/perf_event.h> /* perf_sw_event */
+@@ -14,11 +14,18 @@
#include <linux/hugetlb.h> /* hstate_index_to_shift */
#include <linux/prefetch.h> /* prefetchw */
+ #include <linux/context_tracking.h> /* exception_enter(), ... */
+#include <linux/unistd.h>
+#include <linux/compiler.h>
@@ -27294,7 +27266,6 @@ index 0e88336..2bb9777 100644
#include <asm/pgalloc.h> /* pgd_*(), ... */
#include <asm/kmemcheck.h> /* kmemcheck_*(), ... */
#include <asm/fixmap.h> /* VSYSCALL_START */
- #include <asm/context_tracking.h> /* exception_enter(), ... */
+#include <asm/tlbflush.h>
+
+#if defined(CONFIG_X86_64) && defined(CONFIG_PAX_MEMORY_UDEREF)
@@ -27636,7 +27607,7 @@ index 0e88336..2bb9777 100644
return false;
return true;
-@@ -1008,19 +1203,34 @@ __do_page_fault(struct pt_regs *regs, unsigned long error_code)
+@@ -1008,18 +1203,33 @@ __do_page_fault(struct pt_regs *regs, unsigned long error_code)
{
struct vm_area_struct *vma;
struct task_struct *tsk;
@@ -27647,7 +27618,11 @@ index 0e88336..2bb9777 100644
unsigned int flags = FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_KILLABLE |
(write ? FAULT_FLAG_WRITE : 0);
-+ /* Get the faulting address: */
+- tsk = current;
+- mm = tsk->mm;
+-
+ /* Get the faulting address: */
+- address = read_cr2();
+ unsigned long address = read_cr2();
+
+#if defined(CONFIG_X86_64) && defined(CONFIG_PAX_MEMORY_UDEREF)
@@ -27666,15 +27641,11 @@ index 0e88336..2bb9777 100644
+ }
+#endif
+
- tsk = current;
- mm = tsk->mm;
++ 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 +1290,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:
@@ -27732,9 +27703,9 @@ index 0e88336..2bb9777 100644
if (unlikely(expand_stack(vma, address))) {
bad_area(regs, error_code, address);
return;
-@@ -1228,3 +1449,292 @@ do_page_fault(struct pt_regs *regs, unsigned long error_code)
+@@ -1230,3 +1451,292 @@ do_page_fault(struct pt_regs *regs, unsigned long error_code)
__do_page_fault(regs, error_code);
- exception_exit(regs);
+ exception_exit(prev_state);
}
+
+#if defined(CONFIG_PAX_PAGEEXEC) || defined(CONFIG_PAX_SEGMEXEC)
@@ -28039,7 +28010,7 @@ index dd74e46..7d26398 100644
return 0;
diff --git a/arch/x86/mm/highmem_32.c b/arch/x86/mm/highmem_32.c
-index 6f31ee5..8ee4164 100644
+index 252b8f5..4dcfdc1 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)
@@ -28163,7 +28134,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 0c13708..ca05f23 100644
+index 1f34e92..d252637 100644
--- a/arch/x86/mm/init.c
+++ b/arch/x86/mm/init.c
@@ -4,6 +4,7 @@
@@ -28183,7 +28154,7 @@ index 0c13708..ca05f23 100644
#include "mm_internal.h"
-@@ -448,7 +451,15 @@ void __init init_mem_mapping(void)
+@@ -465,7 +468,15 @@ void __init init_mem_mapping(void)
early_ioremap_page_table_range_init();
#endif
@@ -28199,7 +28170,7 @@ index 0c13708..ca05f23 100644
__flush_tlb_all();
early_memtest(0, max_pfn_mapped << PAGE_SHIFT);
-@@ -464,10 +475,40 @@ void __init init_mem_mapping(void)
+@@ -481,10 +492,40 @@ void __init init_mem_mapping(void)
* Access has to be given to non-kernel-ram areas as well, these contain the PCI
* mmio resources as well as potential bios/acpi data regions.
*/
@@ -28215,10 +28186,10 @@ index 0c13708..ca05f23 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;
@@ -28241,7 +28212,7 @@ index 0c13708..ca05f23 100644
if (iomem_is_exclusive(pagenr << PAGE_SHIFT))
return 0;
if (!page_is_ram(pagenr))
-@@ -524,8 +565,117 @@ void free_init_pages(char *what, unsigned long begin, unsigned long end)
+@@ -538,8 +579,117 @@ void free_init_pages(char *what, unsigned long begin, unsigned long end)
#endif
}
@@ -28360,7 +28331,7 @@ index 0c13708..ca05f23 100644
(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 2d19001..e549d98 100644
+index 3ac7e31..89611b7 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);
@@ -28550,7 +28521,7 @@ index 2d19001..e549d98 100644
prot = PAGE_KERNEL_EXEC;
pages_4k++;
-@@ -482,7 +486,7 @@ void __init native_pagetable_init(void)
+@@ -474,7 +478,7 @@ void __init native_pagetable_init(void)
pud = pud_offset(pgd, va);
pmd = pmd_offset(pud, va);
@@ -28559,7 +28530,7 @@ index 2d19001..e549d98 100644
break;
/* should not be large page here */
-@@ -540,12 +544,10 @@ void __init early_ioremap_page_table_range_init(void)
+@@ -532,12 +536,10 @@ void __init early_ioremap_page_table_range_init(void)
static void __init pagetable_init(void)
{
@@ -28574,7 +28545,7 @@ index 2d19001..e549d98 100644
EXPORT_SYMBOL_GPL(__supported_pte_mask);
/* user-defined highmem size */
-@@ -780,7 +782,7 @@ void __init mem_init(void)
+@@ -772,7 +774,7 @@ void __init mem_init(void)
after_bootmem = 1;
codesize = (unsigned long) &_etext - (unsigned long) &_text;
@@ -28583,7 +28554,7 @@ index 2d19001..e549d98 100644
initsize = (unsigned long) &__init_end - (unsigned long) &__init_begin;
printk(KERN_INFO "Memory: %luk/%luk available (%dk kernel code, "
-@@ -821,10 +823,10 @@ void __init mem_init(void)
+@@ -813,10 +815,10 @@ void __init mem_init(void)
((unsigned long)&__init_end -
(unsigned long)&__init_begin) >> 10,
@@ -28597,7 +28568,7 @@ index 2d19001..e549d98 100644
((unsigned long)&_etext - (unsigned long)&_text) >> 10);
/*
-@@ -914,6 +916,7 @@ void set_kernel_text_rw(void)
+@@ -906,6 +908,7 @@ void set_kernel_text_rw(void)
if (!kernel_set_to_readonly)
return;
@@ -28605,7 +28576,7 @@ index 2d19001..e549d98 100644
pr_debug("Set kernel text: %lx - %lx for read write\n",
start, start+size);
-@@ -928,6 +931,7 @@ void set_kernel_text_ro(void)
+@@ -920,6 +923,7 @@ void set_kernel_text_ro(void)
if (!kernel_set_to_readonly)
return;
@@ -28613,7 +28584,7 @@ index 2d19001..e549d98 100644
pr_debug("Set kernel text: %lx - %lx for read only\n",
start, start+size);
-@@ -956,6 +960,7 @@ void mark_rodata_ro(void)
+@@ -948,6 +952,7 @@ void mark_rodata_ro(void)
unsigned long start = PFN_ALIGN(_text);
unsigned long size = PFN_ALIGN(_etext) - start;
@@ -28622,10 +28593,10 @@ index 2d19001..e549d98 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 474e28f..f016b6e 100644
+index bb00c46..f31d2f0 100644
--- a/arch/x86/mm/init_64.c
+++ b/arch/x86/mm/init_64.c
-@@ -150,7 +150,7 @@ early_param("gbpages", parse_direct_gbpages_on);
+@@ -151,7 +151,7 @@ early_param("gbpages", parse_direct_gbpages_on);
* around without checking the pgd every time.
*/
@@ -28634,7 +28605,7 @@ index 474e28f..f016b6e 100644
EXPORT_SYMBOL_GPL(__supported_pte_mask);
int force_personality32;
-@@ -183,12 +183,22 @@ void sync_global_pgds(unsigned long start, unsigned long end)
+@@ -184,12 +184,22 @@ void sync_global_pgds(unsigned long start, unsigned long end)
for (address = start; address <= end; address += PGDIR_SIZE) {
const pgd_t *pgd_ref = pgd_offset_k(address);
@@ -28657,7 +28628,7 @@ index 474e28f..f016b6e 100644
list_for_each_entry(page, &pgd_list, lru) {
pgd_t *pgd;
spinlock_t *pgt_lock;
-@@ -197,6 +207,7 @@ void sync_global_pgds(unsigned long start, unsigned long end)
+@@ -198,6 +208,7 @@ void sync_global_pgds(unsigned long start, unsigned long end)
/* the pgt_lock only for Xen */
pgt_lock = &pgd_page_get_mm(page)->page_table_lock;
spin_lock(pgt_lock);
@@ -28665,7 +28636,7 @@ index 474e28f..f016b6e 100644
if (pgd_none(*pgd))
set_pgd(pgd, *pgd_ref);
-@@ -204,7 +215,10 @@ void sync_global_pgds(unsigned long start, unsigned long end)
+@@ -205,7 +216,10 @@ void sync_global_pgds(unsigned long start, unsigned long end)
BUG_ON(pgd_page_vaddr(*pgd)
!= pgd_page_vaddr(*pgd_ref));
@@ -28676,7 +28647,7 @@ index 474e28f..f016b6e 100644
}
spin_unlock(&pgd_lock);
}
-@@ -237,7 +251,7 @@ static pud_t *fill_pud(pgd_t *pgd, unsigned long vaddr)
+@@ -238,7 +252,7 @@ static pud_t *fill_pud(pgd_t *pgd, unsigned long vaddr)
{
if (pgd_none(*pgd)) {
pud_t *pud = (pud_t *)spp_getpage();
@@ -28685,7 +28656,7 @@ index 474e28f..f016b6e 100644
if (pud != pud_offset(pgd, 0))
printk(KERN_ERR "PAGETABLE BUG #00! %p <-> %p\n",
pud, pud_offset(pgd, 0));
-@@ -249,7 +263,7 @@ static pmd_t *fill_pmd(pud_t *pud, unsigned long vaddr)
+@@ -250,7 +264,7 @@ static pmd_t *fill_pmd(pud_t *pud, unsigned long vaddr)
{
if (pud_none(*pud)) {
pmd_t *pmd = (pmd_t *) spp_getpage();
@@ -28694,7 +28665,7 @@ index 474e28f..f016b6e 100644
if (pmd != pmd_offset(pud, 0))
printk(KERN_ERR "PAGETABLE BUG #01! %p <-> %p\n",
pmd, pmd_offset(pud, 0));
-@@ -278,7 +292,9 @@ void set_pte_vaddr_pud(pud_t *pud_page, unsigned long vaddr, pte_t new_pte)
+@@ -279,7 +293,9 @@ void set_pte_vaddr_pud(pud_t *pud_page, unsigned long vaddr, pte_t new_pte)
pmd = fill_pmd(pud, vaddr);
pte = fill_pte(pmd, vaddr);
@@ -28704,7 +28675,7 @@ index 474e28f..f016b6e 100644
/*
* It's enough to flush this one mapping.
-@@ -337,14 +353,12 @@ static void __init __init_extra_mapping(unsigned long phys, unsigned long size,
+@@ -338,14 +354,12 @@ static void __init __init_extra_mapping(unsigned long phys, unsigned long size,
pgd = pgd_offset_k((unsigned long)__va(phys));
if (pgd_none(*pgd)) {
pud = (pud_t *) spp_getpage();
@@ -28721,7 +28692,7 @@ index 474e28f..f016b6e 100644
}
pmd = pmd_offset(pud, phys);
BUG_ON(!pmd_none(*pmd));
-@@ -585,7 +599,7 @@ phys_pud_init(pud_t *pud_page, unsigned long addr, unsigned long end,
+@@ -586,7 +600,7 @@ phys_pud_init(pud_t *pud_page, unsigned long addr, unsigned long end,
prot);
spin_lock(&init_mm.page_table_lock);
@@ -28730,7 +28701,7 @@ index 474e28f..f016b6e 100644
spin_unlock(&init_mm.page_table_lock);
}
__flush_tlb_all();
-@@ -626,7 +640,7 @@ kernel_physical_mapping_init(unsigned long start,
+@@ -627,7 +641,7 @@ kernel_physical_mapping_init(unsigned long start,
page_size_mask);
spin_lock(&init_mm.page_table_lock);
@@ -28739,7 +28710,7 @@ index 474e28f..f016b6e 100644
spin_unlock(&init_mm.page_table_lock);
pgd_changed = true;
}
-@@ -1224,8 +1238,8 @@ int kern_addr_valid(unsigned long addr)
+@@ -1221,8 +1235,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),
@@ -28750,7 +28721,7 @@ index 474e28f..f016b6e 100644
};
struct vm_area_struct *get_gate_vma(struct mm_struct *mm)
-@@ -1259,7 +1273,7 @@ int in_gate_area_no_mm(unsigned long addr)
+@@ -1256,7 +1270,7 @@ int in_gate_area_no_mm(unsigned long addr)
const char *arch_vma_name(struct vm_area_struct *vma)
{
@@ -28760,7 +28731,7 @@ index 474e28f..f016b6e 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)
@@ -28776,7 +28747,7 @@ index 7b179b4..6bd1777 100644
return (void *)vaddr;
diff --git a/arch/x86/mm/ioremap.c b/arch/x86/mm/ioremap.c
-index 78fe3f1..73b95e2 100644
+index 9a1e658..da003f3 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,
@@ -28797,7 +28768,7 @@ index 78fe3f1..73b95e2 100644
{
struct vm_struct *p, *o;
-@@ -315,6 +315,9 @@ void *xlate_dev_mem_ptr(unsigned long phys)
+@@ -310,6 +310,9 @@ void *xlate_dev_mem_ptr(unsigned long phys)
/* If page is RAM, we can use __va. Otherwise ioremap and unmap. */
if (page_is_ram(start >> PAGE_SHIFT))
@@ -28807,7 +28778,7 @@ index 78fe3f1..73b95e2 100644
return __va(phys);
addr = (void __force *)ioremap_cache(start, PAGE_SIZE);
-@@ -327,6 +330,9 @@ void *xlate_dev_mem_ptr(unsigned long phys)
+@@ -322,6 +325,9 @@ void *xlate_dev_mem_ptr(unsigned long phys)
void unxlate_dev_mem_ptr(unsigned long phys, void *addr)
{
if (page_is_ram(phys >> PAGE_SHIFT))
@@ -28817,7 +28788,7 @@ index 78fe3f1..73b95e2 100644
return;
iounmap((void __iomem *)((unsigned long)addr & PAGE_MASK));
-@@ -344,7 +350,7 @@ static int __init early_ioremap_debug_setup(char *str)
+@@ -339,7 +345,7 @@ static int __init early_ioremap_debug_setup(char *str)
early_param("early_ioremap_debug", early_ioremap_debug_setup);
static __initdata int after_paging_init;
@@ -28826,7 +28797,7 @@ index 78fe3f1..73b95e2 100644
static inline pmd_t * __init early_ioremap_pmd(unsigned long addr)
{
-@@ -381,8 +387,7 @@ void __init early_ioremap_init(void)
+@@ -376,8 +382,7 @@ void __init early_ioremap_init(void)
slot_virt[i] = __fix_to_virt(FIX_BTMAP_BEGIN - NR_FIX_BTMAPS*i);
pmd = early_ioremap_pmd(fix_to_virt(FIX_BTMAP_BEGIN));
@@ -28987,10 +28958,10 @@ 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 72fe01e..f1a8daa 100644
+index a71c4e2..301ae44 100644
--- a/arch/x86/mm/numa.c
+++ b/arch/x86/mm/numa.c
-@@ -477,7 +477,7 @@ static bool __init numa_meminfo_cover_memory(const struct numa_meminfo *mi)
+@@ -474,7 +474,7 @@ static bool __init numa_meminfo_cover_memory(const struct numa_meminfo *mi)
return true;
}
@@ -29000,7 +28971,7 @@ index 72fe01e..f1a8daa 100644
unsigned long uninitialized_var(pfn_align);
int i, nid;
diff --git a/arch/x86/mm/pageattr-test.c b/arch/x86/mm/pageattr-test.c
-index 0e38951..4ca8458 100644
+index d0b1773..4c3327c 100644
--- a/arch/x86/mm/pageattr-test.c
+++ b/arch/x86/mm/pageattr-test.c
@@ -36,7 +36,7 @@ enum {
@@ -29013,7 +28984,7 @@ index 0e38951..4ca8458 100644
struct split_state {
diff --git a/arch/x86/mm/pageattr.c b/arch/x86/mm/pageattr.c
-index fb4e73e..43f7238 100644
+index bb32480..aef8278 100644
--- a/arch/x86/mm/pageattr.c
+++ b/arch/x86/mm/pageattr.c
@@ -261,7 +261,7 @@ static inline pgprot_t static_protections(pgprot_t prot, unsigned long address,
@@ -29151,6 +29122,19 @@ index 6574388..87e9bef 100644
cattr_name(want_flags),
(unsigned long long)paddr,
(unsigned long long)(paddr + size - 1),
+diff --git a/arch/x86/mm/pat_rbtree.c b/arch/x86/mm/pat_rbtree.c
+index 415f6c4..d319983 100644
+--- a/arch/x86/mm/pat_rbtree.c
++++ b/arch/x86/mm/pat_rbtree.c
+@@ -160,7 +160,7 @@ success:
+
+ failure:
+ printk(KERN_INFO "%s:%d conflicting memory types "
+- "%Lx-%Lx %s<->%s\n", current->comm, current->pid, start,
++ "%Lx-%Lx %s<->%s\n", current->comm, task_pid_nr(current), start,
+ end, cattr_name(found_type), cattr_name(match->type));
+ return -EBUSY;
+ }
diff --git a/arch/x86/mm/pf_in.c b/arch/x86/mm/pf_in.c
index 9f0614d..92ae64a 100644
--- a/arch/x86/mm/pf_in.c
@@ -29216,7 +29200,7 @@ index 17fda6a..489c74a 100644
+void __shadow_user_pgds(pgd_t *dst, const pgd_t *src)
+{
+ unsigned int count = USER_PGD_PTRS;
-+
+
+ while (count--)
+ *dst++ = __pgd((pgd_val(*src++) | (_PAGE_NX & __supported_pte_mask)) & ~_PAGE_USER);
+}
@@ -29229,7 +29213,7 @@ index 17fda6a..489c74a 100644
+
+ while (count--) {
+ pgd_t pgd;
-
++
+#ifdef CONFIG_X86_64
+ pgd = __pgd(pgd_val(*src++) | _PAGE_USER);
+#else
@@ -29664,7 +29648,7 @@ 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 3cbe4538..003d011 100644
+index f66b540..3e88dfb 100644
--- a/arch/x86/net/bpf_jit_comp.c
+++ b/arch/x86/net/bpf_jit_comp.c
@@ -12,6 +12,7 @@
@@ -29936,9 +29920,9 @@ index 3cbe4538..003d011 100644
}
oldproglen = proglen;
}
-@@ -737,7 +856,10 @@ cond_branch: f_offset = addrs[i + filter[i].jf] - addrs[i];
+@@ -732,7 +851,10 @@ cond_branch: f_offset = addrs[i + filter[i].jf] - addrs[i];
+ if (image) {
bpf_flush_icache(image, image + proglen);
-
fp->bpf_func = (void *)image;
- }
+ } else
@@ -29948,7 +29932,7 @@ index 3cbe4538..003d011 100644
out:
kfree(addrs);
return;
-@@ -745,18 +867,20 @@ out:
+@@ -740,18 +862,20 @@ out:
static void jit_free_defer(struct work_struct *arg)
{
@@ -30514,10 +30498,10 @@ index 40e4469..0592924 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 2b20038..eaf558f 100644
+index 39a0e7f1..ecc2f1e 100644
--- a/arch/x86/platform/efi/efi_64.c
+++ b/arch/x86/platform/efi/efi_64.c
-@@ -75,6 +75,11 @@ void __init efi_call_phys_prelog(void)
+@@ -76,6 +76,11 @@ void __init efi_call_phys_prelog(void)
vaddress = (unsigned long)__va(pgd * PGDIR_SIZE);
set_pgd(pgd_offset_k(pgd * PGDIR_SIZE), *pgd_offset_k(vaddress));
}
@@ -30529,7 +30513,7 @@ index 2b20038..eaf558f 100644
__flush_tlb_all();
}
-@@ -88,6 +93,11 @@ void __init efi_call_phys_epilog(void)
+@@ -89,6 +94,11 @@ void __init efi_call_phys_epilog(void)
for (pgd = 0; pgd < n_pgds; pgd++)
set_pgd(pgd_offset_k(pgd * PGDIR_SIZE), save_pgd[pgd]);
kfree(save_pgd);
@@ -30738,7 +30722,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 e31bcd8..f12dc46 100644
+index a0a0a43..a48e233 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];
@@ -30773,23 +30757,30 @@ 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 3c68768..07e82b8 100644
+index 1cf5b30..fd45732 100644
--- a/arch/x86/power/cpu.c
+++ b/arch/x86/power/cpu.c
-@@ -134,7 +134,7 @@ static void do_fpu_end(void)
+@@ -137,11 +137,8 @@ static void do_fpu_end(void)
static void fix_processor_context(void)
{
int cpu = smp_processor_id();
- struct tss_struct *t = &per_cpu(init_tss, cpu);
+-#ifdef CONFIG_X86_64
+- struct desc_struct *desc = get_cpu_gdt_table(cpu);
+- tss_desc tss;
+-#endif
+ struct tss_struct *t = init_tss + cpu;
-
++
set_tss_desc(cpu, t); /*
* This just modifies memory; should not be
-@@ -144,8 +144,6 @@ static void fix_processor_context(void)
+ * necessary. But... This is necessary, because
+@@ -150,10 +147,6 @@ static void fix_processor_context(void)
*/
#ifdef CONFIG_X86_64
-- get_cpu_gdt_table(cpu)[GDT_ENTRY_TSS].type = 9;
+- memcpy(&tss, &desc[GDT_ENTRY_TSS], sizeof(tss_desc));
+- tss.type = 0x9; /* The available 64-bit TSS (see AMD vol 2, pg 91 */
+- write_gdt_entry(desc, GDT_ENTRY_TSS, &tss, DESC_TSS);
-
syscall_init(); /* This sets MSR_*STAR and related */
#endif
@@ -30907,25 +30898,40 @@ index bb360dc..3e5945f 100644
movl %eax, %cr0
/*
+diff --git a/arch/x86/tools/Makefile b/arch/x86/tools/Makefile
+index e812034..c747134 100644
+--- a/arch/x86/tools/Makefile
++++ b/arch/x86/tools/Makefile
+@@ -37,7 +37,7 @@ $(obj)/test_get_len.o: $(srctree)/arch/x86/lib/insn.c $(srctree)/arch/x86/lib/in
+
+ $(obj)/insn_sanity.o: $(srctree)/arch/x86/lib/insn.c $(srctree)/arch/x86/lib/inat.c $(srctree)/arch/x86/include/asm/inat_types.h $(srctree)/arch/x86/include/asm/inat.h $(srctree)/arch/x86/include/asm/insn.h $(objtree)/arch/x86/lib/inat-tables.c
+
+-HOST_EXTRACFLAGS += -I$(srctree)/tools/include
++HOST_EXTRACFLAGS += -I$(srctree)/tools/include -ggdb
+ hostprogs-y += relocs
+ relocs-objs := relocs_32.o relocs_64.o relocs_common.o
+ relocs: $(obj)/relocs
diff --git a/arch/x86/tools/relocs.c b/arch/x86/tools/relocs.c
-index 79d67bd..c7e1b90 100644
+index f7bab68..b6d9886 100644
--- a/arch/x86/tools/relocs.c
+++ b/arch/x86/tools/relocs.c
-@@ -12,10 +12,13 @@
- #include <regex.h>
- #include <tools/le_byteshift.h>
+@@ -1,5 +1,7 @@
+ /* This is included from relocs_32/64.c */
+#include "../../../include/generated/autoconf.h"
+
- static void die(char *fmt, ...);
+ #define ElfW(type) _ElfW(ELF_BITS, type)
+ #define _ElfW(bits, type) __ElfW(bits, type)
+ #define __ElfW(bits, type) Elf##bits##_##type
+@@ -11,6 +13,7 @@
+ #define Elf_Sym ElfW(Sym)
+
+ static Elf_Ehdr ehdr;
++static Elf_Phdr *phdr;
- #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
- static Elf32_Ehdr ehdr;
-+static Elf32_Phdr *phdr;
- static unsigned long reloc_count, reloc_idx;
- static unsigned long *relocs;
- static unsigned long reloc16_count, reloc16_idx;
-@@ -330,9 +333,39 @@ static void read_ehdr(FILE *fp)
+ struct relocs {
+ uint32_t *offset;
+@@ -383,9 +386,39 @@ static void read_ehdr(FILE *fp)
}
}
@@ -30933,7 +30939,7 @@ index 79d67bd..c7e1b90 100644
+{
+ unsigned int i;
+
-+ phdr = calloc(ehdr.e_phnum, sizeof(Elf32_Phdr));
++ phdr = calloc(ehdr.e_phnum, sizeof(Elf_Phdr));
+ if (!phdr) {
+ die("Unable to allocate %d program headers\n",
+ ehdr.e_phnum);
@@ -30947,14 +30953,14 @@ index 79d67bd..c7e1b90 100644
+ strerror(errno));
+ }
+ for(i = 0; i < ehdr.e_phnum; i++) {
-+ phdr[i].p_type = elf32_to_cpu(phdr[i].p_type);
-+ phdr[i].p_offset = elf32_to_cpu(phdr[i].p_offset);
-+ phdr[i].p_vaddr = elf32_to_cpu(phdr[i].p_vaddr);
-+ phdr[i].p_paddr = elf32_to_cpu(phdr[i].p_paddr);
-+ phdr[i].p_filesz = elf32_to_cpu(phdr[i].p_filesz);
-+ phdr[i].p_memsz = elf32_to_cpu(phdr[i].p_memsz);
-+ phdr[i].p_flags = elf32_to_cpu(phdr[i].p_flags);
-+ phdr[i].p_align = elf32_to_cpu(phdr[i].p_align);
++ phdr[i].p_type = elf_word_to_cpu(phdr[i].p_type);
++ phdr[i].p_offset = elf_off_to_cpu(phdr[i].p_offset);
++ phdr[i].p_vaddr = elf_addr_to_cpu(phdr[i].p_vaddr);
++ phdr[i].p_paddr = elf_addr_to_cpu(phdr[i].p_paddr);
++ phdr[i].p_filesz = elf_word_to_cpu(phdr[i].p_filesz);
++ phdr[i].p_memsz = elf_word_to_cpu(phdr[i].p_memsz);
++ phdr[i].p_flags = elf_word_to_cpu(phdr[i].p_flags);
++ phdr[i].p_align = elf_word_to_cpu(phdr[i].p_align);
+ }
+
+}
@@ -30963,10 +30969,10 @@ index 79d67bd..c7e1b90 100644
{
- int i;
+ unsigned int i;
- Elf32_Shdr shdr;
+ Elf_Shdr shdr;
secs = calloc(ehdr.e_shnum, sizeof(struct section));
-@@ -367,7 +400,7 @@ static void read_shdrs(FILE *fp)
+@@ -420,7 +453,7 @@ static void read_shdrs(FILE *fp)
static void read_strtabs(FILE *fp)
{
@@ -30975,7 +30981,7 @@ index 79d67bd..c7e1b90 100644
for (i = 0; i < ehdr.e_shnum; i++) {
struct section *sec = &secs[i];
if (sec->shdr.sh_type != SHT_STRTAB) {
-@@ -392,7 +425,7 @@ static void read_strtabs(FILE *fp)
+@@ -445,7 +478,7 @@ static void read_strtabs(FILE *fp)
static void read_symtabs(FILE *fp)
{
@@ -30984,7 +30990,7 @@ index 79d67bd..c7e1b90 100644
for (i = 0; i < ehdr.e_shnum; i++) {
struct section *sec = &secs[i];
if (sec->shdr.sh_type != SHT_SYMTAB) {
-@@ -423,9 +456,11 @@ static void read_symtabs(FILE *fp)
+@@ -476,9 +509,11 @@ static void read_symtabs(FILE *fp)
}
@@ -30997,8 +31003,8 @@ index 79d67bd..c7e1b90 100644
+
for (i = 0; i < ehdr.e_shnum; i++) {
struct section *sec = &secs[i];
- if (sec->shdr.sh_type != SHT_REL) {
-@@ -445,9 +480,22 @@ static void read_relocs(FILE *fp)
+ if (sec->shdr.sh_type != SHT_REL_TYPE) {
+@@ -498,9 +533,22 @@ static void read_relocs(FILE *fp)
die("Cannot read symbol table: %s\n",
strerror(errno));
}
@@ -31015,21 +31021,23 @@ index 79d67bd..c7e1b90 100644
+ }
+#endif
+
- for (j = 0; j < sec->shdr.sh_size/sizeof(Elf32_Rel); j++) {
- Elf32_Rel *rel = &sec->reltab[j];
-- rel->r_offset = elf32_to_cpu(rel->r_offset);
-+ rel->r_offset = elf32_to_cpu(rel->r_offset) + base;
- rel->r_info = elf32_to_cpu(rel->r_info);
- }
- }
-@@ -456,13 +504,13 @@ static void read_relocs(FILE *fp)
+ for (j = 0; j < sec->shdr.sh_size/sizeof(Elf_Rel); j++) {
+ Elf_Rel *rel = &sec->reltab[j];
+- rel->r_offset = elf_addr_to_cpu(rel->r_offset);
++ rel->r_offset = elf_addr_to_cpu(rel->r_offset) + base;
+ rel->r_info = elf_xword_to_cpu(rel->r_info);
+ #if (SHT_REL_TYPE == SHT_RELA)
+ rel->r_addend = elf_xword_to_cpu(rel->r_addend);
+@@ -512,7 +560,7 @@ static void read_relocs(FILE *fp)
static void print_absolute_symbols(void)
{
- int i;
+ unsigned int i;
- printf("Absolute symbols\n");
- printf(" Num: Value Size Type Bind Visibility Name\n");
+ const char *format;
+
+ if (ELF_BITS == 64)
+@@ -525,7 +573,7 @@ static void print_absolute_symbols(void)
for (i = 0; i < ehdr.e_shnum; i++) {
struct section *sec = &secs[i];
char *sym_strtab;
@@ -31038,76 +31046,76 @@ index 79d67bd..c7e1b90 100644
if (sec->shdr.sh_type != SHT_SYMTAB) {
continue;
-@@ -489,14 +537,14 @@ static void print_absolute_symbols(void)
+@@ -552,7 +600,7 @@ static void print_absolute_symbols(void)
static void print_absolute_relocs(void)
{
- int i, printed = 0;
+ unsigned int i, printed = 0;
+ const char *format;
- for (i = 0; i < ehdr.e_shnum; i++) {
- struct section *sec = &secs[i];
+ if (ELF_BITS == 64)
+@@ -565,7 +613,7 @@ static void print_absolute_relocs(void)
struct section *sec_applies, *sec_symtab;
char *sym_strtab;
- Elf32_Sym *sh_symtab;
+ Elf_Sym *sh_symtab;
- int j;
+ unsigned int j;
- if (sec->shdr.sh_type != SHT_REL) {
+ if (sec->shdr.sh_type != SHT_REL_TYPE) {
continue;
}
-@@ -558,13 +606,13 @@ static void print_absolute_relocs(void)
- static void walk_relocs(void (*visit)(Elf32_Rel *rel, Elf32_Sym *sym),
- int use_real_mode)
+@@ -642,13 +690,13 @@ static void add_reloc(struct relocs *r, uint32_t offset)
+ static void walk_relocs(int (*process)(struct section *sec, Elf_Rel *rel,
+ Elf_Sym *sym, const char *symname))
{
- int i;
+ unsigned int i;
/* Walk through the relocations */
for (i = 0; i < ehdr.e_shnum; i++) {
char *sym_strtab;
- Elf32_Sym *sh_symtab;
+ Elf_Sym *sh_symtab;
struct section *sec_applies, *sec_symtab;
- int j;
+ unsigned int j;
struct section *sec = &secs[i];
- if (sec->shdr.sh_type != SHT_REL) {
-@@ -588,6 +636,24 @@ static void walk_relocs(void (*visit)(Elf32_Rel *rel, Elf32_Sym *sym),
- sym = &sh_symtab[ELF32_R_SYM(rel->r_info)];
- r_type = ELF32_R_TYPE(rel->r_info);
-
-+ if (!use_real_mode) {
-+ /* Don't relocate actual per-cpu variables, they are absolute indices, not addresses */
-+ if (!strcmp(sec_name(sym->st_shndx), ".data..percpu") && strcmp(sym_name(sym_strtab, sym), "__per_cpu_load"))
-+ continue;
+ if (sec->shdr.sh_type != SHT_REL_TYPE) {
+@@ -812,6 +860,23 @@ static int do_reloc32(struct section *sec, Elf_Rel *rel, Elf_Sym *sym,
+ {
+ unsigned r_type = ELF32_R_TYPE(rel->r_info);
+ int shn_abs = (sym->st_shndx == SHN_ABS) && !is_reloc(S_REL, symname);
++ char *sym_strtab = sec->link->link->strtab;
+
-+#if defined(CONFIG_PAX_KERNEXEC) && defined(CONFIG_X86_32)
-+ /* Don't relocate actual code, they are relocated implicitly by the base address of KERNEL_CS */
-+ if (!strcmp(sec_name(sym->st_shndx), ".text.end") && !strcmp(sym_name(sym_strtab, sym), "_etext"))
-+ continue;
-+ if (!strcmp(sec_name(sym->st_shndx), ".init.text"))
-+ continue;
-+ if (!strcmp(sec_name(sym->st_shndx), ".exit.text"))
-+ continue;
-+ if (!strcmp(sec_name(sym->st_shndx), ".text") && strcmp(sym_name(sym_strtab, sym), "__LOAD_PHYSICAL_ADDR"))
-+ continue;
-+#endif
-+ }
++ /* Don't relocate actual per-cpu variables, they are absolute indices, not addresses */
++ if (!strcmp(sec_name(sym->st_shndx), ".data..percpu") && strcmp(sym_name(sym_strtab, sym), "__per_cpu_load"))
++ return 0;
+
- shn_abs = sym->st_shndx == SHN_ABS;
++#ifdef CONFIG_PAX_KERNEXEC
++ /* Don't relocate actual code, they are relocated implicitly by the base address of KERNEL_CS */
++ if (!strcmp(sec_name(sym->st_shndx), ".text.end") && !strcmp(sym_name(sym_strtab, sym), "_etext"))
++ return 0;
++ if (!strcmp(sec_name(sym->st_shndx), ".init.text"))
++ return 0;
++ if (!strcmp(sec_name(sym->st_shndx), ".exit.text"))
++ return 0;
++ if (!strcmp(sec_name(sym->st_shndx), ".text") && strcmp(sym_name(sym_strtab, sym), "__LOAD_PHYSICAL_ADDR"))
++ return 0;
++#endif
- switch (r_type) {
-@@ -681,7 +747,7 @@ static int write32(unsigned int v, FILE *f)
+ switch (r_type) {
+ case R_386_NONE:
+@@ -950,7 +1015,7 @@ static int write32_as_text(uint32_t v, FILE *f)
static void emit_relocs(int as_text, int use_real_mode)
{
- int i;
+ unsigned int i;
- /* Count how many relocations I have and allocate space for them. */
- reloc_count = 0;
- walk_relocs(count_reloc, use_real_mode);
-@@ -808,10 +874,11 @@ int main(int argc, char **argv)
- fname, strerror(errno));
- }
+ int (*write_reloc)(uint32_t, FILE *) = write32;
+ int (*do_reloc)(struct section *sec, Elf_Rel *rel, Elf_Sym *sym,
+ const char *symname);
+@@ -1026,10 +1091,11 @@ void process(FILE *fp, int use_real_mode, int as_text,
+ {
+ regex_init(use_real_mode);
read_ehdr(fp);
+ read_phdrs(fp);
read_shdrs(fp);
@@ -31115,9 +31123,22 @@ index 79d67bd..c7e1b90 100644
read_symtabs(fp);
- read_relocs(fp);
+ read_relocs(fp, use_real_mode);
+ if (ELF_BITS == 64)
+ percpu_init();
if (show_absolute_syms) {
- print_absolute_symbols();
- goto out;
+diff --git a/arch/x86/um/tls_32.c b/arch/x86/um/tls_32.c
+index 80ffa5b..a33bd15 100644
+--- a/arch/x86/um/tls_32.c
++++ b/arch/x86/um/tls_32.c
+@@ -260,7 +260,7 @@ out:
+ if (unlikely(task == current &&
+ !t->arch.tls_array[idx - GDT_ENTRY_TLS_MIN].flushed)) {
+ printk(KERN_ERR "get_tls_entry: task with pid %d got here "
+- "without flushed TLS.", current->pid);
++ "without flushed TLS.", task_pid_nr(current));
+ }
+
+ return 0;
diff --git a/arch/x86/vdso/Makefile b/arch/x86/vdso/Makefile
index fd14be1..e3c79c0 100644
--- a/arch/x86/vdso/Makefile
@@ -31291,10 +31312,10 @@ index 431e875..cbb23f3 100644
-}
-__setup("vdso=", vdso_setup);
diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
-index cf95e19..17e9f50 100644
+index a492be2..08678da 100644
--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
-@@ -100,8 +100,6 @@ EXPORT_SYMBOL_GPL(xen_start_info);
+@@ -123,8 +123,6 @@ EXPORT_SYMBOL_GPL(xen_start_info);
struct shared_info xen_dummy_shared_info;
@@ -31303,7 +31324,7 @@ index cf95e19..17e9f50 100644
RESERVE_BRK(shared_info_page_brk, PAGE_SIZE);
__read_mostly int xen_have_vector_callback;
EXPORT_SYMBOL_GPL(xen_have_vector_callback);
-@@ -511,8 +509,7 @@ static void xen_load_gdt(const struct desc_ptr *dtr)
+@@ -542,8 +540,7 @@ static void xen_load_gdt(const struct desc_ptr *dtr)
{
unsigned long va = dtr->address;
unsigned int size = dtr->size + 1;
@@ -31313,7 +31334,7 @@ index cf95e19..17e9f50 100644
int f;
/*
-@@ -560,8 +557,7 @@ static void __init xen_load_gdt_boot(const struct desc_ptr *dtr)
+@@ -591,8 +588,7 @@ static void __init xen_load_gdt_boot(const struct desc_ptr *dtr)
{
unsigned long va = dtr->address;
unsigned int size = dtr->size + 1;
@@ -31323,7 +31344,7 @@ index cf95e19..17e9f50 100644
int f;
/*
-@@ -569,7 +565,7 @@ static void __init xen_load_gdt_boot(const struct desc_ptr *dtr)
+@@ -600,7 +596,7 @@ static void __init xen_load_gdt_boot(const struct desc_ptr *dtr)
* 8-byte entries, or 16 4k pages..
*/
@@ -31332,7 +31353,7 @@ index cf95e19..17e9f50 100644
BUG_ON(va & ~PAGE_MASK);
for (f = 0; va < dtr->address + size; va += PAGE_SIZE, f++) {
-@@ -954,7 +950,7 @@ static u32 xen_safe_apic_wait_icr_idle(void)
+@@ -985,7 +981,7 @@ static u32 xen_safe_apic_wait_icr_idle(void)
return 0;
}
@@ -31341,7 +31362,7 @@ index cf95e19..17e9f50 100644
{
apic->read = xen_apic_read;
apic->write = xen_apic_write;
-@@ -1260,30 +1256,30 @@ static const struct pv_apic_ops xen_apic_ops __initconst = {
+@@ -1290,30 +1286,30 @@ static const struct pv_apic_ops xen_apic_ops __initconst = {
#endif
};
@@ -31379,7 +31400,7 @@ index cf95e19..17e9f50 100644
{
if (pm_power_off)
pm_power_off();
-@@ -1385,7 +1381,17 @@ asmlinkage void __init xen_start_kernel(void)
+@@ -1464,7 +1460,17 @@ asmlinkage void __init xen_start_kernel(void)
__userpte_alloc_gfp &= ~__GFP_HIGHMEM;
/* Work out if we support NX */
@@ -31398,7 +31419,7 @@ index cf95e19..17e9f50 100644
xen_setup_features();
-@@ -1416,13 +1422,6 @@ asmlinkage void __init xen_start_kernel(void)
+@@ -1495,13 +1501,6 @@ asmlinkage void __init xen_start_kernel(void)
machine_ops = xen_machine_ops;
@@ -31412,7 +31433,7 @@ index cf95e19..17e9f50 100644
xen_smp_init();
#ifdef CONFIG_ACPI_NUMA
-@@ -1616,7 +1615,7 @@ static int __cpuinit xen_hvm_cpu_notify(struct notifier_block *self,
+@@ -1700,7 +1699,7 @@ static int __cpuinit xen_hvm_cpu_notify(struct notifier_block *self,
return NOTIFY_OK;
}
@@ -31422,7 +31443,7 @@ index cf95e19..17e9f50 100644
};
diff --git a/arch/x86/xen/mmu.c b/arch/x86/xen/mmu.c
-index e006c18..b9a7d6c 100644
+index fdc3ba2..3daee39 100644
--- a/arch/x86/xen/mmu.c
+++ b/arch/x86/xen/mmu.c
@@ -1894,6 +1894,9 @@ void __init xen_setup_kernel_pagetable(pgd_t *pgd, unsigned long max_pfn)
@@ -31448,7 +31469,7 @@ index e006c18..b9a7d6c 100644
set_page_prot(level2_kernel_pgt, PAGE_KERNEL_RO);
set_page_prot(level2_fixmap_pgt, PAGE_KERNEL_RO);
-@@ -2110,6 +2117,7 @@ static void __init xen_post_allocator_init(void)
+@@ -2108,6 +2115,7 @@ static void __init xen_post_allocator_init(void)
pv_mmu_ops.set_pud = xen_set_pud;
#if PAGETABLE_LEVELS == 4
pv_mmu_ops.set_pgd = xen_set_pgd;
@@ -31456,7 +31477,7 @@ index e006c18..b9a7d6c 100644
#endif
/* This will work as long as patching hasn't happened yet
-@@ -2188,6 +2196,7 @@ static const struct pv_mmu_ops xen_mmu_ops __initconst = {
+@@ -2186,6 +2194,7 @@ static const struct pv_mmu_ops xen_mmu_ops __initconst = {
.pud_val = PV_CALLEE_SAVE(xen_pud_val),
.make_pud = PV_CALLEE_SAVE(xen_make_pud),
.set_pgd = xen_set_pgd_hyper,
@@ -31465,10 +31486,10 @@ index e006c18..b9a7d6c 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 96c4e85..284fded 100644
+index d99cae8..18401e1 100644
--- a/arch/x86/xen/smp.c
+++ b/arch/x86/xen/smp.c
-@@ -230,11 +230,6 @@ static void __init xen_smp_prepare_boot_cpu(void)
+@@ -240,11 +240,6 @@ static void __init xen_smp_prepare_boot_cpu(void)
{
BUG_ON(smp_processor_id() != 0);
native_smp_prepare_boot_cpu();
@@ -31480,7 +31501,7 @@ index 96c4e85..284fded 100644
xen_filter_cpu_maps();
xen_setup_vcpu_info_placement();
}
-@@ -304,7 +299,7 @@ cpu_initialize_context(unsigned int cpu, struct task_struct *idle)
+@@ -314,7 +309,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;
@@ -31489,7 +31510,7 @@ index 96c4e85..284fded 100644
#else
ctxt->gs_base_kernel = per_cpu_offset(cpu);
#endif
-@@ -314,8 +309,8 @@ cpu_initialize_context(unsigned int cpu, struct task_struct *idle)
+@@ -324,8 +319,8 @@ cpu_initialize_context(unsigned int cpu, struct task_struct *idle)
{
ctxt->user_regs.eflags = 0x1000; /* IOPL_RING1 */
@@ -31500,7 +31521,7 @@ index 96c4e85..284fded 100644
xen_copy_trap_info(ctxt->trap_ctxt);
-@@ -360,13 +355,12 @@ static int __cpuinit xen_cpu_up(unsigned int cpu, struct task_struct *idle)
+@@ -370,13 +365,12 @@ static int __cpuinit xen_cpu_up(unsigned int cpu, struct task_struct *idle)
int rc;
per_cpu(current_task, cpu) = idle;
@@ -31516,7 +31537,7 @@ index 96c4e85..284fded 100644
#endif
xen_setup_runstate_info(cpu);
xen_setup_timer(cpu);
-@@ -642,7 +636,7 @@ static const struct smp_ops xen_smp_ops __initconst = {
+@@ -651,7 +645,7 @@ static const struct smp_ops xen_smp_ops __initconst = {
void __init xen_smp_init(void)
{
@@ -31647,7 +31668,7 @@ 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-iopoll.c b/block/blk-iopoll.c
-index 58916af..eb9dbcf 100644
+index 58916af..eb9dbcf6 100644
--- a/block/blk-iopoll.c
+++ b/block/blk-iopoll.c
@@ -77,7 +77,7 @@ void blk_iopoll_complete(struct blk_iopoll *iopoll)
@@ -31748,7 +31769,7 @@ index 7c668c8..db3521c 100644
err = -EFAULT;
goto out;
diff --git a/block/genhd.c b/block/genhd.c
-index 5098a64..d15a9e8 100644
+index cdeb527..10aa34db 100644
--- a/block/genhd.c
+++ b/block/genhd.c
@@ -467,21 +467,24 @@ static char *bdevt_str(dev_t devt, char *buf)
@@ -31780,33 +31801,35 @@ index 5098a64..d15a9e8 100644
EXPORT_SYMBOL(blk_unregister_region);
diff --git a/block/partitions/efi.c b/block/partitions/efi.c
-index ff5804e..a88acad 100644
+index c85fc89..51e690b 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,
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 = kzalloc(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) {
diff --git a/block/scsi_ioctl.c b/block/scsi_ioctl.c
-index 9a87daa..fb17486 100644
+index a5ffcc9..3cedc9c 100644
--- a/block/scsi_ioctl.c
+++ b/block/scsi_ioctl.c
-@@ -223,8 +223,20 @@ EXPORT_SYMBOL(blk_verify_command);
+@@ -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)
{
@@ -31828,7 +31851,7 @@ index 9a87daa..fb17486 100644
if (blk_verify_command(rq->cmd, mode & FMODE_WRITE))
return -EPERM;
-@@ -433,6 +445,8 @@ int sg_scsi_ioctl(struct request_queue *q, struct gendisk *disk, fmode_t mode,
+@@ -434,6 +446,8 @@ int sg_scsi_ioctl(struct request_queue *q, struct gendisk *disk, fmode_t mode,
int err;
unsigned int in_len, out_len, bytes, opcode, cmdlen;
char *buffer = NULL, sense[SCSI_SENSE_BUFFERSIZE];
@@ -31837,7 +31860,7 @@ index 9a87daa..fb17486 100644
if (!sic)
return -EINVAL;
-@@ -466,9 +480,18 @@ int sg_scsi_ioctl(struct request_queue *q, struct gendisk *disk, fmode_t mode,
+@@ -467,9 +481,18 @@ int sg_scsi_ioctl(struct request_queue *q, struct gendisk *disk, fmode_t mode,
*/
err = -EFAULT;
rq->cmd_len = cmdlen;
@@ -31917,7 +31940,7 @@ index f220d64..d359ad6 100644
struct apei_exec_context {
u32 ip;
diff --git a/drivers/acpi/apei/cper.c b/drivers/acpi/apei/cper.c
-index fefc2ca..12a535d 100644
+index 33dc6a0..4b24b47 100644
--- a/drivers/acpi/apei/cper.c
+++ b/drivers/acpi/apei/cper.c
@@ -39,12 +39,12 @@
@@ -32030,10 +32053,10 @@ index 7586544..636a2f0 100644
if (err)
return err;
diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c
-index ee255c6..747c68b 100644
+index eb133c7..f571552 100644
--- a/drivers/acpi/processor_idle.c
+++ b/drivers/acpi/processor_idle.c
-@@ -986,7 +986,7 @@ static int acpi_processor_setup_cpuidle_states(struct acpi_processor *pr)
+@@ -994,7 +994,7 @@ static int acpi_processor_setup_cpuidle_states(struct acpi_processor *pr)
{
int i, count = CPUIDLE_DRIVER_STATE_START;
struct acpi_processor_cx *cx;
@@ -32043,10 +32066,10 @@ index ee255c6..747c68b 100644
if (!pr->flags.power_setup_done)
diff --git a/drivers/acpi/sysfs.c b/drivers/acpi/sysfs.c
-index 41c0504..f8c0836 100644
+index fcae5fa..e9f71ea 100644
--- a/drivers/acpi/sysfs.c
+++ b/drivers/acpi/sysfs.c
-@@ -420,11 +420,11 @@ static u32 num_counters;
+@@ -423,11 +423,11 @@ static u32 num_counters;
static struct attribute **all_attrs;
static u32 acpi_gpe_count;
@@ -32061,7 +32084,7 @@ index 41c0504..f8c0836 100644
static void delete_gpe_attr_array(void)
{
diff --git a/drivers/ata/libahci.c b/drivers/ata/libahci.c
-index 09f6047..3b3dab4 100644
+index 7b9bdd8..37638ca 100644
--- a/drivers/ata/libahci.c
+++ b/drivers/ata/libahci.c
@@ -1230,7 +1230,7 @@ int ahci_kick_engine(struct ata_port *ap)
@@ -32074,7 +32097,7 @@ index 09f6047..3b3dab4 100644
unsigned long timeout_msec)
{
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
-index 8038ee3..a19a6e6 100644
+index adf002a..39bb8f9 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -4792,7 +4792,7 @@ void ata_qc_free(struct ata_queued_cmd *qc)
@@ -32115,20 +32138,20 @@ index 8038ee3..a19a6e6 100644
}
diff --git a/drivers/ata/pata_arasan_cf.c b/drivers/ata/pata_arasan_cf.c
-index 405022d..fb70e53 100644
+index 7638121..357a965 100644
--- a/drivers/ata/pata_arasan_cf.c
+++ b/drivers/ata/pata_arasan_cf.c
-@@ -864,7 +864,9 @@ static int arasan_cf_probe(struct platform_device *pdev)
+@@ -865,7 +865,9 @@ static int arasan_cf_probe(struct platform_device *pdev)
/* Handle platform specific quirks */
- if (pdata->quirk) {
- if (pdata->quirk & CF_BROKEN_PIO) {
+ if (quirk) {
+ if (quirk & CF_BROKEN_PIO) {
- ap->ops->set_piomode = NULL;
+ pax_open_kernel();
+ *(void **)&ap->ops->set_piomode = NULL;
+ pax_close_kernel();
ap->pio_mask = 0;
}
- if (pdata->quirk & CF_BROKEN_MWDMA)
+ if (quirk & CF_BROKEN_MWDMA)
diff --git a/drivers/atm/adummy.c b/drivers/atm/adummy.c
index f9b983a..887b9d8 100644
--- a/drivers/atm/adummy.c
@@ -32382,7 +32405,7 @@ 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 d689126..e78e412 100644
+index 507362a..a845e57 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)
@@ -33139,7 +33162,7 @@ index d78b204..ecc1929 100644
fn(cont, dev, &ic->classdev);
else
diff --git a/drivers/base/bus.c b/drivers/base/bus.c
-index 519865b..e540db3 100644
+index d414331..b4dd4ba 100644
--- a/drivers/base/bus.c
+++ b/drivers/base/bus.c
@@ -1163,7 +1163,7 @@ int subsys_interface_register(struct subsys_interface *sif)
@@ -33161,10 +33184,10 @@ index 519865b..e540db3 100644
subsys_dev_iter_init(&iter, subsys, NULL, NULL);
while ((dev = subsys_dev_iter_next(&iter)))
diff --git a/drivers/base/devtmpfs.c b/drivers/base/devtmpfs.c
-index 01fc5b0..917801f 100644
+index 7413d06..79155fa 100644
--- a/drivers/base/devtmpfs.c
+++ b/drivers/base/devtmpfs.c
-@@ -348,7 +348,7 @@ int devtmpfs_mount(const char *mntdir)
+@@ -354,7 +354,7 @@ int devtmpfs_mount(const char *mntdir)
if (!thread)
return 0;
@@ -33173,7 +33196,7 @@ index 01fc5b0..917801f 100644
if (err)
printk(KERN_INFO "devtmpfs: error mounting %i\n", err);
else
-@@ -373,11 +373,11 @@ static int devtmpfsd(void *p)
+@@ -380,11 +380,11 @@ static int devtmpfsd(void *p)
*err = sys_unshare(CLONE_NEWNS);
if (*err)
goto out;
@@ -33189,10 +33212,10 @@ index 01fc5b0..917801f 100644
while (1) {
spin_lock(&req_lock);
diff --git a/drivers/base/node.c b/drivers/base/node.c
-index fac124a..66bd4ab 100644
+index 7616a77c..8f57f51 100644
--- a/drivers/base/node.c
+++ b/drivers/base/node.c
-@@ -625,7 +625,7 @@ static ssize_t print_nodes_state(enum node_states state, char *buf)
+@@ -626,7 +626,7 @@ static ssize_t print_nodes_state(enum node_states state, char *buf)
struct node_attr {
struct device_attribute attr;
enum node_states state;
@@ -33202,7 +33225,7 @@ index fac124a..66bd4ab 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 9a6b05a..2fc8fb9 100644
+index 7072404..76dcebd 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)
@@ -33298,10 +33321,10 @@ index e8d11b6..7b1b36f 100644
}
EXPORT_SYMBOL_GPL(unregister_syscore_ops);
diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c
-index dadea48..a1f3835 100644
+index 62b6c2c..4a11354 100644
--- a/drivers/block/cciss.c
+++ b/drivers/block/cciss.c
-@@ -1184,6 +1184,8 @@ static int cciss_ioctl32_passthru(struct block_device *bdev, fmode_t mode,
+@@ -1189,6 +1189,8 @@ static int cciss_ioctl32_passthru(struct block_device *bdev, fmode_t mode,
int err;
u32 cp;
@@ -33310,7 +33333,7 @@ index dadea48..a1f3835 100644
err = 0;
err |=
copy_from_user(&arg64.LUN_info, &arg32->LUN_info,
-@@ -3005,7 +3007,7 @@ static void start_io(ctlr_info_t *h)
+@@ -3010,7 +3012,7 @@ static void start_io(ctlr_info_t *h)
while (!list_empty(&h->reqQ)) {
c = list_entry(h->reqQ.next, CommandList_struct, list);
/* can't do anything if fifo is full */
@@ -33319,7 +33342,7 @@ index dadea48..a1f3835 100644
dev_warn(&h->pdev->dev, "fifo full\n");
break;
}
-@@ -3015,7 +3017,7 @@ static void start_io(ctlr_info_t *h)
+@@ -3020,7 +3022,7 @@ static void start_io(ctlr_info_t *h)
h->Qdepth--;
/* Tell the controller execute command */
@@ -33328,7 +33351,7 @@ index dadea48..a1f3835 100644
/* Put job onto the completed Q */
addQ(&h->cmpQ, c);
-@@ -3441,17 +3443,17 @@ startio:
+@@ -3446,17 +3448,17 @@ startio:
static inline unsigned long get_next_completion(ctlr_info_t *h)
{
@@ -33349,7 +33372,7 @@ index dadea48..a1f3835 100644
(h->interrupts_enabled == 0));
}
-@@ -3484,7 +3486,7 @@ static inline u32 next_command(ctlr_info_t *h)
+@@ -3489,7 +3491,7 @@ static inline u32 next_command(ctlr_info_t *h)
u32 a;
if (unlikely(!(h->transMethod & CFGTBL_Trans_Performant)))
@@ -33358,7 +33381,7 @@ index dadea48..a1f3835 100644
if ((*(h->reply_pool_head) & 1) == (h->reply_pool_wraparound)) {
a = *(h->reply_pool_head); /* Next cmd in ring buffer */
-@@ -4041,7 +4043,7 @@ static void cciss_put_controller_into_performant_mode(ctlr_info_t *h)
+@@ -4046,7 +4048,7 @@ static void cciss_put_controller_into_performant_mode(ctlr_info_t *h)
trans_support & CFGTBL_Trans_use_short_tags);
/* Change the access methods to the performant access methods */
@@ -33367,7 +33390,7 @@ index dadea48..a1f3835 100644
h->transMethod = CFGTBL_Trans_Performant;
return;
-@@ -4310,7 +4312,7 @@ static int cciss_pci_init(ctlr_info_t *h)
+@@ -4319,7 +4321,7 @@ static int cciss_pci_init(ctlr_info_t *h)
if (prod_index < 0)
return -ENODEV;
h->product_name = products[prod_index].product_name;
@@ -33376,7 +33399,7 @@ index dadea48..a1f3835 100644
if (cciss_board_disabled(h)) {
dev_warn(&h->pdev->dev, "controller appears to be disabled\n");
-@@ -5032,7 +5034,7 @@ reinit_after_soft_reset:
+@@ -5051,7 +5053,7 @@ reinit_after_soft_reset:
}
/* make sure the board interrupts are off */
@@ -33385,7 +33408,7 @@ index dadea48..a1f3835 100644
rc = cciss_request_irq(h, do_cciss_msix_intr, do_cciss_intx);
if (rc)
goto clean2;
-@@ -5082,7 +5084,7 @@ reinit_after_soft_reset:
+@@ -5101,7 +5103,7 @@ reinit_after_soft_reset:
* fake ones to scoop up any residual completions.
*/
spin_lock_irqsave(&h->lock, flags);
@@ -33394,7 +33417,7 @@ index dadea48..a1f3835 100644
spin_unlock_irqrestore(&h->lock, flags);
free_irq(h->intr[h->intr_mode], h);
rc = cciss_request_irq(h, cciss_msix_discard_completions,
-@@ -5102,9 +5104,9 @@ reinit_after_soft_reset:
+@@ -5121,9 +5123,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");
@@ -33406,7 +33429,7 @@ index dadea48..a1f3835 100644
rc = controller_reset_failed(h->cfgtable);
if (rc)
-@@ -5127,7 +5129,7 @@ reinit_after_soft_reset:
+@@ -5146,7 +5148,7 @@ reinit_after_soft_reset:
cciss_scsi_setup(h);
/* Turn the interrupts on so we can service requests */
@@ -33415,7 +33438,7 @@ index dadea48..a1f3835 100644
/* Get the firmware version */
inq_buff = kzalloc(sizeof(InquiryData_struct), GFP_KERNEL);
-@@ -5199,7 +5201,7 @@ static void cciss_shutdown(struct pci_dev *pdev)
+@@ -5218,7 +5220,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");
@@ -33438,7 +33461,7 @@ index 7fda30e..eb5dfe0 100644
/* queue and queue Info */
struct list_head reqQ;
diff --git a/drivers/block/cpqarray.c b/drivers/block/cpqarray.c
-index 3f08713..87d4b4a 100644
+index 639d26b..fd6ad1f 100644
--- a/drivers/block/cpqarray.c
+++ b/drivers/block/cpqarray.c
@@ -404,7 +404,7 @@ static int cpqarray_register_ctlr(int i, struct pci_dev *pdev)
@@ -33477,7 +33500,7 @@ index 3f08713..87d4b4a 100644
hba[ctlr]->ctlr = ctlr;
hba[ctlr]->board_id = board_id;
hba[ctlr]->pci_dev = NULL; /* not PCI */
-@@ -980,7 +980,7 @@ static void start_io(ctlr_info_t *h)
+@@ -978,7 +978,7 @@ static void start_io(ctlr_info_t *h)
while((c = h->reqQ) != NULL) {
/* Can't do anything if we're busy */
@@ -33486,7 +33509,7 @@ index 3f08713..87d4b4a 100644
return;
/* Get the first entry from the request Q */
-@@ -988,7 +988,7 @@ static void start_io(ctlr_info_t *h)
+@@ -986,7 +986,7 @@ static void start_io(ctlr_info_t *h)
h->Qdepth--;
/* Tell the controller to do our bidding */
@@ -33495,7 +33518,7 @@ index 3f08713..87d4b4a 100644
/* Get onto the completion Q */
addQ(&h->cmpQ, c);
-@@ -1050,7 +1050,7 @@ static irqreturn_t do_ida_intr(int irq, void *dev_id)
+@@ -1048,7 +1048,7 @@ static irqreturn_t do_ida_intr(int irq, void *dev_id)
unsigned long flags;
__u32 a,a1;
@@ -33504,7 +33527,7 @@ index 3f08713..87d4b4a 100644
/* Is this interrupt for us? */
if (istat == 0)
return IRQ_NONE;
-@@ -1061,7 +1061,7 @@ static irqreturn_t do_ida_intr(int irq, void *dev_id)
+@@ -1059,7 +1059,7 @@ static irqreturn_t do_ida_intr(int irq, void *dev_id)
*/
spin_lock_irqsave(IDA_LOCK(h->ctlr), flags);
if (istat & FIFO_NOT_EMPTY) {
@@ -33513,7 +33536,7 @@ index 3f08713..87d4b4a 100644
a1 = a; a &= ~3;
if ((c = h->cmpQ) == NULL)
{
-@@ -1195,6 +1195,7 @@ out_passthru:
+@@ -1193,6 +1193,7 @@ out_passthru:
ida_pci_info_struct pciinfo;
if (!arg) return -EINVAL;
@@ -33521,7 +33544,7 @@ index 3f08713..87d4b4a 100644
pciinfo.bus = host->pci_dev->bus->number;
pciinfo.dev_fn = host->pci_dev->devfn;
pciinfo.board_id = host->board_id;
-@@ -1449,11 +1450,11 @@ static int sendcmd(
+@@ -1447,11 +1448,11 @@ static int sendcmd(
/*
* Disable interrupt
*/
@@ -33535,7 +33558,7 @@ index 3f08713..87d4b4a 100644
if (temp != 0) {
break;
}
-@@ -1466,7 +1467,7 @@ DBG(
+@@ -1464,7 +1465,7 @@ DBG(
/*
* Send the cmd
*/
@@ -33544,7 +33567,7 @@ index 3f08713..87d4b4a 100644
complete = pollcomplete(ctlr);
pci_unmap_single(info_p->pci_dev, (dma_addr_t) c->req.sg[0].addr,
-@@ -1549,9 +1550,9 @@ static int revalidate_allvol(ctlr_info_t *host)
+@@ -1547,9 +1548,9 @@ static int revalidate_allvol(ctlr_info_t *host)
* we check the new geometry. Then turn interrupts back on when
* we're done.
*/
@@ -33556,7 +33579,7 @@ index 3f08713..87d4b4a 100644
for(i=0; i<NWD; i++) {
struct gendisk *disk = ida_gendisk[ctlr][i];
-@@ -1591,7 +1592,7 @@ static int pollcomplete(int ctlr)
+@@ -1589,7 +1590,7 @@ static int pollcomplete(int ctlr)
/* Wait (up to 2 seconds) for a command to complete */
for (i = 200000; i > 0; i--) {
@@ -33579,7 +33602,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 6b51afa..17e1191 100644
+index f943aac..99bfd19 100644
--- a/drivers/block/drbd/drbd_int.h
+++ b/drivers/block/drbd/drbd_int.h
@@ -582,7 +582,7 @@ struct drbd_epoch {
@@ -33591,16 +33614,16 @@ index 6b51afa..17e1191 100644
atomic_t active; /* increased on every req. added, and dec on every finished. */
unsigned long flags;
};
-@@ -1011,7 +1011,7 @@ struct drbd_conf {
+@@ -1021,7 +1021,7 @@ struct drbd_conf {
+ unsigned int al_tr_number;
int al_tr_cycle;
- int al_tr_pos; /* position of the next transaction in the journal */
wait_queue_head_t seq_wait;
- atomic_t packet_seq;
+ atomic_unchecked_t packet_seq;
unsigned int peer_seq;
spinlock_t peer_seq_lock;
unsigned int minor;
-@@ -1527,7 +1527,7 @@ static inline int drbd_setsockopt(struct socket *sock, int level, int optname,
+@@ -1562,7 +1562,7 @@ static inline int drbd_setsockopt(struct socket *sock, int level, int optname,
char __user *uoptval;
int err;
@@ -33610,7 +33633,7 @@ index 6b51afa..17e1191 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 54d03d4..332f311 100644
+index a5dca6a..bb27967 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,
@@ -33643,10 +33666,10 @@ index 54d03d4..332f311 100644
idr_destroy(&tconn->volumes);
diff --git a/drivers/block/drbd/drbd_receiver.c b/drivers/block/drbd/drbd_receiver.c
-index 2f5fffd..b22a1ae 100644
+index 4222aff..1f79506 100644
--- a/drivers/block/drbd/drbd_receiver.c
+++ b/drivers/block/drbd/drbd_receiver.c
-@@ -833,7 +833,7 @@ int drbd_connected(struct drbd_conf *mdev)
+@@ -834,7 +834,7 @@ int drbd_connected(struct drbd_conf *mdev)
{
int err;
@@ -33655,7 +33678,7 @@ index 2f5fffd..b22a1ae 100644
mdev->peer_seq = 0;
mdev->state_mutex = mdev->tconn->agreed_pro_version < 100 ?
-@@ -1191,7 +1191,7 @@ static enum finish_epoch drbd_may_finish_epoch(struct drbd_tconn *tconn,
+@@ -1193,7 +1193,7 @@ static enum finish_epoch drbd_may_finish_epoch(struct drbd_tconn *tconn,
do {
next_epoch = NULL;
@@ -33664,7 +33687,7 @@ index 2f5fffd..b22a1ae 100644
switch (ev & ~EV_CLEANUP) {
case EV_PUT:
-@@ -1231,7 +1231,7 @@ static enum finish_epoch drbd_may_finish_epoch(struct drbd_tconn *tconn,
+@@ -1233,7 +1233,7 @@ static enum finish_epoch drbd_may_finish_epoch(struct drbd_tconn *tconn,
rv = FE_DESTROYED;
} else {
epoch->flags = 0;
@@ -33673,7 +33696,7 @@ index 2f5fffd..b22a1ae 100644
/* atomic_set(&epoch->active, 0); is already zero */
if (rv == FE_STILL_LIVE)
rv = FE_RECYCLED;
-@@ -1449,7 +1449,7 @@ static int receive_Barrier(struct drbd_tconn *tconn, struct packet_info *pi)
+@@ -1451,7 +1451,7 @@ static int receive_Barrier(struct drbd_tconn *tconn, struct packet_info *pi)
conn_wait_active_ee_empty(tconn);
drbd_flush(tconn);
@@ -33682,7 +33705,7 @@ index 2f5fffd..b22a1ae 100644
epoch = kmalloc(sizeof(struct drbd_epoch), GFP_NOIO);
if (epoch)
break;
-@@ -1462,11 +1462,11 @@ static int receive_Barrier(struct drbd_tconn *tconn, struct packet_info *pi)
+@@ -1464,11 +1464,11 @@ static int receive_Barrier(struct drbd_tconn *tconn, struct packet_info *pi)
}
epoch->flags = 0;
@@ -33696,7 +33719,7 @@ index 2f5fffd..b22a1ae 100644
list_add(&epoch->list, &tconn->current_epoch->list);
tconn->current_epoch = epoch;
tconn->epochs++;
-@@ -2170,7 +2170,7 @@ static int receive_Data(struct drbd_tconn *tconn, struct packet_info *pi)
+@@ -2172,7 +2172,7 @@ static int receive_Data(struct drbd_tconn *tconn, struct packet_info *pi)
err = wait_for_and_update_peer_seq(mdev, peer_seq);
drbd_send_ack_dp(mdev, P_NEG_ACK, p, pi->size);
@@ -33705,7 +33728,7 @@ index 2f5fffd..b22a1ae 100644
err2 = drbd_drain_block(mdev, pi->size);
if (!err)
err = err2;
-@@ -2204,7 +2204,7 @@ static int receive_Data(struct drbd_tconn *tconn, struct packet_info *pi)
+@@ -2206,7 +2206,7 @@ static int receive_Data(struct drbd_tconn *tconn, struct packet_info *pi)
spin_lock(&tconn->epoch_lock);
peer_req->epoch = tconn->current_epoch;
@@ -33714,7 +33737,7 @@ index 2f5fffd..b22a1ae 100644
atomic_inc(&peer_req->epoch->active);
spin_unlock(&tconn->epoch_lock);
-@@ -4345,7 +4345,7 @@ struct data_cmd {
+@@ -4347,7 +4347,7 @@ struct data_cmd {
int expect_payload;
size_t pkt_size;
int (*fn)(struct drbd_tconn *, struct packet_info *);
@@ -33723,7 +33746,7 @@ index 2f5fffd..b22a1ae 100644
static struct data_cmd drbd_cmd_handler[] = {
[P_DATA] = { 1, sizeof(struct p_data), receive_Data },
-@@ -4465,7 +4465,7 @@ static void conn_disconnect(struct drbd_tconn *tconn)
+@@ -4467,7 +4467,7 @@ static void conn_disconnect(struct drbd_tconn *tconn)
if (!list_empty(&tconn->current_epoch->list))
conn_err(tconn, "ASSERTION FAILED: tconn->current_epoch->list not empty\n");
/* ok, no more ee's on the fly, it is safe to reset the epoch_size */
@@ -33732,7 +33755,7 @@ index 2f5fffd..b22a1ae 100644
tconn->send.seen_any_write_yet = false;
conn_info(tconn, "Connection closed\n");
-@@ -5221,7 +5221,7 @@ static int tconn_finish_peer_reqs(struct drbd_tconn *tconn)
+@@ -5223,7 +5223,7 @@ static int tconn_finish_peer_reqs(struct drbd_tconn *tconn)
struct asender_cmd {
size_t pkt_size;
int (*fn)(struct drbd_tconn *tconn, struct packet_info *);
@@ -33742,28 +33765,28 @@ index 2f5fffd..b22a1ae 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 dfe7583..83768bb 100644
+index d92d50f..a7e9d97 100644
--- a/drivers/block/loop.c
+++ b/drivers/block/loop.c
-@@ -231,7 +231,7 @@ static int __do_lo_send_write(struct file *file,
- mm_segment_t old_fs = get_fs();
+@@ -232,7 +232,7 @@ static int __do_lo_send_write(struct file *file,
+ file_start_write(file);
set_fs(get_ds());
- bw = file->f_op->write(file, buf, len, &pos);
+ bw = file->f_op->write(file, (const char __force_user *)buf, len, &pos);
set_fs(old_fs);
+ file_end_write(file);
if (likely(bw == len))
- return 0;
diff --git a/drivers/block/pktcdvd.c b/drivers/block/pktcdvd.c
-index 2e7de7a..ed86dc0 100644
+index f5d0ea1..c62380a 100644
--- a/drivers/block/pktcdvd.c
+++ b/drivers/block/pktcdvd.c
-@@ -83,7 +83,7 @@
-
+@@ -84,7 +84,7 @@
#define MAX_SPEED 0xffff
--#define ZONE(sector, pd) (((sector) + (pd)->offset) & ~((pd)->settings.size - 1))
-+#define ZONE(sector, pd) (((sector) + (pd)->offset) & ~((pd)->settings.size - 1UL))
+ #define ZONE(sector, pd) (((sector) + (pd)->offset) & \
+- ~(sector_t)((pd)->settings.size - 1))
++ ~(sector_t)((pd)->settings.size - 1UL))
static DEFINE_MUTEX(pktcdvd_mutex);
static struct pktcdvd_device *pkt_devs[MAX_WRITERS];
@@ -33820,7 +33843,7 @@ index 8a3aff7..d7538c2 100644
return 1;
diff --git a/drivers/cdrom/gdrom.c b/drivers/cdrom/gdrom.c
-index d59cdcb..11afddf 100644
+index 4afcb65..a68a32d 100644
--- a/drivers/cdrom/gdrom.c
+++ b/drivers/cdrom/gdrom.c
@@ -491,7 +491,6 @@ static struct cdrom_device_ops gdrom_ops = {
@@ -33889,10 +33912,10 @@ index 2e04433..771f2cc 100644
kfree(segment);
return -EFAULT;
diff --git a/drivers/char/genrtc.c b/drivers/char/genrtc.c
-index 21cb980..f15107c 100644
+index 4f94375..413694e 100644
--- a/drivers/char/genrtc.c
+++ b/drivers/char/genrtc.c
-@@ -272,6 +272,7 @@ static int gen_rtc_ioctl(struct file *file,
+@@ -273,6 +273,7 @@ static int gen_rtc_ioctl(struct file *file,
switch (cmd) {
case RTC_PLL_GET:
@@ -33927,7 +33950,7 @@ index 86fe45c..c0ea948 100644
}
diff --git a/drivers/char/ipmi/ipmi_msghandler.c b/drivers/char/ipmi/ipmi_msghandler.c
-index 053201b..8335cce 100644
+index 4445fa1..7c6de37 100644
--- a/drivers/char/ipmi/ipmi_msghandler.c
+++ b/drivers/char/ipmi/ipmi_msghandler.c
@@ -420,7 +420,7 @@ struct ipmi_smi {
@@ -33951,7 +33974,7 @@ index 053201b..8335cce 100644
static int is_lan_addr(struct ipmi_addr *addr)
{
-@@ -2884,7 +2884,7 @@ int ipmi_register_smi(struct ipmi_smi_handlers *handlers,
+@@ -2883,7 +2883,7 @@ int ipmi_register_smi(struct ipmi_smi_handlers *handlers,
INIT_LIST_HEAD(&intf->cmd_rcvrs);
init_waitqueue_head(&intf->waitq);
for (i = 0; i < IPMI_NUM_STATS; i++)
@@ -33961,7 +33984,7 @@ index 053201b..8335cce 100644
intf->proc_dir = NULL;
diff --git a/drivers/char/ipmi/ipmi_si_intf.c b/drivers/char/ipmi/ipmi_si_intf.c
-index 0ac9b45..6179fb5 100644
+index af4b23f..79806fc 100644
--- a/drivers/char/ipmi/ipmi_si_intf.c
+++ b/drivers/char/ipmi/ipmi_si_intf.c
@@ -275,7 +275,7 @@ struct smi_info {
@@ -33985,7 +34008,7 @@ index 0ac9b45..6179fb5 100644
#define SI_MAX_PARMS 4
-@@ -3254,7 +3254,7 @@ static int try_smi_init(struct smi_info *new_smi)
+@@ -3258,7 +3258,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++)
@@ -33995,7 +34018,7 @@ index 0ac9b45..6179fb5 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 2c644af..4b7aede 100644
+index 1ccbe94..6ad651a 100644
--- a/drivers/char/mem.c
+++ b/drivers/char/mem.c
@@ -18,6 +18,7 @@
@@ -34006,7 +34029,7 @@ index 2c644af..4b7aede 100644
#include <linux/ptrace.h>
#include <linux/device.h>
#include <linux/highmem.h>
-@@ -37,6 +38,10 @@
+@@ -38,6 +39,10 @@
#define DEVPORT_MINOR 4
@@ -34017,7 +34040,7 @@ index 2c644af..4b7aede 100644
static inline unsigned long size_inside_page(unsigned long start,
unsigned long size)
{
-@@ -68,9 +73,13 @@ static inline int range_is_allowed(unsigned long pfn, unsigned long size)
+@@ -69,9 +74,13 @@ static inline int range_is_allowed(unsigned long pfn, unsigned long size)
while (cursor < to) {
if (!devmem_is_allowed(pfn)) {
@@ -34031,7 +34054,7 @@ index 2c644af..4b7aede 100644
return 0;
}
cursor += PAGE_SIZE;
-@@ -78,6 +87,11 @@ static inline int range_is_allowed(unsigned long pfn, unsigned long size)
+@@ -79,6 +88,11 @@ static inline int range_is_allowed(unsigned long pfn, unsigned long size)
}
return 1;
}
@@ -34043,7 +34066,7 @@ index 2c644af..4b7aede 100644
#else
static inline int range_is_allowed(unsigned long pfn, unsigned long size)
{
-@@ -120,6 +134,7 @@ static ssize_t read_mem(struct file *file, char __user *buf,
+@@ -121,6 +135,7 @@ static ssize_t read_mem(struct file *file, char __user *buf,
while (count > 0) {
unsigned long remaining;
@@ -34051,7 +34074,7 @@ index 2c644af..4b7aede 100644
sz = size_inside_page(p, count);
-@@ -135,7 +150,23 @@ static ssize_t read_mem(struct file *file, char __user *buf,
+@@ -136,7 +151,23 @@ static ssize_t read_mem(struct file *file, char __user *buf,
if (!ptr)
return -EFAULT;
@@ -34076,7 +34099,7 @@ index 2c644af..4b7aede 100644
unxlate_dev_mem_ptr(p, ptr);
if (remaining)
return -EFAULT;
-@@ -378,7 +409,7 @@ static ssize_t read_oldmem(struct file *file, char __user *buf,
+@@ -379,7 +410,7 @@ static ssize_t read_oldmem(struct file *file, char __user *buf,
else
csize = count;
@@ -34085,7 +34108,7 @@ index 2c644af..4b7aede 100644
if (rc < 0)
return rc;
buf += csize;
-@@ -398,9 +429,8 @@ static ssize_t read_kmem(struct file *file, char __user *buf,
+@@ -399,9 +430,8 @@ static ssize_t read_kmem(struct file *file, char __user *buf,
size_t count, loff_t *ppos)
{
unsigned long p = *ppos;
@@ -34096,7 +34119,7 @@ index 2c644af..4b7aede 100644
read = 0;
if (p < (unsigned long) high_memory) {
-@@ -422,6 +452,8 @@ static ssize_t read_kmem(struct file *file, char __user *buf,
+@@ -423,6 +453,8 @@ static ssize_t read_kmem(struct file *file, char __user *buf,
}
#endif
while (low_count > 0) {
@@ -34105,7 +34128,7 @@ index 2c644af..4b7aede 100644
sz = size_inside_page(p, low_count);
/*
-@@ -431,7 +463,22 @@ static ssize_t read_kmem(struct file *file, char __user *buf,
+@@ -432,7 +464,22 @@ static ssize_t read_kmem(struct file *file, char __user *buf,
*/
kbuf = xlate_dev_kmem_ptr((char *)p);
@@ -34129,7 +34152,7 @@ index 2c644af..4b7aede 100644
return -EFAULT;
buf += sz;
p += sz;
-@@ -833,6 +880,9 @@ static const struct memdev {
+@@ -869,6 +916,9 @@ static const struct memdev {
#ifdef CONFIG_CRASH_DUMP
[12] = { "oldmem", 0, &oldmem_fops, NULL },
#endif
@@ -34139,7 +34162,7 @@ index 2c644af..4b7aede 100644
};
static int memory_open(struct inode *inode, struct file *filp)
-@@ -904,7 +954,7 @@ static int __init chr_dev_init(void)
+@@ -940,7 +990,7 @@ static int __init chr_dev_init(void)
continue;
device_create(mem_class, NULL, MKDEV(MEM_MAJOR, minor),
@@ -34149,7 +34172,7 @@ index 2c644af..4b7aede 100644
return tty_init();
diff --git a/drivers/char/mwave/tp3780i.c b/drivers/char/mwave/tp3780i.c
-index c689697..04e6d6a 100644
+index c689697..04e6d6a2 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
@@ -34249,7 +34272,7 @@ index 5c5cc00..ac9edb7 100644
if (cmd != SIOCWANDEV)
diff --git a/drivers/char/random.c b/drivers/char/random.c
-index eccd7cc..98038d5 100644
+index 35487e8..dac8bd1 100644
--- a/drivers/char/random.c
+++ b/drivers/char/random.c
@@ -272,8 +272,13 @@
@@ -34415,7 +34438,7 @@ index 84ddc55..1d32f1e 100644
return 0;
}
diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c
-index ce5f3fc..e2d3e55 100644
+index 1b456fe..2510242 100644
--- a/drivers/char/virtio_console.c
+++ b/drivers/char/virtio_console.c
@@ -679,7 +679,7 @@ static ssize_t fill_readbuf(struct port *port, char *out_buf, size_t out_count,
@@ -34436,11 +34459,49 @@ index ce5f3fc..e2d3e55 100644
}
static int wait_port_writable(struct port *port, bool nonblock)
+diff --git a/drivers/clk/clk-composite.c b/drivers/clk/clk-composite.c
+index a33f46f..a720eed 100644
+--- a/drivers/clk/clk-composite.c
++++ b/drivers/clk/clk-composite.c
+@@ -122,7 +122,7 @@ struct clk *clk_register_composite(struct device *dev, const char *name,
+ struct clk *clk;
+ struct clk_init_data init;
+ struct clk_composite *composite;
+- struct clk_ops *clk_composite_ops;
++ clk_ops_no_const *clk_composite_ops;
+
+ 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
+--- a/drivers/clk/socfpga/clk.c
++++ b/drivers/clk/socfpga/clk.c
+@@ -22,6 +22,7 @@
+ #include <linux/clk-provider.h>
+ #include <linux/io.h>
+ #include <linux/of.h>
++#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")) {
+ 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;
++ pax_open_kernel();
++ *(void **)&clk_pll_ops.enable = clk_gate_ops.enable;
++ *(void **)&clk_pll_ops.disable = clk_gate_ops.disable;
++ pax_close_kernel();
+ }
+
+ 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 d7ad425..3e3f81f 100644
+index a2b2541..bc1e7ff 100644
--- a/drivers/clocksource/arm_arch_timer.c
+++ b/drivers/clocksource/arm_arch_timer.c
-@@ -262,7 +262,7 @@ static int __cpuinit arch_timer_cpu_notify(struct notifier_block *self,
+@@ -264,7 +264,7 @@ static int __cpuinit arch_timer_cpu_notify(struct notifier_block *self,
return NOTIFY_OK;
}
@@ -34463,7 +34524,7 @@ index ade7513..069445f 100644
};
diff --git a/drivers/cpufreq/acpi-cpufreq.c b/drivers/cpufreq/acpi-cpufreq.c
-index bb5939b..d9accb7 100644
+index edc089e..bc7c0bc 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,
@@ -34475,7 +34536,7 @@ index bb5939b..d9accb7 100644
show_global_boost,
store_global_boost);
-@@ -712,8 +712,11 @@ static int acpi_cpufreq_cpu_init(struct cpufreq_policy *policy)
+@@ -705,8 +705,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;
@@ -34489,7 +34550,7 @@ index bb5939b..d9accb7 100644
result = acpi_processor_register_performance(data->acpi_data, cpu);
if (result)
-@@ -839,7 +842,9 @@ static int acpi_cpufreq_cpu_init(struct cpufreq_policy *policy)
+@@ -832,7 +835,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:
@@ -34500,7 +34561,7 @@ index bb5939b..d9accb7 100644
policy->cur = get_cur_freq_on_cpu(cpu);
break;
default:
-@@ -850,8 +855,11 @@ static int acpi_cpufreq_cpu_init(struct cpufreq_policy *policy)
+@@ -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 */
@@ -34515,10 +34576,10 @@ index bb5939b..d9accb7 100644
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 b02824d..51e44aa 100644
+index 178fe7a..5ee8501 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
-@@ -1813,7 +1813,7 @@ static int __cpuinit cpufreq_cpu_callback(struct notifier_block *nfb,
+@@ -1853,7 +1853,7 @@ static int __cpuinit cpufreq_cpu_callback(struct notifier_block *nfb,
return NOTIFY_OK;
}
@@ -34527,7 +34588,7 @@ index b02824d..51e44aa 100644
.notifier_call = cpufreq_cpu_callback,
};
-@@ -1845,8 +1845,11 @@ int cpufreq_register_driver(struct cpufreq_driver *driver_data)
+@@ -1885,8 +1885,11 @@ int cpufreq_register_driver(struct cpufreq_driver *driver_data)
pr_debug("trying to register driver %s\n", driver_data->name);
@@ -34539,36 +34600,77 @@ index b02824d..51e44aa 100644
+ pax_close_kernel();
+ }
- spin_lock_irqsave(&cpufreq_driver_lock, flags);
+ 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 5a76086..0f4d394 100644
+index 5af40ad..ddf907b 100644
--- a/drivers/cpufreq/cpufreq_governor.c
+++ b/drivers/cpufreq/cpufreq_governor.c
-@@ -201,8 +201,8 @@ int cpufreq_governor_dbs(struct dbs_data *dbs_data,
- {
+@@ -235,7 +235,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;
-- struct cs_ops *cs_ops = NULL;
- struct od_ops *od_ops = NULL;
-+ const struct cs_ops *cs_ops = NULL;
+ const struct od_ops *od_ops = NULL;
- struct od_dbs_tuners *od_tuners = dbs_data->tuners;
- struct cs_dbs_tuners *cs_tuners = dbs_data->tuners;
+ 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,
+
+ if ((cdata->governor == GOV_CONSERVATIVE) &&
+ (!policy->governor->initialized)) {
+- struct cs_ops *cs_ops = dbs_data->cdata->gov_ops;
++ const struct cs_ops *cs_ops = dbs_data->cdata->gov_ops;
+
+ cpufreq_register_notifier(cs_ops->notifier_block,
+ CPUFREQ_TRANSITION_NOTIFIER);
+@@ -315,7 +315,7 @@ int cpufreq_governor_dbs(struct cpufreq_policy *policy,
+
+ if ((dbs_data->cdata->governor == GOV_CONSERVATIVE) &&
+ (policy->governor->initialized == 1)) {
+- struct cs_ops *cs_ops = dbs_data->cdata->gov_ops;
++ const struct cs_ops *cs_ops = dbs_data->cdata->gov_ops;
+
+ 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 cc4bd2f..ad142bc 100644
+index e16a961..0e68927 100644
--- a/drivers/cpufreq/cpufreq_governor.h
+++ b/drivers/cpufreq/cpufreq_governor.h
-@@ -142,7 +142,7 @@ struct dbs_data {
- void (*gov_check_cpu)(int cpu, unsigned int load);
+@@ -204,7 +204,7 @@ struct common_dbs_data {
+ void (*exit)(struct dbs_data *dbs_data);
/* Governor specific ops, see below */
- void *gov_ops;
+ const void *gov_ops;
};
- /* Governor specific ops, will be passed to dbs_data->gov_ops */
+ /* Governer Per policy data */
+diff --git a/drivers/cpufreq/cpufreq_ondemand.c b/drivers/cpufreq/cpufreq_ondemand.c
+index 93eb5cb..f8ab572 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)
+ (struct cpufreq_policy *, unsigned int, unsigned int),
+ unsigned int powersave_bias)
+ {
+- od_ops.powersave_bias_target = f;
++ pax_open_kernel();
++ *(void **)&od_ops.powersave_bias_target = f;
++ pax_close_kernel();
+ od_set_powersave_bias(powersave_bias);
+ }
+ EXPORT_SYMBOL_GPL(od_register_powersave_bias_handler);
+
+ void od_unregister_powersave_bias_handler(void)
+ {
+- od_ops.powersave_bias_target = generic_powersave_bias_target;
++ pax_open_kernel();
++ *(void **)&od_ops.powersave_bias_target = generic_powersave_bias_target;
++ pax_close_kernel();
+ od_set_powersave_bias(0);
+ }
+ 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
--- a/drivers/cpufreq/cpufreq_stats.c
@@ -34583,10 +34685,10 @@ index bfd6273..e39dd63 100644
.priority = 1,
};
diff --git a/drivers/cpufreq/p4-clockmod.c b/drivers/cpufreq/p4-clockmod.c
-index 827629c9..0bc6a03 100644
+index 421ef37..e708530c 100644
--- a/drivers/cpufreq/p4-clockmod.c
+++ b/drivers/cpufreq/p4-clockmod.c
-@@ -167,10 +167,14 @@ static unsigned int cpufreq_p4_get_frequency(struct cpuinfo_x86 *c)
+@@ -160,10 +160,14 @@ static unsigned int cpufreq_p4_get_frequency(struct cpuinfo_x86 *c)
case 0x0F: /* Core Duo */
case 0x16: /* Celeron Core */
case 0x1C: /* Atom */
@@ -34603,7 +34705,7 @@ index 827629c9..0bc6a03 100644
/* fall through */
case 0x09: /* Pentium M (Banias) */
return speedstep_get_frequency(SPEEDSTEP_CPU_PM);
-@@ -182,7 +186,9 @@ static unsigned int cpufreq_p4_get_frequency(struct cpuinfo_x86 *c)
+@@ -175,7 +179,9 @@ static unsigned int cpufreq_p4_get_frequency(struct cpuinfo_x86 *c)
/* on P-4s, the TSC runs with constant frequency independent whether
* throttling is active or not. */
@@ -34614,8 +34716,117 @@ index 827629c9..0bc6a03 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
+--- a/drivers/cpufreq/sparc-us3-cpufreq.c
++++ b/drivers/cpufreq/sparc-us3-cpufreq.c
+@@ -18,14 +18,12 @@
+ #include <asm/head.h>
+ #include <asm/timer.h>
+
+-static struct cpufreq_driver *cpufreq_us3_driver;
+-
+ struct us3_freq_percpu_info {
+ struct cpufreq_frequency_table table[4];
+ };
+
+ /* Indexed by cpu number. */
+-static struct us3_freq_percpu_info *us3_freq_table;
++static struct us3_freq_percpu_info us3_freq_table[NR_CPUS];
+
+ /* UltraSPARC-III has three dividers: 1, 2, and 32. These are controlled
+ * in the Safari config register.
+@@ -186,12 +184,25 @@ static int __init us3_freq_cpu_init(struct cpufreq_policy *policy)
+
+ static int us3_freq_cpu_exit(struct cpufreq_policy *policy)
+ {
+- if (cpufreq_us3_driver)
+- us3_set_cpu_divider_index(policy, 0);
++ us3_set_cpu_divider_index(policy->cpu, 0);
+
+ return 0;
+ }
+
++static int __init us3_freq_init(void);
++static void __exit us3_freq_exit(void);
++
++static struct cpufreq_driver cpufreq_us3_driver = {
++ .init = us3_freq_cpu_init,
++ .verify = us3_freq_verify,
++ .target = us3_freq_target,
++ .get = us3_freq_get,
++ .exit = us3_freq_cpu_exit,
++ .owner = THIS_MODULE,
++ .name = "UltraSPARC-III",
++
++};
++
+ static int __init us3_freq_init(void)
+ {
+ unsigned long manuf, impl, ver;
+@@ -208,57 +219,15 @@ static int __init us3_freq_init(void)
+ (impl == CHEETAH_IMPL ||
+ impl == CHEETAH_PLUS_IMPL ||
+ impl == JAGUAR_IMPL ||
+- impl == PANTHER_IMPL)) {
+- struct cpufreq_driver *driver;
+-
+- ret = -ENOMEM;
+- driver = kzalloc(sizeof(struct cpufreq_driver), GFP_KERNEL);
+- if (!driver)
+- goto err_out;
+-
+- us3_freq_table = kzalloc(
+- (NR_CPUS * sizeof(struct us3_freq_percpu_info)),
+- GFP_KERNEL);
+- if (!us3_freq_table)
+- goto err_out;
+-
+- driver->init = us3_freq_cpu_init;
+- driver->verify = us3_freq_verify;
+- 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;
+- ret = cpufreq_register_driver(driver);
+- if (ret)
+- goto err_out;
+-
+- return 0;
+-
+-err_out:
+- if (driver) {
+- kfree(driver);
+- cpufreq_us3_driver = NULL;
+- }
+- kfree(us3_freq_table);
+- us3_freq_table = NULL;
+- return ret;
+- }
++ impl == PANTHER_IMPL))
++ return cpufreq_register_driver(&cpufreq_us3_driver);
+
+ return -ENODEV;
+ }
+
+ static void __exit us3_freq_exit(void)
+ {
+- if (cpufreq_us3_driver) {
+- cpufreq_unregister_driver(cpufreq_us3_driver);
+- kfree(cpufreq_us3_driver);
+- cpufreq_us3_driver = NULL;
+- kfree(us3_freq_table);
+- us3_freq_table = NULL;
+- }
++ cpufreq_unregister_driver(&cpufreq_us3_driver);
+ }
+
+ MODULE_AUTHOR("David S. Miller <davem@redhat.com>");
diff --git a/drivers/cpufreq/speedstep-centrino.c b/drivers/cpufreq/speedstep-centrino.c
-index 3a953d5..f5993f6 100644
+index 618e6f4..e89d915 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)
@@ -34633,10 +34844,10 @@ index 3a953d5..f5993f6 100644
if (policy->cpu != 0)
return -ENODEV;
diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c
-index eba6929..0f53baf 100644
+index c3a93fe..e808f24 100644
--- a/drivers/cpuidle/cpuidle.c
+++ b/drivers/cpuidle/cpuidle.c
-@@ -277,7 +277,7 @@ static int poll_idle(struct cpuidle_device *dev,
+@@ -254,7 +254,7 @@ static int poll_idle(struct cpuidle_device *dev,
static void poll_idle_init(struct cpuidle_driver *drv)
{
@@ -34724,45 +34935,11 @@ index b70709b..1d8d02a 100644
.notifier_call = sh_dmae_nmi_handler,
/* Run before NMI debug handler and KGDB */
-diff --git a/drivers/edac/edac_mc.c b/drivers/edac/edac_mc.c
-index 27e86d9..89e1090 100644
---- a/drivers/edac/edac_mc.c
-+++ b/drivers/edac/edac_mc.c
-@@ -48,6 +48,8 @@ static LIST_HEAD(mc_devices);
- */
- static void const *edac_mc_owner;
-
-+static struct bus_type mc_bus[EDAC_MAX_MCS];
-+
- unsigned edac_dimm_info_location(struct dimm_info *dimm, char *buf,
- unsigned len)
- {
-@@ -723,6 +725,11 @@ int edac_mc_add_mc(struct mem_ctl_info *mci)
- int ret = -EINVAL;
- edac_dbg(0, "\n");
-
-+ if (mci->mc_idx >= EDAC_MAX_MCS) {
-+ pr_warn_once("Too many memory controllers: %d\n", mci->mc_idx);
-+ return -ENODEV;
-+ }
-+
- #ifdef CONFIG_EDAC_DEBUG
- if (edac_debug_level >= 3)
- edac_mc_dump_mci(mci);
-@@ -762,6 +769,8 @@ int edac_mc_add_mc(struct mem_ctl_info *mci)
- /* set load time so that error rate can be tracked */
- mci->start_time = jiffies;
-
-+ mci->bus = &mc_bus[mci->mc_idx];
-+
- if (edac_create_sysfs_mci_device(mci)) {
- edac_mc_printk(mci, KERN_WARNING,
- "failed to create sysfs device\n");
diff --git a/drivers/edac/edac_mc_sysfs.c b/drivers/edac/edac_mc_sysfs.c
-index 769d92e..8baa11a 100644
+index c4d700a..0b57abd 100644
--- a/drivers/edac/edac_mc_sysfs.c
+++ b/drivers/edac/edac_mc_sysfs.c
-@@ -148,7 +148,7 @@ static const char *edac_caps[] = {
+@@ -148,7 +148,7 @@ static const char * const edac_caps[] = {
struct dev_ch_attribute {
struct device_attribute attr;
int channel;
@@ -34771,60 +34948,7 @@ index 769d92e..8baa11a 100644
#define DEVICE_CHANNEL(_name, _mode, _show, _store, _var) \
struct dev_ch_attribute dev_attr_legacy_##_name = \
-@@ -370,7 +370,7 @@ static int edac_create_csrow_object(struct mem_ctl_info *mci,
- return -ENODEV;
-
- csrow->dev.type = &csrow_attr_type;
-- csrow->dev.bus = &mci->bus;
-+ csrow->dev.bus = mci->bus;
- device_initialize(&csrow->dev);
- csrow->dev.parent = &mci->dev;
- csrow->mci = mci;
-@@ -605,7 +605,7 @@ static int edac_create_dimm_object(struct mem_ctl_info *mci,
- dimm->mci = mci;
-
- dimm->dev.type = &dimm_attr_type;
-- dimm->dev.bus = &mci->bus;
-+ dimm->dev.bus = mci->bus;
- device_initialize(&dimm->dev);
-
- dimm->dev.parent = &mci->dev;
-@@ -975,11 +975,13 @@ int edac_create_sysfs_mci_device(struct mem_ctl_info *mci)
- * The memory controller needs its own bus, in order to avoid
- * namespace conflicts at /sys/bus/edac.
- */
-- mci->bus.name = kasprintf(GFP_KERNEL, "mc%d", mci->mc_idx);
-- if (!mci->bus.name)
-+ mci->bus->name = kasprintf(GFP_KERNEL, "mc%d", mci->mc_idx);
-+ if (!mci->bus->name)
- return -ENOMEM;
-- edac_dbg(0, "creating bus %s\n", mci->bus.name);
-- err = bus_register(&mci->bus);
-+
-+ edac_dbg(0, "creating bus %s\n", mci->bus->name);
-+
-+ err = bus_register(mci->bus);
- if (err < 0)
- return err;
-
-@@ -988,7 +990,7 @@ int edac_create_sysfs_mci_device(struct mem_ctl_info *mci)
- device_initialize(&mci->dev);
-
- mci->dev.parent = mci_pdev;
-- mci->dev.bus = &mci->bus;
-+ mci->dev.bus = mci->bus;
- dev_set_name(&mci->dev, "mc%d", mci->mc_idx);
- dev_set_drvdata(&mci->dev, mci);
- pm_runtime_forbid(&mci->dev);
-@@ -997,20 +999,22 @@ int edac_create_sysfs_mci_device(struct mem_ctl_info *mci)
- err = device_add(&mci->dev);
- if (err < 0) {
- edac_dbg(1, "failure: create device %s\n", dev_name(&mci->dev));
-- bus_unregister(&mci->bus);
-- kfree(mci->bus.name);
-+ bus_unregister(mci->bus);
-+ kfree(mci->bus->name);
- return err;
+@@ -1005,14 +1005,16 @@ int edac_create_sysfs_mci_device(struct mem_ctl_info *mci)
}
if (mci->set_sdram_scrub_rate || mci->get_sdram_scrub_rate) {
@@ -34845,28 +34969,6 @@ index 769d92e..8baa11a 100644
err = device_create_file(&mci->dev,
&dev_attr_sdram_scrub_rate);
if (err) {
-@@ -1064,8 +1068,8 @@ fail:
- }
- fail2:
- device_unregister(&mci->dev);
-- bus_unregister(&mci->bus);
-- kfree(mci->bus.name);
-+ bus_unregister(mci->bus);
-+ kfree(mci->bus->name);
- return err;
- }
-
-@@ -1098,8 +1102,8 @@ void edac_unregister_sysfs(struct mem_ctl_info *mci)
- {
- edac_dbg(1, "Unregistering device %s\n", dev_name(&mci->dev));
- device_unregister(&mci->dev);
-- bus_unregister(&mci->bus);
-- kfree(mci->bus.name);
-+ bus_unregister(mci->bus);
-+ kfree(mci->bus->name);
- }
-
- static void mc_attr_release(struct device *dev)
diff --git a/drivers/edac/edac_pci_sysfs.c b/drivers/edac/edac_pci_sysfs.c
index e8658e4..22746d6 100644
--- a/drivers/edac/edac_pci_sysfs.c
@@ -34963,19 +35065,6 @@ index e8658e4..22746d6 100644
panic("EDAC: PCI Parity Error");
}
}
-diff --git a/drivers/edac/i5100_edac.c b/drivers/edac/i5100_edac.c
-index 1b63517..157b934 100644
---- a/drivers/edac/i5100_edac.c
-+++ b/drivers/edac/i5100_edac.c
-@@ -974,7 +974,7 @@ static int i5100_setup_debugfs(struct mem_ctl_info *mci)
- if (!i5100_debugfs)
- return -ENODEV;
-
-- priv->debugfs = debugfs_create_dir(mci->bus.name, i5100_debugfs);
-+ priv->debugfs = debugfs_create_dir(mci->bus->name, i5100_debugfs);
-
- if (!priv->debugfs)
- return -ENOMEM;
diff --git a/drivers/edac/mce_amd.h b/drivers/edac/mce_amd.h
index 51b7e3a..aa8a3e8 100644
--- a/drivers/edac/mce_amd.h
@@ -35002,22 +35091,8 @@ index 57ea7f4..789e3c3 100644
card->driver->update_phy_reg(card, 4,
PHY_LINK_ACTIVE | PHY_CONTENDER, 0);
-diff --git a/drivers/firewire/core-cdev.c b/drivers/firewire/core-cdev.c
-index 27ac423..13573e8 100644
---- a/drivers/firewire/core-cdev.c
-+++ b/drivers/firewire/core-cdev.c
-@@ -1366,8 +1366,7 @@ static int init_iso_resource(struct client *client,
- int ret;
-
- if ((request->channels == 0 && request->bandwidth == 0) ||
-- request->bandwidth > BANDWIDTH_AVAILABLE_INITIAL ||
-- request->bandwidth < 0)
-+ request->bandwidth > BANDWIDTH_AVAILABLE_INITIAL)
- return -EINVAL;
-
- r = kmalloc(sizeof(*r), GFP_KERNEL);
diff --git a/drivers/firewire/core-device.c b/drivers/firewire/core-device.c
-index 03ce7d9..b70f5da 100644
+index 664a6ff..af13580 100644
--- a/drivers/firewire/core-device.c
+++ b/drivers/firewire/core-device.c
@@ -232,7 +232,7 @@ EXPORT_SYMBOL(fw_device_enable_phys_dma);
@@ -35067,10 +35142,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 4cd392d..4b629e1 100644
+index b95159b..841ae55 100644
--- a/drivers/firmware/dmi_scan.c
+++ b/drivers/firmware/dmi_scan.c
-@@ -490,11 +490,6 @@ void __init dmi_scan_machine(void)
+@@ -497,11 +497,6 @@ void __init dmi_scan_machine(void)
}
}
else {
@@ -35082,7 +35157,7 @@ index 4cd392d..4b629e1 100644
p = dmi_ioremap(0xF0000, 0x10000);
if (p == NULL)
goto error;
-@@ -769,7 +764,7 @@ int dmi_walk(void (*decode)(const struct dmi_header *, void *),
+@@ -786,7 +781,7 @@ int dmi_walk(void (*decode)(const struct dmi_header *, void *),
if (buf == NULL)
return -1;
@@ -35091,22 +35166,39 @@ index 4cd392d..4b629e1 100644
iounmap(buf);
return 0;
-diff --git a/drivers/firmware/efivars.c b/drivers/firmware/efivars.c
-index f4baa11..7970c3a 100644
---- a/drivers/firmware/efivars.c
-+++ b/drivers/firmware/efivars.c
-@@ -139,7 +139,7 @@ struct efivar_attribute {
+diff --git a/drivers/firmware/efi/efi.c b/drivers/firmware/efi/efi.c
+index 5145fa3..0d3babd 100644
+--- a/drivers/firmware/efi/efi.c
++++ b/drivers/firmware/efi/efi.c
+@@ -65,14 +65,16 @@ static struct attribute_group efi_subsys_attr_group = {
};
- static struct efivars __efivars;
--static struct efivar_operations ops;
-+static efivar_operations_no_const ops __read_only;
+ static struct efivars generic_efivars;
+-static struct efivar_operations generic_ops;
++static efivar_operations_no_const generic_ops __read_only;
+
+ static int generic_ops_register(void)
+ {
+- generic_ops.get_variable = efi.get_variable;
+- generic_ops.set_variable = efi.set_variable;
+- generic_ops.get_next_variable = efi.get_next_variable;
+- generic_ops.query_variable_store = efi_query_variable_store;
++ pax_open_kernel();
++ *(void **)&generic_ops.get_variable = efi.get_variable;
++ *(void **)&generic_ops.set_variable = efi.set_variable;
++ *(void **)&generic_ops.get_next_variable = efi.get_next_variable;
++ *(void **)&generic_ops.query_variable_store = efi_query_variable_store;
++ pax_close_kernel();
- #define PSTORE_EFI_ATTRIBUTES \
- (EFI_VARIABLE_NON_VOLATILE | \
-@@ -1844,7 +1844,7 @@ efivar_create_sysfs_entry(struct efivars *efivars,
+ 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
+--- 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)
static int
- create_efivars_bin_attributes(struct efivars *efivars)
+ create_efivars_bin_attributes(void)
{
- struct bin_attribute *attr;
+ bin_attribute_no_const *attr;
@@ -35129,7 +35221,7 @@ 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 de3c317..b7cd029 100644
+index e16d932..f0206ef 100644
--- a/drivers/gpio/gpio-ich.c
+++ b/drivers/gpio/gpio-ich.c
@@ -69,7 +69,7 @@ struct ichx_desc {
@@ -35155,10 +35247,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 7b2d378..cc947ea 100644
+index ed1334e..ee0dd42 100644
--- a/drivers/gpu/drm/drm_crtc_helper.c
+++ b/drivers/gpu/drm/drm_crtc_helper.c
-@@ -319,7 +319,7 @@ static bool drm_encoder_crtc_ok(struct drm_encoder *encoder,
+@@ -321,7 +321,7 @@ static bool drm_encoder_crtc_ok(struct drm_encoder *encoder,
struct drm_crtc *tmp;
int crtc_mask = 1;
@@ -35168,7 +35260,7 @@ index 7b2d378..cc947ea 100644
dev = crtc->dev;
diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
-index 25f91cd..a376f55 100644
+index 9cc247f..36aa285 100644
--- a/drivers/gpu/drm/drm_drv.c
+++ b/drivers/gpu/drm/drm_drv.c
@@ -306,7 +306,7 @@ module_exit(drm_core_exit);
@@ -35183,7 +35275,7 @@ index 25f91cd..a376f55 100644
@@ -376,7 +376,7 @@ long drm_ioctl(struct file *filp,
struct drm_file *file_priv = filp->private_data;
struct drm_device *dev;
- struct drm_ioctl_desc *ioctl;
+ const struct drm_ioctl_desc *ioctl = NULL;
- drm_ioctl_t *func;
+ drm_ioctl_no_const_t func;
unsigned int nr = DRM_IOCTL_NR(cmd);
@@ -35197,29 +35289,7 @@ index 25f91cd..a376f55 100644
+ atomic_inc_unchecked(&dev->counts[_DRM_STAT_IOCTLS]);
++file_priv->ioctl_count;
- DRM_DEBUG("pid=%d, cmd=0x%02x, nr=0x%02x, dev 0x%lx, auth=%d\n",
-diff --git a/drivers/gpu/drm/drm_encoder_slave.c b/drivers/gpu/drm/drm_encoder_slave.c
-index 48c52f7..0cfb60f 100644
---- a/drivers/gpu/drm/drm_encoder_slave.c
-+++ b/drivers/gpu/drm/drm_encoder_slave.c
-@@ -54,16 +54,12 @@ int drm_i2c_encoder_init(struct drm_device *dev,
- struct i2c_adapter *adap,
- const struct i2c_board_info *info)
- {
-- char modalias[sizeof(I2C_MODULE_PREFIX)
-- + I2C_NAME_SIZE];
- struct module *module = NULL;
- struct i2c_client *client;
- struct drm_i2c_encoder_driver *encoder_drv;
- int err = 0;
-
-- snprintf(modalias, sizeof(modalias),
-- "%s%s", I2C_MODULE_PREFIX, info->type);
-- request_module(modalias);
-+ request_module("%s%s", I2C_MODULE_PREFIX, info->type);
-
- client = i2c_new_device(adap, info);
- if (!client) {
+ 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
--- a/drivers/gpu/drm/drm_fops.c
@@ -35486,7 +35556,7 @@ 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 7d30802..42c6cbb 100644
+index 16f3ec5..b28f9ca 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)
@@ -35553,7 +35623,7 @@ 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 7299ea4..5314487 100644
+index e913d32..4d9b351 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)
@@ -35566,7 +35636,7 @@ index 7299ea4..5314487 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 4fa6beb..f930fec 100644
+index 3b315ba..aac280f 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)
@@ -35579,10 +35649,10 @@ index 4fa6beb..f930fec 100644
return can_switch;
}
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
-index ef99b1c..09ce7fb 100644
+index 9669a0b..bb65176 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
-@@ -893,7 +893,7 @@ typedef struct drm_i915_private {
+@@ -915,7 +915,7 @@ typedef struct drm_i915_private {
drm_dma_handle_t *status_page_dmah;
struct resource mch_res;
@@ -35591,7 +35661,7 @@ index ef99b1c..09ce7fb 100644
/* protects the irq masks */
spinlock_t irq_lock;
-@@ -1775,7 +1775,7 @@ extern struct i2c_adapter *intel_gmbus_get_adapter(
+@@ -1811,7 +1811,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);
@@ -35601,10 +35671,10 @@ index ef99b1c..09ce7fb 100644
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 9a48e1a..f0cbc3e 100644
+index 117ce38..eefd237 100644
--- a/drivers/gpu/drm/i915/i915_gem_execbuffer.c
+++ b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
-@@ -729,9 +729,9 @@ i915_gem_check_execbuffer(struct drm_i915_gem_execbuffer2 *exec)
+@@ -727,9 +727,9 @@ i915_gem_check_execbuffer(struct drm_i915_gem_execbuffer2 *exec)
static int
validate_exec_list(struct drm_i915_gem_exec_object2 *exec,
@@ -35616,15 +35686,6 @@ index 9a48e1a..f0cbc3e 100644
int relocs_total = 0;
int relocs_max = INT_MAX / sizeof(struct drm_i915_gem_relocation_entry);
-@@ -1195,7 +1195,7 @@ i915_gem_execbuffer2(struct drm_device *dev, void *data,
- return -ENOMEM;
- }
- ret = copy_from_user(exec2_list,
-- (struct drm_i915_relocation_entry __user *)
-+ (struct drm_i915_gem_exec_object2 __user *)
- (uintptr_t) args->buffers_ptr,
- sizeof(*exec2_list) * args->buffer_count);
- if (ret != 0) {
diff --git a/drivers/gpu/drm/i915/i915_ioc32.c b/drivers/gpu/drm/i915/i915_ioc32.c
index 3c59584..500f2e9 100644
--- a/drivers/gpu/drm/i915/i915_ioc32.c
@@ -35661,10 +35722,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 3c7bb04..182e049 100644
+index e5e32869..1678f36 100644
--- a/drivers/gpu/drm/i915/i915_irq.c
+++ b/drivers/gpu/drm/i915/i915_irq.c
-@@ -549,7 +549,7 @@ static irqreturn_t valleyview_irq_handler(int irq, void *arg)
+@@ -670,7 +670,7 @@ static irqreturn_t valleyview_irq_handler(int irq, void *arg)
int pipe;
u32 pipe_stats[I915_MAX_PIPES];
@@ -35673,7 +35734,7 @@ index 3c7bb04..182e049 100644
while (true) {
iir = I915_READ(VLV_IIR);
-@@ -705,7 +705,7 @@ static irqreturn_t ivybridge_irq_handler(int irq, void *arg)
+@@ -835,7 +835,7 @@ static irqreturn_t ivybridge_irq_handler(int irq, void *arg)
irqreturn_t ret = IRQ_NONE;
int i;
@@ -35682,7 +35743,7 @@ index 3c7bb04..182e049 100644
/* disable master interrupt before clearing iir */
de_ier = I915_READ(DEIER);
-@@ -791,7 +791,7 @@ static irqreturn_t ironlake_irq_handler(int irq, void *arg)
+@@ -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;
@@ -35691,7 +35752,7 @@ index 3c7bb04..182e049 100644
/* disable master interrupt before clearing iir */
de_ier = I915_READ(DEIER);
-@@ -1886,7 +1886,7 @@ static void ironlake_irq_preinstall(struct drm_device *dev)
+@@ -2089,7 +2089,7 @@ static void ironlake_irq_preinstall(struct drm_device *dev)
{
drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private;
@@ -35700,7 +35761,7 @@ index 3c7bb04..182e049 100644
I915_WRITE(HWSTAM, 0xeffe);
-@@ -1912,7 +1912,7 @@ static void valleyview_irq_preinstall(struct drm_device *dev)
+@@ -2124,7 +2124,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;
@@ -35709,7 +35770,7 @@ index 3c7bb04..182e049 100644
/* VLV magic */
I915_WRITE(VLV_IMR, 0);
-@@ -2208,7 +2208,7 @@ static void i8xx_irq_preinstall(struct drm_device * dev)
+@@ -2411,7 +2411,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;
@@ -35718,7 +35779,7 @@ index 3c7bb04..182e049 100644
for_each_pipe(pipe)
I915_WRITE(PIPESTAT(pipe), 0);
-@@ -2259,7 +2259,7 @@ static irqreturn_t i8xx_irq_handler(int irq, void *arg)
+@@ -2490,7 +2490,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;
@@ -35727,7 +35788,7 @@ index 3c7bb04..182e049 100644
iir = I915_READ16(IIR);
if (iir == 0)
-@@ -2344,7 +2344,7 @@ static void i915_irq_preinstall(struct drm_device * dev)
+@@ -2565,7 +2565,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;
@@ -35736,8 +35797,8 @@ index 3c7bb04..182e049 100644
if (I915_HAS_HOTPLUG(dev)) {
I915_WRITE(PORT_HOTPLUG_EN, 0);
-@@ -2448,7 +2448,7 @@ static irqreturn_t i915_irq_handler(int irq, void *arg)
- };
+@@ -2664,7 +2664,7 @@ static irqreturn_t i915_irq_handler(int irq, void *arg)
+ I915_DISPLAY_PLANE_B_FLIP_PENDING_INTERRUPT;
int pipe, ret = IRQ_NONE;
- atomic_inc(&dev_priv->irq_received);
@@ -35745,7 +35806,7 @@ index 3c7bb04..182e049 100644
iir = I915_READ(IIR);
do {
-@@ -2574,7 +2574,7 @@ static void i965_irq_preinstall(struct drm_device * dev)
+@@ -2791,7 +2791,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;
@@ -35754,9 +35815,9 @@ index 3c7bb04..182e049 100644
I915_WRITE(PORT_HOTPLUG_EN, 0);
I915_WRITE(PORT_HOTPLUG_STAT, I915_READ(PORT_HOTPLUG_STAT));
-@@ -2690,7 +2690,7 @@ static irqreturn_t i965_irq_handler(int irq, void *arg)
- int irq_received;
- int ret = IRQ_NONE, pipe;
+@@ -2898,7 +2898,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;
- atomic_inc(&dev_priv->irq_received);
+ atomic_inc_unchecked(&dev_priv->irq_received);
@@ -35764,10 +35825,10 @@ index 3c7bb04..182e049 100644
iir = I915_READ(IIR);
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
-index 2ab65b4..acbd821 100644
+index 56746dc..b5a214f 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
-@@ -8742,13 +8742,13 @@ struct intel_quirk {
+@@ -8919,13 +8919,13 @@ struct intel_quirk {
int subsystem_vendor;
int subsystem_device;
void (*hook)(struct drm_device *dev);
@@ -35783,7 +35844,7 @@ index 2ab65b4..acbd821 100644
static int intel_dmi_reverse_brightness(const struct dmi_system_id *id)
{
-@@ -8756,18 +8756,20 @@ static int intel_dmi_reverse_brightness(const struct dmi_system_id *id)
+@@ -8933,18 +8933,20 @@ static int intel_dmi_reverse_brightness(const struct dmi_system_id *id)
return 1;
}
@@ -35906,7 +35967,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 50a6dd0..ea66ed8 100644
+index 6aa2137..fe8dc55 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,
@@ -35919,10 +35980,10 @@ index 50a6dd0..ea66ed8 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 9c39baf..30a22be 100644
+index f2b30f8..d0f9a95 100644
--- a/drivers/gpu/drm/nouveau/nouveau_drm.h
+++ b/drivers/gpu/drm/nouveau/nouveau_drm.h
-@@ -81,7 +81,7 @@ struct nouveau_drm {
+@@ -92,7 +92,7 @@ struct nouveau_drm {
struct drm_global_reference mem_global_ref;
struct ttm_bo_global_ref bo_global_ref;
struct ttm_bo_device bdev;
@@ -35979,6 +36040,71 @@ index 25d3495..d81aaf6 100644
spin_unlock(&dev->count_lock);
return can_switch;
}
+diff --git a/drivers/gpu/drm/qxl/qxl_ttm.c b/drivers/gpu/drm/qxl/qxl_ttm.c
+index 489cb8c..0b8d0d3 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)
+ }
+ }
+
+-static struct vm_operations_struct qxl_ttm_vm_ops;
++static vm_operations_struct_no_const qxl_ttm_vm_ops __read_only;
+ static const struct vm_operations_struct *ttm_vm_ops;
+
+ static int qxl_ttm_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
+@@ -147,8 +147,10 @@ int qxl_mmap(struct file *filp, struct vm_area_struct *vma)
+ return r;
+ if (unlikely(ttm_vm_ops == NULL)) {
+ ttm_vm_ops = vma->vm_ops;
++ pax_open_kernel();
+ qxl_ttm_vm_ops = *ttm_vm_ops;
+ qxl_ttm_vm_ops.fault = &qxl_ttm_fault;
++ pax_close_kernel();
+ }
+ 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)
+ 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");
+- else
+- sprintf(qxl_mem_types_names[i], "qxl_surf_mm");
+- qxl_mem_types_list[i].name = qxl_mem_types_names[i];
+- qxl_mem_types_list[i].show = &qxl_mm_dump_table;
+- qxl_mem_types_list[i].driver_features = 0;
+- if (i == 0)
+- 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;
++ 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
--- a/drivers/gpu/drm/r128/r128_cce.c
@@ -36109,10 +36235,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 5073665..31d15a6 100644
+index b0dc0b6..a9bfe9c 100644
--- a/drivers/gpu/drm/radeon/radeon_device.c
+++ b/drivers/gpu/drm/radeon/radeon_device.c
-@@ -976,7 +976,7 @@ static bool radeon_switcheroo_can_switch(struct pci_dev *pdev)
+@@ -1014,7 +1014,7 @@ static bool radeon_switcheroo_can_switch(struct pci_dev *pdev)
bool can_switch;
spin_lock(&dev->count_lock);
@@ -36225,7 +36351,7 @@ 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..66f6d65 100644
+index 6c0ce89..57a2529 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)
@@ -36248,59 +36374,74 @@ index 6c0ce89..66f6d65 100644
}
vma->vm_ops = &radeon_ttm_vm_ops;
return 0;
-@@ -862,28 +864,33 @@ static int radeon_ttm_debugfs_init(struct radeon_device *rdev)
- sprintf(radeon_mem_types_names[i], "radeon_vram_mm");
- else
- sprintf(radeon_mem_types_names[i], "radeon_gtt_mm");
+@@ -853,38 +855,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];
++ static struct drm_info_list radeon_mem_types_list[RADEON_DEBUGFS_MEM_TYPES+2] = {
++ {
++ .name = "radeon_vram_mm",
++ .show = &radeon_mm_dump_table,
++ },
++ {
++ .name = "radeon_gtt_mm",
++ .show = &radeon_mm_dump_table,
++ },
++ {
++ .name = "ttm_page_pool",
++ .show = &ttm_page_alloc_debugfs,
++ },
++ {
++ .name = "ttm_dma_page_pool",
++ .show = &ttm_dma_page_alloc_debugfs,
++ },
++ };
+ unsigned i;
+
+- for (i = 0; i < RADEON_DEBUGFS_MEM_TYPES; i++) {
+- if (i == 0)
+- sprintf(radeon_mem_types_names[i], "radeon_vram_mm");
+- else
+- sprintf(radeon_mem_types_names[i], "radeon_gtt_mm");
- radeon_mem_types_list[i].name = radeon_mem_types_names[i];
- radeon_mem_types_list[i].show = &radeon_mm_dump_table;
- radeon_mem_types_list[i].driver_features = 0;
-+ pax_open_kernel();
-+ *(const char **)&radeon_mem_types_list[i].name = radeon_mem_types_names[i];
-+ *(void **)&radeon_mem_types_list[i].show = &radeon_mm_dump_table;
-+ *(u32 *)&radeon_mem_types_list[i].driver_features = 0;
- if (i == 0)
+- if (i == 0)
- radeon_mem_types_list[i].data = rdev->mman.bdev.man[TTM_PL_VRAM].priv;
-+ *(void **)&radeon_mem_types_list[i].data = rdev->mman.bdev.man[TTM_PL_VRAM].priv;
- else
+- else
- radeon_mem_types_list[i].data = rdev->mman.bdev.man[TTM_PL_TT].priv;
-
-+ *(void **)&radeon_mem_types_list[i].data = rdev->mman.bdev.man[TTM_PL_TT].priv;
-+ pax_close_kernel();
- }
- /* Add ttm page pool to debugfs */
- sprintf(radeon_mem_types_names[i], "ttm_page_pool");
+- }
+- /* Add ttm page pool to debugfs */
+- sprintf(radeon_mem_types_names[i], "ttm_page_pool");
- radeon_mem_types_list[i].name = radeon_mem_types_names[i];
- radeon_mem_types_list[i].show = &ttm_page_alloc_debugfs;
- radeon_mem_types_list[i].driver_features = 0;
- radeon_mem_types_list[i++].data = NULL;
+ pax_open_kernel();
-+ *(const char **)&radeon_mem_types_list[i].name = radeon_mem_types_names[i];
-+ *(void **)&radeon_mem_types_list[i].show = &ttm_page_alloc_debugfs;
-+ *(u32 *)&radeon_mem_types_list[i].driver_features = 0;
-+ *(void **)&radeon_mem_types_list[i++].data = NULL;
++ *(void **)&radeon_mem_types_list[0].data = rdev->mman.bdev.man[TTM_PL_VRAM].priv;
++ *(void **)&radeon_mem_types_list[1].data = rdev->mman.bdev.man[TTM_PL_TT].priv;
+ pax_close_kernel();
#ifdef CONFIG_SWIOTLB
- if (swiotlb_nr_tbl()) {
- sprintf(radeon_mem_types_names[i], "ttm_dma_page_pool");
+- if (swiotlb_nr_tbl()) {
+- sprintf(radeon_mem_types_names[i], "ttm_dma_page_pool");
- radeon_mem_types_list[i].name = radeon_mem_types_names[i];
- radeon_mem_types_list[i].show = &ttm_dma_page_alloc_debugfs;
- radeon_mem_types_list[i].driver_features = 0;
- radeon_mem_types_list[i++].data = NULL;
-+ pax_open_kernel();
-+ *(const char **)&radeon_mem_types_list[i].name = radeon_mem_types_names[i];
-+ *(void **)&radeon_mem_types_list[i].show = &ttm_dma_page_alloc_debugfs;
-+ *(u32 *)&radeon_mem_types_list[i].driver_features = 0;
-+ *(void **)&radeon_mem_types_list[i++].data = NULL;
-+ pax_close_kernel();
- }
+- }
++ if (swiotlb_nr_tbl())
++ i++;
#endif
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 fad6633..4ff94de 100644
+index 55880d5..9e95342 100644
--- a/drivers/gpu/drm/radeon/rs690.c
+++ b/drivers/gpu/drm/radeon/rs690.c
-@@ -304,9 +304,11 @@ static void rs690_crtc_bandwidth_compute(struct radeon_device *rdev,
+@@ -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 &&
rdev->pm.sideport_bandwidth.full)
rdev->pm.max_bandwidth = rdev->pm.sideport_bandwidth;
@@ -36352,7 +36493,7 @@ index bd2a3b4..122d9ad 100644
int shrink_pages = sc->nr_to_scan;
diff --git a/drivers/gpu/drm/udl/udl_fb.c b/drivers/gpu/drm/udl/udl_fb.c
-index 9f4be3d..cbc9fcc 100644
+index dc0c065..58a0782 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)
@@ -36569,11 +36710,24 @@ index 8a8725c2..afed796 100644
else {
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
+--- 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)
+ }
+
+ for (i = 0; i < ARRAY_SIZE(debugfs_files); i++)
+- dc->debugfs_files[i].data = dc;
++ *(void **)&dc->debugfs_files[i].data = dc;
+
+ err = drm_debugfs_create_files(dc->debugfs_files,
+ ARRAY_SIZE(debugfs_files),
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
-index e6dbf09..3dd2540 100644
+index 402f486..f862d7e 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
-@@ -2268,7 +2268,7 @@ EXPORT_SYMBOL_GPL(hid_ignore);
+@@ -2275,7 +2275,7 @@ EXPORT_SYMBOL_GPL(hid_ignore);
int hid_add_device(struct hid_device *hdev)
{
@@ -36582,7 +36736,7 @@ index e6dbf09..3dd2540 100644
int ret;
if (WARN_ON(hdev->status & HID_STAT_ADDED))
-@@ -2302,7 +2302,7 @@ int hid_add_device(struct hid_device *hdev)
+@@ -2309,7 +2309,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,
@@ -36620,7 +36774,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 7311589..861e9ef 100644
+index ae49237..380d4c9 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)
@@ -36685,7 +36839,7 @@ index 6351aba..dc4aaf4 100644
int res = 0;
diff --git a/drivers/hwmon/applesmc.c b/drivers/hwmon/applesmc.c
-index b41baff..4953e4d 100644
+index 62c2e32..8f2859a 100644
--- a/drivers/hwmon/applesmc.c
+++ b/drivers/hwmon/applesmc.c
@@ -1084,7 +1084,7 @@ static int applesmc_create_nodes(struct applesmc_node_group *groups, int num)
@@ -36726,10 +36880,10 @@ index b25c643..a13460d 100644
{
sysfs_attr_init(&attr->attr);
diff --git a/drivers/hwmon/coretemp.c b/drivers/hwmon/coretemp.c
-index 3f1e297..a6cafb5 100644
+index 658ce3a..0d0c2f3 100644
--- a/drivers/hwmon/coretemp.c
+++ b/drivers/hwmon/coretemp.c
-@@ -791,7 +791,7 @@ static int __cpuinit coretemp_cpu_callback(struct notifier_block *nfb,
+@@ -790,7 +790,7 @@ static int __cpuinit coretemp_cpu_callback(struct notifier_block *nfb,
return NOTIFY_OK;
}
@@ -36739,10 +36893,10 @@ index 3f1e297..a6cafb5 100644
};
diff --git a/drivers/hwmon/ibmaem.c b/drivers/hwmon/ibmaem.c
-index a14f634..2916ee2 100644
+index 1429f6e..ee03d59 100644
--- a/drivers/hwmon/ibmaem.c
+++ b/drivers/hwmon/ibmaem.c
-@@ -925,7 +925,7 @@ static int aem_register_sensors(struct aem_data *data,
+@@ -926,7 +926,7 @@ static int aem_register_sensors(struct aem_data *data,
struct aem_rw_sensor_template *rw)
{
struct device *dev = &data->pdev->dev;
@@ -36751,6 +36905,19 @@ index a14f634..2916ee2 100644
int err;
/* Set up read-only sensors */
+diff --git a/drivers/hwmon/iio_hwmon.c b/drivers/hwmon/iio_hwmon.c
+index 52b77af..aed1ddf 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)
+ {
+ struct device *dev = &pdev->dev;
+ struct iio_hwmon_state *st;
+- struct sensor_device_attribute *a;
++ sensor_device_attribute_no_const *a;
+ int ret, i;
+ int in_i = 1, temp_i = 1, curr_i = 1;
+ enum iio_chan_type type;
diff --git a/drivers/hwmon/pmbus/pmbus_core.c b/drivers/hwmon/pmbus/pmbus_core.c
index 9add6092..ee7ba3f 100644
--- a/drivers/hwmon/pmbus/pmbus_core.c
@@ -36866,7 +37033,7 @@ index 76f157b..9c0db1b 100644
};
diff --git a/drivers/i2c/busses/i2c-amd756-s4882.c b/drivers/i2c/busses/i2c-amd756-s4882.c
-index 378fcb5..5e91fa8 100644
+index 07f01ac..d79ad3d 100644
--- a/drivers/i2c/busses/i2c-amd756-s4882.c
+++ b/drivers/i2c/busses/i2c-amd756-s4882.c
@@ -43,7 +43,7 @@
@@ -36879,7 +37046,7 @@ index 378fcb5..5e91fa8 100644
/* Wrapper access functions for multiplexed SMBus */
static DEFINE_MUTEX(amd756_lock);
diff --git a/drivers/i2c/busses/i2c-nforce2-s4985.c b/drivers/i2c/busses/i2c-nforce2-s4985.c
-index 29015eb..af2d8e9 100644
+index 2ca268d..c6acbdf 100644
--- a/drivers/i2c/busses/i2c-nforce2-s4985.c
+++ b/drivers/i2c/busses/i2c-nforce2-s4985.c
@@ -41,7 +41,7 @@
@@ -36905,7 +37072,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 8126824..55a2798 100644
+index 2ff6204..218c16e 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)
@@ -36918,7 +37085,7 @@ index 8126824..55a2798 100644
}
}
diff --git a/drivers/iio/industrialio-core.c b/drivers/iio/industrialio-core.c
-index 8848f16..f8e6dd8 100644
+index e145931..08bfc59 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,
@@ -37145,10 +37312,10 @@ index 9f5ad7c..588cd84 100644
}
}
diff --git a/drivers/infiniband/hw/cxgb4/mem.c b/drivers/infiniband/hw/cxgb4/mem.c
-index 903a92d..9262548 100644
+index 4cb8eb2..146bf60 100644
--- a/drivers/infiniband/hw/cxgb4/mem.c
+++ b/drivers/infiniband/hw/cxgb4/mem.c
-@@ -122,7 +122,7 @@ static int write_tpt_entry(struct c4iw_rdev *rdev, u32 reset_tpt_entry,
+@@ -249,7 +249,7 @@ static int write_tpt_entry(struct c4iw_rdev *rdev, u32 reset_tpt_entry,
int err;
struct fw_ri_tpte tpt;
u32 stag_idx;
@@ -37157,7 +37324,7 @@ index 903a92d..9262548 100644
if (c4iw_fatal_error(rdev))
return -EIO;
-@@ -139,7 +139,7 @@ static int write_tpt_entry(struct c4iw_rdev *rdev, u32 reset_tpt_entry,
+@@ -266,7 +266,7 @@ static int write_tpt_entry(struct c4iw_rdev *rdev, u32 reset_tpt_entry,
if (rdev->stats.stag.cur > rdev->stats.stag.max)
rdev->stats.stag.max = rdev->stats.stag.cur;
mutex_unlock(&rdev->stats.lock);
@@ -37561,7 +37728,7 @@ index 4166452..fc952c3 100644
}
diff --git a/drivers/infiniband/hw/nes/nes_nic.c b/drivers/infiniband/hw/nes/nes_nic.c
-index 85cf4d1..05d8e71 100644
+index 49eb511..a774366 100644
--- a/drivers/infiniband/hw/nes/nes_nic.c
+++ b/drivers/infiniband/hw/nes/nes_nic.c
@@ -1273,39 +1273,39 @@ static void nes_netdev_get_ethtool_stats(struct net_device *netdev,
@@ -37797,10 +37964,10 @@ index 25fc597..558bf3b3 100644
serio->dev.release = serio_release_port;
serio->dev.groups = serio_device_attr_groups;
diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c
-index b972d43..8943713 100644
+index d8f98b1..f62a640 100644
--- a/drivers/iommu/iommu.c
+++ b/drivers/iommu/iommu.c
-@@ -554,7 +554,7 @@ static struct notifier_block iommu_bus_nb = {
+@@ -583,7 +583,7 @@ static struct notifier_block iommu_bus_nb = {
static void iommu_bus_init(struct bus_type *bus, struct iommu_ops *ops)
{
bus_register_notifier(bus, &iommu_bus_nb);
@@ -37840,10 +38007,10 @@ 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 fc6aebf..762c5f5 100644
+index 19ceaa6..3625818 100644
--- a/drivers/irqchip/irq-gic.c
+++ b/drivers/irqchip/irq-gic.c
-@@ -83,7 +83,7 @@ static u8 gic_cpu_map[NR_GIC_CPU_IF] __read_mostly;
+@@ -84,7 +84,7 @@ static u8 gic_cpu_map[NR_GIC_CPU_IF] __read_mostly;
* Supported arch specific GIC irq extension.
* Default make them NULL.
*/
@@ -37852,7 +38019,7 @@ index fc6aebf..762c5f5 100644
.irq_eoi = NULL,
.irq_mask = NULL,
.irq_unmask = NULL,
-@@ -332,7 +332,7 @@ static void gic_handle_cascade_irq(unsigned int irq, struct irq_desc *desc)
+@@ -333,7 +333,7 @@ static void gic_handle_cascade_irq(unsigned int irq, struct irq_desc *desc)
chained_irq_exit(chip, desc);
}
@@ -37862,7 +38029,7 @@ index fc6aebf..762c5f5 100644
.irq_mask = gic_mask_irq,
.irq_unmask = gic_unmask_irq,
diff --git a/drivers/isdn/capi/capi.c b/drivers/isdn/capi/capi.c
-index 89562a8..218999b 100644
+index ac6f72b..81150f2 100644
--- a/drivers/isdn/capi/capi.c
+++ b/drivers/isdn/capi/capi.c
@@ -81,8 +81,8 @@ struct capiminor {
@@ -37902,39 +38069,8 @@ index 89562a8..218999b 100644
capimsg_setu32(skb->data, 8, mp->ncci); /* NCCI */
capimsg_setu32(skb->data, 12, (u32)(long)skb->data);/* Data32 */
capimsg_setu16(skb->data, 16, len); /* Data length */
-diff --git a/drivers/isdn/capi/kcapi.c b/drivers/isdn/capi/kcapi.c
-index 9b1b274..c123709 100644
---- a/drivers/isdn/capi/kcapi.c
-+++ b/drivers/isdn/capi/kcapi.c
-@@ -93,7 +93,7 @@ capi_ctr_put(struct capi_ctr *ctr)
-
- static inline struct capi_ctr *get_capi_ctr_by_nr(u16 contr)
- {
-- if (contr - 1 >= CAPI_MAXCONTR)
-+ if (contr < 1 || contr - 1 >= CAPI_MAXCONTR)
- return NULL;
-
- return capi_controller[contr - 1];
-@@ -103,7 +103,7 @@ static inline struct capi20_appl *__get_capi_appl_by_nr(u16 applid)
- {
- lockdep_assert_held(&capi_controller_lock);
-
-- if (applid - 1 >= CAPI_MAXAPPL)
-+ if (applid < 1 || applid - 1 >= CAPI_MAXAPPL)
- return NULL;
-
- return capi_applications[applid - 1];
-@@ -111,7 +111,7 @@ static inline struct capi20_appl *__get_capi_appl_by_nr(u16 applid)
-
- static inline struct capi20_appl *get_capi_appl_by_nr(u16 applid)
- {
-- if (applid - 1 >= CAPI_MAXAPPL)
-+ if (applid < 1 || applid - 1 >= CAPI_MAXAPPL)
- return NULL;
-
- return rcu_dereference(capi_applications[applid - 1]);
diff --git a/drivers/isdn/gigaset/interface.c b/drivers/isdn/gigaset/interface.c
-index e2b5396..c5486dc 100644
+index 600c79b..3752bab 100644
--- a/drivers/isdn/gigaset/interface.c
+++ b/drivers/isdn/gigaset/interface.c
@@ -130,9 +130,9 @@ static int if_open(struct tty_struct *tty, struct file *filp)
@@ -37962,7 +38098,7 @@ index e2b5396..c5486dc 100644
mutex_unlock(&cs->mutex);
diff --git a/drivers/isdn/hardware/avm/b1.c b/drivers/isdn/hardware/avm/b1.c
-index 821f7ac..28d4030 100644
+index 4d9b195..455075c 100644
--- a/drivers/isdn/hardware/avm/b1.c
+++ b/drivers/isdn/hardware/avm/b1.c
@@ -176,7 +176,7 @@ int b1_load_t4file(avmcard *card, capiloaddatapart *t4file)
@@ -37984,10 +38120,10 @@ index 821f7ac..28d4030 100644
} else {
memcpy(buf, dp, left);
diff --git a/drivers/isdn/i4l/isdn_tty.c b/drivers/isdn/i4l/isdn_tty.c
-index ebaebdf..acd4405 100644
+index 3c5f249..5fac4d0 100644
--- a/drivers/isdn/i4l/isdn_tty.c
+++ b/drivers/isdn/i4l/isdn_tty.c
-@@ -1511,9 +1511,9 @@ isdn_tty_open(struct tty_struct *tty, struct file *filp)
+@@ -1508,9 +1508,9 @@ isdn_tty_open(struct tty_struct *tty, struct file *filp)
#ifdef ISDN_DEBUG_MODEM_OPEN
printk(KERN_DEBUG "isdn_tty_open %s, count = %d\n", tty->name,
@@ -37999,7 +38135,7 @@ index ebaebdf..acd4405 100644
port->tty = tty;
/*
* Start up serial port
-@@ -1557,7 +1557,7 @@ isdn_tty_close(struct tty_struct *tty, struct file *filp)
+@@ -1554,7 +1554,7 @@ isdn_tty_close(struct tty_struct *tty, struct file *filp)
#endif
return;
}
@@ -38008,7 +38144,7 @@ index ebaebdf..acd4405 100644
/*
* Uh, oh. tty->count is 1, which means that the tty
* structure will be freed. Info->count should always
-@@ -1566,15 +1566,15 @@ isdn_tty_close(struct tty_struct *tty, struct file *filp)
+@@ -1563,15 +1563,15 @@ isdn_tty_close(struct tty_struct *tty, struct file *filp)
* serial port won't be shutdown.
*/
printk(KERN_ERR "isdn_tty_close: bad port count; tty->count is 1, "
@@ -38030,7 +38166,7 @@ index ebaebdf..acd4405 100644
#ifdef ISDN_DEBUG_MODEM_OPEN
printk(KERN_DEBUG "isdn_tty_close after info->count != 0\n");
#endif
-@@ -1628,7 +1628,7 @@ isdn_tty_hangup(struct tty_struct *tty)
+@@ -1625,7 +1625,7 @@ isdn_tty_hangup(struct tty_struct *tty)
if (isdn_tty_paranoia_check(info, tty->name, "isdn_tty_hangup"))
return;
isdn_tty_shutdown(info);
@@ -38039,7 +38175,7 @@ index ebaebdf..acd4405 100644
port->flags &= ~ASYNC_NORMAL_ACTIVE;
port->tty = NULL;
wake_up_interruptible(&port->open_wait);
-@@ -1973,7 +1973,7 @@ isdn_tty_find_icall(int di, int ch, setup_parm *setup)
+@@ -1970,7 +1970,7 @@ isdn_tty_find_icall(int di, int ch, setup_parm *setup)
for (i = 0; i < ISDN_MAX_CHANNELS; i++) {
modem_info *info = &dev->mdm.info[i];
@@ -38088,28 +38224,28 @@ index 64e204e..c6bf189 100644
.callback = ss4200_led_dmi_callback,
.ident = "Intel SS4200-E",
diff --git a/drivers/lguest/core.c b/drivers/lguest/core.c
-index a5ebc00..3de3364 100644
+index 0bf1e4e..b4bf44e 100644
--- a/drivers/lguest/core.c
+++ b/drivers/lguest/core.c
-@@ -92,9 +92,17 @@ static __init int map_switcher(void)
- * it's worked so far. The end address needs +1 because __get_vm_area
- * allocates an extra guard page, so we need space for that.
+@@ -97,9 +97,17 @@ static __init int map_switcher(void)
+ * The end address needs +1 because __get_vm_area allocates an
+ * extra guard page, so we need space for that.
*/
+
+#if defined(CONFIG_X86_32) && defined(CONFIG_PAX_KERNEXEC)
+ switcher_vma = __get_vm_area(TOTAL_SWITCHER_PAGES * PAGE_SIZE,
-+ VM_ALLOC | VM_KERNEXEC, SWITCHER_ADDR, SWITCHER_ADDR
++ VM_ALLOC | VM_KERNEXEC, switcher_addr, switcher_addr
+ + (TOTAL_SWITCHER_PAGES+1) * PAGE_SIZE);
+#else
switcher_vma = __get_vm_area(TOTAL_SWITCHER_PAGES * PAGE_SIZE,
- VM_ALLOC, SWITCHER_ADDR, SWITCHER_ADDR
+ VM_ALLOC, switcher_addr, switcher_addr
+ (TOTAL_SWITCHER_PAGES+1) * PAGE_SIZE);
+#endif
+
if (!switcher_vma) {
err = -ENOMEM;
printk("lguest: could not map switcher pages high\n");
-@@ -119,7 +127,7 @@ static __init int map_switcher(void)
+@@ -124,7 +132,7 @@ static __init int map_switcher(void)
* Now the Switcher is mapped at the right address, we can't fail!
* Copy in the compiled-in Switcher code (from x86/switcher_32.S).
*/
@@ -38119,10 +38255,10 @@ index a5ebc00..3de3364 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 3b62be16..e33134a 100644
+index 5b9ac32..2ef4f26 100644
--- a/drivers/lguest/page_tables.c
+++ b/drivers/lguest/page_tables.c
-@@ -532,7 +532,7 @@ void pin_page(struct lg_cpu *cpu, unsigned long vaddr)
+@@ -559,7 +559,7 @@ void pin_page(struct lg_cpu *cpu, unsigned long vaddr)
/*:*/
#ifdef CONFIG_X86_PAE
@@ -38132,19 +38268,19 @@ index 3b62be16..e33134a 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 4af12e1..0e89afe 100644
+index f0a3347..f6608b2 100644
--- a/drivers/lguest/x86/core.c
+++ b/drivers/lguest/x86/core.c
@@ -59,7 +59,7 @@ static struct {
/* Offset from where switcher.S was compiled to where we've copied it */
static unsigned long switcher_offset(void)
{
-- return SWITCHER_ADDR - (unsigned long)start_switcher_text;
-+ return SWITCHER_ADDR - (unsigned long)ktla_ktva(start_switcher_text);
+- return switcher_addr - (unsigned long)start_switcher_text;
++ return switcher_addr - (unsigned long)ktla_ktva(start_switcher_text);
}
- /* This cpu's struct lguest_pages. */
-@@ -100,7 +100,13 @@ static void copy_in_guest_info(struct lg_cpu *cpu, struct lguest_pages *pages)
+ /* This cpu's struct lguest_pages (after the Switcher text page) */
+@@ -99,7 +99,13 @@ static void copy_in_guest_info(struct lg_cpu *cpu, struct lguest_pages *pages)
* These copies are pretty cheap, so we do them unconditionally: */
/* Save the current Host top-level page directory.
*/
@@ -38158,7 +38294,7 @@ index 4af12e1..0e89afe 100644
/*
* Set up the Guest's page tables to see this CPU's pages (and no
* other CPU's pages).
-@@ -476,7 +482,7 @@ void __init lguest_arch_host_init(void)
+@@ -475,7 +481,7 @@ void __init lguest_arch_host_init(void)
* compiled-in switcher code and the high-mapped copy we just made.
*/
for (i = 0; i < IDT_ENTRIES; i++)
@@ -38167,7 +38303,7 @@ index 4af12e1..0e89afe 100644
/*
* Set up the Switcher's per-cpu areas.
-@@ -559,7 +565,7 @@ void __init lguest_arch_host_init(void)
+@@ -558,7 +564,7 @@ void __init lguest_arch_host_init(void)
* it will be undisturbed when we switch. To change %cs and jump we
* need this structure to feed to Intel's "lcall" instruction.
*/
@@ -38238,8 +38374,21 @@ index 40634b0..4f5855e 100644
// Every interrupt can come to us here
// But we must truly tell each apart.
+diff --git a/drivers/md/bcache/closure.h b/drivers/md/bcache/closure.h
+index 0003992..854bbce 100644
+--- a/drivers/md/bcache/closure.h
++++ b/drivers/md/bcache/closure.h
+@@ -622,7 +622,7 @@ static inline void closure_wake_up(struct closure_waitlist *list)
+ static inline void set_closure_fn(struct closure *cl, closure_fn *fn,
+ struct workqueue_struct *wq)
+ {
+- BUG_ON(object_is_on_stack(cl));
++ BUG_ON(object_starts_on_stack(cl));
+ closure_set_ip(cl);
+ cl->fn = fn;
+ cl->wq = wq;
diff --git a/drivers/md/bitmap.c b/drivers/md/bitmap.c
-index 4fd9d6a..834fa03 100644
+index 5a2c754..0fa55db 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)
@@ -38265,7 +38414,7 @@ index aa04f02..2a1309e 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 d053098..05cc375 100644
+index 699b5be..eac0a15 100644
--- a/drivers/md/dm-raid1.c
+++ b/drivers/md/dm-raid1.c
@@ -40,7 +40,7 @@ enum dm_raid1_error {
@@ -38341,7 +38490,7 @@ index d053098..05cc375 100644
return (test_bit(DM_RAID1_FLUSH_ERROR, &(m->error_type))) ? 'F' :
diff --git a/drivers/md/dm-stripe.c b/drivers/md/dm-stripe.c
-index 7b8b2b9..9c7d145 100644
+index d907ca6..cfb8384 100644
--- a/drivers/md/dm-stripe.c
+++ b/drivers/md/dm-stripe.c
@@ -20,7 +20,7 @@ struct stripe {
@@ -38396,7 +38545,7 @@ index 1ff252a..ee384c1 100644
"start=%llu, len=%llu, dev_size=%llu",
dm_device_name(ti->table->md), bdevname(bdev, b),
diff --git a/drivers/md/dm-thin-metadata.c b/drivers/md/dm-thin-metadata.c
-index 00cee02..b89a29d 100644
+index 60bce43..9b997d0 100644
--- a/drivers/md/dm-thin-metadata.c
+++ b/drivers/md/dm-thin-metadata.c
@@ -397,7 +397,7 @@ static void __setup_btree_details(struct dm_pool_metadata *pmd)
@@ -38418,7 +38567,7 @@ index 00cee02..b89a29d 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 9a0bdad..4df9543 100644
+index d5370a9..8761bbc 100644
--- a/drivers/md/dm.c
+++ b/drivers/md/dm.c
@@ -169,9 +169,9 @@ struct mapped_device {
@@ -38433,7 +38582,7 @@ index 9a0bdad..4df9543 100644
struct list_head uevent_list;
spinlock_t uevent_lock; /* Protect access to uevent_list */
-@@ -1879,8 +1879,8 @@ static struct mapped_device *alloc_dev(int minor)
+@@ -1877,8 +1877,8 @@ static struct mapped_device *alloc_dev(int minor)
rwlock_init(&md->map_lock);
atomic_set(&md->holders, 1);
atomic_set(&md->open_count, 0);
@@ -38444,7 +38593,7 @@ index 9a0bdad..4df9543 100644
INIT_LIST_HEAD(&md->uevent_list);
spin_lock_init(&md->uevent_lock);
-@@ -2028,7 +2028,7 @@ static void event_callback(void *context)
+@@ -2026,7 +2026,7 @@ static void event_callback(void *context)
dm_send_uevents(&uevents, &disk_to_dev(md->disk)->kobj);
@@ -38453,7 +38602,7 @@ index 9a0bdad..4df9543 100644
wake_up(&md->eventq);
}
-@@ -2685,18 +2685,18 @@ int dm_kobject_uevent(struct mapped_device *md, enum kobject_action action,
+@@ -2683,18 +2683,18 @@ int dm_kobject_uevent(struct mapped_device *md, enum kobject_action action,
uint32_t dm_next_uevent_seq(struct mapped_device *md)
{
@@ -38476,10 +38625,10 @@ index 9a0bdad..4df9543 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 a4a93b9..4747b63 100644
+index 9b82377..6b6922d 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
-@@ -240,10 +240,10 @@ EXPORT_SYMBOL_GPL(md_trim_bio);
+@@ -234,10 +234,10 @@ EXPORT_SYMBOL_GPL(md_trim_bio);
* start build, activate spare
*/
static DECLARE_WAIT_QUEUE_HEAD(md_event_waiters);
@@ -38492,7 +38641,7 @@ index a4a93b9..4747b63 100644
wake_up(&md_event_waiters);
}
EXPORT_SYMBOL_GPL(md_new_event);
-@@ -253,7 +253,7 @@ EXPORT_SYMBOL_GPL(md_new_event);
+@@ -247,7 +247,7 @@ EXPORT_SYMBOL_GPL(md_new_event);
*/
static void md_new_event_inintr(struct mddev *mddev)
{
@@ -38501,7 +38650,7 @@ index a4a93b9..4747b63 100644
wake_up(&md_event_waiters);
}
-@@ -1507,7 +1507,7 @@ static int super_1_load(struct md_rdev *rdev, struct md_rdev *refdev, int minor_
+@@ -1501,7 +1501,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);
@@ -38510,7 +38659,7 @@ index a4a93b9..4747b63 100644
rdev->sb_size = le32_to_cpu(sb->max_dev) * 2 + 256;
bmask = queue_logical_block_size(rdev->bdev->bd_disk->queue)-1;
-@@ -1751,7 +1751,7 @@ static void super_1_sync(struct mddev *mddev, struct md_rdev *rdev)
+@@ -1745,7 +1745,7 @@ static void super_1_sync(struct mddev *mddev, struct md_rdev *rdev)
else
sb->resync_offset = cpu_to_le64(0);
@@ -38519,7 +38668,7 @@ index a4a93b9..4747b63 100644
sb->raid_disks = cpu_to_le32(mddev->raid_disks);
sb->size = cpu_to_le64(mddev->dev_sectors);
-@@ -2751,7 +2751,7 @@ __ATTR(state, S_IRUGO|S_IWUSR, state_show, state_store);
+@@ -2750,7 +2750,7 @@ __ATTR(state, S_IRUGO|S_IWUSR, state_show, state_store);
static ssize_t
errors_show(struct md_rdev *rdev, char *page)
{
@@ -38528,7 +38677,7 @@ index a4a93b9..4747b63 100644
}
static ssize_t
-@@ -2760,7 +2760,7 @@ errors_store(struct md_rdev *rdev, const char *buf, size_t len)
+@@ -2759,7 +2759,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')) {
@@ -38537,7 +38686,7 @@ index a4a93b9..4747b63 100644
return len;
}
return -EINVAL;
-@@ -3210,8 +3210,8 @@ int md_rdev_init(struct md_rdev *rdev)
+@@ -3207,8 +3207,8 @@ int md_rdev_init(struct md_rdev *rdev)
rdev->sb_loaded = 0;
rdev->bb_page = NULL;
atomic_set(&rdev->nr_pending, 0);
@@ -38548,7 +38697,7 @@ index a4a93b9..4747b63 100644
INIT_LIST_HEAD(&rdev->same_set);
init_waitqueue_head(&rdev->blocked_wait);
-@@ -6994,7 +6994,7 @@ static int md_seq_show(struct seq_file *seq, void *v)
+@@ -7009,7 +7009,7 @@ static int md_seq_show(struct seq_file *seq, void *v)
spin_unlock(&pers_lock);
seq_printf(seq, "\n");
@@ -38557,7 +38706,7 @@ index a4a93b9..4747b63 100644
return 0;
}
if (v == (void*)2) {
-@@ -7097,7 +7097,7 @@ static int md_seq_open(struct inode *inode, struct file *file)
+@@ -7112,7 +7112,7 @@ static int md_seq_open(struct inode *inode, struct file *file)
return error;
seq = file->private_data;
@@ -38566,7 +38715,7 @@ index a4a93b9..4747b63 100644
return error;
}
-@@ -7111,7 +7111,7 @@ static unsigned int mdstat_poll(struct file *filp, poll_table *wait)
+@@ -7126,7 +7126,7 @@ static unsigned int mdstat_poll(struct file *filp, poll_table *wait)
/* always allow read */
mask = POLLIN | POLLRDNORM;
@@ -38575,7 +38724,7 @@ index a4a93b9..4747b63 100644
mask |= POLLERR | POLLPRI;
return mask;
}
-@@ -7155,7 +7155,7 @@ static int is_mddev_idle(struct mddev *mddev, int init)
+@@ -7170,7 +7170,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]) -
@@ -38585,7 +38734,7 @@ index a4a93b9..4747b63 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 d90fb1a..4174a2b 100644
+index 653f992b6..6af6c40 100644
--- a/drivers/md/md.h
+++ b/drivers/md/md.h
@@ -94,13 +94,13 @@ struct md_rdev {
@@ -38614,22 +38763,22 @@ index d90fb1a..4174a2b 100644
struct md_personality
diff --git a/drivers/md/persistent-data/dm-space-map.h b/drivers/md/persistent-data/dm-space-map.h
-index 1cbfc6b..56e1dbb 100644
+index 3e6d115..ffecdeb 100644
--- a/drivers/md/persistent-data/dm-space-map.h
+++ b/drivers/md/persistent-data/dm-space-map.h
-@@ -60,6 +60,7 @@ struct dm_space_map {
- int (*root_size)(struct dm_space_map *sm, size_t *result);
- int (*copy_root)(struct dm_space_map *sm, void *copy_to_here_le, size_t len);
+@@ -71,6 +71,7 @@ struct dm_space_map {
+ dm_sm_threshold_fn fn,
+ void *context);
};
+typedef struct dm_space_map __no_const dm_space_map_no_const;
/*----------------------------------------------------------------*/
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
-index 7116798..c81390c 100644
+index 6e17f81..140f717 100644
--- a/drivers/md/raid1.c
+++ b/drivers/md/raid1.c
-@@ -1836,7 +1836,7 @@ static int fix_sync_read_error(struct r1bio *r1_bio)
+@@ -1822,7 +1822,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)
@@ -38638,7 +38787,7 @@ index 7116798..c81390c 100644
}
sectors -= s;
sect += s;
-@@ -2058,7 +2058,7 @@ static void fix_read_error(struct r1conf *conf, int read_disk,
+@@ -2042,7 +2042,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)) {
@@ -38648,10 +38797,10 @@ index 7116798..c81390c 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 e4ea992..d234520 100644
+index d61eb7e..adfd00a 100644
--- a/drivers/md/raid10.c
+++ b/drivers/md/raid10.c
-@@ -1942,7 +1942,7 @@ static void end_sync_read(struct bio *bio, int error)
+@@ -1940,7 +1940,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
*/
@@ -38660,7 +38809,7 @@ index e4ea992..d234520 100644
&conf->mirrors[d].rdev->corrected_errors);
/* for reconstruct, we always reschedule after a read.
-@@ -2291,7 +2291,7 @@ static void check_decay_read_errors(struct mddev *mddev, struct md_rdev *rdev)
+@@ -2292,7 +2292,7 @@ static void check_decay_read_errors(struct mddev *mddev, struct md_rdev *rdev)
{
struct timespec cur_time_mon;
unsigned long hours_since_last;
@@ -38669,7 +38818,7 @@ index e4ea992..d234520 100644
ktime_get_ts(&cur_time_mon);
-@@ -2313,9 +2313,9 @@ static void check_decay_read_errors(struct mddev *mddev, struct md_rdev *rdev)
+@@ -2314,9 +2314,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))
@@ -38681,7 +38830,7 @@ index e4ea992..d234520 100644
}
static int r10_sync_page_io(struct md_rdev *rdev, sector_t sector,
-@@ -2369,8 +2369,8 @@ static void fix_read_error(struct r10conf *conf, struct mddev *mddev, struct r10
+@@ -2370,8 +2370,8 @@ static void fix_read_error(struct r10conf *conf, struct mddev *mddev, struct r10
return;
check_decay_read_errors(mddev, rdev);
@@ -38692,7 +38841,7 @@ index e4ea992..d234520 100644
char b[BDEVNAME_SIZE];
bdevname(rdev->bdev, b);
-@@ -2378,7 +2378,7 @@ static void fix_read_error(struct r10conf *conf, struct mddev *mddev, struct r10
+@@ -2379,7 +2379,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,
@@ -38701,7 +38850,7 @@ index e4ea992..d234520 100644
printk(KERN_NOTICE
"md/raid10:%s: %s: Failing raid device\n",
mdname(mddev), b);
-@@ -2533,7 +2533,7 @@ static void fix_read_error(struct r10conf *conf, struct mddev *mddev, struct r10
+@@ -2534,7 +2534,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));
@@ -38711,10 +38860,10 @@ index e4ea992..d234520 100644
rdev_dec_pending(rdev, mddev);
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
-index 251ab64..ed23a18 100644
+index 05e4a10..48fbe37 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
-@@ -1763,21 +1763,21 @@ static void raid5_end_read_request(struct bio * bi, int error)
+@@ -1764,21 +1764,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));
@@ -38740,7 +38889,7 @@ index 251ab64..ed23a18 100644
if (test_bit(R5_ReadRepl, &sh->dev[i].flags))
printk_ratelimited(
KERN_WARNING
-@@ -1805,7 +1805,7 @@ static void raid5_end_read_request(struct bio * bi, int error)
+@@ -1806,7 +1806,7 @@ static void raid5_end_read_request(struct bio * bi, int error)
mdname(conf->mddev),
(unsigned long long)s,
bdn);
@@ -38776,7 +38925,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 bc78354..42c9459 100644
+index c7a9be1..683f6f8 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);
@@ -38792,22 +38941,8 @@ index bc78354..42c9459 100644
module_param_array(video_nr, int, NULL, 0444);
module_param_array(vbi_nr, int, NULL, 0444);
-diff --git a/drivers/media/pci/saa7134/saa7134-alsa.c b/drivers/media/pci/saa7134/saa7134-alsa.c
-index 10460fd..dbcdfbf 100644
---- a/drivers/media/pci/saa7134/saa7134-alsa.c
-+++ b/drivers/media/pci/saa7134/saa7134-alsa.c
-@@ -172,7 +172,9 @@ static void saa7134_irq_alsa_done(struct saa7134_dev *dev,
- dprintk("irq: overrun [full=%d/%d] - Blocks in %d\n",dev->dmasound.read_count,
- dev->dmasound.bufsize, dev->dmasound.blocks);
- spin_unlock(&dev->slock);
-+ snd_pcm_stream_lock(dev->dmasound.substream);
- snd_pcm_stop(dev->dmasound.substream,SNDRV_PCM_STATE_XRUN);
-+ snd_pcm_stream_unlock(dev->dmasound.substream);
- return;
- }
-
diff --git a/drivers/media/platform/omap/omap_vout.c b/drivers/media/platform/omap/omap_vout.c
-index 96c4a17..1305a79 100644
+index d338b19..aae4f9e 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 {
@@ -38818,7 +38953,7 @@ index 96c4a17..1305a79 100644
/* Variables configurable through module params*/
static u32 video1_numbuffers = 3;
static u32 video2_numbuffers = 3;
-@@ -1012,6 +1011,12 @@ static int omap_vout_open(struct file *file)
+@@ -1015,6 +1014,12 @@ static int omap_vout_open(struct file *file)
{
struct videobuf_queue *q;
struct omap_vout_device *vout = NULL;
@@ -38831,7 +38966,7 @@ index 96c4a17..1305a79 100644
vout = video_drvdata(file);
v4l2_dbg(1, debug, &vout->vid_dev->v4l2_dev, "Entering %s\n", __func__);
-@@ -1029,10 +1034,6 @@ static int omap_vout_open(struct file *file)
+@@ -1032,10 +1037,6 @@ static int omap_vout_open(struct file *file)
vout->type = V4L2_BUF_TYPE_VIDEO_OUTPUT;
q = &vout->vbq;
@@ -38882,7 +39017,7 @@ 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 82142a2..6de47e8 100644
+index ef0efdf..8c78eb6 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)
@@ -38936,7 +39071,7 @@ index 82142a2..6de47e8 100644
/* retrieve update selection rectangle */
res.left = target->x_offset;
-@@ -938,13 +938,13 @@ static int start_streaming(struct vb2_queue *vq, unsigned int count)
+@@ -954,13 +954,13 @@ static int start_streaming(struct vb2_queue *vq, unsigned int count)
mxr_output_get(mdev);
mxr_layer_update_output(layer);
@@ -38952,7 +39087,7 @@ index 82142a2..6de47e8 100644
mxr_streamer_get(mdev);
return 0;
-@@ -1014,7 +1014,7 @@ static int stop_streaming(struct vb2_queue *vq)
+@@ -1030,7 +1030,7 @@ static int stop_streaming(struct vb2_queue *vq)
spin_unlock_irqrestore(&layer->enq_slock, flags);
/* disabling layer in hardware */
@@ -38961,7 +39096,7 @@ index 82142a2..6de47e8 100644
/* remove one streamer */
mxr_streamer_put(mdev);
/* allow changes in output configuration */
-@@ -1053,8 +1053,8 @@ void mxr_base_layer_unregister(struct mxr_layer *layer)
+@@ -1069,8 +1069,8 @@ void mxr_base_layer_unregister(struct mxr_layer *layer)
void mxr_layer_release(struct mxr_layer *layer)
{
@@ -38972,7 +39107,7 @@ index 82142a2..6de47e8 100644
}
void mxr_base_layer_release(struct mxr_layer *layer)
-@@ -1080,7 +1080,7 @@ struct mxr_layer *mxr_base_layer_create(struct mxr_device *mdev,
+@@ -1096,7 +1096,7 @@ struct mxr_layer *mxr_base_layer_create(struct mxr_device *mdev,
layer->mdev = mdev;
layer->idx = idx;
@@ -38995,10 +39130,10 @@ index 3d13a63..da31bf1 100644
.buffer_set = mxr_vp_buffer_set,
.stream_set = mxr_vp_stream_set,
diff --git a/drivers/media/radio/radio-cadet.c b/drivers/media/radio/radio-cadet.c
-index 643d80a..56bb96b 100644
+index 545c04c..a14bded 100644
--- a/drivers/media/radio/radio-cadet.c
+++ b/drivers/media/radio/radio-cadet.c
-@@ -302,6 +302,8 @@ static ssize_t cadet_read(struct file *file, char __user *data, size_t count, lo
+@@ -324,6 +324,8 @@ static ssize_t cadet_read(struct file *file, char __user *data, size_t count, lo
unsigned char readbuf[RDS_BUFFER];
int i = 0;
@@ -39007,7 +39142,7 @@ index 643d80a..56bb96b 100644
mutex_lock(&dev->lock);
if (dev->rdsstat == 0)
cadet_start_rds(dev);
-@@ -317,7 +319,7 @@ static ssize_t cadet_read(struct file *file, char __user *data, size_t count, lo
+@@ -339,7 +341,7 @@ static ssize_t cadet_read(struct file *file, char __user *data, size_t count, lo
while (i < count && dev->rdsin != dev->rdsout)
readbuf[i++] = dev->rdsbuf[dev->rdsout++];
@@ -39030,10 +39165,10 @@ index 3940bb0..fb3952a 100644
static int dib7070_set_param_override(struct dvb_frontend *fe)
{
diff --git a/drivers/media/usb/dvb-usb/dw2102.c b/drivers/media/usb/dvb-usb/dw2102.c
-index 9578a67..31aa652 100644
+index 6e237b6..dc25556 100644
--- a/drivers/media/usb/dvb-usb/dw2102.c
+++ b/drivers/media/usb/dvb-usb/dw2102.c
-@@ -115,7 +115,7 @@ struct su3000_state {
+@@ -118,7 +118,7 @@ struct su3000_state {
struct s6x0_state {
int (*old_set_voltage)(struct dvb_frontend *f, fe_sec_voltage_t v);
@@ -39043,7 +39178,7 @@ index 9578a67..31aa652 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 7157af3..139e91a 100644
+index f129551..ecf6514 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 {
@@ -39074,40 +39209,10 @@ index 7157af3..139e91a 100644
return 0;
}
diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c
-index aa6e7c7..cb5de87 100644
+index 7658586..1079260 100644
--- a/drivers/media/v4l2-core/v4l2-ioctl.c
+++ b/drivers/media/v4l2-core/v4l2-ioctl.c
-@@ -236,7 +236,7 @@ static void v4l_print_format(const void *arg, bool write_only)
- const struct v4l2_vbi_format *vbi;
- const struct v4l2_sliced_vbi_format *sliced;
- const struct v4l2_window *win;
-- const struct v4l2_clip *clip;
-+ const struct v4l2_clip __user *pclip;
- unsigned i;
-
- pr_cont("type=%s", prt_names(p->type, v4l2_type_names));
-@@ -284,12 +284,16 @@ static void v4l_print_format(const void *arg, bool write_only)
- win->w.left, win->w.top,
- prt_names(win->field, v4l2_field_names),
- win->chromakey, win->bitmap, win->global_alpha);
-- clip = win->clips;
-+ pclip = win->clips;
- for (i = 0; i < win->clipcount; i++) {
-+ struct v4l2_clip clip;
-+
-+ if (copy_from_user(&clip, pclip, sizeof clip))
-+ break;
- printk(KERN_DEBUG "clip %u: wxh=%dx%d, x,y=%d,%d\n",
-- i, clip->c.width, clip->c.height,
-- clip->c.left, clip->c.top);
-- clip = clip->next;
-+ i, clip.c.width, clip.c.height,
-+ clip.c.left, clip.c.top);
-+ pclip = clip.next;
- }
- break;
- case V4L2_BUF_TYPE_VBI_CAPTURE:
-@@ -1923,7 +1927,8 @@ struct v4l2_ioctl_info {
+@@ -1995,7 +1995,8 @@ struct v4l2_ioctl_info {
struct file *file, void *fh, void *p);
} u;
void (*debug)(const void *arg, bool write_only);
@@ -39117,7 +39222,7 @@ index aa6e7c7..cb5de87 100644
/* This control needs a priority check */
#define INFO_FL_PRIO (1 << 0)
-@@ -2108,7 +2113,7 @@ static long __video_do_ioctl(struct file *file,
+@@ -2177,7 +2178,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;
@@ -39126,7 +39231,7 @@ index aa6e7c7..cb5de87 100644
const struct v4l2_ioctl_info *info;
void *fh = file->private_data;
struct v4l2_fh *vfh = NULL;
-@@ -2193,7 +2198,7 @@ done:
+@@ -2251,7 +2252,7 @@ done:
}
static int check_array_args(unsigned int cmd, void *parg, size_t *array_size,
@@ -39135,7 +39240,7 @@ index aa6e7c7..cb5de87 100644
{
int ret = 0;
-@@ -2209,7 +2214,7 @@ static int check_array_args(unsigned int cmd, void *parg, size_t *array_size,
+@@ -2267,7 +2268,7 @@ static int check_array_args(unsigned int cmd, void *parg, size_t *array_size,
ret = -EINVAL;
break;
}
@@ -39144,7 +39249,7 @@ index aa6e7c7..cb5de87 100644
*kernel_ptr = (void *)&buf->m.planes;
*array_size = sizeof(struct v4l2_plane) * buf->length;
ret = 1;
-@@ -2244,7 +2249,7 @@ static int check_array_args(unsigned int cmd, void *parg, size_t *array_size,
+@@ -2302,7 +2303,7 @@ static int check_array_args(unsigned int cmd, void *parg, size_t *array_size,
ret = -EINVAL;
break;
}
@@ -39154,7 +39259,7 @@ index aa6e7c7..cb5de87 100644
*array_size = sizeof(struct v4l2_ext_control)
* ctrls->count;
diff --git a/drivers/message/fusion/mptbase.c b/drivers/message/fusion/mptbase.c
-index fb69baa..3aeea2e 100644
+index 767ff4d..c69d259 100644
--- a/drivers/message/fusion/mptbase.c
+++ b/drivers/message/fusion/mptbase.c
@@ -6755,8 +6755,13 @@ static int mpt_iocinfo_proc_show(struct seq_file *m, void *v)
@@ -39184,7 +39289,7 @@ index fb69baa..3aeea2e 100644
seq_printf(m, " {CurRepSz=%d} x {CurRepDepth=%d} = %d bytes ^= 0x%x\n",
ioc->reply_sz, ioc->reply_depth, ioc->reply_sz*ioc->reply_depth, sz);
diff --git a/drivers/message/fusion/mptsas.c b/drivers/message/fusion/mptsas.c
-index fa43c39..daeb158 100644
+index dd239bd..689c4f7 100644
--- a/drivers/message/fusion/mptsas.c
+++ b/drivers/message/fusion/mptsas.c
@@ -446,6 +446,23 @@ mptsas_is_end_device(struct mptsas_devinfo * attached)
@@ -39236,7 +39341,7 @@ index fa43c39..daeb158 100644
mptsas_get_port(struct mptsas_phyinfo *phy_info)
{
diff --git a/drivers/message/fusion/mptscsih.c b/drivers/message/fusion/mptscsih.c
-index 164afa7..b6b2e74 100644
+index 727819c..ad74694 100644
--- a/drivers/message/fusion/mptscsih.c
+++ b/drivers/message/fusion/mptscsih.c
@@ -1271,15 +1271,16 @@ mptscsih_info(struct Scsi_Host *SChost)
@@ -39265,7 +39370,7 @@ index 164afa7..b6b2e74 100644
return h->info_kbuf;
}
diff --git a/drivers/message/i2o/i2o_proc.c b/drivers/message/i2o/i2o_proc.c
-index 8001aa6..b137580 100644
+index b7d87cd..9890039 100644
--- a/drivers/message/i2o/i2o_proc.c
+++ b/drivers/message/i2o/i2o_proc.c
@@ -255,12 +255,6 @@ static char *scsi_devices[] = {
@@ -39522,7 +39627,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 4a87e5c..76bdf5c 100644
+index 4cd4a3d..b48cbc7 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)
@@ -39543,7 +39648,7 @@ index 4a87e5c..76bdf5c 100644
return 0;
}
-@@ -617,7 +617,7 @@ static ssize_t lis3lv02d_misc_read(struct file *file, char __user *buf,
+@@ -616,7 +616,7 @@ static ssize_t lis3lv02d_misc_read(struct file *file, char __user *buf,
add_wait_queue(&lis3->misc_wait, &wait);
while (true) {
set_current_state(TASK_INTERRUPTIBLE);
@@ -39552,7 +39657,7 @@ index 4a87e5c..76bdf5c 100644
if (data)
break;
-@@ -658,7 +658,7 @@ static unsigned int lis3lv02d_misc_poll(struct file *file, poll_table *wait)
+@@ -657,7 +657,7 @@ static unsigned int lis3lv02d_misc_poll(struct file *file, poll_table *wait)
struct lis3lv02d, miscdev);
poll_wait(file, &lis3->misc_wait, wait);
@@ -39590,7 +39695,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 950dbe9..eeef0f8 100644
+index 797d796..ae8f01e 100644
--- a/drivers/misc/sgi-gru/gruprocfs.c
+++ b/drivers/misc/sgi-gru/gruprocfs.c
@@ -32,9 +32,9 @@
@@ -39675,31 +39780,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;
@@ -39751,10 +39831,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;
@@ -39869,21 +39972,21 @@ 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 53b8fd9..615b462 100644
+index 0b74189..818358f 100644
--- a/drivers/mmc/host/dw_mmc.h
+++ b/drivers/mmc/host/dw_mmc.h
-@@ -205,5 +205,5 @@ struct dw_mci_drv_data {
+@@ -202,5 +202,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);
- int (*setup_bus)(struct dw_mci *host,
- struct device_node *slot_np, u8 bus_width);
-};
+} __do_const;
#endif /* _DW_MMC_H_ */
diff --git a/drivers/mmc/host/sdhci-s3c.c b/drivers/mmc/host/sdhci-s3c.c
-index 7363efe..681558e 100644
+index c6f6246..60760a8 100644
--- a/drivers/mmc/host/sdhci-s3c.c
+++ b/drivers/mmc/host/sdhci-s3c.c
-@@ -720,9 +720,11 @@ static int sdhci_s3c_probe(struct platform_device *pdev)
+@@ -664,9 +664,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) {
@@ -39898,19 +40001,6 @@ index 7363efe..681558e 100644
}
/* It supports additional host capabilities if needed */
-diff --git a/drivers/mtd/devices/doc2000.c b/drivers/mtd/devices/doc2000.c
-index a4eb8b5..8c0628f 100644
---- a/drivers/mtd/devices/doc2000.c
-+++ b/drivers/mtd/devices/doc2000.c
-@@ -753,7 +753,7 @@ static int doc_write(struct mtd_info *mtd, loff_t to, size_t len,
-
- /* The ECC will not be calculated correctly if less than 512 is written */
- /* DBB-
-- if (len != 0x200 && eccbuf)
-+ if (len != 0x200)
- printk(KERN_WARNING
- "ECC needs a full sector write (adr: %lx size %lx)\n",
- (long) to, (long) len);
diff --git a/drivers/mtd/nand/denali.c b/drivers/mtd/nand/denali.c
index 0c8bb6b..6f35deb 100644
--- a/drivers/mtd/nand/denali.c
@@ -39936,7 +40026,7 @@ 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 8dd6ba5..419cc1d 100644
+index f9d5615..99dd95f 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,
@@ -39949,10 +40039,10 @@ index 8dd6ba5..419cc1d 100644
struct sm_sysfs_attribute *vendor_attribute;
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
-index dbbea0e..3f4a0b1 100644
+index f975696..4597e21 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
-@@ -4822,7 +4822,7 @@ static unsigned int bond_get_num_tx_queues(void)
+@@ -4870,7 +4870,7 @@ static unsigned int bond_get_num_tx_queues(void)
return tx_queues;
}
@@ -39961,7 +40051,7 @@ index dbbea0e..3f4a0b1 100644
.kind = "bond",
.priv_size = sizeof(struct bonding),
.setup = bond_setup,
-@@ -4947,8 +4947,8 @@ static void __exit bonding_exit(void)
+@@ -4995,8 +4995,8 @@ static void __exit bonding_exit(void)
bond_destroy_debugfs();
@@ -39971,28 +40061,6 @@ index dbbea0e..3f4a0b1 100644
#ifdef CONFIG_NET_POLL_CONTROLLER
/*
-diff --git a/drivers/net/dummy.c b/drivers/net/dummy.c
-index 42aa54a..b710c6b 100644
---- a/drivers/net/dummy.c
-+++ b/drivers/net/dummy.c
-@@ -185,6 +185,8 @@ static int __init dummy_init_module(void)
-
- rtnl_lock();
- err = __rtnl_link_register(&dummy_link_ops);
-+ if (err < 0)
-+ goto out;
-
- for (i = 0; i < numdummies && !err; i++) {
- err = dummy_init_one();
-@@ -192,6 +194,8 @@ static int __init dummy_init_module(void)
- }
- if (err < 0)
- __rtnl_link_unregister(&dummy_link_ops);
-+
-+out:
- rtnl_unlock();
-
- return err;
diff --git a/drivers/net/ethernet/8390/ax88796.c b/drivers/net/ethernet/8390/ax88796.c
index e1d2643..7f4133b 100644
--- a/drivers/net/ethernet/8390/ax88796.c
@@ -40010,117 +40078,11 @@ index e1d2643..7f4133b 100644
}
if (!request_mem_region(mem->start, mem_size, pdev->name)) {
-diff --git a/drivers/net/ethernet/atheros/atl1e/atl1e_main.c b/drivers/net/ethernet/atheros/atl1e/atl1e_main.c
-index ac25f05..35c9d1a 100644
---- a/drivers/net/ethernet/atheros/atl1e/atl1e_main.c
-+++ b/drivers/net/ethernet/atheros/atl1e/atl1e_main.c
-@@ -1667,8 +1667,8 @@ check_sum:
- return 0;
- }
-
--static void atl1e_tx_map(struct atl1e_adapter *adapter,
-- struct sk_buff *skb, struct atl1e_tpd_desc *tpd)
-+static int atl1e_tx_map(struct atl1e_adapter *adapter,
-+ struct sk_buff *skb, struct atl1e_tpd_desc *tpd)
- {
- struct atl1e_tpd_desc *use_tpd = NULL;
- struct atl1e_tx_buffer *tx_buffer = NULL;
-@@ -1679,6 +1679,8 @@ static void atl1e_tx_map(struct atl1e_adapter *adapter,
- u16 nr_frags;
- u16 f;
- int segment;
-+ int ring_start = adapter->tx_ring.next_to_use;
-+ int ring_end;
-
- nr_frags = skb_shinfo(skb)->nr_frags;
- segment = (tpd->word3 >> TPD_SEGMENT_EN_SHIFT) & TPD_SEGMENT_EN_MASK;
-@@ -1691,6 +1693,9 @@ static void atl1e_tx_map(struct atl1e_adapter *adapter,
- tx_buffer->length = map_len;
- tx_buffer->dma = pci_map_single(adapter->pdev,
- skb->data, hdr_len, PCI_DMA_TODEVICE);
-+ if (dma_mapping_error(&adapter->pdev->dev, tx_buffer->dma))
-+ return -ENOSPC;
-+
- ATL1E_SET_PCIMAP_TYPE(tx_buffer, ATL1E_TX_PCIMAP_SINGLE);
- mapped_len += map_len;
- use_tpd->buffer_addr = cpu_to_le64(tx_buffer->dma);
-@@ -1717,6 +1722,22 @@ static void atl1e_tx_map(struct atl1e_adapter *adapter,
- tx_buffer->dma =
- pci_map_single(adapter->pdev, skb->data + mapped_len,
- map_len, PCI_DMA_TODEVICE);
-+
-+ if (dma_mapping_error(&adapter->pdev->dev, tx_buffer->dma)) {
-+ /* We need to unwind the mappings we've done */
-+ ring_end = adapter->tx_ring.next_to_use;
-+ adapter->tx_ring.next_to_use = ring_start;
-+ while (adapter->tx_ring.next_to_use != ring_end) {
-+ tpd = atl1e_get_tpd(adapter);
-+ tx_buffer = atl1e_get_tx_buffer(adapter, tpd);
-+ pci_unmap_single(adapter->pdev, tx_buffer->dma,
-+ tx_buffer->length, PCI_DMA_TODEVICE);
-+ }
-+ /* Reset the tx rings next pointer */
-+ adapter->tx_ring.next_to_use = ring_start;
-+ return -ENOSPC;
-+ }
-+
- ATL1E_SET_PCIMAP_TYPE(tx_buffer, ATL1E_TX_PCIMAP_SINGLE);
- mapped_len += map_len;
- use_tpd->buffer_addr = cpu_to_le64(tx_buffer->dma);
-@@ -1752,6 +1773,23 @@ static void atl1e_tx_map(struct atl1e_adapter *adapter,
- (i * MAX_TX_BUF_LEN),
- tx_buffer->length,
- DMA_TO_DEVICE);
-+
-+ if (dma_mapping_error(&adapter->pdev->dev, tx_buffer->dma)) {
-+ /* We need to unwind the mappings we've done */
-+ ring_end = adapter->tx_ring.next_to_use;
-+ adapter->tx_ring.next_to_use = ring_start;
-+ while (adapter->tx_ring.next_to_use != ring_end) {
-+ tpd = atl1e_get_tpd(adapter);
-+ tx_buffer = atl1e_get_tx_buffer(adapter, tpd);
-+ dma_unmap_page(&adapter->pdev->dev, tx_buffer->dma,
-+ tx_buffer->length, DMA_TO_DEVICE);
-+ }
-+
-+ /* Reset the ring next to use pointer */
-+ adapter->tx_ring.next_to_use = ring_start;
-+ return -ENOSPC;
-+ }
-+
- ATL1E_SET_PCIMAP_TYPE(tx_buffer, ATL1E_TX_PCIMAP_PAGE);
- use_tpd->buffer_addr = cpu_to_le64(tx_buffer->dma);
- use_tpd->word2 = (use_tpd->word2 & (~TPD_BUFLEN_MASK)) |
-@@ -1769,6 +1807,7 @@ static void atl1e_tx_map(struct atl1e_adapter *adapter,
- /* The last buffer info contain the skb address,
- so it will be free after unmap */
- tx_buffer->skb = skb;
-+ return 0;
- }
-
- static void atl1e_tx_queue(struct atl1e_adapter *adapter, u16 count,
-@@ -1836,10 +1875,15 @@ static netdev_tx_t atl1e_xmit_frame(struct sk_buff *skb,
- return NETDEV_TX_OK;
- }
-
-- atl1e_tx_map(adapter, skb, tpd);
-+ if (atl1e_tx_map(adapter, skb, tpd)) {
-+ dev_kfree_skb_any(skb);
-+ goto out;
-+ }
-+
- atl1e_tx_queue(adapter, tpd_req, tpd);
-
- netdev->trans_start = jiffies; /* NETIF_F_LLTX driver :( */
-+out:
- spin_unlock_irqrestore(&adapter->tx_lock, flags);
- return NETDEV_TX_OK;
- }
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h
-index aee7671..3ca2651 100644
+index 151675d..0139a9d 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h
-@@ -1093,7 +1093,7 @@ static inline u8 bnx2x_get_path_func_num(struct bnx2x *bp)
+@@ -1112,7 +1112,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 */
@@ -40130,7 +40092,7 @@ index aee7671..3ca2651 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 edfa67a..d6c52ae 100644
+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)
@@ -40153,10 +40115,10 @@ index edfa67a..d6c52ae 100644
* 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 c50696b..cf96f52 100644
+index b4c9dea..2a9927f 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
-@@ -11394,6 +11394,8 @@ static int bnx2x_init_bp(struct bnx2x *bp)
+@@ -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);
@@ -40166,10 +40128,10 @@ index c50696b..cf96f52 100644
}
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c
-index 7306416..5fb7fb5 100644
+index 32a9609..0b1c53a 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c
-@@ -2381,15 +2381,14 @@ int bnx2x_config_rx_mode(struct bnx2x *bp,
+@@ -2387,15 +2387,14 @@ int bnx2x_config_rx_mode(struct bnx2x *bp,
return rc;
}
@@ -40191,10 +40153,10 @@ index 7306416..5fb7fb5 100644
}
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.h b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.h
-index ff90760..08d8aed 100644
+index 43c00bc..dd1d03d 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.h
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.h
-@@ -1306,8 +1306,7 @@ int bnx2x_vlan_mac_move(struct bnx2x *bp,
+@@ -1321,8 +1321,7 @@ int bnx2x_vlan_mac_move(struct bnx2x *bp,
/********************* RX MODE ****************/
@@ -40205,7 +40167,7 @@ index ff90760..08d8aed 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 25309bf..fcfd54c 100644
+index ff6e30e..87e8452 100644
--- a/drivers/net/ethernet/broadcom/tg3.h
+++ b/drivers/net/ethernet/broadcom/tg3.h
@@ -147,6 +147,7 @@
@@ -40216,24 +40178,11 @@ index 25309bf..fcfd54c 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/brocade/bna/bnad_debugfs.c b/drivers/net/ethernet/brocade/bna/bnad_debugfs.c
-index 6e8bc9d..94d957d 100644
---- a/drivers/net/ethernet/brocade/bna/bnad_debugfs.c
-+++ b/drivers/net/ethernet/brocade/bna/bnad_debugfs.c
-@@ -244,7 +244,7 @@ bnad_debugfs_lseek(struct file *file, loff_t offset, int orig)
- file->f_pos += offset;
- break;
- case 2:
-- file->f_pos = debug->buffer_len - offset;
-+ file->f_pos = debug->buffer_len + offset;
- break;
- default:
- return -EINVAL;
diff --git a/drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c b/drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c
-index 2b5e621..32187b8 100644
+index 71497e8..b650951 100644
--- a/drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c
+++ b/drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c
-@@ -3036,7 +3036,9 @@ static void t3_io_resume(struct pci_dev *pdev)
+@@ -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));
@@ -40279,10 +40228,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 2886c9b..db71673 100644
+index 6e43426..1bd8365 100644
--- a/drivers/net/ethernet/emulex/benet/be_main.c
+++ b/drivers/net/ethernet/emulex/benet/be_main.c
-@@ -455,7 +455,7 @@ static void accumulate_16bit_val(u32 *acc, u16 val)
+@@ -469,7 +469,7 @@ static void accumulate_16bit_val(u32 *acc, u16 val)
if (wrapped)
newacc += 65536;
@@ -40290,9 +40239,9 @@ index 2886c9b..db71673 100644
+ ACCESS_ONCE_RW(*acc) = newacc;
}
- void be_parse_stats(struct be_adapter *adapter)
+ 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 7c361d1..57e3ff1 100644
+index 21b85fb..b49e5fc 100644
--- a/drivers/net/ethernet/faraday/ftgmac100.c
+++ b/drivers/net/ethernet/faraday/ftgmac100.c
@@ -31,6 +31,8 @@
@@ -40305,7 +40254,7 @@ index 7c361d1..57e3ff1 100644
#include "ftgmac100.h"
diff --git a/drivers/net/ethernet/faraday/ftmac100.c b/drivers/net/ethernet/faraday/ftmac100.c
-index b5ea8fb..bd25e9a 100644
+index a6eda8d..935d273 100644
--- a/drivers/net/ethernet/faraday/ftmac100.c
+++ b/drivers/net/ethernet/faraday/ftmac100.c
@@ -31,6 +31,8 @@
@@ -40356,11 +40305,11 @@ 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 5c033f2..7bbb0d8 100644
+index 5e7fb1d..f8d1810 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_init.c
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_init.c
-@@ -1894,7 +1894,9 @@ int qlcnic_83xx_config_default_opmode(struct qlcnic_adapter *adapter)
- op_mode = QLCRDX(ahw, QLC_83XX_DRV_OP_MODE);
+@@ -1948,7 +1948,9 @@ int qlcnic_83xx_config_default_opmode(struct qlcnic_adapter *adapter)
+ op_mode = QLC_83XX_DEFAULT_OPMODE;
if (op_mode == QLC_83XX_DEFAULT_OPMODE) {
- adapter->nic_ops->init_driver = qlcnic_83xx_init_default_driver;
@@ -40400,10 +40349,10 @@ index b0c3de9..fc5857e 100644
return -EIO;
}
diff --git a/drivers/net/ethernet/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c
-index 54fd2ef..33c8a4f 100644
+index 393f961..d343034 100644
--- a/drivers/net/ethernet/realtek/r8169.c
+++ b/drivers/net/ethernet/realtek/r8169.c
-@@ -740,22 +740,22 @@ struct rtl8169_private {
+@@ -753,22 +753,22 @@ struct rtl8169_private {
struct mdio_ops {
void (*write)(struct rtl8169_private *, int, int);
int (*read)(struct rtl8169_private *, int);
@@ -40430,66 +40379,11 @@ index 54fd2ef..33c8a4f 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/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c
-index 8791999..68caa85 100644
---- a/drivers/net/ethernet/renesas/sh_eth.c
-+++ b/drivers/net/ethernet/renesas/sh_eth.c
-@@ -172,8 +172,9 @@ static struct sh_eth_cpu_data sh_eth_my_cpu_data = {
- .rmcr_value = 0x00000001,
-
- .tx_check = EESR_FTC | EESR_CND | EESR_DLC | EESR_CD | EESR_RTO,
-- .eesr_err_check = EESR_TWB | EESR_TABT | EESR_RABT | EESR_RDE |
-- EESR_RFRMER | EESR_TFE | EESR_TDE | EESR_ECI,
-+ .eesr_err_check = EESR_TWB | EESR_TABT | EESR_RABT | EESR_RFE |
-+ EESR_RDE | EESR_RFRMER | EESR_TFE | EESR_TDE |
-+ EESR_ECI,
- .tx_error_check = EESR_TWB | EESR_TABT | EESR_TDE | EESR_TFE,
-
- .apr = 1,
-@@ -286,9 +287,9 @@ static struct sh_eth_cpu_data sh_eth_my_cpu_data_giga = {
- .eesipr_value = DMAC_M_RFRMER | DMAC_M_ECI | 0x003fffff,
-
- .tx_check = EESR_TC1 | EESR_FTC,
-- .eesr_err_check = EESR_TWB1 | EESR_TWB | EESR_TABT | EESR_RABT | \
-- EESR_RDE | EESR_RFRMER | EESR_TFE | EESR_TDE | \
-- EESR_ECI,
-+ .eesr_err_check = EESR_TWB1 | EESR_TWB | EESR_TABT | EESR_RABT |
-+ EESR_RFE | EESR_RDE | EESR_RFRMER | EESR_TFE |
-+ EESR_TDE | EESR_ECI,
- .tx_error_check = EESR_TWB1 | EESR_TWB | EESR_TABT | EESR_TDE | \
- EESR_TFE,
- .fdr_value = 0x0000072f,
-@@ -505,9 +506,9 @@ static struct sh_eth_cpu_data sh_eth_my_cpu_data = {
- .eesipr_value = DMAC_M_RFRMER | DMAC_M_ECI | 0x003fffff,
-
- .tx_check = EESR_TC1 | EESR_FTC,
-- .eesr_err_check = EESR_TWB1 | EESR_TWB | EESR_TABT | EESR_RABT | \
-- EESR_RDE | EESR_RFRMER | EESR_TFE | EESR_TDE | \
-- EESR_ECI,
-+ .eesr_err_check = EESR_TWB1 | EESR_TWB | EESR_TABT | EESR_RABT |
-+ EESR_RFE | EESR_RDE | EESR_RFRMER | EESR_TFE |
-+ EESR_TDE | EESR_ECI,
- .tx_error_check = EESR_TWB1 | EESR_TWB | EESR_TABT | EESR_TDE | \
- EESR_TFE,
-
-diff --git a/drivers/net/ethernet/renesas/sh_eth.h b/drivers/net/ethernet/renesas/sh_eth.h
-index 828be45..832be11 100644
---- a/drivers/net/ethernet/renesas/sh_eth.h
-+++ b/drivers/net/ethernet/renesas/sh_eth.h
-@@ -472,7 +472,7 @@ enum EESR_BIT {
-
- #define DEFAULT_TX_CHECK (EESR_FTC | EESR_CND | EESR_DLC | EESR_CD | \
- EESR_RTO)
--#define DEFAULT_EESR_ERR_CHECK (EESR_TWB | EESR_TABT | EESR_RABT | \
-+#define DEFAULT_EESR_ERR_CHECK (EESR_TWB | EESR_TABT | EESR_RABT | EESR_RFE | \
- EESR_RDE | EESR_RFRMER | EESR_ADE | \
- EESR_TFE | EESR_TDE | EESR_ECI)
- #define DEFAULT_TX_ERROR_CHECK (EESR_TWB | EESR_TABT | EESR_ADE | EESR_TDE | \
diff --git a/drivers/net/ethernet/sfc/ptp.c b/drivers/net/ethernet/sfc/ptp.c
-index 3f93624..cf01144 100644
+index 9a95abf..36df7f9 100644
--- a/drivers/net/ethernet/sfc/ptp.c
+++ b/drivers/net/ethernet/sfc/ptp.c
-@@ -553,7 +553,7 @@ static int efx_ptp_synchronize(struct efx_nic *efx, unsigned int num_readings)
+@@ -535,7 +535,7 @@ static int efx_ptp_synchronize(struct efx_nic *efx, unsigned int num_readings)
(u32)((u64)ptp->start.dma_addr >> 32));
/* Clear flag that signals MC ready */
@@ -40513,19 +40407,6 @@ index 50617c5..b13724c 100644
}
/* To mask all all interrupts.*/
-diff --git a/drivers/net/ethernet/sun/sunvnet.c b/drivers/net/ethernet/sun/sunvnet.c
-index 1df0ff3..3df5684 100644
---- a/drivers/net/ethernet/sun/sunvnet.c
-+++ b/drivers/net/ethernet/sun/sunvnet.c
-@@ -1239,6 +1239,8 @@ static int vnet_port_remove(struct vio_dev *vdev)
- dev_set_drvdata(&vdev->dev, NULL);
-
- kfree(port);
-+
-+ unregister_netdev(vp->dev);
- }
- return 0;
- }
diff --git a/drivers/net/hyperv/hyperv_net.h b/drivers/net/hyperv/hyperv_net.h
index e6fe0d8..2b7d752 100644
--- a/drivers/net/hyperv/hyperv_net.h
@@ -40562,10 +40443,10 @@ 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 8f1c256..a2991d1 100644
+index bf0d55e..82bcfbd1 100644
--- a/drivers/net/ieee802154/fakehard.c
+++ b/drivers/net/ieee802154/fakehard.c
-@@ -385,7 +385,7 @@ static int ieee802154fake_probe(struct platform_device *pdev)
+@@ -364,7 +364,7 @@ static int ieee802154fake_probe(struct platform_device *pdev)
phy->transmit_power = 0xbf;
dev->netdev_ops = &fake_ops;
@@ -40574,34 +40455,11 @@ index 8f1c256..a2991d1 100644
priv = netdev_priv(dev);
priv->phy = phy;
-diff --git a/drivers/net/ifb.c b/drivers/net/ifb.c
-index 8216438..c51944d 100644
---- a/drivers/net/ifb.c
-+++ b/drivers/net/ifb.c
-@@ -290,11 +290,17 @@ static int __init ifb_init_module(void)
-
- rtnl_lock();
- err = __rtnl_link_register(&ifb_link_ops);
-+ if (err < 0)
-+ goto out;
-
-- for (i = 0; i < numifbs && !err; i++)
-+ for (i = 0; i < numifbs && !err; i++) {
- err = ifb_init_one(i);
-+ cond_resched();
-+ }
- if (err)
- __rtnl_link_unregister(&ifb_link_ops);
-+
-+out:
- rtnl_unlock();
-
- return err;
diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c
-index 011062e..ada88e9 100644
+index 6e91931..2b0ebe7 100644
--- a/drivers/net/macvlan.c
+++ b/drivers/net/macvlan.c
-@@ -892,13 +892,15 @@ static const struct nla_policy macvlan_policy[IFLA_MACVLAN_MAX + 1] = {
+@@ -905,13 +905,15 @@ static const struct nla_policy macvlan_policy[IFLA_MACVLAN_MAX + 1] = {
int macvlan_link_register(struct rtnl_link_ops *ops)
{
/* common fields */
@@ -40624,7 +40482,7 @@ index 011062e..ada88e9 100644
return rtnl_link_register(ops);
};
-@@ -954,7 +956,7 @@ static int macvlan_device_event(struct notifier_block *unused,
+@@ -967,7 +969,7 @@ static int macvlan_device_event(struct notifier_block *unused,
return NOTIFY_DONE;
}
@@ -40634,121 +40492,10 @@ index 011062e..ada88e9 100644
};
diff --git a/drivers/net/macvtap.c b/drivers/net/macvtap.c
-index acf6450..d880503 100644
+index 523d6b2..5e16aa1 100644
--- a/drivers/net/macvtap.c
+++ b/drivers/net/macvtap.c
-@@ -525,8 +525,10 @@ static int zerocopy_sg_from_iovec(struct sk_buff *skb, const struct iovec *from,
- return -EMSGSIZE;
- num_pages = get_user_pages_fast(base, size, 0, &page[i]);
- if (num_pages != size) {
-- for (i = 0; i < num_pages; i++)
-- put_page(page[i]);
-+ int j;
-+
-+ for (j = 0; j < num_pages; j++)
-+ put_page(page[i + j]);
- return -EFAULT;
- }
- truesize = size * PAGE_SIZE;
-@@ -632,6 +634,28 @@ static int macvtap_skb_to_vnet_hdr(const struct sk_buff *skb,
- return 0;
- }
-
-+static unsigned long iov_pages(const struct iovec *iv, int offset,
-+ unsigned long nr_segs)
-+{
-+ unsigned long seg, base;
-+ int pages = 0, len, size;
-+
-+ while (nr_segs && (offset >= iv->iov_len)) {
-+ offset -= iv->iov_len;
-+ ++iv;
-+ --nr_segs;
-+ }
-+
-+ for (seg = 0; seg < nr_segs; seg++) {
-+ base = (unsigned long)iv[seg].iov_base + offset;
-+ len = iv[seg].iov_len - offset;
-+ size = ((base & ~PAGE_MASK) + len + ~PAGE_MASK) >> PAGE_SHIFT;
-+ pages += size;
-+ offset = 0;
-+ }
-+
-+ return pages;
-+}
-
- /* Get packet from user space buffer */
- static ssize_t macvtap_get_user(struct macvtap_queue *q, struct msghdr *m,
-@@ -647,6 +671,7 @@ static ssize_t macvtap_get_user(struct macvtap_queue *q, struct msghdr *m,
- int copylen = 0;
- bool zerocopy = false;
- struct flow_keys keys;
-+ size_t linear;
-
- if (q->flags & IFF_VNET_HDR) {
- vnet_hdr_len = q->vnet_hdr_sz;
-@@ -678,42 +703,35 @@ static ssize_t macvtap_get_user(struct macvtap_queue *q, struct msghdr *m,
- if (unlikely(count > UIO_MAXIOV))
- goto err;
-
-- if (m && m->msg_control && sock_flag(&q->sk, SOCK_ZEROCOPY))
-- zerocopy = true;
-+ if (m && m->msg_control && sock_flag(&q->sk, SOCK_ZEROCOPY)) {
-+ copylen = vnet_hdr.hdr_len ? vnet_hdr.hdr_len : GOODCOPY_LEN;
-+ linear = copylen;
-+ if (iov_pages(iv, vnet_hdr_len + copylen, count)
-+ <= MAX_SKB_FRAGS)
-+ zerocopy = true;
-+ }
-
-- if (zerocopy) {
-- /* Userspace may produce vectors with count greater than
-- * MAX_SKB_FRAGS, so we need to linearize parts of the skb
-- * to let the rest of data to be fit in the frags.
-- */
-- if (count > MAX_SKB_FRAGS) {
-- copylen = iov_length(iv, count - MAX_SKB_FRAGS);
-- if (copylen < vnet_hdr_len)
-- copylen = 0;
-- else
-- copylen -= vnet_hdr_len;
-- }
-- /* There are 256 bytes to be copied in skb, so there is enough
-- * room for skb expand head in case it is used.
-- * The rest buffer is mapped from userspace.
-- */
-- if (copylen < vnet_hdr.hdr_len)
-- copylen = vnet_hdr.hdr_len;
-- if (!copylen)
-- copylen = GOODCOPY_LEN;
-- } else
-+ if (!zerocopy) {
- copylen = len;
-+ linear = vnet_hdr.hdr_len;
-+ }
-
- skb = macvtap_alloc_skb(&q->sk, NET_IP_ALIGN, copylen,
-- vnet_hdr.hdr_len, noblock, &err);
-+ linear, noblock, &err);
- if (!skb)
- goto err;
-
- if (zerocopy)
- err = zerocopy_sg_from_iovec(skb, iv, vnet_hdr_len, count);
-- else
-+ else {
- err = skb_copy_datagram_from_iovec(skb, 0, iv, vnet_hdr_len,
- len);
-+ if (!err && m && m->msg_control) {
-+ struct ubuf_info *uarg = m->msg_control;
-+ uarg->callback(uarg, false);
-+ }
-+ }
-+
- if (err)
- goto err_kfree;
-
-@@ -1099,7 +1117,7 @@ static int macvtap_device_event(struct notifier_block *unused,
+@@ -1110,7 +1110,7 @@ static int macvtap_device_event(struct notifier_block *unused,
return NOTIFY_DONE;
}
@@ -40805,10 +40552,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 0017b67..ab8f595 100644
+index b305105..8ead6df 100644
--- a/drivers/net/team/team.c
+++ b/drivers/net/team/team.c
-@@ -2668,7 +2668,7 @@ static int team_device_event(struct notifier_block *unused,
+@@ -2682,7 +2682,7 @@ static int team_device_event(struct notifier_block *unused,
return NOTIFY_DONE;
}
@@ -40818,125 +40565,10 @@ index 0017b67..ab8f595 100644
};
diff --git a/drivers/net/tun.c b/drivers/net/tun.c
-index 8ad822e..9bf0655 100644
+index 2491eb2..694b2ec 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
-@@ -1013,8 +1013,10 @@ static int zerocopy_sg_from_iovec(struct sk_buff *skb, const struct iovec *from,
- return -EMSGSIZE;
- num_pages = get_user_pages_fast(base, size, 0, &page[i]);
- if (num_pages != size) {
-- for (i = 0; i < num_pages; i++)
-- put_page(page[i]);
-+ int j;
-+
-+ for (j = 0; j < num_pages; j++)
-+ put_page(page[i + j]);
- return -EFAULT;
- }
- truesize = size * PAGE_SIZE;
-@@ -1038,6 +1040,29 @@ static int zerocopy_sg_from_iovec(struct sk_buff *skb, const struct iovec *from,
- return 0;
- }
-
-+static unsigned long iov_pages(const struct iovec *iv, int offset,
-+ unsigned long nr_segs)
-+{
-+ unsigned long seg, base;
-+ int pages = 0, len, size;
-+
-+ while (nr_segs && (offset >= iv->iov_len)) {
-+ offset -= iv->iov_len;
-+ ++iv;
-+ --nr_segs;
-+ }
-+
-+ for (seg = 0; seg < nr_segs; seg++) {
-+ base = (unsigned long)iv[seg].iov_base + offset;
-+ len = iv[seg].iov_len - offset;
-+ size = ((base & ~PAGE_MASK) + len + ~PAGE_MASK) >> PAGE_SHIFT;
-+ pages += size;
-+ offset = 0;
-+ }
-+
-+ return pages;
-+}
-+
- /* Get packet from user space buffer */
- static ssize_t tun_get_user(struct tun_struct *tun, struct tun_file *tfile,
- void *msg_control, const struct iovec *iv,
-@@ -1045,7 +1070,7 @@ static ssize_t tun_get_user(struct tun_struct *tun, struct tun_file *tfile,
- {
- struct tun_pi pi = { 0, cpu_to_be16(ETH_P_IP) };
- struct sk_buff *skb;
-- size_t len = total_len, align = NET_SKB_PAD;
-+ size_t len = total_len, align = NET_SKB_PAD, linear;
- struct virtio_net_hdr gso = { 0 };
- int offset = 0;
- int copylen;
-@@ -1086,34 +1111,23 @@ static ssize_t tun_get_user(struct tun_struct *tun, struct tun_file *tfile,
- return -EINVAL;
- }
-
-- if (msg_control)
-- zerocopy = true;
--
-- if (zerocopy) {
-- /* Userspace may produce vectors with count greater than
-- * MAX_SKB_FRAGS, so we need to linearize parts of the skb
-- * to let the rest of data to be fit in the frags.
-- */
-- if (count > MAX_SKB_FRAGS) {
-- copylen = iov_length(iv, count - MAX_SKB_FRAGS);
-- if (copylen < offset)
-- copylen = 0;
-- else
-- copylen -= offset;
-- } else
-- copylen = 0;
-- /* There are 256 bytes to be copied in skb, so there is enough
-- * room for skb expand head in case it is used.
-+ if (msg_control) {
-+ /* There are 256 bytes to be copied in skb, so there is
-+ * enough room for skb expand head in case it is used.
- * The rest of the buffer is mapped from userspace.
- */
-- if (copylen < gso.hdr_len)
-- copylen = gso.hdr_len;
-- if (!copylen)
-- copylen = GOODCOPY_LEN;
-- } else
-+ copylen = gso.hdr_len ? gso.hdr_len : GOODCOPY_LEN;
-+ linear = copylen;
-+ if (iov_pages(iv, offset + copylen, count) <= MAX_SKB_FRAGS)
-+ zerocopy = true;
-+ }
-+
-+ if (!zerocopy) {
- copylen = len;
-+ linear = gso.hdr_len;
-+ }
-
-- skb = tun_alloc_skb(tfile, align, copylen, gso.hdr_len, noblock);
-+ skb = tun_alloc_skb(tfile, align, copylen, linear, noblock);
- if (IS_ERR(skb)) {
- if (PTR_ERR(skb) != -EAGAIN)
- tun->dev->stats.rx_dropped++;
-@@ -1122,8 +1136,13 @@ static ssize_t tun_get_user(struct tun_struct *tun, struct tun_file *tfile,
-
- if (zerocopy)
- err = zerocopy_sg_from_iovec(skb, iv, offset, count);
-- else
-+ else {
- err = skb_copy_datagram_from_iovec(skb, 0, iv, offset, len);
-+ if (!err && msg_control) {
-+ struct ubuf_info *uarg = msg_control;
-+ uarg->callback(uarg, false);
-+ }
-+ }
-
- if (err) {
- tun->dev->stats.rx_dropped++;
-@@ -1859,7 +1878,7 @@ unlock:
+@@ -1869,7 +1869,7 @@ unlock:
}
static long __tun_chr_ioctl(struct file *file, unsigned int cmd,
@@ -40945,7 +40577,7 @@ index 8ad822e..9bf0655 100644
{
struct tun_file *tfile = file->private_data;
struct tun_struct *tun;
-@@ -1871,6 +1890,9 @@ static long __tun_chr_ioctl(struct file *file, unsigned int cmd,
+@@ -1881,6 +1881,9 @@ static long __tun_chr_ioctl(struct file *file, unsigned int cmd,
int vnet_hdr_sz;
int ret;
@@ -40956,7 +40588,7 @@ index 8ad822e..9bf0655 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 e2dd324..be92fcf 100644
+index cba1d46..f703766 100644
--- a/drivers/net/usb/hso.c
+++ b/drivers/net/usb/hso.c
@@ -71,7 +71,7 @@
@@ -41037,7 +40669,7 @@ index e2dd324..be92fcf 100644
/* Setup and send a ctrl req read on
* port i */
if (!serial->rx_urb_filled[0]) {
-@@ -3066,7 +3065,7 @@ static int hso_resume(struct usb_interface *iface)
+@@ -3057,7 +3056,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)) {
@@ -41047,10 +40679,10 @@ index e2dd324..be92fcf 100644
hso_start_serial_device(serial_table[i], GFP_NOIO);
hso_kick_transmit(dev2ser(serial_table[i]));
diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
-index a4fe5f1..6c9e77f 100644
+index 57325f3..36b181f 100644
--- a/drivers/net/vxlan.c
+++ b/drivers/net/vxlan.c
-@@ -1454,7 +1454,7 @@ nla_put_failure:
+@@ -1579,7 +1579,7 @@ nla_put_failure:
return -EMSGSIZE;
}
@@ -41060,7 +40692,7 @@ index a4fe5f1..6c9e77f 100644
.maxtype = IFLA_VXLAN_MAX,
.policy = vxlan_policy,
diff --git a/drivers/net/wireless/at76c50x-usb.c b/drivers/net/wireless/at76c50x-usb.c
-index 5ac5f7a..5f82012 100644
+index 34c8a33..3261fdc 100644
--- a/drivers/net/wireless/at76c50x-usb.c
+++ b/drivers/net/wireless/at76c50x-usb.c
@@ -353,7 +353,7 @@ static int at76_dfu_get_state(struct usb_device *udev, u8 *state)
@@ -41278,10 +40910,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 784e81c..349e01e 100644
+index ae30343..a117806 100644
--- a/drivers/net/wireless/ath/ath9k/hw.h
+++ b/drivers/net/wireless/ath/ath9k/hw.h
-@@ -653,7 +653,7 @@ struct ath_hw_private_ops {
+@@ -652,7 +652,7 @@ struct ath_hw_private_ops {
/* ANI */
void (*ani_cache_ini_regs)(struct ath_hw *ah);
@@ -41290,7 +40922,7 @@ index 784e81c..349e01e 100644
/**
* struct ath_spec_scan - parameters for Atheros spectral scan
-@@ -722,7 +722,7 @@ struct ath_hw_ops {
+@@ -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);
@@ -41300,7 +40932,7 @@ index 784e81c..349e01e 100644
struct ath_nf_limits {
s16 max;
diff --git a/drivers/net/wireless/iwlegacy/3945-mac.c b/drivers/net/wireless/iwlegacy/3945-mac.c
-index c353b5f..62aaca2 100644
+index b37a582..680835d 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)
@@ -41315,7 +40947,7 @@ index c353b5f..62aaca2 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 81d4071..f2071ea 100644
+index d532948..e0d8bb1 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,
@@ -41354,6 +40986,21 @@ index 81d4071..f2071ea 100644
int value;
memset(buf, 0, sizeof(buf));
+@@ -698,10 +698,10 @@ DEBUGFS_READ_FILE_OPS(temperature);
+ DEBUGFS_READ_WRITE_FILE_OPS(sleep_level_override);
+ DEBUGFS_READ_FILE_OPS(current_sleep_command);
+
+-static const char *fmt_value = " %-30s %10u\n";
+-static const char *fmt_hex = " %-30s 0x%02X\n";
+-static const char *fmt_table = " %-30s %10u %10u %10u %10u\n";
+-static const char *fmt_header =
++static const char fmt_value[] = " %-30s %10u\n";
++static const char fmt_hex[] = " %-30s 0x%02X\n";
++static const char fmt_table[] = " %-30s %10u %10u %10u %10u\n";
++static const char fmt_header[] =
+ "%-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,
{
struct iwl_priv *priv = file->private_data;
@@ -41417,7 +41064,7 @@ index 81d4071..f2071ea 100644
memset(buf, 0, sizeof(buf));
buf_size = min(count, sizeof(buf) - 1);
-@@ -2256,7 +2256,7 @@ static ssize_t iwl_dbgfs_log_event_write(struct file *file,
+@@ -2254,7 +2254,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];
@@ -41426,7 +41073,7 @@ index 81d4071..f2071ea 100644
/* check that the interface is up */
if (!iwl_is_ready(priv))
-@@ -2310,7 +2310,7 @@ static ssize_t iwl_dbgfs_calib_disabled_write(struct file *file,
+@@ -2308,7 +2308,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;
@@ -41436,10 +41083,10 @@ index 81d4071..f2071ea 100644
memset(buf, 0, sizeof(buf));
buf_size = min(count, sizeof(buf) - 1);
diff --git a/drivers/net/wireless/iwlwifi/pcie/trans.c b/drivers/net/wireless/iwlwifi/pcie/trans.c
-index 12c4f31..484d948 100644
+index 50ba0a4..29424e7 100644
--- a/drivers/net/wireless/iwlwifi/pcie/trans.c
+++ b/drivers/net/wireless/iwlwifi/pcie/trans.c
-@@ -1328,7 +1328,7 @@ static ssize_t iwl_dbgfs_interrupt_write(struct file *file,
+@@ -1329,7 +1329,7 @@ static ssize_t iwl_dbgfs_interrupt_write(struct file *file,
struct isr_statistics *isr_stats = &trans_pcie->isr_stats;
char buf[8];
@@ -41448,7 +41095,7 @@ index 12c4f31..484d948 100644
u32 reset_flag;
memset(buf, 0, sizeof(buf));
-@@ -1349,7 +1349,7 @@ static ssize_t iwl_dbgfs_csr_write(struct file *file,
+@@ -1350,7 +1350,7 @@ static ssize_t iwl_dbgfs_csr_write(struct file *file,
{
struct iwl_trans *trans = file->private_data;
char buf[8];
@@ -41458,10 +41105,10 @@ index 12c4f31..484d948 100644
memset(buf, 0, sizeof(buf));
diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c
-index 2b49f48..14fc244 100644
+index cb34c78..9fec0dc 100644
--- a/drivers/net/wireless/mac80211_hwsim.c
+++ b/drivers/net/wireless/mac80211_hwsim.c
-@@ -2143,25 +2143,19 @@ static int __init init_mac80211_hwsim(void)
+@@ -2195,25 +2195,19 @@ static int __init init_mac80211_hwsim(void)
if (channels > 1) {
hwsim_if_comb.num_different_channels = channels;
@@ -41500,48 +41147,8 @@ index 2b49f48..14fc244 100644
}
spin_lock_init(&hwsim_radio_lock);
-diff --git a/drivers/net/wireless/mwifiex/debugfs.c b/drivers/net/wireless/mwifiex/debugfs.c
-index 753b568..a5f9875 100644
---- a/drivers/net/wireless/mwifiex/debugfs.c
-+++ b/drivers/net/wireless/mwifiex/debugfs.c
-@@ -26,10 +26,17 @@
- static struct dentry *mwifiex_dfs_dir;
-
- static char *bss_modes[] = {
-- "Unknown",
-- "Ad-hoc",
-- "Managed",
-- "Auto"
-+ "UNSPECIFIED",
-+ "ADHOC",
-+ "STATION",
-+ "AP",
-+ "AP_VLAN",
-+ "WDS",
-+ "MONITOR",
-+ "MESH_POINT",
-+ "P2P_CLIENT",
-+ "P2P_GO",
-+ "P2P_DEVICE",
- };
-
- /* size/addr for mwifiex_debug_info */
-@@ -200,7 +207,12 @@ mwifiex_info_read(struct file *file, char __user *ubuf,
- p += sprintf(p, "driver_version = %s", fmt);
- p += sprintf(p, "\nverext = %s", priv->version_str);
- p += sprintf(p, "\ninterface_name=\"%s\"\n", netdev->name);
-- p += sprintf(p, "bss_mode=\"%s\"\n", bss_modes[info.bss_mode]);
-+
-+ if (info.bss_mode >= ARRAY_SIZE(bss_modes))
-+ p += sprintf(p, "bss_mode=\"%d\"\n", info.bss_mode);
-+ else
-+ p += sprintf(p, "bss_mode=\"%s\"\n", bss_modes[info.bss_mode]);
-+
- p += sprintf(p, "media_state=\"%s\"\n",
- (!priv->media_connected ? "Disconnected" : "Connected"));
- p += sprintf(p, "mac_address=\"%pM\"\n", netdev->dev_addr);
diff --git a/drivers/net/wireless/rndis_wlan.c b/drivers/net/wireless/rndis_wlan.c
-index 525fd75..6c9f791 100644
+index 8169a85..7fa3b47 100644
--- a/drivers/net/wireless/rndis_wlan.c
+++ b/drivers/net/wireless/rndis_wlan.c
@@ -1238,7 +1238,7 @@ static int set_rts_threshold(struct usbnet *usbdev, u32 rts_threshold)
@@ -41554,10 +41161,10 @@ index 525fd75..6c9f791 100644
tmp = cpu_to_le32(rts_threshold);
diff --git a/drivers/net/wireless/rt2x00/rt2x00.h b/drivers/net/wireless/rt2x00/rt2x00.h
-index 086abb4..8279c30 100644
+index 7510723..5ba37f5 100644
--- a/drivers/net/wireless/rt2x00/rt2x00.h
+++ b/drivers/net/wireless/rt2x00/rt2x00.h
-@@ -396,7 +396,7 @@ struct rt2x00_intf {
+@@ -386,7 +386,7 @@ struct rt2x00_intf {
* for hardware which doesn't support hardware
* sequence counting.
*/
@@ -41567,10 +41174,10 @@ index 086abb4..8279c30 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 4d91795..62fccff 100644
+index 2c12311..7b77f24 100644
--- a/drivers/net/wireless/rt2x00/rt2x00queue.c
+++ b/drivers/net/wireless/rt2x00/rt2x00queue.c
-@@ -251,9 +251,9 @@ static void rt2x00queue_create_tx_descriptor_seq(struct rt2x00_dev *rt2x00dev,
+@@ -252,9 +252,9 @@ static void rt2x00queue_create_tx_descriptor_seq(struct rt2x00_dev *rt2x00dev,
* sequence counter given by mac80211.
*/
if (test_bit(ENTRY_TXD_FIRST_FRAGMENT, &txdesc->flags))
@@ -41583,10 +41190,10 @@ index 4d91795..62fccff 100644
hdr->seq_ctrl &= cpu_to_le16(IEEE80211_SCTL_FRAG);
hdr->seq_ctrl |= cpu_to_le16(seqno);
diff --git a/drivers/net/wireless/ti/wl1251/sdio.c b/drivers/net/wireless/ti/wl1251/sdio.c
-index e57ee48..541cf6c 100644
+index e2b3d9c..67a5184 100644
--- a/drivers/net/wireless/ti/wl1251/sdio.c
+++ b/drivers/net/wireless/ti/wl1251/sdio.c
-@@ -269,13 +269,17 @@ static int wl1251_sdio_probe(struct sdio_func *func,
+@@ -271,13 +271,17 @@ static int wl1251_sdio_probe(struct sdio_func *func,
irq_set_irq_type(wl->irq, IRQ_TYPE_EDGE_RISING);
@@ -41609,7 +41216,7 @@ index e57ee48..541cf6c 100644
wl1251_info("using SDIO interrupt");
}
diff --git a/drivers/net/wireless/ti/wl12xx/main.c b/drivers/net/wireless/ti/wl12xx/main.c
-index 09694e3..24ccec7 100644
+index 1c627da..69f7d17 100644
--- a/drivers/net/wireless/ti/wl12xx/main.c
+++ b/drivers/net/wireless/ti/wl12xx/main.c
@@ -656,7 +656,9 @@ static int wl12xx_identify_chip(struct wl1271 *wl)
@@ -41635,10 +41242,10 @@ index 09694e3..24ccec7 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 da3ef1b..4790b95 100644
+index 9fa692d..b31fee0 100644
--- a/drivers/net/wireless/ti/wl18xx/main.c
+++ b/drivers/net/wireless/ti/wl18xx/main.c
-@@ -1664,8 +1664,10 @@ static int wl18xx_setup(struct wl1271 *wl)
+@@ -1687,8 +1687,10 @@ static int wl18xx_setup(struct wl1271 *wl)
}
if (!checksum_param) {
@@ -41811,7 +41418,7 @@ index 93404f7..4a313d8 100644
};
diff --git a/drivers/parport/procfs.c b/drivers/parport/procfs.c
-index 3f56bc0..707d642 100644
+index 92ed045..62d39bd7 100644
--- a/drivers/parport/procfs.c
+++ b/drivers/parport/procfs.c
@@ -64,7 +64,7 @@ static int do_active_device(ctl_table *table, int write,
@@ -41942,10 +41549,10 @@ index 76ba8a1..20ca857 100644
/* initialize our int15 lock */
diff --git a/drivers/pci/hotplug/pci_hotplug_core.c b/drivers/pci/hotplug/pci_hotplug_core.c
-index 202f4a9..8ee47d0 100644
+index ec20f74..c1d961e 100644
--- a/drivers/pci/hotplug/pci_hotplug_core.c
+++ b/drivers/pci/hotplug/pci_hotplug_core.c
-@@ -448,8 +448,10 @@ int __pci_hp_register(struct hotplug_slot *slot, struct pci_bus *bus,
+@@ -441,8 +441,10 @@ int __pci_hp_register(struct hotplug_slot *slot, struct pci_bus *bus,
return -EINVAL;
}
@@ -41972,7 +41579,7 @@ index 7d72c5e..edce02c 100644
int retval = -ENOMEM;
diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c
-index 9c6e9bb..2916736 100644
+index 5b4a9d9..cd5ac1f 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)
@@ -42003,10 +41610,10 @@ index 9c6e9bb..2916736 100644
if (!sysfs_initialized)
return -EACCES;
diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h
-index 7346ee6..41520eb 100644
+index d1182c4..2a138ec 100644
--- a/drivers/pci/pci.h
+++ b/drivers/pci/pci.h
-@@ -93,7 +93,7 @@ struct pci_vpd_ops {
+@@ -92,7 +92,7 @@ struct pci_vpd_ops {
struct pci_vpd {
unsigned int len;
const struct pci_vpd_ops *ops;
@@ -42014,7 +41621,7 @@ index 7346ee6..41520eb 100644
+ bin_attribute_no_const *attr; /* descriptor for sysfs VPD entry */
};
- extern int pci_vpd_pci22_init(struct pci_dev *dev);
+ 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
--- a/drivers/pci/pcie/aspm.c
@@ -42033,7 +41640,7 @@ 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 9c8b3bd..899c8fa 100644
+index ea37072..10e58e56 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,
@@ -42046,10 +41653,10 @@ index 9c8b3bd..899c8fa 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 0b00947..64f7c0a 100644
+index 0812608..b04018c4 100644
--- a/drivers/pci/proc.c
+++ b/drivers/pci/proc.c
-@@ -465,7 +465,16 @@ static const struct file_operations proc_bus_pci_dev_operations = {
+@@ -453,7 +453,16 @@ static const struct file_operations proc_bus_pci_dev_operations = {
static int __init pci_proc_init(void)
{
struct pci_dev *dev = NULL;
@@ -42105,10 +41712,10 @@ index 6b22938..bc9700e 100644
/* disable hardware control by fn key */
diff --git a/drivers/platform/x86/sony-laptop.c b/drivers/platform/x86/sony-laptop.c
-index 14d4dce..b129917 100644
+index 2ac045f..39c443d 100644
--- a/drivers/platform/x86/sony-laptop.c
+++ b/drivers/platform/x86/sony-laptop.c
-@@ -2465,7 +2465,7 @@ static void sony_nc_gfx_switch_cleanup(struct platform_device *pd)
+@@ -2483,7 +2483,7 @@ static void sony_nc_gfx_switch_cleanup(struct platform_device *pd)
}
/* High speed charging function */
@@ -42118,7 +41725,7 @@ index 14d4dce..b129917 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 edec135..59a24a3 100644
+index 54d31c0..3f896d3 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)
@@ -42332,12 +41939,12 @@ index 3e6db1c..1fbbdae 100644
/* check if the resource is reserved */
diff --git a/drivers/power/pda_power.c b/drivers/power/pda_power.c
-index 7df7c5f..bd48c47 100644
+index 0c52e2a..3421ab7 100644
--- a/drivers/power/pda_power.c
+++ b/drivers/power/pda_power.c
@@ -37,7 +37,11 @@ static int polling;
- #ifdef CONFIG_USB_OTG_UTILS
+ #if IS_ENABLED(CONFIG_USB_PHY)
static struct usb_phy *transceiver;
-static struct notifier_block otg_nb;
+static int otg_handle_notification(struct notifier_block *nb,
@@ -42350,7 +41957,7 @@ index 7df7c5f..bd48c47 100644
static struct regulator *ac_draw;
@@ -369,7 +373,6 @@ static int pda_power_probe(struct platform_device *pdev)
- #ifdef CONFIG_USB_OTG_UTILS
+ #if IS_ENABLED(CONFIG_USB_PHY)
if (!IS_ERR_OR_NULL(transceiver) && pdata->use_otg_notifier) {
- otg_nb.notifier_call = otg_handle_notification;
ret = usb_register_notifier(transceiver, &otg_nb);
@@ -42376,7 +41983,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 5deac43..608c5ff 100644
+index 1c517c3..ffa2f17 100644
--- a/drivers/power/power_supply_core.c
+++ b/drivers/power/power_supply_core.c
@@ -24,7 +24,10 @@
@@ -42389,9 +41996,9 @@ index 5deac43..608c5ff 100644
+ .groups = power_supply_attr_groups,
+};
- static int __power_supply_changed_work(struct device *dev, void *data)
- {
-@@ -393,7 +396,7 @@ static int __init power_supply_class_init(void)
+ 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)
return PTR_ERR(power_supply_class);
power_supply_class->dev_uevent = power_supply_uevent;
@@ -42425,7 +42032,7 @@ index 29178f7..c65f324 100644
__power_supply_attrs[i] = &power_supply_attrs[i].attr;
}
diff --git a/drivers/regulator/max8660.c b/drivers/regulator/max8660.c
-index 4d7c635..9860196 100644
+index d428ef9..fdc0357 100644
--- a/drivers/regulator/max8660.c
+++ b/drivers/regulator/max8660.c
@@ -333,8 +333,10 @@ static int max8660_probe(struct i2c_client *client,
@@ -42442,7 +42049,7 @@ index 4d7c635..9860196 100644
/*
diff --git a/drivers/regulator/max8973-regulator.c b/drivers/regulator/max8973-regulator.c
-index 9a8ea91..c483dd9 100644
+index adb1414..c13e0ce 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,
@@ -42461,10 +42068,10 @@ index 9a8ea91..c483dd9 100644
max->enable_external_control = pdata->enable_ext_control;
diff --git a/drivers/regulator/mc13892-regulator.c b/drivers/regulator/mc13892-regulator.c
-index 9891aec..beb3083 100644
+index b716283..3cc4349 100644
--- a/drivers/regulator/mc13892-regulator.c
+++ b/drivers/regulator/mc13892-regulator.c
-@@ -583,10 +583,12 @@ static int mc13892_regulator_probe(struct platform_device *pdev)
+@@ -582,10 +582,12 @@ static int mc13892_regulator_probe(struct platform_device *pdev)
}
mc13xxx_unlock(mc13892);
@@ -42478,9 +42085,9 @@ index 9891aec..beb3083 100644
+ pax_close_kernel();
mc13xxx_data = mc13xxx_parse_regulators_dt(pdev, mc13892_regulators,
- ARRAY_SIZE(mc13892_regulators),
+ ARRAY_SIZE(mc13892_regulators));
diff --git a/drivers/rtc/rtc-cmos.c b/drivers/rtc/rtc-cmos.c
-index cc5bea9..689f7d9 100644
+index f1cb706..4c7832a 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)
@@ -42516,10 +42123,10 @@ index d049393..bb20be0 100644
case RTC_PIE_ON:
diff --git a/drivers/rtc/rtc-ds1307.c b/drivers/rtc/rtc-ds1307.c
-index 970a236..3613169 100644
+index b53992a..776df84 100644
--- a/drivers/rtc/rtc-ds1307.c
+++ b/drivers/rtc/rtc-ds1307.c
-@@ -106,7 +106,7 @@ struct ds1307 {
+@@ -107,7 +107,7 @@ struct ds1307 {
u8 offset; /* register's offset */
u8 regs[11];
u16 nvram_offset;
@@ -42578,32 +42185,6 @@ index 23a90e7..9cf04ee 100644
/*
* Queue element to wait for room in request queue. FIFO order is
-diff --git a/drivers/scsi/bfa/bfad_debugfs.c b/drivers/scsi/bfa/bfad_debugfs.c
-index 439c012..b63d534 100644
---- a/drivers/scsi/bfa/bfad_debugfs.c
-+++ b/drivers/scsi/bfa/bfad_debugfs.c
-@@ -186,7 +186,7 @@ bfad_debugfs_lseek(struct file *file, loff_t offset, int orig)
- file->f_pos += offset;
- break;
- case 2:
-- file->f_pos = debug->buffer_len - offset;
-+ file->f_pos = debug->buffer_len + offset;
- break;
- default:
- return -EINVAL;
-diff --git a/drivers/scsi/fnic/fnic_debugfs.c b/drivers/scsi/fnic/fnic_debugfs.c
-index adc1f7f..85e1ffd 100644
---- a/drivers/scsi/fnic/fnic_debugfs.c
-+++ b/drivers/scsi/fnic/fnic_debugfs.c
-@@ -174,7 +174,7 @@ static loff_t fnic_trace_debugfs_lseek(struct file *file,
- pos = file->f_pos + offset;
- break;
- case 2:
-- pos = fnic_dbg_prt->buffer_len - offset;
-+ pos = fnic_dbg_prt->buffer_len + offset;
- }
- return (pos < 0 || pos > fnic_dbg_prt->buffer_len) ?
- -EINVAL : (file->f_pos = pos);
diff --git a/drivers/scsi/hosts.c b/drivers/scsi/hosts.c
index df0c3c7..b00e1d0 100644
--- a/drivers/scsi/hosts.c
@@ -42767,7 +42348,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 c772d8d..35c362c 100644
+index 8b928c6..9c76300 100644
--- a/drivers/scsi/libfc/fc_exch.c
+++ b/drivers/scsi/libfc/fc_exch.c
@@ -100,12 +100,12 @@ struct fc_exch_mgr {
@@ -42789,7 +42370,7 @@ index c772d8d..35c362c 100644
} stats;
};
-@@ -725,7 +725,7 @@ static struct fc_exch *fc_exch_em_alloc(struct fc_lport *lport,
+@@ -736,7 +736,7 @@ static struct fc_exch *fc_exch_em_alloc(struct fc_lport *lport,
/* allocate memory for exchange */
ep = mempool_alloc(mp->ep_pool, GFP_ATOMIC);
if (!ep) {
@@ -42798,7 +42379,7 @@ index c772d8d..35c362c 100644
goto out;
}
memset(ep, 0, sizeof(*ep));
-@@ -786,7 +786,7 @@ out:
+@@ -797,7 +797,7 @@ out:
return ep;
err:
spin_unlock_bh(&pool->lock);
@@ -42807,7 +42388,7 @@ index c772d8d..35c362c 100644
mempool_free(ep, mp->ep_pool);
return NULL;
}
-@@ -929,7 +929,7 @@ static enum fc_pf_rjt_reason fc_seq_lookup_recip(struct fc_lport *lport,
+@@ -940,7 +940,7 @@ static enum fc_pf_rjt_reason fc_seq_lookup_recip(struct fc_lport *lport,
xid = ntohs(fh->fh_ox_id); /* we originated exch */
ep = fc_exch_find(mp, xid);
if (!ep) {
@@ -42816,7 +42397,7 @@ index c772d8d..35c362c 100644
reject = FC_RJT_OX_ID;
goto out;
}
-@@ -959,7 +959,7 @@ static enum fc_pf_rjt_reason fc_seq_lookup_recip(struct fc_lport *lport,
+@@ -970,7 +970,7 @@ static enum fc_pf_rjt_reason fc_seq_lookup_recip(struct fc_lport *lport,
ep = fc_exch_find(mp, xid);
if ((f_ctl & FC_FC_FIRST_SEQ) && fc_sof_is_init(fr_sof(fp))) {
if (ep) {
@@ -42825,7 +42406,7 @@ index c772d8d..35c362c 100644
reject = FC_RJT_RX_ID;
goto rel;
}
-@@ -970,7 +970,7 @@ static enum fc_pf_rjt_reason fc_seq_lookup_recip(struct fc_lport *lport,
+@@ -981,7 +981,7 @@ static enum fc_pf_rjt_reason fc_seq_lookup_recip(struct fc_lport *lport,
}
xid = ep->xid; /* get our XID */
} else if (!ep) {
@@ -42834,7 +42415,7 @@ index c772d8d..35c362c 100644
reject = FC_RJT_RX_ID; /* XID not found */
goto out;
}
-@@ -987,7 +987,7 @@ static enum fc_pf_rjt_reason fc_seq_lookup_recip(struct fc_lport *lport,
+@@ -998,7 +998,7 @@ static enum fc_pf_rjt_reason fc_seq_lookup_recip(struct fc_lport *lport,
} else {
sp = &ep->seq;
if (sp->id != fh->fh_seq_id) {
@@ -42843,7 +42424,7 @@ index c772d8d..35c362c 100644
if (f_ctl & FC_FC_END_SEQ) {
/*
* Update sequence_id based on incoming last
-@@ -1437,22 +1437,22 @@ static void fc_exch_recv_seq_resp(struct fc_exch_mgr *mp, struct fc_frame *fp)
+@@ -1448,22 +1448,22 @@ static void fc_exch_recv_seq_resp(struct fc_exch_mgr *mp, struct fc_frame *fp)
ep = fc_exch_find(mp, ntohs(fh->fh_ox_id));
if (!ep) {
@@ -42870,7 +42451,7 @@ index c772d8d..35c362c 100644
goto rel;
}
sof = fr_sof(fp);
-@@ -1461,7 +1461,7 @@ static void fc_exch_recv_seq_resp(struct fc_exch_mgr *mp, struct fc_frame *fp)
+@@ -1472,7 +1472,7 @@ static void fc_exch_recv_seq_resp(struct fc_exch_mgr *mp, struct fc_frame *fp)
sp->ssb_stat |= SSB_ST_RESP;
sp->id = fh->fh_seq_id;
} else if (sp->id != fh->fh_seq_id) {
@@ -42879,7 +42460,7 @@ index c772d8d..35c362c 100644
goto rel;
}
-@@ -1525,9 +1525,9 @@ static void fc_exch_recv_resp(struct fc_exch_mgr *mp, struct fc_frame *fp)
+@@ -1536,9 +1536,9 @@ static void fc_exch_recv_resp(struct fc_exch_mgr *mp, struct fc_frame *fp)
sp = fc_seq_lookup_orig(mp, fp); /* doesn't hold sequence */
if (!sp)
@@ -42891,7 +42472,7 @@ index c772d8d..35c362c 100644
fc_frame_free(fp);
}
-@@ -2174,13 +2174,13 @@ void fc_exch_update_stats(struct fc_lport *lport)
+@@ -2185,13 +2185,13 @@ void fc_exch_update_stats(struct fc_lport *lport)
list_for_each_entry(ema, &lport->ema_list, ema_list) {
mp = ema->mp;
@@ -42912,7 +42493,7 @@ index c772d8d..35c362c 100644
}
EXPORT_SYMBOL(fc_exch_update_stats);
diff --git a/drivers/scsi/libsas/sas_ata.c b/drivers/scsi/libsas/sas_ata.c
-index bdb81cd..d3c7c2c 100644
+index 161c98e..6d563b3 100644
--- a/drivers/scsi/libsas/sas_ata.c
+++ b/drivers/scsi/libsas/sas_ata.c
@@ -554,7 +554,7 @@ static struct ata_port_operations sas_sata_ops = {
@@ -42925,10 +42506,10 @@ index bdb81cd..d3c7c2c 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 7706c99..3b4fc0c 100644
+index bcc56ca..6f4174a 100644
--- a/drivers/scsi/lpfc/lpfc.h
+++ b/drivers/scsi/lpfc/lpfc.h
-@@ -424,7 +424,7 @@ struct lpfc_vport {
+@@ -431,7 +431,7 @@ struct lpfc_vport {
struct dentry *debug_nodelist;
struct dentry *vport_debugfs_root;
struct lpfc_debugfs_trc *disc_trc;
@@ -42937,7 +42518,7 @@ index 7706c99..3b4fc0c 100644
#endif
uint8_t stat_data_enabled;
uint8_t stat_data_blocked;
-@@ -853,8 +853,8 @@ struct lpfc_hba {
+@@ -865,8 +865,8 @@ struct lpfc_hba {
struct timer_list fabric_block_timer;
unsigned long bit_flags;
#define FABRIC_COMANDS_BLOCKED 0
@@ -42948,7 +42529,7 @@ index 7706c99..3b4fc0c 100644
unsigned long last_rsrc_error_time;
unsigned long last_ramp_down_time;
unsigned long last_ramp_up_time;
-@@ -890,7 +890,7 @@ struct lpfc_hba {
+@@ -902,7 +902,7 @@ struct lpfc_hba {
struct dentry *debug_slow_ring_trc;
struct lpfc_debugfs_trc *slow_ring_trc;
@@ -42958,7 +42539,7 @@ index 7706c99..3b4fc0c 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 f63f5ff..32549a4 100644
+index f525ecb..32549a4 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,
@@ -43022,15 +42603,6 @@ index f63f5ff..32549a4 100644
dtp->jif = jiffies;
#endif
return;
-@@ -1178,7 +1178,7 @@ lpfc_debugfs_lseek(struct file *file, loff_t off, int whence)
- pos = file->f_pos + off;
- break;
- case 2:
-- pos = debug->len - off;
-+ pos = debug->len + off;
- }
- return (pos < 0 || pos > debug->len) ? -EINVAL : (file->f_pos = pos);
- }
@@ -4182,7 +4182,7 @@ lpfc_debugfs_initialize(struct lpfc_vport *vport)
"slow_ring buffer\n");
goto debug_failed;
@@ -43050,10 +42622,10 @@ index f63f5ff..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 314b4f6..7005d10 100644
+index cb465b2..2e7b25f 100644
--- a/drivers/scsi/lpfc/lpfc_init.c
+++ b/drivers/scsi/lpfc/lpfc_init.c
-@@ -10551,8 +10551,10 @@ lpfc_init(void)
+@@ -10950,8 +10950,10 @@ lpfc_init(void)
"misc_register returned with status %d", error);
if (lpfc_enable_npiv) {
@@ -43067,10 +42639,10 @@ index 314b4f6..7005d10 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 98af07c..7625fb5 100644
+index 8523b278e..ce1d812 100644
--- a/drivers/scsi/lpfc/lpfc_scsi.c
+++ b/drivers/scsi/lpfc/lpfc_scsi.c
-@@ -325,7 +325,7 @@ lpfc_rampdown_queue_depth(struct lpfc_hba *phba)
+@@ -331,7 +331,7 @@ lpfc_rampdown_queue_depth(struct lpfc_hba *phba)
uint32_t evt_posted;
spin_lock_irqsave(&phba->hbalock, flags);
@@ -43079,7 +42651,7 @@ index 98af07c..7625fb5 100644
phba->last_rsrc_error_time = jiffies;
if ((phba->last_ramp_down_time + QUEUE_RAMP_DOWN_INTERVAL) > jiffies) {
-@@ -366,7 +366,7 @@ lpfc_rampup_queue_depth(struct lpfc_vport *vport,
+@@ -372,7 +372,7 @@ lpfc_rampup_queue_depth(struct lpfc_vport *vport,
unsigned long flags;
struct lpfc_hba *phba = vport->phba;
uint32_t evt_posted;
@@ -43088,7 +42660,7 @@ index 98af07c..7625fb5 100644
if (vport->cfg_lun_queue_depth <= queue_depth)
return;
-@@ -410,8 +410,8 @@ lpfc_ramp_down_queue_handler(struct lpfc_hba *phba)
+@@ -416,8 +416,8 @@ lpfc_ramp_down_queue_handler(struct lpfc_hba *phba)
unsigned long num_rsrc_err, num_cmd_success;
int i;
@@ -43099,7 +42671,7 @@ index 98af07c..7625fb5 100644
/*
* The error and success command counters are global per
-@@ -439,8 +439,8 @@ lpfc_ramp_down_queue_handler(struct lpfc_hba *phba)
+@@ -445,8 +445,8 @@ lpfc_ramp_down_queue_handler(struct lpfc_hba *phba)
}
}
lpfc_destroy_vport_work_array(phba, vports);
@@ -43110,7 +42682,7 @@ index 98af07c..7625fb5 100644
}
/**
-@@ -474,8 +474,8 @@ lpfc_ramp_up_queue_handler(struct lpfc_hba *phba)
+@@ -480,8 +480,8 @@ lpfc_ramp_up_queue_handler(struct lpfc_hba *phba)
}
}
lpfc_destroy_vport_work_array(phba, vports);
@@ -43121,133 +42693,8 @@ index 98af07c..7625fb5 100644
}
/**
-diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c
-index 9d53540..e5a5746 100644
---- a/drivers/scsi/megaraid/megaraid_sas_base.c
-+++ b/drivers/scsi/megaraid/megaraid_sas_base.c
-@@ -4852,10 +4852,12 @@ megasas_mgmt_fw_ioctl(struct megasas_instance *instance,
- sense, sense_handle);
- }
-
-- for (i = 0; i < ioc->sge_count && kbuff_arr[i]; i++) {
-- dma_free_coherent(&instance->pdev->dev,
-- kern_sge32[i].length,
-- kbuff_arr[i], kern_sge32[i].phys_addr);
-+ for (i = 0; i < ioc->sge_count; i++) {
-+ if (kbuff_arr[i])
-+ dma_free_coherent(&instance->pdev->dev,
-+ kern_sge32[i].length,
-+ kbuff_arr[i],
-+ kern_sge32[i].phys_addr);
- }
-
- megasas_return_cmd(instance, cmd);
-diff --git a/drivers/scsi/mpt3sas/mpt3sas_scsih.c b/drivers/scsi/mpt3sas/mpt3sas_scsih.c
-index dcbf7c8..f8c4b85 100644
---- a/drivers/scsi/mpt3sas/mpt3sas_scsih.c
-+++ b/drivers/scsi/mpt3sas/mpt3sas_scsih.c
-@@ -1273,6 +1273,7 @@ _scsih_slave_alloc(struct scsi_device *sdev)
- struct MPT3SAS_DEVICE *sas_device_priv_data;
- struct scsi_target *starget;
- struct _raid_device *raid_device;
-+ struct _sas_device *sas_device;
- unsigned long flags;
-
- sas_device_priv_data = kzalloc(sizeof(struct scsi_device), GFP_KERNEL);
-@@ -1301,6 +1302,19 @@ _scsih_slave_alloc(struct scsi_device *sdev)
- spin_unlock_irqrestore(&ioc->raid_device_lock, flags);
- }
-
-+ if (!(sas_target_priv_data->flags & MPT_TARGET_FLAGS_VOLUME)) {
-+ spin_lock_irqsave(&ioc->sas_device_lock, flags);
-+ sas_device = mpt3sas_scsih_sas_device_find_by_sas_address(ioc,
-+ sas_target_priv_data->sas_address);
-+ if (sas_device && (sas_device->starget == NULL)) {
-+ sdev_printk(KERN_INFO, sdev,
-+ "%s : sas_device->starget set to starget @ %d\n",
-+ __func__, __LINE__);
-+ sas_device->starget = starget;
-+ }
-+ spin_unlock_irqrestore(&ioc->sas_device_lock, flags);
-+ }
-+
- return 0;
- }
-
-@@ -6392,7 +6406,7 @@ _scsih_search_responding_sas_devices(struct MPT3SAS_ADAPTER *ioc)
- handle))) {
- ioc_status = le16_to_cpu(mpi_reply.IOCStatus) &
- MPI2_IOCSTATUS_MASK;
-- if (ioc_status == MPI2_IOCSTATUS_CONFIG_INVALID_PAGE)
-+ if (ioc_status != MPI2_IOCSTATUS_SUCCESS)
- break;
- handle = le16_to_cpu(sas_device_pg0.DevHandle);
- device_info = le32_to_cpu(sas_device_pg0.DeviceInfo);
-@@ -6494,7 +6508,7 @@ _scsih_search_responding_raid_devices(struct MPT3SAS_ADAPTER *ioc)
- &volume_pg1, MPI2_RAID_VOLUME_PGAD_FORM_GET_NEXT_HANDLE, handle))) {
- ioc_status = le16_to_cpu(mpi_reply.IOCStatus) &
- MPI2_IOCSTATUS_MASK;
-- if (ioc_status == MPI2_IOCSTATUS_CONFIG_INVALID_PAGE)
-+ if (ioc_status != MPI2_IOCSTATUS_SUCCESS)
- break;
- handle = le16_to_cpu(volume_pg1.DevHandle);
-
-@@ -6518,7 +6532,7 @@ _scsih_search_responding_raid_devices(struct MPT3SAS_ADAPTER *ioc)
- phys_disk_num))) {
- ioc_status = le16_to_cpu(mpi_reply.IOCStatus) &
- MPI2_IOCSTATUS_MASK;
-- if (ioc_status == MPI2_IOCSTATUS_CONFIG_INVALID_PAGE)
-+ if (ioc_status != MPI2_IOCSTATUS_SUCCESS)
- break;
- phys_disk_num = pd_pg0.PhysDiskNum;
- handle = le16_to_cpu(pd_pg0.DevHandle);
-@@ -6597,7 +6611,7 @@ _scsih_search_responding_expanders(struct MPT3SAS_ADAPTER *ioc)
-
- ioc_status = le16_to_cpu(mpi_reply.IOCStatus) &
- MPI2_IOCSTATUS_MASK;
-- if (ioc_status == MPI2_IOCSTATUS_CONFIG_INVALID_PAGE)
-+ if (ioc_status != MPI2_IOCSTATUS_SUCCESS)
- break;
-
- handle = le16_to_cpu(expander_pg0.DevHandle);
-@@ -6742,8 +6756,6 @@ _scsih_scan_for_devices_after_reset(struct MPT3SAS_ADAPTER *ioc)
- MPI2_SAS_EXPAND_PGAD_FORM_GET_NEXT_HNDL, handle))) {
- ioc_status = le16_to_cpu(mpi_reply.IOCStatus) &
- MPI2_IOCSTATUS_MASK;
-- if (ioc_status == MPI2_IOCSTATUS_CONFIG_INVALID_PAGE)
-- break;
- if (ioc_status != MPI2_IOCSTATUS_SUCCESS) {
- pr_info(MPT3SAS_FMT "\tbreak from expander scan: " \
- "ioc_status(0x%04x), loginfo(0x%08x)\n",
-@@ -6787,8 +6799,6 @@ _scsih_scan_for_devices_after_reset(struct MPT3SAS_ADAPTER *ioc)
- phys_disk_num))) {
- ioc_status = le16_to_cpu(mpi_reply.IOCStatus) &
- MPI2_IOCSTATUS_MASK;
-- if (ioc_status == MPI2_IOCSTATUS_CONFIG_INVALID_PAGE)
-- break;
- if (ioc_status != MPI2_IOCSTATUS_SUCCESS) {
- pr_info(MPT3SAS_FMT "\tbreak from phys disk scan: "\
- "ioc_status(0x%04x), loginfo(0x%08x)\n",
-@@ -6854,8 +6864,6 @@ _scsih_scan_for_devices_after_reset(struct MPT3SAS_ADAPTER *ioc)
- &volume_pg1, MPI2_RAID_VOLUME_PGAD_FORM_GET_NEXT_HANDLE, handle))) {
- ioc_status = le16_to_cpu(mpi_reply.IOCStatus) &
- MPI2_IOCSTATUS_MASK;
-- if (ioc_status == MPI2_IOCSTATUS_CONFIG_INVALID_PAGE)
-- break;
- if (ioc_status != MPI2_IOCSTATUS_SUCCESS) {
- pr_info(MPT3SAS_FMT "\tbreak from volume scan: " \
- "ioc_status(0x%04x), loginfo(0x%08x)\n",
-@@ -6914,8 +6922,6 @@ _scsih_scan_for_devices_after_reset(struct MPT3SAS_ADAPTER *ioc)
- handle))) {
- ioc_status = le16_to_cpu(mpi_reply.IOCStatus) &
- MPI2_IOCSTATUS_MASK;
-- if (ioc_status == MPI2_IOCSTATUS_CONFIG_INVALID_PAGE)
-- break;
- if (ioc_status != MPI2_IOCSTATUS_SUCCESS) {
- pr_info(MPT3SAS_FMT "\tbreak from end device scan:"\
- " ioc_status(0x%04x), loginfo(0x%08x)\n",
diff --git a/drivers/scsi/pmcraid.c b/drivers/scsi/pmcraid.c
-index b46f5e9..c4c4ccb 100644
+index 8e1b737..50ff510 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)
@@ -43282,7 +42729,7 @@ index b46f5e9..c4c4ccb 100644
pinstance->num_hrrq;
cmd->cmd_done = pmcraid_io_done;
-@@ -3859,7 +3859,7 @@ static long pmcraid_ioctl_passthrough(
+@@ -3846,7 +3846,7 @@ static long pmcraid_ioctl_passthrough(
* block of scsi_cmd which is re-used (e.g. cancel/abort), which uses
* hrrq_id assigned here in queuecommand
*/
@@ -43291,7 +42738,7 @@ index b46f5e9..c4c4ccb 100644
pinstance->num_hrrq;
if (request_size) {
-@@ -4497,7 +4497,7 @@ static void pmcraid_worker_function(struct work_struct *workp)
+@@ -4483,7 +4483,7 @@ static void pmcraid_worker_function(struct work_struct *workp)
pinstance = container_of(workp, struct pmcraid_instance, worker_q);
/* add resources only after host is added into system */
@@ -43300,7 +42747,7 @@ index b46f5e9..c4c4ccb 100644
return;
fw_version = be16_to_cpu(pinstance->inq_data->fw_version);
-@@ -5324,8 +5324,8 @@ static int pmcraid_init_instance(struct pci_dev *pdev, struct Scsi_Host *host,
+@@ -5310,8 +5310,8 @@ static int pmcraid_init_instance(struct pci_dev *pdev, struct Scsi_Host *host,
init_waitqueue_head(&pinstance->reset_wait_q);
atomic_set(&pinstance->outstanding_cmds, 0);
@@ -43311,7 +42758,7 @@ index b46f5e9..c4c4ccb 100644
INIT_LIST_HEAD(&pinstance->free_res_q);
INIT_LIST_HEAD(&pinstance->used_res_q);
-@@ -6038,7 +6038,7 @@ static int pmcraid_probe(struct pci_dev *pdev,
+@@ -6024,7 +6024,7 @@ static int pmcraid_probe(struct pci_dev *pdev,
/* Schedule worker thread to handle CCN and take care of adding and
* removing devices to OS
*/
@@ -43354,10 +42801,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 b3db9dc..c3b1756 100644
+index bf60c63..74d4dce 100644
--- a/drivers/scsi/qla2xxx/qla_attr.c
+++ b/drivers/scsi/qla2xxx/qla_attr.c
-@@ -1971,7 +1971,7 @@ qla24xx_vport_disable(struct fc_vport *fc_vport, bool disable)
+@@ -2001,7 +2001,7 @@ qla24xx_vport_disable(struct fc_vport *fc_vport, bool disable)
return 0;
}
@@ -43366,7 +42813,7 @@ index b3db9dc..c3b1756 100644
.show_host_node_name = 1,
.show_host_port_name = 1,
-@@ -2018,7 +2018,7 @@ struct fc_function_template qla2xxx_transport_functions = {
+@@ -2048,7 +2048,7 @@ struct fc_function_template qla2xxx_transport_functions = {
.bsg_timeout = qla24xx_bsg_timeout,
};
@@ -43376,10 +42823,10 @@ index b3db9dc..c3b1756 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 b310fa9..b9b3944 100644
+index 026bfde..90c4018 100644
--- a/drivers/scsi/qla2xxx/qla_gbl.h
+++ b/drivers/scsi/qla2xxx/qla_gbl.h
-@@ -523,8 +523,8 @@ extern void qla2x00_get_sym_node_name(scsi_qla_host_t *, uint8_t *);
+@@ -528,8 +528,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;
@@ -43391,10 +42838,10 @@ index b310fa9..b9b3944 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 2c6dd3d..e5ecd82 100644
+index ad72c1d..afc9a98 100644
--- a/drivers/scsi/qla2xxx/qla_os.c
+++ b/drivers/scsi/qla2xxx/qla_os.c
-@@ -1554,8 +1554,10 @@ qla2x00_config_dma_addressing(struct qla_hw_data *ha)
+@@ -1571,8 +1571,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;
@@ -43408,10 +42855,10 @@ index 2c6dd3d..e5ecd82 100644
}
}
diff --git a/drivers/scsi/qla4xxx/ql4_def.h b/drivers/scsi/qla4xxx/ql4_def.h
-index 129f5dd..ade53e8 100644
+index ddf16a8..80f4dd0 100644
--- a/drivers/scsi/qla4xxx/ql4_def.h
+++ b/drivers/scsi/qla4xxx/ql4_def.h
-@@ -275,7 +275,7 @@ struct ddb_entry {
+@@ -291,7 +291,7 @@ struct ddb_entry {
* (4000 only) */
atomic_t relogin_timer; /* Max Time to wait for
* relogin to complete */
@@ -43421,10 +42868,10 @@ index 129f5dd..ade53e8 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 6142729..b6a85c9 100644
+index 4d231c1..2892c37 100644
--- a/drivers/scsi/qla4xxx/ql4_os.c
+++ b/drivers/scsi/qla4xxx/ql4_os.c
-@@ -2622,12 +2622,12 @@ static void qla4xxx_check_relogin_flash_ddb(struct iscsi_cls_session *cls_sess)
+@@ -2971,12 +2971,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 */
@@ -43439,7 +42886,7 @@ index 6142729..b6a85c9 100644
ddb_entry->default_time2wait + 4));
set_bit(DPC_RELOGIN_DEVICE, &ha->dpc_flags);
atomic_set(&ddb_entry->retry_relogin_timer,
-@@ -4742,7 +4742,7 @@ static void qla4xxx_setup_flash_ddb_entry(struct scsi_qla_host *ha,
+@@ -5081,7 +5081,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);
@@ -43449,7 +42896,7 @@ index 6142729..b6a85c9 100644
ddb_entry->default_relogin_timeout =
(def_timeout > LOGIN_TOV) && (def_timeout < LOGIN_TOV * 10) ?
diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c
-index 2c0d0ec..4e8681a 100644
+index 3b1ea34..1583a72 100644
--- a/drivers/scsi/scsi.c
+++ b/drivers/scsi/scsi.c
@@ -661,7 +661,7 @@ int scsi_dispatch_cmd(struct scsi_cmnd *cmd)
@@ -43462,10 +42909,10 @@ index 2c0d0ec..4e8681a 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 c31187d..0ead8c3 100644
+index 86d5220..f22c51a 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
-@@ -1459,7 +1459,7 @@ static void scsi_kill_request(struct request *req, struct request_queue *q)
+@@ -1458,7 +1458,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;
@@ -43474,7 +42921,7 @@ index c31187d..0ead8c3 100644
/*
* SCSI request completion path will do scsi_device_unbusy(),
-@@ -1485,9 +1485,9 @@ static void scsi_softirq_done(struct request *rq)
+@@ -1484,9 +1484,9 @@ static void scsi_softirq_done(struct request *rq)
INIT_LIST_HEAD(&cmd->eh_entry);
@@ -43513,10 +42960,10 @@ 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 e894ca7..de9d7660 100644
+index e106c27..11a380e 100644
--- a/drivers/scsi/scsi_transport_fc.c
+++ b/drivers/scsi/scsi_transport_fc.c
-@@ -498,7 +498,7 @@ static DECLARE_TRANSPORT_CLASS(fc_vport_class,
+@@ -497,7 +497,7 @@ static DECLARE_TRANSPORT_CLASS(fc_vport_class,
* Netlink Infrastructure
*/
@@ -43525,7 +42972,7 @@ index e894ca7..de9d7660 100644
/**
* fc_get_event_number - Obtain the next sequential FC event number
-@@ -511,7 +511,7 @@ static atomic_t fc_event_seq;
+@@ -510,7 +510,7 @@ static atomic_t fc_event_seq;
u32
fc_get_event_number(void)
{
@@ -43534,7 +42981,7 @@ index e894ca7..de9d7660 100644
}
EXPORT_SYMBOL(fc_get_event_number);
-@@ -659,7 +659,7 @@ static __init int fc_transport_init(void)
+@@ -654,7 +654,7 @@ static __init int fc_transport_init(void)
{
int error;
@@ -43543,7 +42990,7 @@ index e894ca7..de9d7660 100644
error = transport_class_register(&fc_host_class);
if (error)
-@@ -849,7 +849,7 @@ static int fc_str_to_dev_loss(const char *buf, unsigned long *val)
+@@ -844,7 +844,7 @@ static int fc_str_to_dev_loss(const char *buf, unsigned long *val)
char *cp;
*val = simple_strtoul(buf, &cp, 0);
@@ -43553,10 +43000,10 @@ index e894ca7..de9d7660 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 0a74b97..fa8d648 100644
+index 133926b..903000d 100644
--- a/drivers/scsi/scsi_transport_iscsi.c
+++ b/drivers/scsi/scsi_transport_iscsi.c
-@@ -79,7 +79,7 @@ struct iscsi_internal {
+@@ -80,7 +80,7 @@ struct iscsi_internal {
struct transport_container session_cont;
};
@@ -43565,7 +43012,7 @@ index 0a74b97..fa8d648 100644
static struct workqueue_struct *iscsi_eh_timer_workq;
static DEFINE_IDA(iscsi_sess_ida);
-@@ -1064,7 +1064,7 @@ int iscsi_add_session(struct iscsi_cls_session *session, unsigned int target_id)
+@@ -1738,7 +1738,7 @@ int iscsi_add_session(struct iscsi_cls_session *session, unsigned int target_id)
int err;
ihost = shost->shost_data;
@@ -43574,7 +43021,7 @@ index 0a74b97..fa8d648 100644
if (target_id == ISCSI_MAX_TARGET) {
id = ida_simple_get(&iscsi_sess_ida, 0, 0, GFP_KERNEL);
-@@ -2955,7 +2955,7 @@ static __init int iscsi_transport_init(void)
+@@ -3944,7 +3944,7 @@ static __init int iscsi_transport_init(void)
printk(KERN_INFO "Loading iSCSI transport class v%s.\n",
ISCSI_TRANSPORT_VERSION);
@@ -43615,10 +43062,10 @@ index f379c7f..e8fc69c 100644
transport_setup_device(&rport->dev);
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
-index 0f0370f..7e076c4 100644
+index 1b1125e..31a2019 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
-@@ -2929,7 +2929,7 @@ static int sd_probe(struct device *dev)
+@@ -2936,7 +2936,7 @@ static int sd_probe(struct device *dev)
sdkp->disk = gd;
sdkp->index = index;
atomic_set(&sdkp->openers, 0);
@@ -43628,10 +43075,10 @@ index 0f0370f..7e076c4 100644
if (!sdp->request_queue->rq_timeout) {
if (sdp->type != TYPE_MOD)
diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c
-index 9f0c465..47194ee 100644
+index df5e961..df6b97f 100644
--- a/drivers/scsi/sg.c
+++ b/drivers/scsi/sg.c
-@@ -1101,7 +1101,7 @@ sg_ioctl(struct file *filp, unsigned int cmd_in, unsigned long arg)
+@@ -1102,7 +1102,7 @@ sg_ioctl(struct file *filp, unsigned int cmd_in, unsigned long arg)
sdp->disk->disk_name,
MKDEV(SCSI_GENERIC_MAJOR, sdp->index),
NULL,
@@ -43641,10 +43088,10 @@ index 9f0c465..47194ee 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 004b10f..7c98d51 100644
+index 32b7bb1..2f1c4bd 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
-@@ -1620,7 +1620,7 @@ int spi_bus_unlock(struct spi_master *master)
+@@ -1631,7 +1631,7 @@ int spi_bus_unlock(struct spi_master *master)
EXPORT_SYMBOL_GPL(spi_bus_unlock);
/* portable code must never pass more than 32 bytes */
@@ -43653,19 +43100,19 @@ index 004b10f..7c98d51 100644
static u8 *buf;
-diff --git a/drivers/staging/iio/iio_hwmon.c b/drivers/staging/iio/iio_hwmon.c
-index 93af756..a4bc5bf 100644
---- a/drivers/staging/iio/iio_hwmon.c
-+++ b/drivers/staging/iio/iio_hwmon.c
-@@ -67,7 +67,7 @@ static int iio_hwmon_probe(struct platform_device *pdev)
+diff --git a/drivers/staging/media/solo6x10/solo6x10-core.c b/drivers/staging/media/solo6x10/solo6x10-core.c
+index 3675020..e80d92c 100644
+--- a/drivers/staging/media/solo6x10/solo6x10-core.c
++++ b/drivers/staging/media/solo6x10/solo6x10-core.c
+@@ -434,7 +434,7 @@ static void solo_device_release(struct device *dev)
+
+ static int solo_sysfs_init(struct solo_dev *solo_dev)
{
- struct device *dev = &pdev->dev;
- struct iio_hwmon_state *st;
-- struct sensor_device_attribute *a;
-+ sensor_device_attribute_no_const *a;
- int ret, i;
- int in_i = 1, temp_i = 1, curr_i = 1;
- enum iio_chan_type type;
+- struct bin_attribute *sdram_attr = &solo_dev->sdram_attr;
++ bin_attribute_no_const *sdram_attr = &solo_dev->sdram_attr;
+ struct device *dev = &solo_dev->dev;
+ const char *driver;
+ int i;
diff --git a/drivers/staging/octeon/ethernet-rx.c b/drivers/staging/octeon/ethernet-rx.c
index 34afc16..ffe44dd 100644
--- a/drivers/staging/octeon/ethernet-rx.c
@@ -43745,7 +43192,7 @@ index 1f5088b..0e59820 100644
return 0;
diff --git a/drivers/staging/usbip/vhci.h b/drivers/staging/usbip/vhci.h
-index 5dddc4d..34fcb2f 100644
+index a863a98..d272795 100644
--- a/drivers/staging/usbip/vhci.h
+++ b/drivers/staging/usbip/vhci.h
@@ -83,7 +83,7 @@ struct vhci_hcd {
@@ -43758,7 +43205,7 @@ index 5dddc4d..34fcb2f 100644
/*
* NOTE:
diff --git a/drivers/staging/usbip/vhci_hcd.c b/drivers/staging/usbip/vhci_hcd.c
-index f1ca084..7b5c0c3 100644
+index d7974cb..d78076b 100644
--- a/drivers/staging/usbip/vhci_hcd.c
+++ b/drivers/staging/usbip/vhci_hcd.c
@@ -441,7 +441,7 @@ static void vhci_tx_urb(struct urb *urb)
@@ -43789,10 +43236,10 @@ index f1ca084..7b5c0c3 100644
hcd->power_budget = 0; /* no limit */
diff --git a/drivers/staging/usbip/vhci_rx.c b/drivers/staging/usbip/vhci_rx.c
-index faf8e60..c46f8ab 100644
+index d07fcb5..358e1e1 100644
--- a/drivers/staging/usbip/vhci_rx.c
+++ b/drivers/staging/usbip/vhci_rx.c
-@@ -76,7 +76,7 @@ static void vhci_recv_ret_submit(struct vhci_device *vdev,
+@@ -80,7 +80,7 @@ static void vhci_recv_ret_submit(struct vhci_device *vdev,
if (!urb) {
pr_err("cannot find a urb of seqnum %u\n", pdu->base.seqnum);
pr_info("max seqnum %d\n",
@@ -43802,10 +43249,10 @@ index faf8e60..c46f8ab 100644
return;
}
diff --git a/drivers/staging/vt6655/hostap.c b/drivers/staging/vt6655/hostap.c
-index 5f13890..36a044b 100644
+index 8417c2f..ef5ebd6 100644
--- a/drivers/staging/vt6655/hostap.c
+++ b/drivers/staging/vt6655/hostap.c
-@@ -73,14 +73,13 @@ static int msglevel =MSG_LEVEL_INFO;
+@@ -69,14 +69,13 @@ static int msglevel = MSG_LEVEL_INFO;
*
*/
@@ -43813,17 +43260,17 @@ index 5f13890..36a044b 100644
+
static int hostap_enable_hostapd(PSDevice pDevice, int rtnl_locked)
{
- PSDevice apdev_priv;
+ PSDevice apdev_priv;
struct net_device *dev = pDevice->dev;
int ret;
- const struct net_device_ops apdev_netdev_ops = {
- .ndo_start_xmit = pDevice->tx_80211,
- };
- DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "%s: Enabling hostapd mode\n", dev->name);
+ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "%s: Enabling hostapd mode\n", dev->name);
-@@ -92,6 +91,8 @@ static int hostap_enable_hostapd(PSDevice pDevice, int rtnl_locked)
- *apdev_priv = *pDevice;
+@@ -88,6 +87,8 @@ static int hostap_enable_hostapd(PSDevice pDevice, int rtnl_locked)
+ *apdev_priv = *pDevice;
memcpy(pDevice->apdev->dev_addr, dev->dev_addr, ETH_ALEN);
+ /* only half broken now */
@@ -43832,7 +43279,7 @@ index 5f13890..36a044b 100644
pDevice->apdev->type = ARPHRD_IEEE80211;
diff --git a/drivers/staging/vt6656/hostap.c b/drivers/staging/vt6656/hostap.c
-index a94e66f..31984d0 100644
+index c699a30..b90a5fd 100644
--- a/drivers/staging/vt6656/hostap.c
+++ b/drivers/staging/vt6656/hostap.c
@@ -60,14 +60,13 @@ static int msglevel =MSG_LEVEL_INFO;
@@ -43862,10 +43309,10 @@ index a94e66f..31984d0 100644
pDevice->apdev->type = ARPHRD_IEEE80211;
diff --git a/drivers/staging/zcache/tmem.c b/drivers/staging/zcache/tmem.c
-index a2b7e03..9ff4bbd 100644
+index d7e51e4..d07eaab 100644
--- a/drivers/staging/zcache/tmem.c
+++ b/drivers/staging/zcache/tmem.c
-@@ -50,7 +50,7 @@
+@@ -51,7 +51,7 @@
* A tmem host implementation must use this function to register callbacks
* for memory allocation.
*/
@@ -43874,7 +43321,7 @@ index a2b7e03..9ff4bbd 100644
static void tmem_objnode_tree_init(void);
-@@ -64,7 +64,7 @@ void tmem_register_hostops(struct tmem_hostops *m)
+@@ -65,7 +65,7 @@ void tmem_register_hostops(struct tmem_hostops *m)
* A tmem host implementation must use this function to register
* callbacks for a page-accessible memory (PAM) implementation.
*/
@@ -43884,7 +43331,7 @@ index a2b7e03..9ff4bbd 100644
void tmem_register_pamops(struct tmem_pamops *m)
{
diff --git a/drivers/staging/zcache/tmem.h b/drivers/staging/zcache/tmem.h
-index adbe5a8..d387359 100644
+index d128ce2..a43980c 100644
--- a/drivers/staging/zcache/tmem.h
+++ b/drivers/staging/zcache/tmem.h
@@ -226,6 +226,7 @@ struct tmem_pamops {
@@ -43904,10 +43351,10 @@ index adbe5a8..d387359 100644
/* core tmem accessor functions */
diff --git a/drivers/target/target_core_device.c b/drivers/target/target_core_device.c
-index 2e4d655..fd72e68 100644
+index 4630481..c26782a 100644
--- a/drivers/target/target_core_device.c
+++ b/drivers/target/target_core_device.c
-@@ -1414,7 +1414,7 @@ struct se_device *target_alloc_device(struct se_hba *hba, const char *name)
+@@ -1400,7 +1400,7 @@ struct se_device *target_alloc_device(struct se_hba *hba, const char *name)
spin_lock_init(&dev->se_port_lock);
spin_lock_init(&dev->se_tmr_lock);
spin_lock_init(&dev->qf_cmd_lock);
@@ -43917,10 +43364,10 @@ index 2e4d655..fd72e68 100644
spin_lock_init(&dev->t10_wwn.t10_vpd_lock);
INIT_LIST_HEAD(&dev->t10_pr.registration_list);
diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c
-index fc9a5a0..1d5975e 100644
+index 21e3158..43c6004 100644
--- a/drivers/target/target_core_transport.c
+++ b/drivers/target/target_core_transport.c
-@@ -1081,7 +1081,7 @@ transport_check_alloc_task_attr(struct se_cmd *cmd)
+@@ -1080,7 +1080,7 @@ transport_check_alloc_task_attr(struct se_cmd *cmd)
* Used to determine when ORDERED commands should go from
* Dormant to Active status.
*/
@@ -43930,10 +43377,10 @@ index fc9a5a0..1d5975e 100644
pr_debug("Allocated se_ordered_id: %u for Task Attr: 0x%02x on %s\n",
cmd->se_ordered_id, cmd->sam_task_attr,
diff --git a/drivers/tty/cyclades.c b/drivers/tty/cyclades.c
-index 345bd0e..61d5375 100644
+index 33f83fe..d80f8e1 100644
--- a/drivers/tty/cyclades.c
+++ b/drivers/tty/cyclades.c
-@@ -1576,10 +1576,10 @@ static int cy_open(struct tty_struct *tty, struct file *filp)
+@@ -1570,10 +1570,10 @@ static int cy_open(struct tty_struct *tty, struct file *filp)
printk(KERN_DEBUG "cyc:cy_open ttyC%d, count = %d\n", info->line,
info->port.count);
#endif
@@ -43946,7 +43393,7 @@ index 345bd0e..61d5375 100644
#endif
/*
-@@ -3978,7 +3978,7 @@ static int cyclades_proc_show(struct seq_file *m, void *v)
+@@ -3972,7 +3972,7 @@ static int cyclades_proc_show(struct seq_file *m, void *v)
for (j = 0; j < cy_card[i].nports; j++) {
info = &cy_card[i].ports[j];
@@ -44228,10 +43675,10 @@ index 8fd72ff..34a0bed 100644
ipwireless_disassociate_network_ttys(network,
ttyj->channel_idx);
diff --git a/drivers/tty/moxa.c b/drivers/tty/moxa.c
-index adeac25..787a0a1 100644
+index 1deaca4..c8582d4 100644
--- a/drivers/tty/moxa.c
+++ b/drivers/tty/moxa.c
-@@ -1193,7 +1193,7 @@ static int moxa_open(struct tty_struct *tty, struct file *filp)
+@@ -1189,7 +1189,7 @@ static int moxa_open(struct tty_struct *tty, struct file *filp)
}
ch = &brd->ports[port % MAX_PORTS_PER_BOARD];
@@ -44241,10 +43688,10 @@ index adeac25..787a0a1 100644
tty_port_tty_set(&ch->port, tty);
mutex_lock(&ch->port.mutex);
diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c
-index 4a43ef5d7..aa71f27 100644
+index 6422390..49003ac8 100644
--- a/drivers/tty/n_gsm.c
+++ b/drivers/tty/n_gsm.c
-@@ -1636,7 +1636,7 @@ static struct gsm_dlci *gsm_dlci_alloc(struct gsm_mux *gsm, int addr)
+@@ -1632,7 +1632,7 @@ static struct gsm_dlci *gsm_dlci_alloc(struct gsm_mux *gsm, int addr)
spin_lock_init(&dlci->lock);
mutex_init(&dlci->mutex);
dlci->fifo = &dlci->_fifo;
@@ -44253,7 +43700,7 @@ index 4a43ef5d7..aa71f27 100644
kfree(dlci);
return NULL;
}
-@@ -2936,7 +2936,7 @@ static int gsmtty_open(struct tty_struct *tty, struct file *filp)
+@@ -2932,7 +2932,7 @@ static int gsmtty_open(struct tty_struct *tty, struct file *filp)
struct gsm_dlci *dlci = tty->driver_data;
struct tty_port *port = &dlci->port;
@@ -44263,10 +43710,10 @@ index 4a43ef5d7..aa71f27 100644
dlci_get(dlci->gsm->dlci[0]);
mux_get(dlci->gsm);
diff --git a/drivers/tty/n_tty.c b/drivers/tty/n_tty.c
-index 1f8cba6..47b06c2 100644
+index 6c7fe90..9241dab 100644
--- a/drivers/tty/n_tty.c
+++ b/drivers/tty/n_tty.c
-@@ -2205,6 +2205,7 @@ void n_tty_inherit_ops(struct tty_ldisc_ops *ops)
+@@ -2203,6 +2203,7 @@ void n_tty_inherit_ops(struct tty_ldisc_ops *ops)
{
*ops = tty_ldisc_N_TTY;
ops->owner = NULL;
@@ -44276,10 +43723,10 @@ index 1f8cba6..47b06c2 100644
}
EXPORT_SYMBOL_GPL(n_tty_inherit_ops);
diff --git a/drivers/tty/pty.c b/drivers/tty/pty.c
-index 74a5e8b..40c36a7 100644
+index abfd990..5ab5da9 100644
--- a/drivers/tty/pty.c
+++ b/drivers/tty/pty.c
-@@ -797,8 +797,10 @@ static void __init unix98_pty_init(void)
+@@ -796,8 +796,10 @@ static void __init unix98_pty_init(void)
panic("Couldn't register Unix98 pts driver");
/* Now create the /dev/ptmx special device */
@@ -44292,10 +43739,10 @@ index 74a5e8b..40c36a7 100644
cdev_init(&ptmx_cdev, &ptmx_fops);
if (cdev_add(&ptmx_cdev, MKDEV(TTYAUX_MAJOR, 2), 1) ||
diff --git a/drivers/tty/rocket.c b/drivers/tty/rocket.c
-index 1d27003..959f452 100644
+index 354564e..fe50d9a 100644
--- a/drivers/tty/rocket.c
+++ b/drivers/tty/rocket.c
-@@ -923,7 +923,7 @@ static int rp_open(struct tty_struct *tty, struct file *filp)
+@@ -914,7 +914,7 @@ static int rp_open(struct tty_struct *tty, struct file *filp)
tty->driver_data = info;
tty_port_tty_set(port, tty);
@@ -44304,7 +43751,7 @@ index 1d27003..959f452 100644
atomic_inc(&rp_num_ports_open);
#ifdef ROCKET_DEBUG_OPEN
-@@ -932,7 +932,7 @@ static int rp_open(struct tty_struct *tty, struct file *filp)
+@@ -923,7 +923,7 @@ static int rp_open(struct tty_struct *tty, struct file *filp)
#endif
}
#ifdef ROCKET_DEBUG_OPEN
@@ -44313,7 +43760,7 @@ index 1d27003..959f452 100644
#endif
/*
-@@ -1527,7 +1527,7 @@ static void rp_hangup(struct tty_struct *tty)
+@@ -1515,7 +1515,7 @@ static void rp_hangup(struct tty_struct *tty)
spin_unlock_irqrestore(&info->port.lock, flags);
return;
}
@@ -44429,10 +43876,10 @@ index 1002054..dd644a8 100644
/* This is only available if kgdboc is a built in for early debugging */
static int __init kgdboc_early_init(char *opt)
diff --git a/drivers/tty/serial/samsung.c b/drivers/tty/serial/samsung.c
-index 2769a38..f3dbe48 100644
+index 0c8a9fa..234a95f 100644
--- a/drivers/tty/serial/samsung.c
+++ b/drivers/tty/serial/samsung.c
-@@ -451,11 +451,16 @@ static void s3c24xx_serial_shutdown(struct uart_port *port)
+@@ -453,11 +453,16 @@ static void s3c24xx_serial_shutdown(struct uart_port *port)
}
}
@@ -44449,7 +43896,7 @@ index 2769a38..f3dbe48 100644
dbg("s3c24xx_serial_startup: port=%p (%08lx,%p)\n",
port->mapbase, port->membase);
-@@ -1120,10 +1125,6 @@ static int s3c24xx_serial_init_port(struct s3c24xx_uart_port *ourport,
+@@ -1124,10 +1129,6 @@ static int s3c24xx_serial_init_port(struct s3c24xx_uart_port *ourport,
/* setup info for port */
port->dev = &platdev->dev;
@@ -44461,7 +43908,7 @@ index 2769a38..f3dbe48 100644
if (cfg->uart_flags & UPF_CONS_FLOW) {
diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
-index 8fbb6d2..822a9e6 100644
+index f87dbfd..42ad4b1 100644
--- a/drivers/tty/serial/serial_core.c
+++ b/drivers/tty/serial/serial_core.c
@@ -1454,7 +1454,7 @@ static void uart_hangup(struct tty_struct *tty)
@@ -44501,10 +43948,10 @@ index 8fbb6d2..822a9e6 100644
goto end;
}
diff --git a/drivers/tty/synclink.c b/drivers/tty/synclink.c
-index 8983276..72a4090 100644
+index 8eaf1ab..85c030d 100644
--- a/drivers/tty/synclink.c
+++ b/drivers/tty/synclink.c
-@@ -3093,7 +3093,7 @@ static void mgsl_close(struct tty_struct *tty, struct file * filp)
+@@ -3090,7 +3090,7 @@ static void mgsl_close(struct tty_struct *tty, struct file * filp)
if (debug_level >= DEBUG_LEVEL_INFO)
printk("%s(%d):mgsl_close(%s) entry, count=%d\n",
@@ -44513,7 +43960,7 @@ index 8983276..72a4090 100644
if (tty_port_close_start(&info->port, tty, filp) == 0)
goto cleanup;
-@@ -3111,7 +3111,7 @@ static void mgsl_close(struct tty_struct *tty, struct file * filp)
+@@ -3108,7 +3108,7 @@ static void mgsl_close(struct tty_struct *tty, struct file * filp)
cleanup:
if (debug_level >= DEBUG_LEVEL_INFO)
printk("%s(%d):mgsl_close(%s) exit, count=%d\n", __FILE__,__LINE__,
@@ -44522,7 +43969,7 @@ index 8983276..72a4090 100644
} /* end of mgsl_close() */
-@@ -3210,8 +3210,8 @@ static void mgsl_hangup(struct tty_struct *tty)
+@@ -3207,8 +3207,8 @@ static void mgsl_hangup(struct tty_struct *tty)
mgsl_flush_buffer(tty);
shutdown(info);
@@ -44533,7 +43980,7 @@ index 8983276..72a4090 100644
info->port.flags &= ~ASYNC_NORMAL_ACTIVE;
info->port.tty = NULL;
-@@ -3300,12 +3300,12 @@ static int block_til_ready(struct tty_struct *tty, struct file * filp,
+@@ -3297,12 +3297,12 @@ static int block_til_ready(struct tty_struct *tty, struct file * filp,
if (debug_level >= DEBUG_LEVEL_INFO)
printk("%s(%d):block_til_ready before block on %s count=%d\n",
@@ -44548,7 +43995,7 @@ index 8983276..72a4090 100644
}
spin_unlock_irqrestore(&info->irq_spinlock, flags);
port->blocked_open++;
-@@ -3334,7 +3334,7 @@ static int block_til_ready(struct tty_struct *tty, struct file * filp,
+@@ -3331,7 +3331,7 @@ static int block_til_ready(struct tty_struct *tty, struct file * filp,
if (debug_level >= DEBUG_LEVEL_INFO)
printk("%s(%d):block_til_ready blocking on %s count=%d\n",
@@ -44557,7 +44004,7 @@ index 8983276..72a4090 100644
tty_unlock(tty);
schedule();
-@@ -3346,12 +3346,12 @@ static int block_til_ready(struct tty_struct *tty, struct file * filp,
+@@ -3343,12 +3343,12 @@ static int block_til_ready(struct tty_struct *tty, struct file * filp,
/* FIXME: Racy on hangup during close wait */
if (extra_count)
@@ -44572,7 +44019,7 @@ index 8983276..72a4090 100644
if (!retval)
port->flags |= ASYNC_NORMAL_ACTIVE;
-@@ -3403,7 +3403,7 @@ static int mgsl_open(struct tty_struct *tty, struct file * filp)
+@@ -3400,7 +3400,7 @@ static int mgsl_open(struct tty_struct *tty, struct file * filp)
if (debug_level >= DEBUG_LEVEL_INFO)
printk("%s(%d):mgsl_open(%s), old ref count = %d\n",
@@ -44581,7 +44028,7 @@ index 8983276..72a4090 100644
/* If port is closing, signal caller to try again */
if (tty_hung_up_p(filp) || info->port.flags & ASYNC_CLOSING){
-@@ -3422,10 +3422,10 @@ static int mgsl_open(struct tty_struct *tty, struct file * filp)
+@@ -3419,10 +3419,10 @@ static int mgsl_open(struct tty_struct *tty, struct file * filp)
spin_unlock_irqrestore(&info->netlock, flags);
goto cleanup;
}
@@ -44594,7 +44041,7 @@ index 8983276..72a4090 100644
/* 1st open on this device, init hardware */
retval = startup(info);
if (retval < 0)
-@@ -3449,8 +3449,8 @@ cleanup:
+@@ -3446,8 +3446,8 @@ cleanup:
if (retval) {
if (tty->count == 1)
info->port.tty = NULL; /* tty layer will release tty struct */
@@ -44605,7 +44052,7 @@ index 8983276..72a4090 100644
}
return retval;
-@@ -7668,7 +7668,7 @@ static int hdlcdev_attach(struct net_device *dev, unsigned short encoding,
+@@ -7665,7 +7665,7 @@ static int hdlcdev_attach(struct net_device *dev, unsigned short encoding,
unsigned short new_crctype;
/* return error if TTY interface open */
@@ -44614,7 +44061,7 @@ index 8983276..72a4090 100644
return -EBUSY;
switch (encoding)
-@@ -7763,7 +7763,7 @@ static int hdlcdev_open(struct net_device *dev)
+@@ -7760,7 +7760,7 @@ static int hdlcdev_open(struct net_device *dev)
/* arbitrate between network and tty opens */
spin_lock_irqsave(&info->netlock, flags);
@@ -44623,7 +44070,7 @@ index 8983276..72a4090 100644
printk(KERN_WARNING "%s: hdlc_open returning busy\n", dev->name);
spin_unlock_irqrestore(&info->netlock, flags);
return -EBUSY;
-@@ -7849,7 +7849,7 @@ static int hdlcdev_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
+@@ -7846,7 +7846,7 @@ static int hdlcdev_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
printk("%s:hdlcdev_ioctl(%s)\n",__FILE__,dev->name);
/* return error if TTY interface open */
@@ -44633,7 +44080,7 @@ index 8983276..72a4090 100644
if (cmd != SIOCWANDEV)
diff --git a/drivers/tty/synclink_gt.c b/drivers/tty/synclink_gt.c
-index aa9eece..d8baaec 100644
+index 1abf946..1ee34fc 100644
--- a/drivers/tty/synclink_gt.c
+++ b/drivers/tty/synclink_gt.c
@@ -670,7 +670,7 @@ static int open(struct tty_struct *tty, struct file *filp)
@@ -44751,7 +44198,7 @@ index aa9eece..d8baaec 100644
if (!retval)
diff --git a/drivers/tty/synclinkmp.c b/drivers/tty/synclinkmp.c
-index 6d5780c..aa4d8cd 100644
+index ff17138..e38b41e 100644
--- a/drivers/tty/synclinkmp.c
+++ b/drivers/tty/synclinkmp.c
@@ -750,7 +750,7 @@ static int open(struct tty_struct *tty, struct file *filp)
@@ -44890,10 +44337,10 @@ index 6d5780c..aa4d8cd 100644
if (!retval)
port->flags |= ASYNC_NORMAL_ACTIVE;
diff --git a/drivers/tty/sysrq.c b/drivers/tty/sysrq.c
-index 3687f0c..6b9b808 100644
+index b51c154..17d55d1 100644
--- a/drivers/tty/sysrq.c
+++ b/drivers/tty/sysrq.c
-@@ -995,7 +995,7 @@ EXPORT_SYMBOL(unregister_sysrq_key);
+@@ -1022,7 +1022,7 @@ EXPORT_SYMBOL(unregister_sysrq_key);
static ssize_t write_sysrq_trigger(struct file *file, const char __user *buf,
size_t count, loff_t *ppos)
{
@@ -44903,10 +44350,10 @@ index 3687f0c..6b9b808 100644
if (get_user(c, buf))
diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c
-index a9cd0b9..47b9336 100644
+index 4476682..d77e748 100644
--- a/drivers/tty/tty_io.c
+++ b/drivers/tty/tty_io.c
-@@ -3398,7 +3398,7 @@ EXPORT_SYMBOL_GPL(get_current_tty);
+@@ -3466,7 +3466,7 @@ EXPORT_SYMBOL_GPL(get_current_tty);
void tty_default_fops(struct file_operations *fops)
{
@@ -44916,19 +44363,10 @@ index a9cd0b9..47b9336 100644
/*
diff --git a/drivers/tty/tty_ldisc.c b/drivers/tty/tty_ldisc.c
-index d794087..e4f49e5 100644
+index 1afe192..73d2c20 100644
--- a/drivers/tty/tty_ldisc.c
+++ b/drivers/tty/tty_ldisc.c
-@@ -56,7 +56,7 @@ static void put_ldisc(struct tty_ldisc *ld)
- if (atomic_dec_and_test(&ld->users)) {
- struct tty_ldisc_ops *ldo = ld->ops;
-
-- ldo->refcount--;
-+ atomic_dec(&ldo->refcount);
- module_put(ldo->owner);
- raw_spin_unlock_irqrestore(&tty_ldisc_lock, flags);
-
-@@ -93,7 +93,7 @@ int tty_register_ldisc(int disc, struct tty_ldisc_ops *new_ldisc)
+@@ -66,7 +66,7 @@ int tty_register_ldisc(int disc, struct tty_ldisc_ops *new_ldisc)
raw_spin_lock_irqsave(&tty_ldisc_lock, flags);
tty_ldiscs[disc] = new_ldisc;
new_ldisc->num = disc;
@@ -44937,7 +44375,7 @@ index d794087..e4f49e5 100644
raw_spin_unlock_irqrestore(&tty_ldisc_lock, flags);
return ret;
-@@ -121,7 +121,7 @@ int tty_unregister_ldisc(int disc)
+@@ -94,7 +94,7 @@ int tty_unregister_ldisc(int disc)
return -EINVAL;
raw_spin_lock_irqsave(&tty_ldisc_lock, flags);
@@ -44946,7 +44384,7 @@ index d794087..e4f49e5 100644
ret = -EBUSY;
else
tty_ldiscs[disc] = NULL;
-@@ -142,7 +142,7 @@ static struct tty_ldisc_ops *get_ldops(int disc)
+@@ -115,7 +115,7 @@ static struct tty_ldisc_ops *get_ldops(int disc)
if (ldops) {
ret = ERR_PTR(-EAGAIN);
if (try_module_get(ldops->owner)) {
@@ -44955,7 +44393,7 @@ index d794087..e4f49e5 100644
ret = ldops;
}
}
-@@ -155,7 +155,7 @@ static void put_ldops(struct tty_ldisc_ops *ldops)
+@@ -128,7 +128,7 @@ static void put_ldops(struct tty_ldisc_ops *ldops)
unsigned long flags;
raw_spin_lock_irqsave(&tty_ldisc_lock, flags);
@@ -44964,20 +44402,29 @@ index d794087..e4f49e5 100644
module_put(ldops->owner);
raw_spin_unlock_irqrestore(&tty_ldisc_lock, flags);
}
+@@ -196,7 +196,7 @@ static inline void tty_ldisc_put(struct tty_ldisc *ld)
+ /* unreleased reader reference(s) will cause this WARN */
+ WARN_ON(!atomic_dec_and_test(&ld->users));
+
+- ld->ops->refcount--;
++ atomic_dec(&ld->ops->refcount);
+ module_put(ld->ops->owner);
+ kfree(ld);
+ raw_spin_unlock_irqrestore(&tty_ldisc_lock, flags);
diff --git a/drivers/tty/tty_port.c b/drivers/tty/tty_port.c
-index b7ff59d..7c6105e 100644
+index 121aeb9..0d2c4b9 100644
--- a/drivers/tty/tty_port.c
+++ b/drivers/tty/tty_port.c
-@@ -218,7 +218,7 @@ void tty_port_hangup(struct tty_port *port)
+@@ -232,7 +232,7 @@ void tty_port_hangup(struct tty_port *port)
unsigned long flags;
spin_lock_irqsave(&port->lock, flags);
- port->count = 0;
+ atomic_set(&port->count, 0);
port->flags &= ~ASYNC_NORMAL_ACTIVE;
- if (port->tty) {
- set_bit(TTY_IO_ERROR, &port->tty->flags);
-@@ -344,7 +344,7 @@ int tty_port_block_til_ready(struct tty_port *port,
+ tty = port->tty;
+ if (tty)
+@@ -391,7 +391,7 @@ int tty_port_block_til_ready(struct tty_port *port,
/* The port lock protects the port counts */
spin_lock_irqsave(&port->lock, flags);
if (!tty_hung_up_p(filp))
@@ -44986,7 +44433,7 @@ index b7ff59d..7c6105e 100644
port->blocked_open++;
spin_unlock_irqrestore(&port->lock, flags);
-@@ -386,7 +386,7 @@ int tty_port_block_til_ready(struct tty_port *port,
+@@ -433,7 +433,7 @@ int tty_port_block_til_ready(struct tty_port *port,
we must not mess that up further */
spin_lock_irqsave(&port->lock, flags);
if (!tty_hung_up_p(filp))
@@ -44995,7 +44442,7 @@ index b7ff59d..7c6105e 100644
port->blocked_open--;
if (retval == 0)
port->flags |= ASYNC_NORMAL_ACTIVE;
-@@ -406,19 +406,19 @@ int tty_port_close_start(struct tty_port *port,
+@@ -467,19 +467,19 @@ int tty_port_close_start(struct tty_port *port,
return 0;
}
@@ -45022,7 +44469,7 @@ index b7ff59d..7c6105e 100644
spin_unlock_irqrestore(&port->lock, flags);
if (port->ops->drop)
port->ops->drop(port);
-@@ -516,7 +516,7 @@ int tty_port_open(struct tty_port *port, struct tty_struct *tty,
+@@ -565,7 +565,7 @@ int tty_port_open(struct tty_port *port, struct tty_struct *tty,
{
spin_lock_irq(&port->lock);
if (!tty_hung_up_p(filp))
@@ -45201,7 +44648,7 @@ index 8a7eb77..c00402f 100644
pos += tmp;
diff --git a/drivers/usb/atm/usbatm.c b/drivers/usb/atm/usbatm.c
-index 35f10bf..6a38a0b 100644
+index d3527dd..26effa2 100644
--- a/drivers/usb/atm/usbatm.c
+++ b/drivers/usb/atm/usbatm.c
@@ -333,7 +333,7 @@ static void usbatm_extract_one_cell(struct usbatm_data *instance, unsigned char
@@ -45315,7 +44762,7 @@ index 2a3bbdf..91d72cf 100644
file->f_version = event_count;
return POLLIN | POLLRDNORM;
diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c
-index f9ec44c..eb5779f 100644
+index d53547d..6a22d02 100644
--- a/drivers/usb/core/hcd.c
+++ b/drivers/usb/core/hcd.c
@@ -1526,7 +1526,7 @@ int usb_hcd_submit_urb (struct urb *urb, gfp_t mem_flags)
@@ -45350,7 +44797,7 @@ index 444d30e..f15c850 100644
__u16 size, int timeout)
{
diff --git a/drivers/usb/core/sysfs.c b/drivers/usb/core/sysfs.c
-index 3f81a3d..a3aa993 100644
+index aa38db4..0a08682 100644
--- a/drivers/usb/core/sysfs.c
+++ b/drivers/usb/core/sysfs.c
@@ -239,7 +239,7 @@ show_urbnum(struct device *dev, struct device_attribute *attr, char *buf)
@@ -45363,10 +44810,10 @@ index 3f81a3d..a3aa993 100644
static DEVICE_ATTR(urbnum, S_IRUGO, show_urbnum, NULL);
diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c
-index f81b925..78d22ec 100644
+index b10da72..43aa0b2 100644
--- a/drivers/usb/core/usb.c
+++ b/drivers/usb/core/usb.c
-@@ -388,7 +388,7 @@ struct usb_device *usb_alloc_dev(struct usb_device *parent,
+@@ -389,7 +389,7 @@ struct usb_device *usb_alloc_dev(struct usb_device *parent,
set_dev_node(&dev->dev, dev_to_node(bus->controller));
dev->state = USB_STATE_ATTACHED;
dev->lpm_disable_count = 1;
@@ -45532,132 +44979,6 @@ index 5f3bcd3..bfca43f 100644
usb_autopm_put_interface(serial->interface);
error_get_interface:
usb_serial_put(serial);
-diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c
-index 4747d1c..3850e92 100644
---- a/drivers/usb/serial/cp210x.c
-+++ b/drivers/usb/serial/cp210x.c
-@@ -53,6 +53,7 @@ static const struct usb_device_id id_table[] = {
- { USB_DEVICE(0x0489, 0xE000) }, /* Pirelli Broadband S.p.A, DP-L10 SIP/GSM Mobile */
- { USB_DEVICE(0x0489, 0xE003) }, /* Pirelli Broadband S.p.A, DP-L10 SIP/GSM Mobile */
- { USB_DEVICE(0x0745, 0x1000) }, /* CipherLab USB CCD Barcode Scanner 1000 */
-+ { USB_DEVICE(0x0846, 0x1100) }, /* NetGear Managed Switch M4100 series, M5300 series, M7100 series */
- { USB_DEVICE(0x08e6, 0x5501) }, /* Gemalto Prox-PU/CU contactless smartcard reader */
- { USB_DEVICE(0x08FD, 0x000A) }, /* Digianswer A/S , ZigBee/802.15.4 MAC Device */
- { USB_DEVICE(0x0BED, 0x1100) }, /* MEI (TM) Cashflow-SC Bill/Voucher Acceptor */
-@@ -118,6 +119,8 @@ static const struct usb_device_id id_table[] = {
- { USB_DEVICE(0x10C4, 0x85F8) }, /* Virtenio Preon32 */
- { USB_DEVICE(0x10C4, 0x8664) }, /* AC-Services CAN-IF */
- { USB_DEVICE(0x10C4, 0x8665) }, /* AC-Services OBD-IF */
-+ { USB_DEVICE(0x10C4, 0x88A4) }, /* MMB Networks ZigBee USB Device */
-+ { USB_DEVICE(0x10C4, 0x88A5) }, /* Planet Innovation Ingeni ZigBee USB Device */
- { USB_DEVICE(0x10C4, 0xEA60) }, /* Silicon Labs factory default */
- { USB_DEVICE(0x10C4, 0xEA61) }, /* Silicon Labs factory default */
- { USB_DEVICE(0x10C4, 0xEA70) }, /* Silicon Labs factory default */
-@@ -148,6 +151,7 @@ static const struct usb_device_id id_table[] = {
- { USB_DEVICE(0x17F4, 0xAAAA) }, /* Wavesense Jazz blood glucose meter */
- { USB_DEVICE(0x1843, 0x0200) }, /* Vaisala USB Instrument Cable */
- { USB_DEVICE(0x18EF, 0xE00F) }, /* ELV USB-I2C-Interface */
-+ { USB_DEVICE(0x1ADB, 0x0001) }, /* Schweitzer Engineering C662 Cable */
- { USB_DEVICE(0x1BE3, 0x07A6) }, /* WAGO 750-923 USB Service Cable */
- { USB_DEVICE(0x1E29, 0x0102) }, /* Festo CPX-USB */
- { USB_DEVICE(0x1E29, 0x0501) }, /* Festo CMSP */
-diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
-index 9162db2..b7cabbf 100644
---- a/drivers/usb/serial/option.c
-+++ b/drivers/usb/serial/option.c
-@@ -343,17 +343,12 @@ static void option_instat_callback(struct urb *urb);
- #define OLIVETTI_VENDOR_ID 0x0b3c
- #define OLIVETTI_PRODUCT_OLICARD100 0xc000
- #define OLIVETTI_PRODUCT_OLICARD145 0xc003
-+#define OLIVETTI_PRODUCT_OLICARD200 0xc005
-
- /* Celot products */
- #define CELOT_VENDOR_ID 0x211f
- #define CELOT_PRODUCT_CT680M 0x6801
-
--/* ONDA Communication vendor id */
--#define ONDA_VENDOR_ID 0x1ee8
--
--/* ONDA MT825UP HSDPA 14.2 modem */
--#define ONDA_MT825UP 0x000b
--
- /* Samsung products */
- #define SAMSUNG_VENDOR_ID 0x04e8
- #define SAMSUNG_PRODUCT_GT_B3730 0x6889
-@@ -446,7 +441,8 @@ static void option_instat_callback(struct urb *urb);
-
- /* Hyundai Petatel Inc. products */
- #define PETATEL_VENDOR_ID 0x1ff4
--#define PETATEL_PRODUCT_NP10T 0x600e
-+#define PETATEL_PRODUCT_NP10T_600A 0x600a
-+#define PETATEL_PRODUCT_NP10T_600E 0x600e
-
- /* TP-LINK Incorporated products */
- #define TPLINK_VENDOR_ID 0x2357
-@@ -786,6 +782,7 @@ static const struct usb_device_id option_ids[] = {
- { USB_DEVICE(KYOCERA_VENDOR_ID, KYOCERA_PRODUCT_KPC650) },
- { USB_DEVICE(KYOCERA_VENDOR_ID, KYOCERA_PRODUCT_KPC680) },
- { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x6613)}, /* Onda H600/ZTE MF330 */
-+ { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x0023)}, /* ONYX 3G device */
- { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x9000)}, /* SIMCom SIM5218 */
- { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_6280) }, /* BP3-USB & BP3-EXT HSDPA */
- { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_6008) },
-@@ -821,7 +818,8 @@ static const struct usb_device_id option_ids[] = {
- { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0017, 0xff, 0xff, 0xff),
- .driver_info = (kernel_ulong_t)&net_intf3_blacklist },
- { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0018, 0xff, 0xff, 0xff) },
-- { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0019, 0xff, 0xff, 0xff) },
-+ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0019, 0xff, 0xff, 0xff),
-+ .driver_info = (kernel_ulong_t)&net_intf3_blacklist },
- { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0020, 0xff, 0xff, 0xff) },
- { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0021, 0xff, 0xff, 0xff),
- .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
-@@ -1260,8 +1258,8 @@ static const struct usb_device_id option_ids[] = {
-
- { USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD100) },
- { USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD145) },
-+ { USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD200) },
- { USB_DEVICE(CELOT_VENDOR_ID, CELOT_PRODUCT_CT680M) }, /* CT-650 CDMA 450 1xEVDO modem */
-- { USB_DEVICE(ONDA_VENDOR_ID, ONDA_MT825UP) }, /* ONDA MT825UP modem */
- { USB_DEVICE_AND_INTERFACE_INFO(SAMSUNG_VENDOR_ID, SAMSUNG_PRODUCT_GT_B3730, USB_CLASS_CDC_DATA, 0x00, 0x00) }, /* Samsung GT-B3730 LTE USB modem.*/
- { USB_DEVICE(YUGA_VENDOR_ID, YUGA_PRODUCT_CEM600) },
- { USB_DEVICE(YUGA_VENDOR_ID, YUGA_PRODUCT_CEM610) },
-@@ -1333,9 +1331,12 @@ static const struct usb_device_id option_ids[] = {
- { USB_DEVICE_AND_INTERFACE_INFO(MEDIATEK_VENDOR_ID, MEDIATEK_PRODUCT_DC_4COM2, 0xff, 0x02, 0x01) },
- { USB_DEVICE_AND_INTERFACE_INFO(MEDIATEK_VENDOR_ID, MEDIATEK_PRODUCT_DC_4COM2, 0xff, 0x00, 0x00) },
- { USB_DEVICE(CELLIENT_VENDOR_ID, CELLIENT_PRODUCT_MEN200) },
-- { USB_DEVICE(PETATEL_VENDOR_ID, PETATEL_PRODUCT_NP10T) },
-+ { USB_DEVICE(PETATEL_VENDOR_ID, PETATEL_PRODUCT_NP10T_600A) },
-+ { USB_DEVICE(PETATEL_VENDOR_ID, PETATEL_PRODUCT_NP10T_600E) },
- { USB_DEVICE(TPLINK_VENDOR_ID, TPLINK_PRODUCT_MA180),
- .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
-+ { USB_DEVICE(TPLINK_VENDOR_ID, 0x9000), /* TP-Link MA260 */
-+ .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
- { USB_DEVICE(CHANGHONG_VENDOR_ID, CHANGHONG_PRODUCT_CH690) },
- { USB_DEVICE_AND_INTERFACE_INFO(0x2001, 0x7d01, 0xff, 0x02, 0x01) }, /* D-Link DWM-156 (variant) */
- { USB_DEVICE_AND_INTERFACE_INFO(0x2001, 0x7d01, 0xff, 0x00, 0x00) }, /* D-Link DWM-156 (variant) */
-@@ -1343,6 +1344,8 @@ static const struct usb_device_id option_ids[] = {
- { USB_DEVICE_AND_INTERFACE_INFO(0x2001, 0x7d02, 0xff, 0x00, 0x00) },
- { USB_DEVICE_AND_INTERFACE_INFO(0x2001, 0x7d03, 0xff, 0x02, 0x01) },
- { USB_DEVICE_AND_INTERFACE_INFO(0x2001, 0x7d03, 0xff, 0x00, 0x00) },
-+ { USB_DEVICE_AND_INTERFACE_INFO(0x07d1, 0x3e01, 0xff, 0xff, 0xff) }, /* D-Link DWM-152/C1 */
-+ { USB_DEVICE_AND_INTERFACE_INFO(0x07d1, 0x3e02, 0xff, 0xff, 0xff) }, /* D-Link DWM-156/C1 */
- { } /* Terminating entry */
- };
- MODULE_DEVICE_TABLE(usb, option_ids);
-diff --git a/drivers/usb/storage/realtek_cr.c b/drivers/usb/storage/realtek_cr.c
-index 6c3586a..a94e621 100644
---- a/drivers/usb/storage/realtek_cr.c
-+++ b/drivers/usb/storage/realtek_cr.c
-@@ -429,7 +429,7 @@ static int rts51x_read_status(struct us_data *us,
-
- buf = kmalloc(len, GFP_NOIO);
- if (buf == NULL)
-- return USB_STOR_TRANSPORT_ERROR;
-+ return -ENOMEM;
-
- US_DEBUGP("%s, lun = %d\n", __func__, lun);
-
diff --git a/drivers/usb/storage/usb.h b/drivers/usb/storage/usb.h
index 75f70f0..d467e1a 100644
--- a/drivers/usb/storage/usb.h
@@ -45706,55 +45027,18 @@ index 6ef94bc..1b41265 100644
}
/*
-diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c
-index dfff647..3a19054 100644
---- a/drivers/vhost/net.c
-+++ b/drivers/vhost/net.c
-@@ -857,7 +857,7 @@ static long vhost_net_set_backend(struct vhost_net *n, unsigned index, int fd)
- mutex_unlock(&vq->mutex);
-
- if (oldubufs) {
-- vhost_ubuf_put_and_wait(oldubufs);
-+ vhost_ubuf_put_and_wait_and_free(oldubufs);
- mutex_lock(&vq->mutex);
- vhost_zerocopy_signal_used(n, vq);
- mutex_unlock(&vq->mutex);
-@@ -875,7 +875,7 @@ err_used:
- rcu_assign_pointer(vq->private_data, oldsock);
- vhost_net_enable_vq(n, vq);
- if (ubufs)
-- vhost_ubuf_put_and_wait(ubufs);
-+ vhost_ubuf_put_and_wait_and_free(ubufs);
- err_ubufs:
- fput(sock->file);
- err_vq:
-diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c
-index 9759249..2e2524c 100644
---- a/drivers/vhost/vhost.c
-+++ b/drivers/vhost/vhost.c
-@@ -1581,5 +1581,11 @@ void vhost_ubuf_put_and_wait(struct vhost_ubuf_ref *ubufs)
- {
- kref_put(&ubufs->kref, vhost_zerocopy_done_signal);
- wait_event(ubufs->wait, !atomic_read(&ubufs->kref.refcount));
-+}
-+
-+void vhost_ubuf_put_and_wait_and_free(struct vhost_ubuf_ref *ubufs)
-+{
-+ vhost_ubuf_put_and_wait(ubufs);
- kfree(ubufs);
- }
-+
-diff --git a/drivers/vhost/vhost.h b/drivers/vhost/vhost.h
-index 17261e2..70cbe6f 100644
---- a/drivers/vhost/vhost.h
-+++ b/drivers/vhost/vhost.h
-@@ -63,6 +63,7 @@ struct vhost_ubuf_ref {
- struct vhost_ubuf_ref *vhost_ubuf_alloc(struct vhost_virtqueue *, bool zcopy);
- void vhost_ubuf_put(struct vhost_ubuf_ref *);
- void vhost_ubuf_put_and_wait(struct vhost_ubuf_ref *);
-+void vhost_ubuf_put_and_wait_and_free(struct vhost_ubuf_ref *);
-
- struct ubuf_info;
+diff --git a/drivers/vhost/vringh.c b/drivers/vhost/vringh.c
+index 5174eba..86e764a 100644
+--- a/drivers/vhost/vringh.c
++++ b/drivers/vhost/vringh.c
+@@ -800,7 +800,7 @@ static inline int getu16_kern(u16 *val, const u16 *p)
+
+ static inline int putu16_kern(u16 *p, u16 val)
+ {
+- ACCESS_ONCE(*p) = val;
++ ACCESS_ONCE_RW(*p) = val;
+ return 0;
+ }
diff --git a/drivers/video/aty/aty128fb.c b/drivers/video/aty/aty128fb.c
index 8c55011..eed4ae1a 100644
@@ -45813,8 +45097,21 @@ index 95ec042..e6affdd 100644
return 0;
}
+diff --git a/drivers/video/backlight/backlight.c b/drivers/video/backlight/backlight.c
+index c74e7aa..e3c2790 100644
+--- a/drivers/video/backlight/backlight.c
++++ b/drivers/video/backlight/backlight.c
+@@ -304,7 +304,7 @@ struct backlight_device *backlight_device_register(const char *name,
+ new_bd->dev.class = backlight_class;
+ new_bd->dev.parent = parent;
+ new_bd->dev.release = bl_device_release;
+- dev_set_name(&new_bd->dev, name);
++ dev_set_name(&new_bd->dev, "%s", name);
+ dev_set_drvdata(&new_bd->dev, devdata);
+
+ /* Set default properties */
diff --git a/drivers/video/backlight/kb3886_bl.c b/drivers/video/backlight/kb3886_bl.c
-index 6c5ed6b..b727c88 100644
+index bca6ccc..252107e 100644
--- a/drivers/video/backlight/kb3886_bl.c
+++ b/drivers/video/backlight/kb3886_bl.c
@@ -78,7 +78,7 @@ static struct kb3886bl_machinfo *bl_machinfo;
@@ -45826,6 +45123,19 @@ index 6c5ed6b..b727c88 100644
{
.ident = "Sahara Touch-iT",
.matches = {
+diff --git a/drivers/video/backlight/lcd.c b/drivers/video/backlight/lcd.c
+index 34fb6bd..3649fd9 100644
+--- a/drivers/video/backlight/lcd.c
++++ b/drivers/video/backlight/lcd.c
+@@ -219,7 +219,7 @@ struct lcd_device *lcd_device_register(const char *name, struct device *parent,
+ new_ld->dev.class = lcd_class;
+ new_ld->dev.parent = parent;
+ new_ld->dev.release = lcd_device_release;
+- dev_set_name(&new_ld->dev, name);
++ dev_set_name(&new_ld->dev, "%s", name);
+ dev_set_drvdata(&new_ld->dev, devdata);
+
+ rc = device_register(&new_ld->dev);
diff --git a/drivers/video/fb_defio.c b/drivers/video/fb_defio.c
index 900aa4e..6d49418 100644
--- a/drivers/video/fb_defio.c
@@ -45865,7 +45175,7 @@ index 5c3960d..15cf8fc 100644
goto out1;
}
diff --git a/drivers/video/fbmem.c b/drivers/video/fbmem.c
-index 86291dc..7cc5962 100644
+index 098bfc6..796841d 100644
--- a/drivers/video/fbmem.c
+++ b/drivers/video/fbmem.c
@@ -428,7 +428,7 @@ static void fb_do_show_logo(struct fb_info *info, struct fb_image *image,
@@ -48729,7 +48039,7 @@ index 0d6f2cd..6285b97 100644
ret_code = device_register(&new_dev->dev);
if (ret_code) {
diff --git a/drivers/video/s1d13xxxfb.c b/drivers/video/s1d13xxxfb.c
-index 76d9053..dec2bfd 100644
+index 05c2dc3..ea1f391 100644
--- a/drivers/video/s1d13xxxfb.c
+++ b/drivers/video/s1d13xxxfb.c
@@ -881,8 +881,10 @@ static int s1d13xxxfb_probe(struct platform_device *pdev)
@@ -48746,10 +48056,10 @@ index 76d9053..dec2bfd 100644
FBINFO_HWACCEL_FILLRECT | FBINFO_HWACCEL_COPYAREA;
break;
diff --git a/drivers/video/smscufx.c b/drivers/video/smscufx.c
-index 97bd662..39fab85 100644
+index b2b33fc..f9f4658 100644
--- a/drivers/video/smscufx.c
+++ b/drivers/video/smscufx.c
-@@ -1171,7 +1171,9 @@ static int ufx_ops_release(struct fb_info *info, int user)
+@@ -1175,7 +1175,9 @@ static int ufx_ops_release(struct fb_info *info, int user)
fb_deferred_io_cleanup(info);
kfree(info->fbdefio);
info->fbdefio = NULL;
@@ -48761,10 +48071,10 @@ index 97bd662..39fab85 100644
pr_debug("released /dev/fb%d user=%d count=%d",
diff --git a/drivers/video/udlfb.c b/drivers/video/udlfb.c
-index 86d449e..8e04dc5 100644
+index ec03e72..f578436 100644
--- a/drivers/video/udlfb.c
+++ b/drivers/video/udlfb.c
-@@ -619,11 +619,11 @@ int dlfb_handle_damage(struct dlfb_data *dev, int x, int y,
+@@ -623,11 +623,11 @@ int dlfb_handle_damage(struct dlfb_data *dev, int x, int y,
dlfb_urb_completion(urb);
error:
@@ -48780,7 +48090,7 @@ index 86d449e..8e04dc5 100644
>> 10)), /* Kcycles */
&dev->cpu_kcycles_used);
-@@ -744,11 +744,11 @@ static void dlfb_dpy_deferred_io(struct fb_info *info,
+@@ -748,11 +748,11 @@ static void dlfb_dpy_deferred_io(struct fb_info *info,
dlfb_urb_completion(urb);
error:
@@ -48796,7 +48106,7 @@ index 86d449e..8e04dc5 100644
>> 10)), /* Kcycles */
&dev->cpu_kcycles_used);
}
-@@ -989,7 +989,9 @@ static int dlfb_ops_release(struct fb_info *info, int user)
+@@ -993,7 +993,9 @@ static int dlfb_ops_release(struct fb_info *info, int user)
fb_deferred_io_cleanup(info);
kfree(info->fbdefio);
info->fbdefio = NULL;
@@ -48807,7 +48117,7 @@ index 86d449e..8e04dc5 100644
}
pr_warn("released /dev/fb%d user=%d count=%d\n",
-@@ -1372,7 +1374,7 @@ static ssize_t metrics_bytes_rendered_show(struct device *fbdev,
+@@ -1376,7 +1378,7 @@ static ssize_t metrics_bytes_rendered_show(struct device *fbdev,
struct fb_info *fb_info = dev_get_drvdata(fbdev);
struct dlfb_data *dev = fb_info->par;
return snprintf(buf, PAGE_SIZE, "%u\n",
@@ -48816,7 +48126,7 @@ index 86d449e..8e04dc5 100644
}
static ssize_t metrics_bytes_identical_show(struct device *fbdev,
-@@ -1380,7 +1382,7 @@ static ssize_t metrics_bytes_identical_show(struct device *fbdev,
+@@ -1384,7 +1386,7 @@ static ssize_t metrics_bytes_identical_show(struct device *fbdev,
struct fb_info *fb_info = dev_get_drvdata(fbdev);
struct dlfb_data *dev = fb_info->par;
return snprintf(buf, PAGE_SIZE, "%u\n",
@@ -48825,7 +48135,7 @@ index 86d449e..8e04dc5 100644
}
static ssize_t metrics_bytes_sent_show(struct device *fbdev,
-@@ -1388,7 +1390,7 @@ static ssize_t metrics_bytes_sent_show(struct device *fbdev,
+@@ -1392,7 +1394,7 @@ static ssize_t metrics_bytes_sent_show(struct device *fbdev,
struct fb_info *fb_info = dev_get_drvdata(fbdev);
struct dlfb_data *dev = fb_info->par;
return snprintf(buf, PAGE_SIZE, "%u\n",
@@ -48834,7 +48144,7 @@ index 86d449e..8e04dc5 100644
}
static ssize_t metrics_cpu_kcycles_used_show(struct device *fbdev,
-@@ -1396,7 +1398,7 @@ static ssize_t metrics_cpu_kcycles_used_show(struct device *fbdev,
+@@ -1400,7 +1402,7 @@ static ssize_t metrics_cpu_kcycles_used_show(struct device *fbdev,
struct fb_info *fb_info = dev_get_drvdata(fbdev);
struct dlfb_data *dev = fb_info->par;
return snprintf(buf, PAGE_SIZE, "%u\n",
@@ -48843,7 +48153,7 @@ index 86d449e..8e04dc5 100644
}
static ssize_t edid_show(
-@@ -1456,10 +1458,10 @@ static ssize_t metrics_reset_store(struct device *fbdev,
+@@ -1460,10 +1462,10 @@ static ssize_t metrics_reset_store(struct device *fbdev,
struct fb_info *fb_info = dev_get_drvdata(fbdev);
struct dlfb_data *dev = fb_info->par;
@@ -48859,7 +48169,7 @@ index 86d449e..8e04dc5 100644
return count;
}
diff --git a/drivers/video/uvesafb.c b/drivers/video/uvesafb.c
-index d428445..79a78df 100644
+index e328a61..1b08ecb 100644
--- a/drivers/video/uvesafb.c
+++ b/drivers/video/uvesafb.c
@@ -19,6 +19,7 @@
@@ -49124,10 +48434,10 @@ index fef20db..d28b1ab 100644
return -ENOMEM;
return 0;
diff --git a/fs/9p/vfs_addr.c b/fs/9p/vfs_addr.c
-index 0ad61c6..f198bd7 100644
+index 055562c..fdfb10d 100644
--- a/fs/9p/vfs_addr.c
+++ b/fs/9p/vfs_addr.c
-@@ -185,7 +185,7 @@ static int v9fs_vfs_writepage_locked(struct page *page)
+@@ -186,7 +186,7 @@ static int v9fs_vfs_writepage_locked(struct page *page)
retval = v9fs_file_write_internal(inode,
v9inode->writeback_fid,
@@ -49150,10 +48460,10 @@ index d86edc8..40ff2fb 100644
p9_debug(P9_DEBUG_VFS, " %s %s\n",
dentry->d_name.name, IS_ERR(s) ? "<error>" : s);
diff --git a/fs/Kconfig.binfmt b/fs/Kconfig.binfmt
-index 0efd152..b5802ad 100644
+index 370b24c..ff0be7b 100644
--- a/fs/Kconfig.binfmt
+++ b/fs/Kconfig.binfmt
-@@ -89,7 +89,7 @@ config HAVE_AOUT
+@@ -103,7 +103,7 @@ config HAVE_AOUT
config BINFMT_AOUT
tristate "Kernel support for a.out and ECOFF binaries"
@@ -49163,10 +48473,10 @@ index 0efd152..b5802ad 100644
A.out (Assembler.OUTput) is a set of formats for libraries and
executables used in the earliest versions of UNIX. Linux used
diff --git a/fs/aio.c b/fs/aio.c
-index 1dc8786..d3b29e8 100644
+index 2bbcacf..8614116 100644
--- a/fs/aio.c
+++ b/fs/aio.c
-@@ -111,7 +111,7 @@ static int aio_setup_ring(struct kioctx *ctx)
+@@ -160,7 +160,7 @@ static int aio_setup_ring(struct kioctx *ctx)
size += sizeof(struct io_event) * nr_events;
nr_pages = (size + PAGE_SIZE-1) >> PAGE_SHIFT;
@@ -49175,39 +48485,39 @@ index 1dc8786..d3b29e8 100644
return -EINVAL;
nr_events = (PAGE_SIZE * nr_pages - sizeof(struct aio_ring)) / sizeof(struct io_event);
-@@ -1375,18 +1375,19 @@ static ssize_t aio_fsync(struct kiocb *iocb)
- static ssize_t aio_setup_vectored_rw(int type, struct kiocb *kiocb, bool compat)
+@@ -950,6 +950,7 @@ static ssize_t aio_rw_vect_retry(struct kiocb *iocb, int rw, aio_rw_op *rw_op)
+ static ssize_t aio_setup_vectored_rw(int rw, struct kiocb *kiocb, bool compat)
{
ssize_t ret;
+ struct iovec iovstack;
- #ifdef CONFIG_COMPAT
+ kiocb->ki_nr_segs = kiocb->ki_nbytes;
+
+@@ -957,17 +958,22 @@ static ssize_t aio_setup_vectored_rw(int rw, struct kiocb *kiocb, bool compat)
if (compat)
- ret = compat_rw_copy_check_uvector(type,
+ ret = compat_rw_copy_check_uvector(rw,
(struct compat_iovec __user *)kiocb->ki_buf,
-- kiocb->ki_nbytes, 1, &kiocb->ki_inline_vec,
-+ kiocb->ki_nbytes, 1, &iovstack,
+- kiocb->ki_nr_segs, 1, &kiocb->ki_inline_vec,
++ kiocb->ki_nr_segs, 1, &iovstack,
&kiocb->ki_iovec);
else
#endif
- ret = rw_copy_check_uvector(type,
+ ret = rw_copy_check_uvector(rw,
(struct iovec __user *)kiocb->ki_buf,
-- kiocb->ki_nbytes, 1, &kiocb->ki_inline_vec,
-+ kiocb->ki_nbytes, 1, &iovstack,
+- kiocb->ki_nr_segs, 1, &kiocb->ki_inline_vec,
++ kiocb->ki_nr_segs, 1, &iovstack,
&kiocb->ki_iovec);
if (ret < 0)
- goto out;
-@@ -1395,6 +1396,10 @@ static ssize_t aio_setup_vectored_rw(int type, struct kiocb *kiocb, bool compat)
- if (ret < 0)
- goto out;
+ return ret;
+ if (kiocb->ki_iovec == &iovstack) {
+ kiocb->ki_inline_vec = iovstack;
+ kiocb->ki_iovec = &kiocb->ki_inline_vec;
+ }
- kiocb->ki_nr_segs = kiocb->ki_nbytes;
- kiocb->ki_cur_seg = 0;
- /* ki_nbytes/left now reflect bytes instead of segs */
++
+ /* ki_nbytes now reflect bytes instead of segs */
+ kiocb->ki_nbytes = ret;
+ return 0;
diff --git a/fs/attr.c b/fs/attr.c
index 1449adb..a2038c2 100644
--- a/fs/attr.c
@@ -49280,7 +48590,7 @@ index 2722387..c8dd2a7 100644
{
if (BEFS_SB(sb)->byte_order == BEFS_BYTESEX_LE)
diff --git a/fs/befs/linuxvfs.c b/fs/befs/linuxvfs.c
-index 8615ee8..388ed68 100644
+index f95dddc..b1e2c1c 100644
--- a/fs/befs/linuxvfs.c
+++ b/fs/befs/linuxvfs.c
@@ -510,7 +510,7 @@ static void befs_put_link(struct dentry *dentry, struct nameidata *nd, void *p)
@@ -49293,7 +48603,7 @@ index 8615ee8..388ed68 100644
kfree(link);
}
diff --git a/fs/binfmt_aout.c b/fs/binfmt_aout.c
-index bbc8f88..7c7ac97 100644
+index bce8769..7fc7544 100644
--- a/fs/binfmt_aout.c
+++ b/fs/binfmt_aout.c
@@ -16,6 +16,7 @@
@@ -49313,7 +48623,7 @@ index bbc8f88..7c7ac97 100644
fs = get_fs();
set_fs(KERNEL_DS);
has_dumped = 1;
-@@ -70,10 +73,12 @@ static int aout_core_dump(struct coredump_params *cprm)
+@@ -69,10 +72,12 @@ static int aout_core_dump(struct coredump_params *cprm)
/* If the size of the dump file exceeds the rlimit, then see what would happen
if we wrote the stack, but not the data area. */
@@ -49326,7 +48636,7 @@ index bbc8f88..7c7ac97 100644
if ((dump.u_ssize + 1) * PAGE_SIZE > cprm->limit)
dump.u_ssize = 0;
-@@ -234,6 +239,8 @@ static int load_aout_binary(struct linux_binprm * bprm)
+@@ -233,6 +238,8 @@ static int load_aout_binary(struct linux_binprm * bprm)
rlim = rlimit(RLIMIT_DATA);
if (rlim >= RLIM_INFINITY)
rlim = ~0;
@@ -49335,7 +48645,7 @@ index bbc8f88..7c7ac97 100644
if (ex.a_data + ex.a_bss > rlim)
return -ENOMEM;
-@@ -268,6 +275,27 @@ static int load_aout_binary(struct linux_binprm * bprm)
+@@ -267,6 +274,27 @@ static int load_aout_binary(struct linux_binprm * bprm)
install_exec_creds(bprm);
@@ -49363,7 +48673,7 @@ index bbc8f88..7c7ac97 100644
if (N_MAGIC(ex) == OMAGIC) {
unsigned long text_addr, map_size;
loff_t pos;
-@@ -333,7 +361,7 @@ static int load_aout_binary(struct linux_binprm * bprm)
+@@ -324,7 +352,7 @@ static int load_aout_binary(struct linux_binprm * bprm)
}
error = vm_mmap(bprm->file, N_DATADDR(ex), ex.a_data,
@@ -49373,7 +48683,7 @@ index bbc8f88..7c7ac97 100644
fd_offset + ex.a_text);
if (error != N_DATADDR(ex)) {
diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c
-index 86af964..5d53bf6 100644
+index f8a0b0e..8c841c3 100644
--- a/fs/binfmt_elf.c
+++ b/fs/binfmt_elf.c
@@ -34,6 +34,7 @@
@@ -49384,7 +48694,7 @@ index 86af964..5d53bf6 100644
#include <asm/uaccess.h>
#include <asm/param.h>
#include <asm/page.h>
-@@ -60,6 +61,10 @@ static int elf_core_dump(struct coredump_params *cprm);
+@@ -60,6 +61,14 @@ static int elf_core_dump(struct coredump_params *cprm);
#define elf_core_dump NULL
#endif
@@ -49392,10 +48702,14 @@ index 86af964..5d53bf6 100644
+static void elf_handle_mprotect(struct vm_area_struct *vma, unsigned long newflags);
+#endif
+
++#ifdef CONFIG_GRKERNSEC_RWXMAP_LOG
++static void elf_handle_mmap(struct file *file);
++#endif
++
#if ELF_EXEC_PAGESIZE > PAGE_SIZE
#define ELF_MIN_ALIGN ELF_EXEC_PAGESIZE
#else
-@@ -79,6 +84,11 @@ static struct linux_binfmt elf_format = {
+@@ -79,6 +88,15 @@ static struct linux_binfmt elf_format = {
.load_binary = load_elf_binary,
.load_shlib = load_elf_library,
.core_dump = elf_core_dump,
@@ -49404,10 +48718,14 @@ index 86af964..5d53bf6 100644
+ .handle_mprotect= elf_handle_mprotect,
+#endif
+
++#ifdef CONFIG_GRKERNSEC_RWXMAP_LOG
++ .handle_mmap = elf_handle_mmap,
++#endif
++
.min_coredump = ELF_EXEC_PAGESIZE,
};
-@@ -86,6 +96,8 @@ static struct linux_binfmt elf_format = {
+@@ -86,6 +104,8 @@ static struct linux_binfmt elf_format = {
static int set_brk(unsigned long start, unsigned long end)
{
@@ -49416,7 +48734,7 @@ index 86af964..5d53bf6 100644
start = ELF_PAGEALIGN(start);
end = ELF_PAGEALIGN(end);
if (end > start) {
-@@ -94,7 +106,7 @@ static int set_brk(unsigned long start, unsigned long end)
+@@ -94,7 +114,7 @@ static int set_brk(unsigned long start, unsigned long end)
if (BAD_ADDR(addr))
return addr;
}
@@ -49425,7 +48743,7 @@ index 86af964..5d53bf6 100644
return 0;
}
-@@ -155,12 +167,13 @@ create_elf_tables(struct linux_binprm *bprm, struct elfhdr *exec,
+@@ -155,12 +175,13 @@ create_elf_tables(struct linux_binprm *bprm, struct elfhdr *exec,
elf_addr_t __user *u_rand_bytes;
const char *k_platform = ELF_PLATFORM;
const char *k_base_platform = ELF_BASE_PLATFORM;
@@ -49440,22 +48758,22 @@ index 86af964..5d53bf6 100644
/*
* In some cases (e.g. Hyper-Threading), we want to avoid L1
-@@ -202,8 +215,12 @@ create_elf_tables(struct linux_binprm *bprm, struct elfhdr *exec,
+@@ -202,8 +223,12 @@ create_elf_tables(struct linux_binprm *bprm, struct elfhdr *exec,
* Generate 16 random bytes for userspace PRNG seeding.
*/
get_random_bytes(k_rand_bytes, sizeof(k_rand_bytes));
- u_rand_bytes = (elf_addr_t __user *)
- STACK_ALLOC(p, sizeof(k_rand_bytes));
-+ srandom32(k_rand_bytes[0] ^ random32());
-+ srandom32(k_rand_bytes[1] ^ random32());
-+ srandom32(k_rand_bytes[2] ^ random32());
-+ srandom32(k_rand_bytes[3] ^ random32());
++ prandom_seed(k_rand_bytes[0] ^ prandom_u32());
++ prandom_seed(k_rand_bytes[1] ^ prandom_u32());
++ prandom_seed(k_rand_bytes[2] ^ prandom_u32());
++ prandom_seed(k_rand_bytes[3] ^ prandom_u32());
+ p = STACK_ROUND(p, sizeof(k_rand_bytes));
+ u_rand_bytes = (elf_addr_t __user *) p;
if (__copy_to_user(u_rand_bytes, k_rand_bytes, sizeof(k_rand_bytes)))
return -EFAULT;
-@@ -315,9 +332,11 @@ create_elf_tables(struct linux_binprm *bprm, struct elfhdr *exec,
+@@ -318,9 +343,11 @@ create_elf_tables(struct linux_binprm *bprm, struct elfhdr *exec,
return -EFAULT;
current->mm->env_end = p;
@@ -49468,7 +48786,7 @@ index 86af964..5d53bf6 100644
return -EFAULT;
return 0;
}
-@@ -385,15 +404,14 @@ static unsigned long total_mapping_size(struct elf_phdr *cmds, int nr)
+@@ -388,15 +415,14 @@ static unsigned long total_mapping_size(struct elf_phdr *cmds, int nr)
an ELF header */
static unsigned long load_elf_interp(struct elfhdr *interp_elf_ex,
@@ -49487,7 +48805,7 @@ index 86af964..5d53bf6 100644
unsigned long total_size;
int retval, i, size;
-@@ -439,6 +457,11 @@ static unsigned long load_elf_interp(struct elfhdr *interp_elf_ex,
+@@ -442,6 +468,11 @@ static unsigned long load_elf_interp(struct elfhdr *interp_elf_ex,
goto out_close;
}
@@ -49499,7 +48817,7 @@ index 86af964..5d53bf6 100644
eppnt = elf_phdata;
for (i = 0; i < interp_elf_ex->e_phnum; i++, eppnt++) {
if (eppnt->p_type == PT_LOAD) {
-@@ -462,8 +485,6 @@ static unsigned long load_elf_interp(struct elfhdr *interp_elf_ex,
+@@ -465,8 +496,6 @@ static unsigned long load_elf_interp(struct elfhdr *interp_elf_ex,
map_addr = elf_map(interpreter, load_addr + vaddr,
eppnt, elf_prot, elf_type, total_size);
total_size = 0;
@@ -49508,7 +48826,7 @@ index 86af964..5d53bf6 100644
error = map_addr;
if (BAD_ADDR(map_addr))
goto out_close;
-@@ -482,8 +503,8 @@ static unsigned long load_elf_interp(struct elfhdr *interp_elf_ex,
+@@ -485,8 +514,8 @@ static unsigned long load_elf_interp(struct elfhdr *interp_elf_ex,
k = load_addr + eppnt->p_vaddr;
if (BAD_ADDR(k) ||
eppnt->p_filesz > eppnt->p_memsz ||
@@ -49519,7 +48837,7 @@ index 86af964..5d53bf6 100644
error = -ENOMEM;
goto out_close;
}
-@@ -535,6 +556,315 @@ out:
+@@ -538,6 +567,315 @@ out:
return error;
}
@@ -49835,7 +49153,7 @@ index 86af964..5d53bf6 100644
/*
* These are the functions used to load ELF style executables and shared
* libraries. There is no binary dependent code anywhere else.
-@@ -551,6 +881,11 @@ static unsigned long randomize_stack_top(unsigned long stack_top)
+@@ -554,6 +892,11 @@ static unsigned long randomize_stack_top(unsigned long stack_top)
{
unsigned int random_variable = 0;
@@ -49847,7 +49165,7 @@ index 86af964..5d53bf6 100644
if ((current->flags & PF_RANDOMIZE) &&
!(current->personality & ADDR_NO_RANDOMIZE)) {
random_variable = get_random_int() & STACK_RND_MASK;
-@@ -569,7 +904,7 @@ static int load_elf_binary(struct linux_binprm *bprm)
+@@ -572,7 +915,7 @@ static int load_elf_binary(struct linux_binprm *bprm)
unsigned long load_addr = 0, load_bias = 0;
int load_addr_set = 0;
char * elf_interpreter = NULL;
@@ -49856,7 +49174,7 @@ index 86af964..5d53bf6 100644
struct elf_phdr *elf_ppnt, *elf_phdata;
unsigned long elf_bss, elf_brk;
int retval, i;
-@@ -579,12 +914,12 @@ static int load_elf_binary(struct linux_binprm *bprm)
+@@ -582,12 +925,12 @@ static int load_elf_binary(struct linux_binprm *bprm)
unsigned long start_code, end_code, start_data, end_data;
unsigned long reloc_func_desc __maybe_unused = 0;
int executable_stack = EXSTACK_DEFAULT;
@@ -49870,7 +49188,7 @@ index 86af964..5d53bf6 100644
loc = kmalloc(sizeof(*loc), GFP_KERNEL);
if (!loc) {
-@@ -720,11 +1055,81 @@ static int load_elf_binary(struct linux_binprm *bprm)
+@@ -723,11 +1066,81 @@ static int load_elf_binary(struct linux_binprm *bprm)
goto out_free_dentry;
/* OK, This is the point of no return */
@@ -49953,7 +49271,7 @@ index 86af964..5d53bf6 100644
if (elf_read_implies_exec(loc->elf_ex, executable_stack))
current->personality |= READ_IMPLIES_EXEC;
-@@ -815,6 +1220,20 @@ static int load_elf_binary(struct linux_binprm *bprm)
+@@ -819,6 +1232,20 @@ static int load_elf_binary(struct linux_binprm *bprm)
#else
load_bias = ELF_PAGESTART(ELF_ET_DYN_BASE - vaddr);
#endif
@@ -49974,7 +49292,7 @@ index 86af964..5d53bf6 100644
}
error = elf_map(bprm->file, load_bias + vaddr, elf_ppnt,
-@@ -847,9 +1266,9 @@ static int load_elf_binary(struct linux_binprm *bprm)
+@@ -851,9 +1278,9 @@ static int load_elf_binary(struct linux_binprm *bprm)
* allowed task size. Note that p_filesz must always be
* <= p_memsz so it is only necessary to check p_memsz.
*/
@@ -49987,7 +49305,7 @@ index 86af964..5d53bf6 100644
/* set_brk can never work. Avoid overflows. */
send_sig(SIGKILL, current, 0);
retval = -EINVAL;
-@@ -888,17 +1307,45 @@ static int load_elf_binary(struct linux_binprm *bprm)
+@@ -892,17 +1319,45 @@ static int load_elf_binary(struct linux_binprm *bprm)
goto out_free_dentry;
}
if (likely(elf_bss != elf_brk) && unlikely(padzero(elf_bss))) {
@@ -50001,8 +49319,6 @@ index 86af964..5d53bf6 100644
+ */
}
-- if (elf_interpreter) {
-- unsigned long interp_map_addr = 0;
+#ifdef CONFIG_PAX_RANDMMAP
+ if (current->mm->pax_flags & MF_PAX_RANDMMAP) {
+ unsigned long start, size, flags;
@@ -50012,7 +49328,7 @@ index 86af964..5d53bf6 100644
+ size = PAGE_SIZE + ((pax_get_random_long() & ((1UL << 22) - 1UL)) << 4);
+ flags = MAP_FIXED | MAP_PRIVATE;
+ vm_flags = VM_DONTEXPAND | VM_DONTDUMP;
-
++
+ down_write(&current->mm->mmap_sem);
+ start = get_unmapped_area(NULL, start, PAGE_ALIGN(size), 0, flags);
+ retval = -ENOMEM;
@@ -50032,14 +49348,16 @@ index 86af964..5d53bf6 100644
+ }
+#endif
+
-+ if (elf_interpreter) {
+ if (elf_interpreter) {
+- unsigned long interp_map_addr = 0;
+-
elf_entry = load_elf_interp(&loc->interp_elf_ex,
interpreter,
- &interp_map_addr,
load_bias);
if (!IS_ERR((void *)elf_entry)) {
/*
-@@ -1120,7 +1567,7 @@ static bool always_dump_vma(struct vm_area_struct *vma)
+@@ -1124,7 +1579,7 @@ static bool always_dump_vma(struct vm_area_struct *vma)
* Decide what to dump of a segment, part, all or none.
*/
static unsigned long vma_dump_size(struct vm_area_struct *vma,
@@ -50048,7 +49366,7 @@ index 86af964..5d53bf6 100644
{
#define FILTER(type) (mm_flags & (1UL << MMF_DUMP_##type))
-@@ -1158,7 +1605,7 @@ static unsigned long vma_dump_size(struct vm_area_struct *vma,
+@@ -1162,7 +1617,7 @@ static unsigned long vma_dump_size(struct vm_area_struct *vma,
if (vma->vm_file == NULL)
return 0;
@@ -50057,7 +49375,7 @@ index 86af964..5d53bf6 100644
goto whole;
/*
-@@ -1383,9 +1830,9 @@ static void fill_auxv_note(struct memelfnote *note, struct mm_struct *mm)
+@@ -1387,9 +1842,9 @@ static void fill_auxv_note(struct memelfnote *note, struct mm_struct *mm)
{
elf_addr_t *auxv = (elf_addr_t *) mm->saved_auxv;
int i = 0;
@@ -50069,7 +49387,7 @@ index 86af964..5d53bf6 100644
fill_note(note, "CORE", NT_AUXV, i * sizeof(elf_addr_t), auxv);
}
-@@ -1394,7 +1841,7 @@ static void fill_siginfo_note(struct memelfnote *note, user_siginfo_t *csigdata,
+@@ -1398,7 +1853,7 @@ static void fill_siginfo_note(struct memelfnote *note, user_siginfo_t *csigdata,
{
mm_segment_t old_fs = get_fs();
set_fs(KERNEL_DS);
@@ -50078,7 +49396,7 @@ index 86af964..5d53bf6 100644
set_fs(old_fs);
fill_note(note, "CORE", NT_SIGINFO, sizeof(*csigdata), csigdata);
}
-@@ -2015,14 +2462,14 @@ static void fill_extnum_info(struct elfhdr *elf, struct elf_shdr *shdr4extnum,
+@@ -2019,14 +2474,14 @@ static void fill_extnum_info(struct elfhdr *elf, struct elf_shdr *shdr4extnum,
}
static size_t elf_core_vma_data_size(struct vm_area_struct *gate_vma,
@@ -50095,7 +49413,7 @@ index 86af964..5d53bf6 100644
return size;
}
-@@ -2116,7 +2563,7 @@ static int elf_core_dump(struct coredump_params *cprm)
+@@ -2119,7 +2574,7 @@ static int elf_core_dump(struct coredump_params *cprm)
dataoff = offset = roundup(offset, ELF_EXEC_PAGESIZE);
@@ -50104,7 +49422,7 @@ index 86af964..5d53bf6 100644
offset += elf_core_extra_data_size();
e_shoff = offset;
-@@ -2130,10 +2577,12 @@ static int elf_core_dump(struct coredump_params *cprm)
+@@ -2133,10 +2588,12 @@ static int elf_core_dump(struct coredump_params *cprm)
offset = dataoff;
size += sizeof(*elf);
@@ -50117,7 +49435,7 @@ index 86af964..5d53bf6 100644
if (size > cprm->limit
|| !dump_write(cprm->file, phdr4note, sizeof(*phdr4note)))
goto end_coredump;
-@@ -2147,7 +2596,7 @@ static int elf_core_dump(struct coredump_params *cprm)
+@@ -2150,7 +2607,7 @@ static int elf_core_dump(struct coredump_params *cprm)
phdr.p_offset = offset;
phdr.p_vaddr = vma->vm_start;
phdr.p_paddr = 0;
@@ -50126,7 +49444,7 @@ index 86af964..5d53bf6 100644
phdr.p_memsz = vma->vm_end - vma->vm_start;
offset += phdr.p_filesz;
phdr.p_flags = vma->vm_flags & VM_READ ? PF_R : 0;
-@@ -2158,6 +2607,7 @@ static int elf_core_dump(struct coredump_params *cprm)
+@@ -2161,6 +2618,7 @@ static int elf_core_dump(struct coredump_params *cprm)
phdr.p_align = ELF_EXEC_PAGESIZE;
size += sizeof(phdr);
@@ -50134,7 +49452,7 @@ index 86af964..5d53bf6 100644
if (size > cprm->limit
|| !dump_write(cprm->file, &phdr, sizeof(phdr)))
goto end_coredump;
-@@ -2182,7 +2632,7 @@ static int elf_core_dump(struct coredump_params *cprm)
+@@ -2185,7 +2643,7 @@ static int elf_core_dump(struct coredump_params *cprm)
unsigned long addr;
unsigned long end;
@@ -50143,7 +49461,7 @@ index 86af964..5d53bf6 100644
for (addr = vma->vm_start; addr < end; addr += PAGE_SIZE) {
struct page *page;
-@@ -2191,6 +2641,7 @@ static int elf_core_dump(struct coredump_params *cprm)
+@@ -2194,6 +2652,7 @@ static int elf_core_dump(struct coredump_params *cprm)
page = get_dump_page(addr);
if (page) {
void *kaddr = kmap(page);
@@ -50151,7 +49469,7 @@ index 86af964..5d53bf6 100644
stop = ((size += PAGE_SIZE) > cprm->limit) ||
!dump_write(cprm->file, kaddr,
PAGE_SIZE);
-@@ -2208,6 +2659,7 @@ static int elf_core_dump(struct coredump_params *cprm)
+@@ -2211,6 +2670,7 @@ static int elf_core_dump(struct coredump_params *cprm)
if (e_phnum == PN_XNUM) {
size += sizeof(*shdr4extnum);
@@ -50159,7 +49477,7 @@ index 86af964..5d53bf6 100644
if (size > cprm->limit
|| !dump_write(cprm->file, shdr4extnum,
sizeof(*shdr4extnum)))
-@@ -2228,6 +2680,97 @@ out:
+@@ -2231,6 +2691,167 @@ out:
#endif /* CONFIG_ELF_CORE */
@@ -50227,9 +49545,9 @@ index 86af964..5d53bf6 100644
+ elf_dyn dyn;
+
+ if (sizeof(dyn) != kernel_read(vma->vm_file, elf_p.p_offset + i*sizeof(dyn), (char *)&dyn, sizeof(dyn)))
-+ return;
++ break;
+ if (dyn.d_tag == DT_NULL)
-+ return;
++ break;
+ if (dyn.d_tag == DT_TEXTREL || (dyn.d_tag == DT_FLAGS && (dyn.d_un.d_val & DF_TEXTREL))) {
+ gr_log_textrel(vma);
+ if (is_textrel_rw)
@@ -50237,31 +49555,101 @@ index 86af964..5d53bf6 100644
+ else
+ /* PaX: disallow write access after relocs are done, hopefully noone else needs it... */
+ vma->vm_flags &= ~VM_MAYWRITE;
-+ return;
++ break;
+ }
+ i++;
+ }
-+ return;
++ is_textrel_rw = false;
++ is_textrel_rx = false;
++ continue;
+
+ case PT_GNU_RELRO:
+ if (!is_relro)
+ continue;
+ if ((elf_p.p_offset >> PAGE_SHIFT) == vma->vm_pgoff && ELF_PAGEALIGN(elf_p.p_memsz) == vma->vm_end - vma->vm_start)
+ vma->vm_flags &= ~VM_MAYWRITE;
-+ return;
++ is_relro = false;
++ continue;
++
++#ifdef CONFIG_PAX_PT_PAX_FLAGS
++ case PT_PAX_FLAGS: {
++ const char *msg_mprotect = "", *msg_emutramp = "";
++ char *buffer_lib, *buffer_exe;
++
++ if (elf_p.p_flags & PF_NOMPROTECT)
++ msg_mprotect = "MPROTECT disabled";
++
++#ifdef CONFIG_PAX_EMUTRAMP
++ if (!(vma->vm_mm->pax_flags & MF_PAX_EMUTRAMP) && !(elf_p.p_flags & PF_NOEMUTRAMP))
++ msg_emutramp = "EMUTRAMP enabled";
++#endif
++
++ if (!msg_mprotect[0] && !msg_emutramp[0])
++ continue;
++
++ if (!printk_ratelimit())
++ continue;
++
++ buffer_lib = (char *)__get_free_page(GFP_KERNEL);
++ buffer_exe = (char *)__get_free_page(GFP_KERNEL);
++ if (buffer_lib && buffer_exe) {
++ char *path_lib, *path_exe;
++
++ path_lib = pax_get_path(&vma->vm_file->f_path, buffer_lib, PAGE_SIZE);
++ path_exe = pax_get_path(&vma->vm_mm->exe_file->f_path, buffer_exe, PAGE_SIZE);
++
++ pr_info("PAX: %s wants %s%s%s on %s\n", path_lib, msg_mprotect,
++ (msg_mprotect[0] && msg_emutramp[0] ? " and " : ""), msg_emutramp, path_exe);
++
++ }
++ free_page((unsigned long)buffer_exe);
++ free_page((unsigned long)buffer_lib);
++ continue;
++ }
++#endif
++
+ }
+ }
+}
+#endif
+
++#ifdef CONFIG_GRKERNSEC_RWXMAP_LOG
++
++extern int grsec_enable_log_rwxmaps;
++
++static void elf_handle_mmap(struct file *file)
++{
++ struct elfhdr elf_h;
++ struct elf_phdr elf_p;
++ unsigned long i;
++
++ if (!grsec_enable_log_rwxmaps)
++ return;
++
++ if (sizeof(elf_h) != kernel_read(file, 0UL, (char *)&elf_h, sizeof(elf_h)) ||
++ memcmp(elf_h.e_ident, ELFMAG, SELFMAG) ||
++ (elf_h.e_type != ET_DYN && elf_h.e_type != ET_EXEC) || !elf_check_arch(&elf_h) ||
++ elf_h.e_phentsize != sizeof(struct elf_phdr) ||
++ elf_h.e_phnum > 65536UL / sizeof(struct elf_phdr))
++ return;
++
++ for (i = 0UL; i < elf_h.e_phnum; i++) {
++ if (sizeof(elf_p) != kernel_read(file, elf_h.e_phoff + i*sizeof(elf_p), (char *)&elf_p, sizeof(elf_p)))
++ return;
++ if (elf_p.p_type == PT_GNU_STACK && (elf_p.p_flags & PF_X))
++ gr_log_ptgnustack(file);
++ }
++}
++#endif
++
static int __init init_elf_binfmt(void)
{
register_binfmt(&elf_format);
diff --git a/fs/binfmt_flat.c b/fs/binfmt_flat.c
-index 2036d21..b0430d0 100644
+index d50bbe5..af3b649 100644
--- a/fs/binfmt_flat.c
+++ b/fs/binfmt_flat.c
-@@ -562,7 +562,9 @@ static int load_flat_file(struct linux_binprm * bprm,
+@@ -566,7 +566,9 @@ static int load_flat_file(struct linux_binprm * bprm,
realdatastart = (unsigned long) -ENOMEM;
printk("Unable to allocate RAM for process data, errno %d\n",
(int)-realdatastart);
@@ -50271,7 +49659,7 @@ index 2036d21..b0430d0 100644
ret = realdatastart;
goto err;
}
-@@ -586,8 +588,10 @@ static int load_flat_file(struct linux_binprm * bprm,
+@@ -590,8 +592,10 @@ static int load_flat_file(struct linux_binprm * bprm,
}
if (IS_ERR_VALUE(result)) {
printk("Unable to read data+bss, errno %d\n", (int)-result);
@@ -50282,7 +49670,7 @@ index 2036d21..b0430d0 100644
ret = result;
goto err;
}
-@@ -654,8 +658,10 @@ static int load_flat_file(struct linux_binprm * bprm,
+@@ -653,8 +657,10 @@ static int load_flat_file(struct linux_binprm * bprm,
}
if (IS_ERR_VALUE(result)) {
printk("Unable to read code+data+bss, errno %d\n",(int)-result);
@@ -50294,10 +49682,10 @@ index 2036d21..b0430d0 100644
goto err;
}
diff --git a/fs/bio.c b/fs/bio.c
-index b96fc6c..431d628 100644
+index 94bbc04..6fe78a4 100644
--- a/fs/bio.c
+++ b/fs/bio.c
-@@ -818,7 +818,7 @@ struct bio *bio_copy_user_iov(struct request_queue *q,
+@@ -1096,7 +1096,7 @@ struct bio *bio_copy_user_iov(struct request_queue *q,
/*
* Overflow, abort
*/
@@ -50306,7 +49694,7 @@ index b96fc6c..431d628 100644
return ERR_PTR(-EINVAL);
nr_pages += end - start;
-@@ -952,7 +952,7 @@ static struct bio *__bio_map_user_iov(struct request_queue *q,
+@@ -1230,7 +1230,7 @@ static struct bio *__bio_map_user_iov(struct request_queue *q,
/*
* Overflow, abort
*/
@@ -50315,46 +49703,20 @@ index b96fc6c..431d628 100644
return ERR_PTR(-EINVAL);
nr_pages += end - start;
-@@ -1214,7 +1214,7 @@ static void bio_copy_kern_endio(struct bio *bio, int err)
+@@ -1492,7 +1492,7 @@ static void bio_copy_kern_endio(struct bio *bio, int err)
const int read = bio_data_dir(bio) == READ;
struct bio_map_data *bmd = bio->bi_private;
int i;
- char *p = bmd->sgvecs[0].iov_base;
+ char *p = (char __force_kernel *)bmd->sgvecs[0].iov_base;
- __bio_for_each_segment(bvec, bio, i, 0) {
+ bio_for_each_segment_all(bvec, bio, i) {
char *addr = page_address(bvec->bv_page);
diff --git a/fs/block_dev.c b/fs/block_dev.c
-index aae187a..8325c5d 100644
+index 85f5c85..d6f0b1a 100644
--- a/fs/block_dev.c
+++ b/fs/block_dev.c
-@@ -57,17 +57,24 @@ static void bdev_inode_switch_bdi(struct inode *inode,
- struct backing_dev_info *dst)
- {
- struct backing_dev_info *old = inode->i_data.backing_dev_info;
-+ bool wakeup_bdi = false;
-
- if (unlikely(dst == old)) /* deadlock avoidance */
- return;
- bdi_lock_two(&old->wb, &dst->wb);
- spin_lock(&inode->i_lock);
- inode->i_data.backing_dev_info = dst;
-- if (inode->i_state & I_DIRTY)
-+ if (inode->i_state & I_DIRTY) {
-+ if (bdi_cap_writeback_dirty(dst) && !wb_has_dirty_io(&dst->wb))
-+ wakeup_bdi = true;
- list_move(&inode->i_wb_list, &dst->wb.b_dirty);
-+ }
- spin_unlock(&inode->i_lock);
- spin_unlock(&old->wb.list_lock);
- spin_unlock(&dst->wb.list_lock);
-+
-+ if (wakeup_bdi)
-+ bdi_wakeup_thread_delayed(dst);
- }
-
- /* Kill _all_ buffers and pagecache , dirty or not.. */
-@@ -652,7 +659,7 @@ static bool bd_may_claim(struct block_device *bdev, struct block_device *whole,
+@@ -658,7 +658,7 @@ static bool bd_may_claim(struct block_device *bdev, struct block_device *whole,
else if (bdev->bd_contains == bdev)
return true; /* is a whole device which isn't held */
@@ -50364,10 +49726,10 @@ index aae187a..8325c5d 100644
else if (whole->bd_holder != NULL)
return false; /* is a partition of a held device */
diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c
-index 7a983f7..c73ee93 100644
+index 7fb054b..ad36c67 100644
--- a/fs/btrfs/ctree.c
+++ b/fs/btrfs/ctree.c
-@@ -1036,9 +1036,12 @@ static noinline int __btrfs_cow_block(struct btrfs_trans_handle *trans,
+@@ -1076,9 +1076,12 @@ static noinline int __btrfs_cow_block(struct btrfs_trans_handle *trans,
free_extent_buffer(buf);
add_root_to_dirty_list(root);
} else {
@@ -50384,10 +49746,10 @@ index 7a983f7..c73ee93 100644
WARN_ON(trans->transid != btrfs_header_generation(parent));
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
-index f49b62f..07834ab 100644
+index 0f81d67..0ad55fe 100644
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
-@@ -3077,9 +3077,12 @@ long btrfs_ioctl_space_info(struct btrfs_root *root, void __user *arg)
+@@ -3084,9 +3084,12 @@ static long btrfs_ioctl_space_info(struct btrfs_root *root, void __user *arg)
for (i = 0; i < num_types; i++) {
struct btrfs_space_info *tmp;
@@ -50400,7 +49762,7 @@ index f49b62f..07834ab 100644
info = NULL;
rcu_read_lock();
list_for_each_entry_rcu(tmp, &root->fs_info->space_info,
-@@ -3101,10 +3104,7 @@ long btrfs_ioctl_space_info(struct btrfs_root *root, void __user *arg)
+@@ -3108,10 +3111,7 @@ static long btrfs_ioctl_space_info(struct btrfs_root *root, void __user *arg)
memcpy(dest, &space, sizeof(space));
dest++;
space_args.total_spaces++;
@@ -50412,11 +49774,11 @@ index f49b62f..07834ab 100644
up_read(&info->groups_sem);
}
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
-index f6b8859..54fe8c5 100644
+index f0857e0..e7023c5 100644
--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
-@@ -266,7 +266,7 @@ void __btrfs_abort_transaction(struct btrfs_trans_handle *trans,
- function, line, errstr);
+@@ -265,7 +265,7 @@ void __btrfs_abort_transaction(struct btrfs_trans_handle *trans,
+ function, line, errstr);
return;
}
- ACCESS_ONCE(trans->transaction->aborted) = errno;
@@ -50424,6 +49786,19 @@ index f6b8859..54fe8c5 100644
__btrfs_std_error(root->fs_info, function, line, errno, NULL);
}
/*
+diff --git a/fs/buffer.c b/fs/buffer.c
+index d2a4d1b..df798ca 100644
+--- a/fs/buffer.c
++++ b/fs/buffer.c
+@@ -3367,7 +3367,7 @@ void __init buffer_init(void)
+ bh_cachep = kmem_cache_create("buffer_head",
+ sizeof(struct buffer_head), 0,
+ (SLAB_RECLAIM_ACCOUNT|SLAB_PANIC|
+- SLAB_MEM_SPREAD),
++ SLAB_MEM_SPREAD|SLAB_NO_SANITIZE),
+ NULL);
+
+ /*
diff --git a/fs/cachefiles/bind.c b/fs/cachefiles/bind.c
index 622f469..e8d2d55 100644
--- a/fs/cachefiles/bind.c
@@ -50566,10 +49941,10 @@ index eccd339..4c1d995 100644
return 0;
diff --git a/fs/cachefiles/rdwr.c b/fs/cachefiles/rdwr.c
-index 4809922..aab2c39 100644
+index 317f9ee..3d24511 100644
--- a/fs/cachefiles/rdwr.c
+++ b/fs/cachefiles/rdwr.c
-@@ -965,7 +965,7 @@ int cachefiles_write_page(struct fscache_storage *op, struct page *page)
+@@ -966,7 +966,7 @@ int cachefiles_write_page(struct fscache_storage *op, struct page *page)
old_fs = get_fs();
set_fs(KERNEL_DS);
ret = file->f_op->write(
@@ -50577,9 +49952,9 @@ index 4809922..aab2c39 100644
+ file, (const void __force_user *) data, len, &pos);
set_fs(old_fs);
kunmap(page);
- if (ret != len)
+ file_end_write(file);
diff --git a/fs/ceph/dir.c b/fs/ceph/dir.c
-index 6d797f4..0ace2e5 100644
+index f02d82b..2632cf86 100644
--- a/fs/ceph/dir.c
+++ b/fs/ceph/dir.c
@@ -243,7 +243,7 @@ static int ceph_readdir(struct file *filp, void *dirent, filldir_t filldir)
@@ -50592,10 +49967,10 @@ index 6d797f4..0ace2e5 100644
u32 ftype;
struct ceph_mds_reply_info_parsed *rinfo;
diff --git a/fs/cifs/cifs_debug.c b/fs/cifs/cifs_debug.c
-index d9ea6ed..1e6c8ac 100644
+index d597483..747901b 100644
--- a/fs/cifs/cifs_debug.c
+++ b/fs/cifs/cifs_debug.c
-@@ -267,8 +267,8 @@ static ssize_t cifs_stats_proc_write(struct file *file,
+@@ -284,8 +284,8 @@ static ssize_t cifs_stats_proc_write(struct file *file,
if (c == '1' || c == 'y' || c == 'Y' || c == '0') {
#ifdef CONFIG_CIFS_STATS2
@@ -50606,7 +49981,7 @@ index d9ea6ed..1e6c8ac 100644
#endif /* CONFIG_CIFS_STATS2 */
spin_lock(&cifs_tcp_ses_lock);
list_for_each(tmp1, &cifs_tcp_ses_list) {
-@@ -281,7 +281,7 @@ static ssize_t cifs_stats_proc_write(struct file *file,
+@@ -298,7 +298,7 @@ static ssize_t cifs_stats_proc_write(struct file *file,
tcon = list_entry(tmp3,
struct cifs_tcon,
tcon_list);
@@ -50615,7 +49990,7 @@ index d9ea6ed..1e6c8ac 100644
if (server->ops->clear_stats)
server->ops->clear_stats(tcon);
}
-@@ -313,8 +313,8 @@ static int cifs_stats_proc_show(struct seq_file *m, void *v)
+@@ -330,8 +330,8 @@ static int cifs_stats_proc_show(struct seq_file *m, void *v)
smBufAllocCount.counter, cifs_min_small);
#ifdef CONFIG_CIFS_STATS2
seq_printf(m, "Total Large %d Small %d Allocations\n",
@@ -50626,7 +50001,7 @@ index d9ea6ed..1e6c8ac 100644
#endif /* CONFIG_CIFS_STATS2 */
seq_printf(m, "Operations (MIDs): %d\n", atomic_read(&midCount));
-@@ -343,7 +343,7 @@ static int cifs_stats_proc_show(struct seq_file *m, void *v)
+@@ -360,7 +360,7 @@ static int cifs_stats_proc_show(struct seq_file *m, void *v)
if (tcon->need_reconnect)
seq_puts(m, "\tDISCONNECTED ");
seq_printf(m, "\nSMBs: %d",
@@ -50636,11 +50011,11 @@ index d9ea6ed..1e6c8ac 100644
server->ops->print_stats(m, tcon);
}
diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c
-index 345fc89..b2acae5 100644
+index 3752b9f..8db5569 100644
--- a/fs/cifs/cifsfs.c
+++ b/fs/cifs/cifsfs.c
-@@ -1033,7 +1033,7 @@ cifs_init_request_bufs(void)
- /* cERROR(1, "CIFSMaxBufSize %d 0x%x",CIFSMaxBufSize,CIFSMaxBufSize); */
+@@ -1035,7 +1035,7 @@ cifs_init_request_bufs(void)
+ */
cifs_req_cachep = kmem_cache_create("cifs_request",
CIFSMaxBufSize + max_hdr_size, 0,
- SLAB_HWCACHE_ALIGN, NULL);
@@ -50648,7 +50023,7 @@ index 345fc89..b2acae5 100644
if (cifs_req_cachep == NULL)
return -ENOMEM;
-@@ -1060,7 +1060,7 @@ cifs_init_request_bufs(void)
+@@ -1062,7 +1062,7 @@ cifs_init_request_bufs(void)
efficient to alloc 1 per page off the slab compared to 17K (5page)
alloc of large cifs buffers even when page debugging is on */
cifs_sm_req_cachep = kmem_cache_create("cifs_small_rq",
@@ -50657,7 +50032,7 @@ index 345fc89..b2acae5 100644
NULL);
if (cifs_sm_req_cachep == NULL) {
mempool_destroy(cifs_req_poolp);
-@@ -1145,8 +1145,8 @@ init_cifs(void)
+@@ -1147,8 +1147,8 @@ init_cifs(void)
atomic_set(&bufAllocCount, 0);
atomic_set(&smBufAllocCount, 0);
#ifdef CONFIG_CIFS_STATS2
@@ -50753,7 +50128,7 @@ index 4f07f6f..55de8ce 100644
GLOBAL_EXTERN atomic_t smBufAllocCount;
GLOBAL_EXTERN atomic_t midCount;
diff --git a/fs/cifs/link.c b/fs/cifs/link.c
-index 9f6c4c4..8de307a 100644
+index b83c3f5..6437caa 100644
--- a/fs/cifs/link.c
+++ b/fs/cifs/link.c
@@ -616,7 +616,7 @@ symlink_exit:
@@ -50766,7 +50141,7 @@ index 9f6c4c4..8de307a 100644
kfree(p);
}
diff --git a/fs/cifs/misc.c b/fs/cifs/misc.c
-index 1b15bf8..1ce489e 100644
+index 1bec014..f329411 100644
--- a/fs/cifs/misc.c
+++ b/fs/cifs/misc.c
@@ -169,7 +169,7 @@ cifs_buf_get(void)
@@ -50788,10 +50163,10 @@ index 1b15bf8..1ce489e 100644
}
diff --git a/fs/cifs/smb1ops.c b/fs/cifs/smb1ops.c
-index 47bc5a8..10decbe 100644
+index 3efdb9d..e845a5e 100644
--- a/fs/cifs/smb1ops.c
+++ b/fs/cifs/smb1ops.c
-@@ -586,27 +586,27 @@ static void
+@@ -591,27 +591,27 @@ static void
cifs_clear_stats(struct cifs_tcon *tcon)
{
#ifdef CONFIG_CIFS_STATS
@@ -50840,7 +50215,7 @@ index 47bc5a8..10decbe 100644
#endif
}
-@@ -615,36 +615,36 @@ cifs_print_stats(struct seq_file *m, struct cifs_tcon *tcon)
+@@ -620,36 +620,36 @@ cifs_print_stats(struct seq_file *m, struct cifs_tcon *tcon)
{
#ifdef CONFIG_CIFS_STATS
seq_printf(m, " Oplocks breaks: %d",
@@ -50897,7 +50272,7 @@ index 47bc5a8..10decbe 100644
}
diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c
-index bceffe7..cd1ae59 100644
+index f2e76f3..c44fac7 100644
--- a/fs/cifs/smb2ops.c
+++ b/fs/cifs/smb2ops.c
@@ -274,8 +274,8 @@ smb2_clear_stats(struct cifs_tcon *tcon)
@@ -51019,13 +50394,13 @@ index bceffe7..cd1ae59 100644
}
diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c
-index 41d9d07..dbb4772 100644
+index 2b95ce2..d079d75 100644
--- a/fs/cifs/smb2pdu.c
+++ b/fs/cifs/smb2pdu.c
-@@ -1761,8 +1761,7 @@ SMB2_query_directory(const unsigned int xid, struct cifs_tcon *tcon,
+@@ -1760,8 +1760,7 @@ SMB2_query_directory(const unsigned int xid, struct cifs_tcon *tcon,
default:
- cERROR(1, "info level %u isn't supported",
- srch_inf->info_level);
+ cifs_dbg(VFS, "info level %u isn't supported\n",
+ srch_inf->info_level);
- rc = -EINVAL;
- goto qdir_exit;
+ return -EINVAL;
@@ -51081,7 +50456,7 @@ index 1da168c..8bc7ff6 100644
return hit;
diff --git a/fs/compat.c b/fs/compat.c
-index d487985..c9e04b1 100644
+index fc3b55d..7b568ae 100644
--- a/fs/compat.c
+++ b/fs/compat.c
@@ -54,7 +54,7 @@
@@ -51093,7 +50468,7 @@ index d487985..c9e04b1 100644
int compat_printk(const char *fmt, ...)
{
-@@ -490,7 +490,7 @@ compat_sys_io_setup(unsigned nr_reqs, u32 __user *ctx32p)
+@@ -488,7 +488,7 @@ compat_sys_io_setup(unsigned nr_reqs, u32 __user *ctx32p)
set_fs(KERNEL_DS);
/* The __user pointer cast is valid because of the set_fs() */
@@ -51102,7 +50477,7 @@ index d487985..c9e04b1 100644
set_fs(oldfs);
/* truncating is ok because it's a user address */
if (!ret)
-@@ -548,7 +548,7 @@ ssize_t compat_rw_copy_check_uvector(int type,
+@@ -546,7 +546,7 @@ ssize_t compat_rw_copy_check_uvector(int type,
goto out;
ret = -EINVAL;
@@ -51111,7 +50486,7 @@ index d487985..c9e04b1 100644
goto out;
if (nr_segs > fast_segs) {
ret = -ENOMEM;
-@@ -835,6 +835,7 @@ struct compat_old_linux_dirent {
+@@ -833,6 +833,7 @@ struct compat_old_linux_dirent {
struct compat_readdir_callback {
struct compat_old_linux_dirent __user *dirent;
@@ -51119,7 +50494,7 @@ index d487985..c9e04b1 100644
int result;
};
-@@ -852,6 +853,10 @@ static int compat_fillonedir(void *__buf, const char *name, int namlen,
+@@ -850,6 +851,10 @@ static int compat_fillonedir(void *__buf, const char *name, int namlen,
buf->result = -EOVERFLOW;
return -EOVERFLOW;
}
@@ -51130,7 +50505,7 @@ index d487985..c9e04b1 100644
buf->result++;
dirent = buf->dirent;
if (!access_ok(VERIFY_WRITE, dirent,
-@@ -882,6 +887,7 @@ asmlinkage long compat_sys_old_readdir(unsigned int fd,
+@@ -880,6 +885,7 @@ asmlinkage long compat_sys_old_readdir(unsigned int fd,
buf.result = 0;
buf.dirent = dirent;
@@ -51138,7 +50513,7 @@ index d487985..c9e04b1 100644
error = vfs_readdir(f.file, compat_fillonedir, &buf);
if (buf.result)
-@@ -901,6 +907,7 @@ struct compat_linux_dirent {
+@@ -899,6 +905,7 @@ struct compat_linux_dirent {
struct compat_getdents_callback {
struct compat_linux_dirent __user *current_dir;
struct compat_linux_dirent __user *previous;
@@ -51146,7 +50521,7 @@ index d487985..c9e04b1 100644
int count;
int error;
};
-@@ -922,6 +929,10 @@ static int compat_filldir(void *__buf, const char *name, int namlen,
+@@ -920,6 +927,10 @@ static int compat_filldir(void *__buf, const char *name, int namlen,
buf->error = -EOVERFLOW;
return -EOVERFLOW;
}
@@ -51157,7 +50532,7 @@ index d487985..c9e04b1 100644
dirent = buf->previous;
if (dirent) {
if (__put_user(offset, &dirent->d_off))
-@@ -967,6 +978,7 @@ asmlinkage long compat_sys_getdents(unsigned int fd,
+@@ -965,6 +976,7 @@ asmlinkage long compat_sys_getdents(unsigned int fd,
buf.previous = NULL;
buf.count = count;
buf.error = 0;
@@ -51165,7 +50540,7 @@ index d487985..c9e04b1 100644
error = vfs_readdir(f.file, compat_filldir, &buf);
if (error >= 0)
-@@ -987,6 +999,7 @@ asmlinkage long compat_sys_getdents(unsigned int fd,
+@@ -985,6 +997,7 @@ asmlinkage long compat_sys_getdents(unsigned int fd,
struct compat_getdents_callback64 {
struct linux_dirent64 __user *current_dir;
struct linux_dirent64 __user *previous;
@@ -51173,7 +50548,7 @@ index d487985..c9e04b1 100644
int count;
int error;
};
-@@ -1003,6 +1016,10 @@ static int compat_filldir64(void * __buf, const char * name, int namlen, loff_t
+@@ -1001,6 +1014,10 @@ static int compat_filldir64(void * __buf, const char * name, int namlen, loff_t
buf->error = -EINVAL; /* only used if we fail.. */
if (reclen > buf->count)
return -EINVAL;
@@ -51184,7 +50559,7 @@ index d487985..c9e04b1 100644
dirent = buf->previous;
if (dirent) {
-@@ -1052,13 +1069,14 @@ asmlinkage long compat_sys_getdents64(unsigned int fd,
+@@ -1050,13 +1067,14 @@ asmlinkage long compat_sys_getdents64(unsigned int fd,
buf.previous = NULL;
buf.count = count;
buf.error = 0;
@@ -51219,10 +50594,10 @@ index a81147e..20bf2b5 100644
/*
diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c
-index 3ced75f..b28d192 100644
+index 996cdc5..15e2f33 100644
--- a/fs/compat_ioctl.c
+++ b/fs/compat_ioctl.c
-@@ -623,7 +623,7 @@ static int serial_struct_ioctl(unsigned fd, unsigned cmd,
+@@ -622,7 +622,7 @@ static int serial_struct_ioctl(unsigned fd, unsigned cmd,
return -EFAULT;
if (__get_user(udata, &ss32->iomem_base))
return -EFAULT;
@@ -51231,7 +50606,7 @@ index 3ced75f..b28d192 100644
if (__get_user(ss.iomem_reg_shift, &ss32->iomem_reg_shift) ||
__get_user(ss.port_high, &ss32->port_high))
return -EFAULT;
-@@ -704,8 +704,8 @@ static int do_i2c_rdwr_ioctl(unsigned int fd, unsigned int cmd,
+@@ -703,8 +703,8 @@ static int do_i2c_rdwr_ioctl(unsigned int fd, unsigned int cmd,
for (i = 0; i < nmsgs; i++) {
if (copy_in_user(&tmsgs[i].addr, &umsgs[i].addr, 3*sizeof(u16)))
return -EFAULT;
@@ -51242,7 +50617,7 @@ index 3ced75f..b28d192 100644
return -EFAULT;
}
return sys_ioctl(fd, cmd, (unsigned long)tdata);
-@@ -798,7 +798,7 @@ static int compat_ioctl_preallocate(struct file *file,
+@@ -797,7 +797,7 @@ static int compat_ioctl_preallocate(struct file *file,
copy_in_user(&p->l_len, &p32->l_len, sizeof(s64)) ||
copy_in_user(&p->l_sysid, &p32->l_sysid, sizeof(s32)) ||
copy_in_user(&p->l_pid, &p32->l_pid, sizeof(u32)) ||
@@ -51251,7 +50626,7 @@ index 3ced75f..b28d192 100644
return -EFAULT;
return ioctl_preallocate(file, p);
-@@ -1620,8 +1620,8 @@ asmlinkage long compat_sys_ioctl(unsigned int fd, unsigned int cmd,
+@@ -1619,8 +1619,8 @@ asmlinkage long compat_sys_ioctl(unsigned int fd, unsigned int cmd,
static int __init init_sys32_ioctl_cmp(const void *p, const void *q)
{
unsigned int a, b;
@@ -51291,7 +50666,7 @@ index 7aabc6a..34c1197 100644
/*
* We'll have a dentry and an inode for
diff --git a/fs/coredump.c b/fs/coredump.c
-index c647965..a77bff3 100644
+index dafafba..10b3b27 100644
--- a/fs/coredump.c
+++ b/fs/coredump.c
@@ -52,7 +52,7 @@ struct core_name {
@@ -51321,40 +50696,43 @@ index c647965..a77bff3 100644
cn->corename = kmalloc(cn->size, GFP_KERNEL);
cn->used = 0;
-@@ -414,17 +414,17 @@ static void wait_for_dump_helpers(struct file *file)
- pipe = file_inode(file)->i_pipe;
+@@ -435,8 +435,8 @@ static void wait_for_dump_helpers(struct file *file)
+ struct pipe_inode_info *pipe = file->private_data;
pipe_lock(pipe);
- pipe->readers++;
- pipe->writers--;
+ atomic_inc(&pipe->readers);
+ atomic_dec(&pipe->writers);
+ wake_up_interruptible_sync(&pipe->wait);
+ kill_fasync(&pipe->fasync_readers, SIGIO, POLL_IN);
+ pipe_unlock(pipe);
+@@ -445,11 +445,11 @@ static void wait_for_dump_helpers(struct file *file)
+ * We actually want wait_event_freezable() but then we need
+ * to clear TIF_SIGPENDING and improve dump_interrupted().
+ */
+- wait_event_interruptible(pipe->wait, pipe->readers == 1);
++ wait_event_interruptible(pipe->wait, atomic_read(&pipe->readers) == 1);
-- while ((pipe->readers > 1) && (!signal_pending(current))) {
-+ while ((atomic_read(&pipe->readers) > 1) && (!signal_pending(current))) {
- wake_up_interruptible_sync(&pipe->wait);
- kill_fasync(&pipe->fasync_readers, SIGIO, POLL_IN);
- pipe_wait(pipe);
- }
-
+ pipe_lock(pipe);
- pipe->readers--;
- pipe->writers++;
+ atomic_dec(&pipe->readers);
+ atomic_inc(&pipe->writers);
pipe_unlock(pipe);
-
}
-@@ -471,7 +471,8 @@ void do_coredump(siginfo_t *siginfo)
- int ispipe;
+
+@@ -496,7 +496,8 @@ void do_coredump(siginfo_t *siginfo)
struct files_struct *displaced;
bool need_nonrelative = false;
+ bool core_dumped = false;
- static atomic_t core_dump_count = ATOMIC_INIT(0);
+ static atomic_unchecked_t core_dump_count = ATOMIC_INIT(0);
+ long signr = siginfo->si_signo;
struct coredump_params cprm = {
.siginfo = siginfo,
.regs = signal_pt_regs(),
-@@ -484,7 +485,10 @@ void do_coredump(siginfo_t *siginfo)
+@@ -509,7 +510,10 @@ void do_coredump(siginfo_t *siginfo)
.mm_flags = mm->flags,
};
@@ -51366,7 +50744,7 @@ index c647965..a77bff3 100644
binfmt = mm->binfmt;
if (!binfmt || !binfmt->core_dump)
-@@ -508,7 +512,7 @@ void do_coredump(siginfo_t *siginfo)
+@@ -533,7 +537,7 @@ void do_coredump(siginfo_t *siginfo)
need_nonrelative = true;
}
@@ -51375,7 +50753,7 @@ index c647965..a77bff3 100644
if (retval < 0)
goto fail_creds;
-@@ -556,7 +560,7 @@ void do_coredump(siginfo_t *siginfo)
+@@ -576,7 +580,7 @@ void do_coredump(siginfo_t *siginfo)
}
cprm.limit = RLIM_INFINITY;
@@ -51384,7 +50762,7 @@ index c647965..a77bff3 100644
if (core_pipe_limit && (core_pipe_limit < dump_count)) {
printk(KERN_WARNING "Pid %d(%s) over core_pipe_limit\n",
task_tgid_vnr(current), current->comm);
-@@ -583,6 +587,8 @@ void do_coredump(siginfo_t *siginfo)
+@@ -608,6 +612,8 @@ void do_coredump(siginfo_t *siginfo)
} else {
struct inode *inode;
@@ -51393,7 +50771,7 @@ index c647965..a77bff3 100644
if (cprm.limit < binfmt->min_coredump)
goto fail_unlock;
-@@ -640,7 +646,7 @@ close_fail:
+@@ -666,7 +672,7 @@ close_fail:
filp_close(cprm.file, NULL);
fail_dropcount:
if (ispipe)
@@ -51402,25 +50780,26 @@ index c647965..a77bff3 100644
fail_unlock:
kfree(cn.corename);
fail_corename:
-@@ -659,7 +665,7 @@ fail:
- */
- int dump_write(struct file *file, const void *addr, int nr)
+@@ -687,7 +693,7 @@ int dump_write(struct file *file, const void *addr, int nr)
{
-- return access_ok(VERIFY_READ, addr, nr) && file->f_op->write(file, addr, nr, &file->f_pos) == nr;
-+ return access_ok(VERIFY_READ, addr, nr) && file->f_op->write(file, (const char __force_user *)addr, nr, &file->f_pos) == nr;
+ return !dump_interrupted() &&
+ access_ok(VERIFY_READ, addr, nr) &&
+- file->f_op->write(file, addr, nr, &file->f_pos) == nr;
++ file->f_op->write(file, (const char __force_user *)addr, nr, &file->f_pos) == nr;
}
EXPORT_SYMBOL(dump_write);
diff --git a/fs/dcache.c b/fs/dcache.c
-index e689268..f36956e 100644
+index f09b908..04b9690 100644
--- a/fs/dcache.c
+++ b/fs/dcache.c
-@@ -3100,7 +3100,7 @@ void __init vfs_caches_init(unsigned long mempages)
+@@ -3086,7 +3086,8 @@ void __init vfs_caches_init(unsigned long mempages)
mempages -= reserve;
names_cachep = kmem_cache_create("names_cache", PATH_MAX, 0,
- SLAB_HWCACHE_ALIGN|SLAB_PANIC, NULL);
-+ SLAB_HWCACHE_ALIGN|SLAB_PANIC|SLAB_USERCOPY, NULL);
++ SLAB_HWCACHE_ALIGN|SLAB_PANIC|SLAB_USERCOPY|
++ SLAB_NO_SANITIZE, NULL);
dcache_init();
inode_init();
@@ -51475,21 +50854,8 @@ index e4141f2..d8263e8 100644
goto out_unlock_msg_ctx;
i += packet_length_size;
if (copy_to_user(&buf[i], msg_ctx->msg, msg_ctx->msg_size))
-diff --git a/fs/ecryptfs/read_write.c b/fs/ecryptfs/read_write.c
-index 6a16053..2155147 100644
---- a/fs/ecryptfs/read_write.c
-+++ b/fs/ecryptfs/read_write.c
-@@ -240,7 +240,7 @@ int ecryptfs_read_lower(char *data, loff_t offset, size_t size,
- return -EIO;
- fs_save = get_fs();
- set_fs(get_ds());
-- rc = vfs_read(lower_file, data, size, &offset);
-+ rc = vfs_read(lower_file, (char __force_user *)data, size, &offset);
- set_fs(fs_save);
- return rc;
- }
diff --git a/fs/exec.c b/fs/exec.c
-index 0d5c76f..3d4585e 100644
+index ffd7a81..d95acf6 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -55,8 +55,20 @@
@@ -51616,7 +50982,7 @@ index 0d5c76f..3d4585e 100644
+
+#ifdef CONFIG_PAX_RANDUSTACK
+ if (randomize_va_space)
-+ bprm->p ^= random32() & ~PAGE_MASK;
++ bprm->p ^= prandom_u32() & ~PAGE_MASK;
+#endif
+
return 0;
@@ -51767,7 +51133,7 @@ index 0d5c76f..3d4585e 100644
+
+#ifdef CONFIG_X86
+ if (!ret) {
-+ size = mmap_min_addr + ((mm->delta_mmap ^ mm->delta_stack) & (0xFFUL << PAGE_SHIFT));
++ size = PAGE_SIZE + mmap_min_addr + ((mm->delta_mmap ^ mm->delta_stack) & (0xFFUL << PAGE_SHIFT));
+ ret = 0 != mmap_region(NULL, 0, PAGE_ALIGN(size), vm_flags, 0);
+ }
+#endif
@@ -51796,7 +51162,7 @@ index 0d5c76f..3d4585e 100644
set_fs(old_fs);
return result;
}
-@@ -1252,7 +1330,7 @@ static int check_unsafe_exec(struct linux_binprm *bprm)
+@@ -1251,7 +1329,7 @@ static int check_unsafe_exec(struct linux_binprm *bprm)
}
rcu_read_unlock();
@@ -51805,7 +51171,7 @@ index 0d5c76f..3d4585e 100644
bprm->unsafe |= LSM_UNSAFE_SHARE;
} else {
res = -EAGAIN;
-@@ -1452,6 +1530,31 @@ int search_binary_handler(struct linux_binprm *bprm)
+@@ -1451,6 +1529,31 @@ int search_binary_handler(struct linux_binprm *bprm)
EXPORT_SYMBOL(search_binary_handler);
@@ -51837,7 +51203,7 @@ index 0d5c76f..3d4585e 100644
/*
* sys_execve() executes a new program.
*/
-@@ -1459,6 +1562,11 @@ static int do_execve_common(const char *filename,
+@@ -1458,6 +1561,11 @@ static int do_execve_common(const char *filename,
struct user_arg_ptr argv,
struct user_arg_ptr envp)
{
@@ -51849,7 +51215,7 @@ index 0d5c76f..3d4585e 100644
struct linux_binprm *bprm;
struct file *file;
struct files_struct *displaced;
-@@ -1466,6 +1574,8 @@ static int do_execve_common(const char *filename,
+@@ -1465,6 +1573,8 @@ static int do_execve_common(const char *filename,
int retval;
const struct cred *cred = current_cred();
@@ -51858,7 +51224,7 @@ index 0d5c76f..3d4585e 100644
/*
* We move the actual failure in case of RLIMIT_NPROC excess from
* set*uid() to execve() because too many poorly written programs
-@@ -1506,12 +1616,22 @@ static int do_execve_common(const char *filename,
+@@ -1505,12 +1615,22 @@ static int do_execve_common(const char *filename,
if (IS_ERR(file))
goto out_unmark;
@@ -51881,7 +51247,7 @@ index 0d5c76f..3d4585e 100644
retval = bprm_mm_init(bprm);
if (retval)
goto out_file;
-@@ -1528,24 +1648,70 @@ static int do_execve_common(const char *filename,
+@@ -1527,24 +1647,70 @@ static int do_execve_common(const char *filename,
if (retval < 0)
goto out;
@@ -51956,7 +51322,7 @@ index 0d5c76f..3d4585e 100644
current->fs->in_exec = 0;
current->in_execve = 0;
acct_update_integrals(current);
-@@ -1554,6 +1720,14 @@ static int do_execve_common(const char *filename,
+@@ -1553,6 +1719,14 @@ static int do_execve_common(const char *filename,
put_files_struct(displaced);
return retval;
@@ -51971,7 +51337,7 @@ index 0d5c76f..3d4585e 100644
out:
if (bprm->mm) {
acct_arg_size(bprm, 0);
-@@ -1702,3 +1876,283 @@ asmlinkage long compat_sys_execve(const char __user * filename,
+@@ -1701,3 +1875,285 @@ asmlinkage long compat_sys_execve(const char __user * filename,
return error;
}
#endif
@@ -52030,6 +51396,25 @@ index 0d5c76f..3d4585e 100644
+EXPORT_SYMBOL(pax_check_flags);
+
+#if defined(CONFIG_PAX_PAGEEXEC) || defined(CONFIG_PAX_SEGMEXEC)
++char *pax_get_path(const struct path *path, char *buf, int buflen)
++{
++ char *pathname = d_path(path, buf, buflen);
++
++ if (IS_ERR(pathname))
++ goto toolong;
++
++ pathname = mangle_path(buf, pathname, "\t\n\\");
++ if (!pathname)
++ goto toolong;
++
++ *pathname = 0;
++ return buf;
++
++toolong:
++ return "<path too long>";
++}
++EXPORT_SYMBOL(pax_get_path);
++
+void pax_report_fault(struct pt_regs *regs, void *pc, void *sp)
+{
+ struct task_struct *tsk = current;
@@ -52053,36 +51438,19 @@ index 0d5c76f..3d4585e 100644
+ vma_fault = vma;
+ vma = vma->vm_next;
+ }
-+ if (vma_exec) {
-+ path_exec = d_path(&vma_exec->vm_file->f_path, buffer_exec, PAGE_SIZE);
-+ if (IS_ERR(path_exec))
-+ path_exec = "<path too long>";
-+ else {
-+ path_exec = mangle_path(buffer_exec, path_exec, "\t\n\\");
-+ if (path_exec) {
-+ *path_exec = 0;
-+ path_exec = buffer_exec;
-+ } else
-+ path_exec = "<path too long>";
-+ }
-+ }
++ if (vma_exec)
++ path_exec = pax_get_path(&vma_exec->vm_file->f_path, buffer_exec, PAGE_SIZE);
+ if (vma_fault) {
+ start = vma_fault->vm_start;
+ end = vma_fault->vm_end;
+ offset = vma_fault->vm_pgoff << PAGE_SHIFT;
-+ if (vma_fault->vm_file) {
-+ path_fault = d_path(&vma_fault->vm_file->f_path, buffer_fault, PAGE_SIZE);
-+ if (IS_ERR(path_fault))
-+ path_fault = "<path too long>";
-+ else {
-+ path_fault = mangle_path(buffer_fault, path_fault, "\t\n\\");
-+ if (path_fault) {
-+ *path_fault = 0;
-+ path_fault = buffer_fault;
-+ } else
-+ path_fault = "<path too long>";
-+ }
-+ } else
++ if (vma_fault->vm_file)
++ path_fault = pax_get_path(&vma_fault->vm_file->f_path, buffer_fault, PAGE_SIZE);
++ else if (pc >= mm->start_brk && pc < mm->brk)
++ path_fault = "<heap>";
++ else if (vma_fault->vm_flags & (VM_GROWSDOWN | VM_GROWSUP))
++ path_fault = "<stack>";
++ else
+ path_fault = "<anonymous mapping>";
+ }
+ up_read(&mm->mmap_sem);
@@ -52289,40 +51657,26 @@ index 22548f5..41521d8 100644
return 0;
}
return 1;
-diff --git a/fs/ext3/inode.c b/fs/ext3/inode.c
-index d512c4b..d706dbf 100644
---- a/fs/ext3/inode.c
-+++ b/fs/ext3/inode.c
-@@ -218,7 +218,8 @@ void ext3_evict_inode (struct inode *inode)
- */
- if (inode->i_nlink && ext3_should_journal_data(inode) &&
- EXT3_SB(inode->i_sb)->s_journal &&
-- (S_ISLNK(inode->i_mode) || S_ISREG(inode->i_mode))) {
-+ (S_ISLNK(inode->i_mode) || S_ISREG(inode->i_mode)) &&
-+ inode->i_ino != EXT3_JOURNAL_INO) {
- tid_t commit_tid = atomic_read(&ei->i_datasync_tid);
- journal_t *journal = EXT3_SB(inode->i_sb)->s_journal;
-
diff --git a/fs/ext4/balloc.c b/fs/ext4/balloc.c
-index 92e68b3..115d987 100644
+index 3742e4c..69a797f 100644
--- a/fs/ext4/balloc.c
+++ b/fs/ext4/balloc.c
-@@ -505,8 +505,8 @@ static int ext4_has_free_clusters(struct ext4_sb_info *sbi,
+@@ -528,8 +528,8 @@ static int ext4_has_free_clusters(struct ext4_sb_info *sbi,
/* Hm, nope. Are (enough) root reserved clusters available? */
if (uid_eq(sbi->s_resuid, current_fsuid()) ||
(!gid_eq(sbi->s_resgid, GLOBAL_ROOT_GID) && in_group_p(sbi->s_resgid)) ||
- capable(CAP_SYS_RESOURCE) ||
-- (flags & EXT4_MB_USE_ROOT_BLOCKS)) {
-+ (flags & EXT4_MB_USE_ROOT_BLOCKS) ||
+- (flags & EXT4_MB_USE_ROOT_BLOCKS)) {
++ (flags & EXT4_MB_USE_ROOT_BLOCKS) ||
+ capable_nolog(CAP_SYS_RESOURCE)) {
- if (free_clusters >= (nclusters + dirty_clusters))
- return 1;
+ if (free_clusters >= (nclusters + dirty_clusters +
+ resv_clusters))
diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
-index 3b83cd6..0f34dcd 100644
+index 5aae3d1..b5da7f8 100644
--- a/fs/ext4/ext4.h
+++ b/fs/ext4/ext4.h
-@@ -1254,19 +1254,19 @@ struct ext4_sb_info {
+@@ -1252,19 +1252,19 @@ struct ext4_sb_info {
unsigned long s_mb_last_start;
/* stats for buddy allocator */
@@ -52353,10 +51707,10 @@ index 3b83cd6..0f34dcd 100644
/* locality groups */
diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
-index 8b6e837..36fd6c1 100644
+index 59c6750..a549154 100644
--- a/fs/ext4/mballoc.c
+++ b/fs/ext4/mballoc.c
-@@ -1754,7 +1754,7 @@ void ext4_mb_simple_scan_group(struct ext4_allocation_context *ac,
+@@ -1865,7 +1865,7 @@ void ext4_mb_simple_scan_group(struct ext4_allocation_context *ac,
BUG_ON(ac->ac_b_ex.fe_len != ac->ac_g_ex.fe_len);
if (EXT4_SB(sb)->s_mb_stats)
@@ -52365,7 +51719,7 @@ index 8b6e837..36fd6c1 100644
break;
}
-@@ -2059,7 +2059,7 @@ repeat:
+@@ -2170,7 +2170,7 @@ repeat:
ac->ac_status = AC_STATUS_CONTINUE;
ac->ac_flags |= EXT4_MB_HINT_FIRST;
cr = 3;
@@ -52374,7 +51728,7 @@ index 8b6e837..36fd6c1 100644
goto repeat;
}
}
-@@ -2567,25 +2567,25 @@ int ext4_mb_release(struct super_block *sb)
+@@ -2678,25 +2678,25 @@ int ext4_mb_release(struct super_block *sb)
if (sbi->s_mb_stats) {
ext4_msg(sb, KERN_INFO,
"mballoc: %u blocks %u reqs (%u success)",
@@ -52410,7 +51764,7 @@ index 8b6e837..36fd6c1 100644
}
free_percpu(sbi->s_locality_groups);
-@@ -3039,16 +3039,16 @@ static void ext4_mb_collect_stats(struct ext4_allocation_context *ac)
+@@ -3150,16 +3150,16 @@ static void ext4_mb_collect_stats(struct ext4_allocation_context *ac)
struct ext4_sb_info *sbi = EXT4_SB(ac->ac_sb);
if (sbi->s_mb_stats && ac->ac_g_ex.fe_len > 1) {
@@ -52433,7 +51787,7 @@ index 8b6e837..36fd6c1 100644
}
if (ac->ac_op == EXT4_MB_HISTORY_ALLOC)
-@@ -3448,7 +3448,7 @@ ext4_mb_new_inode_pa(struct ext4_allocation_context *ac)
+@@ -3559,7 +3559,7 @@ ext4_mb_new_inode_pa(struct ext4_allocation_context *ac)
trace_ext4_mb_new_inode_pa(ac, pa);
ext4_mb_use_inode_pa(ac, pa);
@@ -52442,7 +51796,7 @@ index 8b6e837..36fd6c1 100644
ei = EXT4_I(ac->ac_inode);
grp = ext4_get_group_info(sb, ac->ac_b_ex.fe_group);
-@@ -3508,7 +3508,7 @@ ext4_mb_new_group_pa(struct ext4_allocation_context *ac)
+@@ -3619,7 +3619,7 @@ ext4_mb_new_group_pa(struct ext4_allocation_context *ac)
trace_ext4_mb_new_group_pa(ac, pa);
ext4_mb_use_group_pa(ac, pa);
@@ -52451,7 +51805,7 @@ index 8b6e837..36fd6c1 100644
grp = ext4_get_group_info(sb, ac->ac_b_ex.fe_group);
lg = ac->ac_lg;
-@@ -3597,7 +3597,7 @@ ext4_mb_release_inode_pa(struct ext4_buddy *e4b, struct buffer_head *bitmap_bh,
+@@ -3708,7 +3708,7 @@ ext4_mb_release_inode_pa(struct ext4_buddy *e4b, struct buffer_head *bitmap_bh,
* from the bitmap and continue.
*/
}
@@ -52460,7 +51814,7 @@ index 8b6e837..36fd6c1 100644
return err;
}
-@@ -3615,7 +3615,7 @@ ext4_mb_release_group_pa(struct ext4_buddy *e4b,
+@@ -3726,7 +3726,7 @@ ext4_mb_release_group_pa(struct ext4_buddy *e4b,
ext4_get_group_no_and_offset(sb, pa->pa_pstart, &group, &bit);
BUG_ON(group != e4b->bd_group && pa->pa_len != 0);
mb_free_blocks(pa->pa_inode, e4b, bit, pa->pa_len);
@@ -52470,7 +51824,7 @@ index 8b6e837..36fd6c1 100644
return 0;
diff --git a/fs/ext4/mmp.c b/fs/ext4/mmp.c
-index b3b1f7d..cff51d5 100644
+index 214461e..3614c89 100644
--- a/fs/ext4/mmp.c
+++ b/fs/ext4/mmp.c
@@ -113,7 +113,7 @@ static int read_mmp_block(struct super_block *sb, struct buffer_head **bh,
@@ -52483,7 +51837,7 @@ index b3b1f7d..cff51d5 100644
"MMP failure info: last update time: %llu, last update "
"node: %s, last update device: %s\n",
diff --git a/fs/ext4/resize.c b/fs/ext4/resize.c
-index 1cb76e8..0fe3928 100644
+index 49d3c01..9579efd 100644
--- a/fs/ext4/resize.c
+++ b/fs/ext4/resize.c
@@ -79,12 +79,20 @@ static int verify_group_input(struct super_block *sb,
@@ -52522,10 +51876,10 @@ index 1cb76e8..0fe3928 100644
else if (input->reserved_blocks > input->blocks_count / 5)
ext4_warning(sb, "Reserved blocks too high (%u)",
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
-index febbe0e..d0cdc02 100644
+index 6681c03..d88cd33 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
-@@ -1238,7 +1238,7 @@ static ext4_fsblk_t get_sb_block(void **data)
+@@ -1236,7 +1236,7 @@ static ext4_fsblk_t get_sb_block(void **data)
}
#define DEFAULT_JOURNAL_IOPRIO (IOPRIO_PRIO_VALUE(IOPRIO_CLASS_BE, 3))
@@ -52534,15 +51888,15 @@ index febbe0e..d0cdc02 100644
"Contact linux-ext4@vger.kernel.org if you think we should keep it.\n";
#ifdef CONFIG_QUOTA
-@@ -2380,7 +2380,7 @@ struct ext4_attr {
+@@ -2372,7 +2372,7 @@ struct ext4_attr {
ssize_t (*store)(struct ext4_attr *, struct ext4_sb_info *,
const char *, size_t);
int offset;
-};
+} __do_const;
- static int parse_strtoul(const char *buf,
- unsigned long max, unsigned long *value)
+ static int parse_strtoull(const char *buf,
+ unsigned long long max, unsigned long long *value)
diff --git a/fs/fcntl.c b/fs/fcntl.c
index 6599222..e7bf0de 100644
--- a/fs/fcntl.c
@@ -52573,82 +51927,8 @@ index 999ff5c..41f4109 100644
copy_to_user(ufh, handle,
sizeof(struct file_handle) + handle_bytes))
retval = -EFAULT;
-diff --git a/fs/fifo.c b/fs/fifo.c
-index cf6f434..3d7942c 100644
---- a/fs/fifo.c
-+++ b/fs/fifo.c
-@@ -59,10 +59,10 @@ static int fifo_open(struct inode *inode, struct file *filp)
- */
- filp->f_op = &read_pipefifo_fops;
- pipe->r_counter++;
-- if (pipe->readers++ == 0)
-+ if (atomic_inc_return(&pipe->readers) == 1)
- wake_up_partner(inode);
-
-- if (!pipe->writers) {
-+ if (!atomic_read(&pipe->writers)) {
- if ((filp->f_flags & O_NONBLOCK)) {
- /* suppress POLLHUP until we have
- * seen a writer */
-@@ -81,15 +81,15 @@ static int fifo_open(struct inode *inode, struct file *filp)
- * errno=ENXIO when there is no process reading the FIFO.
- */
- ret = -ENXIO;
-- if ((filp->f_flags & O_NONBLOCK) && !pipe->readers)
-+ if ((filp->f_flags & O_NONBLOCK) && !atomic_read(&pipe->readers))
- goto err;
-
- filp->f_op = &write_pipefifo_fops;
- pipe->w_counter++;
-- if (!pipe->writers++)
-+ if (atomic_inc_return(&pipe->writers) == 1)
- wake_up_partner(inode);
-
-- if (!pipe->readers) {
-+ if (!atomic_read(&pipe->readers)) {
- if (wait_for_partner(inode, &pipe->r_counter))
- goto err_wr;
- }
-@@ -104,11 +104,11 @@ static int fifo_open(struct inode *inode, struct file *filp)
- */
- filp->f_op = &rdwr_pipefifo_fops;
-
-- pipe->readers++;
-- pipe->writers++;
-+ atomic_inc(&pipe->readers);
-+ atomic_inc(&pipe->writers);
- pipe->r_counter++;
- pipe->w_counter++;
-- if (pipe->readers == 1 || pipe->writers == 1)
-+ if (atomic_read(&pipe->readers) == 1 || atomic_read(&pipe->writers) == 1)
- wake_up_partner(inode);
- break;
-
-@@ -122,19 +122,19 @@ static int fifo_open(struct inode *inode, struct file *filp)
- return 0;
-
- err_rd:
-- if (!--pipe->readers)
-+ if (atomic_dec_and_test(&pipe->readers))
- wake_up_interruptible(&pipe->wait);
- ret = -ERESTARTSYS;
- goto err;
-
- err_wr:
-- if (!--pipe->writers)
-+ if (atomic_dec_and_test(&pipe->writers))
- wake_up_interruptible(&pipe->wait);
- ret = -ERESTARTSYS;
- goto err;
-
- err:
-- if (!pipe->readers && !pipe->writers)
-+ if (!atomic_read(&pipe->readers) && !atomic_read(&pipe->writers))
- free_pipe_info(inode);
-
- err_nocleanup:
diff --git a/fs/file.c b/fs/file.c
-index 3906d95..5fe379b 100644
+index 4a78f98..9447397 100644
--- a/fs/file.c
+++ b/fs/file.c
@@ -16,6 +16,7 @@
@@ -52659,7 +51939,7 @@ index 3906d95..5fe379b 100644
#include <linux/fdtable.h>
#include <linux/bitops.h>
#include <linux/interrupt.h>
-@@ -892,6 +893,7 @@ int replace_fd(unsigned fd, struct file *file, unsigned flags)
+@@ -828,6 +829,7 @@ int replace_fd(unsigned fd, struct file *file, unsigned flags)
if (!file)
return __close_fd(files, fd);
@@ -52667,7 +51947,7 @@ index 3906d95..5fe379b 100644
if (fd >= rlimit(RLIMIT_NOFILE))
return -EBADF;
-@@ -918,6 +920,7 @@ SYSCALL_DEFINE3(dup3, unsigned int, oldfd, unsigned int, newfd, int, flags)
+@@ -854,6 +856,7 @@ SYSCALL_DEFINE3(dup3, unsigned int, oldfd, unsigned int, newfd, int, flags)
if (unlikely(oldfd == newfd))
return -EINVAL;
@@ -52675,7 +51955,7 @@ index 3906d95..5fe379b 100644
if (newfd >= rlimit(RLIMIT_NOFILE))
return -EBADF;
-@@ -973,6 +976,7 @@ SYSCALL_DEFINE1(dup, unsigned int, fildes)
+@@ -909,6 +912,7 @@ SYSCALL_DEFINE1(dup, unsigned int, fildes)
int f_dupfd(unsigned int from, struct file *file, unsigned flags)
{
int err;
@@ -52927,7 +52207,9 @@ index ee38fef..0a326d4 100644
#ifdef CONFIG_FSCACHE_STATS
-extern atomic_t fscache_n_ops_processed[FSCACHE_MAX_THREADS];
-extern atomic_t fscache_n_objs_processed[FSCACHE_MAX_THREADS];
--
++extern atomic_unchecked_t fscache_n_ops_processed[FSCACHE_MAX_THREADS];
++extern atomic_unchecked_t fscache_n_objs_processed[FSCACHE_MAX_THREADS];
+
-extern atomic_t fscache_n_op_pend;
-extern atomic_t fscache_n_op_run;
-extern atomic_t fscache_n_op_enqueue;
@@ -52936,13 +52218,26 @@ index ee38fef..0a326d4 100644
-extern atomic_t fscache_n_op_gc;
-extern atomic_t fscache_n_op_cancelled;
-extern atomic_t fscache_n_op_rejected;
--
++extern atomic_unchecked_t fscache_n_op_pend;
++extern atomic_unchecked_t fscache_n_op_run;
++extern atomic_unchecked_t fscache_n_op_enqueue;
++extern atomic_unchecked_t fscache_n_op_deferred_release;
++extern atomic_unchecked_t fscache_n_op_release;
++extern atomic_unchecked_t fscache_n_op_gc;
++extern atomic_unchecked_t fscache_n_op_cancelled;
++extern atomic_unchecked_t fscache_n_op_rejected;
+
-extern atomic_t fscache_n_attr_changed;
-extern atomic_t fscache_n_attr_changed_ok;
-extern atomic_t fscache_n_attr_changed_nobufs;
-extern atomic_t fscache_n_attr_changed_nomem;
-extern atomic_t fscache_n_attr_changed_calls;
--
++extern atomic_unchecked_t fscache_n_attr_changed;
++extern atomic_unchecked_t fscache_n_attr_changed_ok;
++extern atomic_unchecked_t fscache_n_attr_changed_nobufs;
++extern atomic_unchecked_t fscache_n_attr_changed_nomem;
++extern atomic_unchecked_t fscache_n_attr_changed_calls;
+
-extern atomic_t fscache_n_allocs;
-extern atomic_t fscache_n_allocs_ok;
-extern atomic_t fscache_n_allocs_wait;
@@ -52951,7 +52246,15 @@ index ee38fef..0a326d4 100644
-extern atomic_t fscache_n_allocs_object_dead;
-extern atomic_t fscache_n_alloc_ops;
-extern atomic_t fscache_n_alloc_op_waits;
--
++extern atomic_unchecked_t fscache_n_allocs;
++extern atomic_unchecked_t fscache_n_allocs_ok;
++extern atomic_unchecked_t fscache_n_allocs_wait;
++extern atomic_unchecked_t fscache_n_allocs_nobufs;
++extern atomic_unchecked_t fscache_n_allocs_intr;
++extern atomic_unchecked_t fscache_n_allocs_object_dead;
++extern atomic_unchecked_t fscache_n_alloc_ops;
++extern atomic_unchecked_t fscache_n_alloc_op_waits;
+
-extern atomic_t fscache_n_retrievals;
-extern atomic_t fscache_n_retrievals_ok;
-extern atomic_t fscache_n_retrievals_wait;
@@ -52962,91 +52265,6 @@ index ee38fef..0a326d4 100644
-extern atomic_t fscache_n_retrievals_object_dead;
-extern atomic_t fscache_n_retrieval_ops;
-extern atomic_t fscache_n_retrieval_op_waits;
--
--extern atomic_t fscache_n_stores;
--extern atomic_t fscache_n_stores_ok;
--extern atomic_t fscache_n_stores_again;
--extern atomic_t fscache_n_stores_nobufs;
--extern atomic_t fscache_n_stores_oom;
--extern atomic_t fscache_n_store_ops;
--extern atomic_t fscache_n_store_calls;
--extern atomic_t fscache_n_store_pages;
--extern atomic_t fscache_n_store_radix_deletes;
--extern atomic_t fscache_n_store_pages_over_limit;
--
--extern atomic_t fscache_n_store_vmscan_not_storing;
--extern atomic_t fscache_n_store_vmscan_gone;
--extern atomic_t fscache_n_store_vmscan_busy;
--extern atomic_t fscache_n_store_vmscan_cancelled;
--extern atomic_t fscache_n_store_vmscan_wait;
--
--extern atomic_t fscache_n_marks;
--extern atomic_t fscache_n_uncaches;
--
--extern atomic_t fscache_n_acquires;
--extern atomic_t fscache_n_acquires_null;
--extern atomic_t fscache_n_acquires_no_cache;
--extern atomic_t fscache_n_acquires_ok;
--extern atomic_t fscache_n_acquires_nobufs;
--extern atomic_t fscache_n_acquires_oom;
--
--extern atomic_t fscache_n_invalidates;
--extern atomic_t fscache_n_invalidates_run;
--
--extern atomic_t fscache_n_updates;
--extern atomic_t fscache_n_updates_null;
--extern atomic_t fscache_n_updates_run;
--
--extern atomic_t fscache_n_relinquishes;
--extern atomic_t fscache_n_relinquishes_null;
--extern atomic_t fscache_n_relinquishes_waitcrt;
--extern atomic_t fscache_n_relinquishes_retire;
--
--extern atomic_t fscache_n_cookie_index;
--extern atomic_t fscache_n_cookie_data;
--extern atomic_t fscache_n_cookie_special;
--
--extern atomic_t fscache_n_object_alloc;
--extern atomic_t fscache_n_object_no_alloc;
--extern atomic_t fscache_n_object_lookups;
--extern atomic_t fscache_n_object_lookups_negative;
--extern atomic_t fscache_n_object_lookups_positive;
--extern atomic_t fscache_n_object_lookups_timed_out;
--extern atomic_t fscache_n_object_created;
--extern atomic_t fscache_n_object_avail;
--extern atomic_t fscache_n_object_dead;
--
--extern atomic_t fscache_n_checkaux_none;
--extern atomic_t fscache_n_checkaux_okay;
--extern atomic_t fscache_n_checkaux_update;
--extern atomic_t fscache_n_checkaux_obsolete;
-+extern atomic_unchecked_t fscache_n_ops_processed[FSCACHE_MAX_THREADS];
-+extern atomic_unchecked_t fscache_n_objs_processed[FSCACHE_MAX_THREADS];
-+
-+extern atomic_unchecked_t fscache_n_op_pend;
-+extern atomic_unchecked_t fscache_n_op_run;
-+extern atomic_unchecked_t fscache_n_op_enqueue;
-+extern atomic_unchecked_t fscache_n_op_deferred_release;
-+extern atomic_unchecked_t fscache_n_op_release;
-+extern atomic_unchecked_t fscache_n_op_gc;
-+extern atomic_unchecked_t fscache_n_op_cancelled;
-+extern atomic_unchecked_t fscache_n_op_rejected;
-+
-+extern atomic_unchecked_t fscache_n_attr_changed;
-+extern atomic_unchecked_t fscache_n_attr_changed_ok;
-+extern atomic_unchecked_t fscache_n_attr_changed_nobufs;
-+extern atomic_unchecked_t fscache_n_attr_changed_nomem;
-+extern atomic_unchecked_t fscache_n_attr_changed_calls;
-+
-+extern atomic_unchecked_t fscache_n_allocs;
-+extern atomic_unchecked_t fscache_n_allocs_ok;
-+extern atomic_unchecked_t fscache_n_allocs_wait;
-+extern atomic_unchecked_t fscache_n_allocs_nobufs;
-+extern atomic_unchecked_t fscache_n_allocs_intr;
-+extern atomic_unchecked_t fscache_n_allocs_object_dead;
-+extern atomic_unchecked_t fscache_n_alloc_ops;
-+extern atomic_unchecked_t fscache_n_alloc_op_waits;
-+
+extern atomic_unchecked_t fscache_n_retrievals;
+extern atomic_unchecked_t fscache_n_retrievals_ok;
+extern atomic_unchecked_t fscache_n_retrievals_wait;
@@ -53057,7 +52275,17 @@ index ee38fef..0a326d4 100644
+extern atomic_unchecked_t fscache_n_retrievals_object_dead;
+extern atomic_unchecked_t fscache_n_retrieval_ops;
+extern atomic_unchecked_t fscache_n_retrieval_op_waits;
-+
+
+-extern atomic_t fscache_n_stores;
+-extern atomic_t fscache_n_stores_ok;
+-extern atomic_t fscache_n_stores_again;
+-extern atomic_t fscache_n_stores_nobufs;
+-extern atomic_t fscache_n_stores_oom;
+-extern atomic_t fscache_n_store_ops;
+-extern atomic_t fscache_n_store_calls;
+-extern atomic_t fscache_n_store_pages;
+-extern atomic_t fscache_n_store_radix_deletes;
+-extern atomic_t fscache_n_store_pages_over_limit;
+extern atomic_unchecked_t fscache_n_stores;
+extern atomic_unchecked_t fscache_n_stores_ok;
+extern atomic_unchecked_t fscache_n_stores_again;
@@ -53068,39 +52296,73 @@ index ee38fef..0a326d4 100644
+extern atomic_unchecked_t fscache_n_store_pages;
+extern atomic_unchecked_t fscache_n_store_radix_deletes;
+extern atomic_unchecked_t fscache_n_store_pages_over_limit;
-+
+
+-extern atomic_t fscache_n_store_vmscan_not_storing;
+-extern atomic_t fscache_n_store_vmscan_gone;
+-extern atomic_t fscache_n_store_vmscan_busy;
+-extern atomic_t fscache_n_store_vmscan_cancelled;
+-extern atomic_t fscache_n_store_vmscan_wait;
+extern atomic_unchecked_t fscache_n_store_vmscan_not_storing;
+extern atomic_unchecked_t fscache_n_store_vmscan_gone;
+extern atomic_unchecked_t fscache_n_store_vmscan_busy;
+extern atomic_unchecked_t fscache_n_store_vmscan_cancelled;
+extern atomic_unchecked_t fscache_n_store_vmscan_wait;
-+
+
+-extern atomic_t fscache_n_marks;
+-extern atomic_t fscache_n_uncaches;
+extern atomic_unchecked_t fscache_n_marks;
+extern atomic_unchecked_t fscache_n_uncaches;
-+
+
+-extern atomic_t fscache_n_acquires;
+-extern atomic_t fscache_n_acquires_null;
+-extern atomic_t fscache_n_acquires_no_cache;
+-extern atomic_t fscache_n_acquires_ok;
+-extern atomic_t fscache_n_acquires_nobufs;
+-extern atomic_t fscache_n_acquires_oom;
+extern atomic_unchecked_t fscache_n_acquires;
+extern atomic_unchecked_t fscache_n_acquires_null;
+extern atomic_unchecked_t fscache_n_acquires_no_cache;
+extern atomic_unchecked_t fscache_n_acquires_ok;
+extern atomic_unchecked_t fscache_n_acquires_nobufs;
+extern atomic_unchecked_t fscache_n_acquires_oom;
-+
+
+-extern atomic_t fscache_n_invalidates;
+-extern atomic_t fscache_n_invalidates_run;
+extern atomic_unchecked_t fscache_n_invalidates;
+extern atomic_unchecked_t fscache_n_invalidates_run;
-+
+
+-extern atomic_t fscache_n_updates;
+-extern atomic_t fscache_n_updates_null;
+-extern atomic_t fscache_n_updates_run;
+extern atomic_unchecked_t fscache_n_updates;
+extern atomic_unchecked_t fscache_n_updates_null;
+extern atomic_unchecked_t fscache_n_updates_run;
-+
+
+-extern atomic_t fscache_n_relinquishes;
+-extern atomic_t fscache_n_relinquishes_null;
+-extern atomic_t fscache_n_relinquishes_waitcrt;
+-extern atomic_t fscache_n_relinquishes_retire;
+extern atomic_unchecked_t fscache_n_relinquishes;
+extern atomic_unchecked_t fscache_n_relinquishes_null;
+extern atomic_unchecked_t fscache_n_relinquishes_waitcrt;
+extern atomic_unchecked_t fscache_n_relinquishes_retire;
-+
+
+-extern atomic_t fscache_n_cookie_index;
+-extern atomic_t fscache_n_cookie_data;
+-extern atomic_t fscache_n_cookie_special;
+extern atomic_unchecked_t fscache_n_cookie_index;
+extern atomic_unchecked_t fscache_n_cookie_data;
+extern atomic_unchecked_t fscache_n_cookie_special;
-+
+
+-extern atomic_t fscache_n_object_alloc;
+-extern atomic_t fscache_n_object_no_alloc;
+-extern atomic_t fscache_n_object_lookups;
+-extern atomic_t fscache_n_object_lookups_negative;
+-extern atomic_t fscache_n_object_lookups_positive;
+-extern atomic_t fscache_n_object_lookups_timed_out;
+-extern atomic_t fscache_n_object_created;
+-extern atomic_t fscache_n_object_avail;
+-extern atomic_t fscache_n_object_dead;
+extern atomic_unchecked_t fscache_n_object_alloc;
+extern atomic_unchecked_t fscache_n_object_no_alloc;
+extern atomic_unchecked_t fscache_n_object_lookups;
@@ -53110,7 +52372,11 @@ index ee38fef..0a326d4 100644
+extern atomic_unchecked_t fscache_n_object_created;
+extern atomic_unchecked_t fscache_n_object_avail;
+extern atomic_unchecked_t fscache_n_object_dead;
-+
+
+-extern atomic_t fscache_n_checkaux_none;
+-extern atomic_t fscache_n_checkaux_okay;
+-extern atomic_t fscache_n_checkaux_update;
+-extern atomic_t fscache_n_checkaux_obsolete;
+extern atomic_unchecked_t fscache_n_checkaux_none;
+extern atomic_unchecked_t fscache_n_checkaux_okay;
+extern atomic_unchecked_t fscache_n_checkaux_update;
@@ -53807,13 +53073,27 @@ index 40d13c7..ddf52b9 100644
-atomic_t fscache_n_op_gc;
-atomic_t fscache_n_op_cancelled;
-atomic_t fscache_n_op_rejected;
--
++atomic_unchecked_t fscache_n_op_pend;
++atomic_unchecked_t fscache_n_op_run;
++atomic_unchecked_t fscache_n_op_enqueue;
++atomic_unchecked_t fscache_n_op_requeue;
++atomic_unchecked_t fscache_n_op_deferred_release;
++atomic_unchecked_t fscache_n_op_release;
++atomic_unchecked_t fscache_n_op_gc;
++atomic_unchecked_t fscache_n_op_cancelled;
++atomic_unchecked_t fscache_n_op_rejected;
+
-atomic_t fscache_n_attr_changed;
-atomic_t fscache_n_attr_changed_ok;
-atomic_t fscache_n_attr_changed_nobufs;
-atomic_t fscache_n_attr_changed_nomem;
-atomic_t fscache_n_attr_changed_calls;
--
++atomic_unchecked_t fscache_n_attr_changed;
++atomic_unchecked_t fscache_n_attr_changed_ok;
++atomic_unchecked_t fscache_n_attr_changed_nobufs;
++atomic_unchecked_t fscache_n_attr_changed_nomem;
++atomic_unchecked_t fscache_n_attr_changed_calls;
+
-atomic_t fscache_n_allocs;
-atomic_t fscache_n_allocs_ok;
-atomic_t fscache_n_allocs_wait;
@@ -53822,7 +53102,15 @@ index 40d13c7..ddf52b9 100644
-atomic_t fscache_n_allocs_object_dead;
-atomic_t fscache_n_alloc_ops;
-atomic_t fscache_n_alloc_op_waits;
--
++atomic_unchecked_t fscache_n_allocs;
++atomic_unchecked_t fscache_n_allocs_ok;
++atomic_unchecked_t fscache_n_allocs_wait;
++atomic_unchecked_t fscache_n_allocs_nobufs;
++atomic_unchecked_t fscache_n_allocs_intr;
++atomic_unchecked_t fscache_n_allocs_object_dead;
++atomic_unchecked_t fscache_n_alloc_ops;
++atomic_unchecked_t fscache_n_alloc_op_waits;
+
-atomic_t fscache_n_retrievals;
-atomic_t fscache_n_retrievals_ok;
-atomic_t fscache_n_retrievals_wait;
@@ -53833,89 +53121,6 @@ index 40d13c7..ddf52b9 100644
-atomic_t fscache_n_retrievals_object_dead;
-atomic_t fscache_n_retrieval_ops;
-atomic_t fscache_n_retrieval_op_waits;
--
--atomic_t fscache_n_stores;
--atomic_t fscache_n_stores_ok;
--atomic_t fscache_n_stores_again;
--atomic_t fscache_n_stores_nobufs;
--atomic_t fscache_n_stores_oom;
--atomic_t fscache_n_store_ops;
--atomic_t fscache_n_store_calls;
--atomic_t fscache_n_store_pages;
--atomic_t fscache_n_store_radix_deletes;
--atomic_t fscache_n_store_pages_over_limit;
--
--atomic_t fscache_n_store_vmscan_not_storing;
--atomic_t fscache_n_store_vmscan_gone;
--atomic_t fscache_n_store_vmscan_busy;
--atomic_t fscache_n_store_vmscan_cancelled;
--atomic_t fscache_n_store_vmscan_wait;
--
--atomic_t fscache_n_marks;
--atomic_t fscache_n_uncaches;
--
--atomic_t fscache_n_acquires;
--atomic_t fscache_n_acquires_null;
--atomic_t fscache_n_acquires_no_cache;
--atomic_t fscache_n_acquires_ok;
--atomic_t fscache_n_acquires_nobufs;
--atomic_t fscache_n_acquires_oom;
--
--atomic_t fscache_n_invalidates;
--atomic_t fscache_n_invalidates_run;
--
--atomic_t fscache_n_updates;
--atomic_t fscache_n_updates_null;
--atomic_t fscache_n_updates_run;
--
--atomic_t fscache_n_relinquishes;
--atomic_t fscache_n_relinquishes_null;
--atomic_t fscache_n_relinquishes_waitcrt;
--atomic_t fscache_n_relinquishes_retire;
--
--atomic_t fscache_n_cookie_index;
--atomic_t fscache_n_cookie_data;
--atomic_t fscache_n_cookie_special;
--
--atomic_t fscache_n_object_alloc;
--atomic_t fscache_n_object_no_alloc;
--atomic_t fscache_n_object_lookups;
--atomic_t fscache_n_object_lookups_negative;
--atomic_t fscache_n_object_lookups_positive;
--atomic_t fscache_n_object_lookups_timed_out;
--atomic_t fscache_n_object_created;
--atomic_t fscache_n_object_avail;
--atomic_t fscache_n_object_dead;
--
--atomic_t fscache_n_checkaux_none;
--atomic_t fscache_n_checkaux_okay;
--atomic_t fscache_n_checkaux_update;
--atomic_t fscache_n_checkaux_obsolete;
-+atomic_unchecked_t fscache_n_op_pend;
-+atomic_unchecked_t fscache_n_op_run;
-+atomic_unchecked_t fscache_n_op_enqueue;
-+atomic_unchecked_t fscache_n_op_requeue;
-+atomic_unchecked_t fscache_n_op_deferred_release;
-+atomic_unchecked_t fscache_n_op_release;
-+atomic_unchecked_t fscache_n_op_gc;
-+atomic_unchecked_t fscache_n_op_cancelled;
-+atomic_unchecked_t fscache_n_op_rejected;
-+
-+atomic_unchecked_t fscache_n_attr_changed;
-+atomic_unchecked_t fscache_n_attr_changed_ok;
-+atomic_unchecked_t fscache_n_attr_changed_nobufs;
-+atomic_unchecked_t fscache_n_attr_changed_nomem;
-+atomic_unchecked_t fscache_n_attr_changed_calls;
-+
-+atomic_unchecked_t fscache_n_allocs;
-+atomic_unchecked_t fscache_n_allocs_ok;
-+atomic_unchecked_t fscache_n_allocs_wait;
-+atomic_unchecked_t fscache_n_allocs_nobufs;
-+atomic_unchecked_t fscache_n_allocs_intr;
-+atomic_unchecked_t fscache_n_allocs_object_dead;
-+atomic_unchecked_t fscache_n_alloc_ops;
-+atomic_unchecked_t fscache_n_alloc_op_waits;
-+
+atomic_unchecked_t fscache_n_retrievals;
+atomic_unchecked_t fscache_n_retrievals_ok;
+atomic_unchecked_t fscache_n_retrievals_wait;
@@ -53926,7 +53131,17 @@ index 40d13c7..ddf52b9 100644
+atomic_unchecked_t fscache_n_retrievals_object_dead;
+atomic_unchecked_t fscache_n_retrieval_ops;
+atomic_unchecked_t fscache_n_retrieval_op_waits;
-+
+
+-atomic_t fscache_n_stores;
+-atomic_t fscache_n_stores_ok;
+-atomic_t fscache_n_stores_again;
+-atomic_t fscache_n_stores_nobufs;
+-atomic_t fscache_n_stores_oom;
+-atomic_t fscache_n_store_ops;
+-atomic_t fscache_n_store_calls;
+-atomic_t fscache_n_store_pages;
+-atomic_t fscache_n_store_radix_deletes;
+-atomic_t fscache_n_store_pages_over_limit;
+atomic_unchecked_t fscache_n_stores;
+atomic_unchecked_t fscache_n_stores_ok;
+atomic_unchecked_t fscache_n_stores_again;
@@ -53937,39 +53152,73 @@ index 40d13c7..ddf52b9 100644
+atomic_unchecked_t fscache_n_store_pages;
+atomic_unchecked_t fscache_n_store_radix_deletes;
+atomic_unchecked_t fscache_n_store_pages_over_limit;
-+
+
+-atomic_t fscache_n_store_vmscan_not_storing;
+-atomic_t fscache_n_store_vmscan_gone;
+-atomic_t fscache_n_store_vmscan_busy;
+-atomic_t fscache_n_store_vmscan_cancelled;
+-atomic_t fscache_n_store_vmscan_wait;
+atomic_unchecked_t fscache_n_store_vmscan_not_storing;
+atomic_unchecked_t fscache_n_store_vmscan_gone;
+atomic_unchecked_t fscache_n_store_vmscan_busy;
+atomic_unchecked_t fscache_n_store_vmscan_cancelled;
+atomic_unchecked_t fscache_n_store_vmscan_wait;
-+
+
+-atomic_t fscache_n_marks;
+-atomic_t fscache_n_uncaches;
+atomic_unchecked_t fscache_n_marks;
+atomic_unchecked_t fscache_n_uncaches;
-+
+
+-atomic_t fscache_n_acquires;
+-atomic_t fscache_n_acquires_null;
+-atomic_t fscache_n_acquires_no_cache;
+-atomic_t fscache_n_acquires_ok;
+-atomic_t fscache_n_acquires_nobufs;
+-atomic_t fscache_n_acquires_oom;
+atomic_unchecked_t fscache_n_acquires;
+atomic_unchecked_t fscache_n_acquires_null;
+atomic_unchecked_t fscache_n_acquires_no_cache;
+atomic_unchecked_t fscache_n_acquires_ok;
+atomic_unchecked_t fscache_n_acquires_nobufs;
+atomic_unchecked_t fscache_n_acquires_oom;
-+
+
+-atomic_t fscache_n_invalidates;
+-atomic_t fscache_n_invalidates_run;
+atomic_unchecked_t fscache_n_invalidates;
+atomic_unchecked_t fscache_n_invalidates_run;
-+
+
+-atomic_t fscache_n_updates;
+-atomic_t fscache_n_updates_null;
+-atomic_t fscache_n_updates_run;
+atomic_unchecked_t fscache_n_updates;
+atomic_unchecked_t fscache_n_updates_null;
+atomic_unchecked_t fscache_n_updates_run;
-+
+
+-atomic_t fscache_n_relinquishes;
+-atomic_t fscache_n_relinquishes_null;
+-atomic_t fscache_n_relinquishes_waitcrt;
+-atomic_t fscache_n_relinquishes_retire;
+atomic_unchecked_t fscache_n_relinquishes;
+atomic_unchecked_t fscache_n_relinquishes_null;
+atomic_unchecked_t fscache_n_relinquishes_waitcrt;
+atomic_unchecked_t fscache_n_relinquishes_retire;
-+
+
+-atomic_t fscache_n_cookie_index;
+-atomic_t fscache_n_cookie_data;
+-atomic_t fscache_n_cookie_special;
+atomic_unchecked_t fscache_n_cookie_index;
+atomic_unchecked_t fscache_n_cookie_data;
+atomic_unchecked_t fscache_n_cookie_special;
-+
+
+-atomic_t fscache_n_object_alloc;
+-atomic_t fscache_n_object_no_alloc;
+-atomic_t fscache_n_object_lookups;
+-atomic_t fscache_n_object_lookups_negative;
+-atomic_t fscache_n_object_lookups_positive;
+-atomic_t fscache_n_object_lookups_timed_out;
+-atomic_t fscache_n_object_created;
+-atomic_t fscache_n_object_avail;
+-atomic_t fscache_n_object_dead;
+atomic_unchecked_t fscache_n_object_alloc;
+atomic_unchecked_t fscache_n_object_no_alloc;
+atomic_unchecked_t fscache_n_object_lookups;
@@ -53979,7 +53228,11 @@ index 40d13c7..ddf52b9 100644
+atomic_unchecked_t fscache_n_object_created;
+atomic_unchecked_t fscache_n_object_avail;
+atomic_unchecked_t fscache_n_object_dead;
-+
+
+-atomic_t fscache_n_checkaux_none;
+-atomic_t fscache_n_checkaux_okay;
+-atomic_t fscache_n_checkaux_update;
+-atomic_t fscache_n_checkaux_obsolete;
+atomic_unchecked_t fscache_n_checkaux_none;
+atomic_unchecked_t fscache_n_checkaux_okay;
+atomic_unchecked_t fscache_n_checkaux_update;
@@ -54186,10 +53439,10 @@ index 40d13c7..ddf52b9 100644
seq_printf(m, "CacheOp: alo=%d luo=%d luc=%d gro=%d\n",
atomic_read(&fscache_n_cop_alloc_object),
diff --git a/fs/fuse/cuse.c b/fs/fuse/cuse.c
-index 6f96a8d..6019bb9 100644
+index aef34b1..59bfd7b 100644
--- a/fs/fuse/cuse.c
+++ b/fs/fuse/cuse.c
-@@ -597,10 +597,12 @@ static int __init cuse_init(void)
+@@ -600,10 +600,12 @@ static int __init cuse_init(void)
INIT_LIST_HEAD(&cuse_conntbl[i]);
/* inherit and extend fuse_dev_operations */
@@ -54207,10 +53460,10 @@ index 6f96a8d..6019bb9 100644
cuse_class = class_create(THIS_MODULE, "cuse");
if (IS_ERR(cuse_class))
diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c
-index 11dfa0c..6f64416 100644
+index 1d55f94..088da65 100644
--- a/fs/fuse/dev.c
+++ b/fs/fuse/dev.c
-@@ -1294,7 +1294,7 @@ static ssize_t fuse_dev_splice_read(struct file *in, loff_t *ppos,
+@@ -1339,7 +1339,7 @@ static ssize_t fuse_dev_splice_read(struct file *in, loff_t *ppos,
ret = 0;
pipe_lock(pipe);
@@ -54219,77 +53472,20 @@ index 11dfa0c..6f64416 100644
send_sig(SIGPIPE, current, 0);
if (!ret)
ret = -EPIPE;
+@@ -1364,7 +1364,7 @@ static ssize_t fuse_dev_splice_read(struct file *in, loff_t *ppos,
+ page_nr++;
+ ret += buf->len;
+
+- if (pipe->files)
++ if (atomic_read(&pipe->files))
+ do_wakeup = 1;
+ }
+
diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c
-index 185c479..2a4c1b2 100644
+index 5b12746..b481b03 100644
--- a/fs/fuse/dir.c
+++ b/fs/fuse/dir.c
-@@ -1225,13 +1225,29 @@ static int fuse_direntplus_link(struct file *file,
- if (name.name[1] == '.' && name.len == 2)
- return 0;
- }
-+
-+ if (invalid_nodeid(o->nodeid))
-+ return -EIO;
-+ if (!fuse_valid_type(o->attr.mode))
-+ return -EIO;
-+
- fc = get_fuse_conn(dir);
-
- name.hash = full_name_hash(name.name, name.len);
- dentry = d_lookup(parent, &name);
-- if (dentry && dentry->d_inode) {
-+ if (dentry) {
- inode = dentry->d_inode;
-- if (get_node_id(inode) == o->nodeid) {
-+ if (!inode) {
-+ d_drop(dentry);
-+ } else if (get_node_id(inode) != o->nodeid ||
-+ ((o->attr.mode ^ inode->i_mode) & S_IFMT)) {
-+ err = d_invalidate(dentry);
-+ if (err)
-+ goto out;
-+ } else if (is_bad_inode(inode)) {
-+ err = -EIO;
-+ goto out;
-+ } else {
- struct fuse_inode *fi;
- fi = get_fuse_inode(inode);
- spin_lock(&fc->lock);
-@@ -1244,9 +1260,6 @@ static int fuse_direntplus_link(struct file *file,
- */
- goto found;
- }
-- err = d_invalidate(dentry);
-- if (err)
-- goto out;
- dput(dentry);
- dentry = NULL;
- }
-@@ -1261,10 +1274,19 @@ static int fuse_direntplus_link(struct file *file,
- if (!inode)
- goto out;
-
-- alias = d_materialise_unique(dentry, inode);
-- err = PTR_ERR(alias);
-- if (IS_ERR(alias))
-- goto out;
-+ if (S_ISDIR(inode->i_mode)) {
-+ mutex_lock(&fc->inst_mutex);
-+ alias = fuse_d_add_directory(dentry, inode);
-+ mutex_unlock(&fc->inst_mutex);
-+ err = PTR_ERR(alias);
-+ if (IS_ERR(alias)) {
-+ iput(inode);
-+ goto out;
-+ }
-+ } else {
-+ alias = d_splice_alias(inode, dentry);
-+ }
-+
- if (alias) {
- dput(dentry);
- dentry = alias;
-@@ -1415,7 +1437,7 @@ static char *read_link(struct dentry *dentry)
+@@ -1437,7 +1437,7 @@ static char *read_link(struct dentry *dentry)
return link;
}
@@ -54299,10 +53495,10 @@ index 185c479..2a4c1b2 100644
if (!IS_ERR(link))
free_page((unsigned long) link);
diff --git a/fs/gfs2/inode.c b/fs/gfs2/inode.c
-index cc00bd1..3edb692 100644
+index 62b484e..0f9a140 100644
--- a/fs/gfs2/inode.c
+++ b/fs/gfs2/inode.c
-@@ -1500,7 +1500,7 @@ out:
+@@ -1441,7 +1441,7 @@ out:
static void gfs2_put_link(struct dentry *dentry, struct nameidata *nd, void *p)
{
@@ -54362,7 +53558,7 @@ index a3f868a..bb308ae 100644
static int can_do_hugetlb_shm(void)
{
diff --git a/fs/inode.c b/fs/inode.c
-index a898b3d..9b5a214 100644
+index 00d5fc3..98ce7d7 100644
--- a/fs/inode.c
+++ b/fs/inode.c
@@ -878,8 +878,8 @@ unsigned int get_next_ino(void)
@@ -54405,10 +53601,10 @@ index a6597d6..41b30ec 100644
/*
diff --git a/fs/jfs/super.c b/fs/jfs/super.c
-index 2003e83..40db287 100644
+index 788e0a9..8433098 100644
--- a/fs/jfs/super.c
+++ b/fs/jfs/super.c
-@@ -856,7 +856,7 @@ static int __init init_jfs_fs(void)
+@@ -878,7 +878,7 @@ static int __init init_jfs_fs(void)
jfs_inode_cachep =
kmem_cache_create("jfs_ip", sizeof(struct jfs_inode_info), 0,
@@ -54476,36 +53672,6 @@ index a2aa97d..10d6c41 100644
if (IS_ERR(nlmsvc_task)) {
error = PTR_ERR(nlmsvc_task);
printk(KERN_WARNING
-diff --git a/fs/lockd/svclock.c b/fs/lockd/svclock.c
-index e703318..8ebd3f5 100644
---- a/fs/lockd/svclock.c
-+++ b/fs/lockd/svclock.c
-@@ -939,6 +939,7 @@ nlmsvc_retry_blocked(void)
- unsigned long timeout = MAX_SCHEDULE_TIMEOUT;
- struct nlm_block *block;
-
-+ spin_lock(&nlm_blocked_lock);
- while (!list_empty(&nlm_blocked) && !kthread_should_stop()) {
- block = list_entry(nlm_blocked.next, struct nlm_block, b_list);
-
-@@ -948,6 +949,7 @@ nlmsvc_retry_blocked(void)
- timeout = block->b_when - jiffies;
- break;
- }
-+ spin_unlock(&nlm_blocked_lock);
-
- dprintk("nlmsvc_retry_blocked(%p, when=%ld)\n",
- block, block->b_when);
-@@ -957,7 +959,9 @@ nlmsvc_retry_blocked(void)
- retry_deferred_block(block);
- } else
- nlmsvc_grant_blocked(block);
-+ spin_lock(&nlm_blocked_lock);
- }
-+ spin_unlock(&nlm_blocked_lock);
-
- return timeout;
- }
diff --git a/fs/locks.c b/fs/locks.c
index cb424a4..850e4dd 100644
--- a/fs/locks.c
@@ -54532,7 +53698,7 @@ index cb424a4..850e4dd 100644
lock_flocks();
diff --git a/fs/namei.c b/fs/namei.c
-index 85e40d1..b66744e 100644
+index 9ed9361..2b72db1 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -319,16 +319,32 @@ int generic_permission(struct inode *inode, int mask)
@@ -54647,7 +53813,7 @@ index 85e40d1..b66744e 100644
+ }
+
if (!err && nd->flags & LOOKUP_DIRECTORY) {
- if (!nd->inode->i_op->lookup) {
+ if (!can_lookup(nd->inode)) {
path_put(&nd->path);
@@ -2002,8 +2027,15 @@ static int filename_lookup(int dfd, struct filename *name,
retval = path_lookupat(dfd, name->name,
@@ -55106,10 +54272,10 @@ index 85e40d1..b66744e 100644
out:
return len;
diff --git a/fs/namespace.c b/fs/namespace.c
-index e945b81..fc018e2 100644
+index 7b1ca9b..6faeccf 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
-@@ -1219,6 +1219,9 @@ static int do_umount(struct mount *mnt, int flags)
+@@ -1265,6 +1265,9 @@ static int do_umount(struct mount *mnt, int flags)
if (!(sb->s_flags & MS_RDONLY))
retval = do_remount_sb(sb, MS_RDONLY, NULL, 0);
up_write(&sb->s_umount);
@@ -55119,17 +54285,17 @@ index e945b81..fc018e2 100644
return retval;
}
-@@ -1238,6 +1241,9 @@ static int do_umount(struct mount *mnt, int flags)
+@@ -1283,6 +1286,9 @@ static int do_umount(struct mount *mnt, int flags)
+ }
br_write_unlock(&vfsmount_lock);
- up_write(&namespace_sem);
- release_mounts(&umount_list);
+ namespace_unlock();
+
+ gr_log_unmount(mnt->mnt_devname, retval);
+
return retval;
}
-@@ -1257,7 +1263,7 @@ static inline bool may_mount(void)
+@@ -1302,7 +1308,7 @@ static inline bool may_mount(void)
* unixes. Our API is identical to OSF/1 to avoid making a mess of AMD
*/
@@ -55138,7 +54304,7 @@ index e945b81..fc018e2 100644
{
struct path path;
struct mount *mnt;
-@@ -1297,7 +1303,7 @@ out:
+@@ -1342,7 +1348,7 @@ out:
/*
* The 2.0 compatible umount. No flags.
*/
@@ -55147,7 +54313,7 @@ index e945b81..fc018e2 100644
{
return sys_umount(name, 0);
}
-@@ -2267,6 +2273,16 @@ long do_mount(const char *dev_name, const char *dir_name,
+@@ -2313,6 +2319,16 @@ long do_mount(const char *dev_name, const char *dir_name,
MS_NOATIME | MS_NODIRATIME | MS_RELATIME| MS_KERNMOUNT |
MS_STRICTATIME);
@@ -55164,7 +54330,7 @@ index e945b81..fc018e2 100644
if (flags & MS_REMOUNT)
retval = do_remount(&path, flags & ~MS_REMOUNT, mnt_flags,
data_page);
-@@ -2281,6 +2297,9 @@ long do_mount(const char *dev_name, const char *dir_name,
+@@ -2327,6 +2343,9 @@ long do_mount(const char *dev_name, const char *dir_name,
dev_name, data_page);
dput_out:
path_put(&path);
@@ -55174,7 +54340,7 @@ index e945b81..fc018e2 100644
return retval;
}
-@@ -2454,8 +2473,8 @@ struct dentry *mount_subtree(struct vfsmount *mnt, const char *name)
+@@ -2500,8 +2519,8 @@ struct dentry *mount_subtree(struct vfsmount *mnt, const char *name)
}
EXPORT_SYMBOL(mount_subtree);
@@ -55185,7 +54351,7 @@ index e945b81..fc018e2 100644
{
int ret;
char *kernel_type;
-@@ -2567,6 +2586,11 @@ SYSCALL_DEFINE2(pivot_root, const char __user *, new_root,
+@@ -2614,6 +2633,11 @@ SYSCALL_DEFINE2(pivot_root, const char __user *, new_root,
if (error)
goto out2;
@@ -55195,9 +54361,9 @@ index e945b81..fc018e2 100644
+ }
+
get_fs_root(current->fs, &root);
- error = lock_mount(&old);
- if (error)
-@@ -2815,7 +2839,7 @@ static int mntns_install(struct nsproxy *nsproxy, void *ns)
+ old_mp = lock_mount(&old);
+ error = PTR_ERR(old_mp);
+@@ -2864,7 +2888,7 @@ static int mntns_install(struct nsproxy *nsproxy, void *ns)
!nsown_capable(CAP_SYS_ADMIN))
return -EPERM;
@@ -55207,10 +54373,10 @@ index e945b81..fc018e2 100644
get_mnt_ns(mnt_ns);
diff --git a/fs/nfs/callback.c b/fs/nfs/callback.c
-index 5088b57..eabd719 100644
+index cff089a..4c3d57a 100644
--- a/fs/nfs/callback.c
+++ b/fs/nfs/callback.c
-@@ -208,7 +208,6 @@ static int nfs_callback_start_svc(int minorversion, struct rpc_xprt *xprt,
+@@ -211,7 +211,6 @@ static int nfs_callback_start_svc(int minorversion, struct rpc_xprt *xprt,
struct svc_rqst *rqstp;
int (*callback_svc)(void *vrqstp);
struct nfs_callback_data *cb_info = &nfs_callback_info[minorversion];
@@ -55218,7 +54384,7 @@ index 5088b57..eabd719 100644
int ret;
nfs_callback_bc_serv(minorversion, xprt, serv);
-@@ -232,10 +231,9 @@ static int nfs_callback_start_svc(int minorversion, struct rpc_xprt *xprt,
+@@ -235,10 +234,9 @@ static int nfs_callback_start_svc(int minorversion, struct rpc_xprt *xprt,
svc_sock_update_bufs(serv);
@@ -55231,7 +54397,7 @@ index 5088b57..eabd719 100644
ret = PTR_ERR(cb_info->task);
svc_exit_thread(cb_info->rqst);
diff --git a/fs/nfs/callback_xdr.c b/fs/nfs/callback_xdr.c
-index 59461c9..b17c57e 100644
+index a35582c..ebbdcd5 100644
--- a/fs/nfs/callback_xdr.c
+++ b/fs/nfs/callback_xdr.c
@@ -51,7 +51,7 @@ struct callback_op {
@@ -55244,10 +54410,10 @@ index 59461c9..b17c57e 100644
static struct callback_op callback_ops[];
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
-index 1f94167..79c4ce4 100644
+index c1c7a9d..7afa0b8 100644
--- a/fs/nfs/inode.c
+++ b/fs/nfs/inode.c
-@@ -1041,16 +1041,16 @@ static int nfs_size_need_update(const struct inode *inode, const struct nfs_fatt
+@@ -1043,16 +1043,16 @@ static int nfs_size_need_update(const struct inode *inode, const struct nfs_fatt
return nfs_size_to_loff_t(fattr->size) > i_size_read(inode);
}
@@ -55268,10 +54434,10 @@ index 1f94167..79c4ce4 100644
void nfs_fattr_init(struct nfs_fattr *fattr)
diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c
-index d41a351..7899577 100644
+index 2c37442..9b9538b 100644
--- a/fs/nfs/nfs4state.c
+++ b/fs/nfs/nfs4state.c
-@@ -1182,7 +1182,7 @@ void nfs4_schedule_state_manager(struct nfs_client *clp)
+@@ -1193,7 +1193,7 @@ void nfs4_schedule_state_manager(struct nfs_client *clp)
snprintf(buf, sizeof(buf), "%s-manager",
rpc_peeraddr2str(clp->cl_rpcclient, RPC_DISPLAY_ADDR));
rcu_read_unlock();
@@ -55281,10 +54447,10 @@ index d41a351..7899577 100644
printk(KERN_ERR "%s: kthread_run: %ld\n",
__func__, PTR_ERR(task));
diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c
-index d401d01..10b3e62 100644
+index 27d74a2..c4c2a73 100644
--- a/fs/nfsd/nfs4proc.c
+++ b/fs/nfsd/nfs4proc.c
-@@ -1109,7 +1109,7 @@ struct nfsd4_operation {
+@@ -1126,7 +1126,7 @@ struct nfsd4_operation {
nfsd4op_rsize op_rsize_bop;
stateid_getter op_get_currentstateid;
stateid_setter op_set_currentstateid;
@@ -55294,10 +54460,10 @@ index d401d01..10b3e62 100644
static struct nfsd4_operation nfsd4_ops[];
diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c
-index a49c11b..8cd8130 100644
+index 582321a..0224663 100644
--- a/fs/nfsd/nfs4xdr.c
+++ b/fs/nfsd/nfs4xdr.c
-@@ -1457,7 +1457,7 @@ nfsd4_decode_notsupp(struct nfsd4_compoundargs *argp, void *p)
+@@ -1458,7 +1458,7 @@ nfsd4_decode_notsupp(struct nfsd4_compoundargs *argp, void *p)
typedef __be32(*nfsd4_dec)(struct nfsd4_compoundargs *argp, void *);
@@ -55306,7 +54472,7 @@ index a49c11b..8cd8130 100644
[OP_ACCESS] = (nfsd4_dec)nfsd4_decode_access,
[OP_CLOSE] = (nfsd4_dec)nfsd4_decode_close,
[OP_COMMIT] = (nfsd4_dec)nfsd4_decode_commit,
-@@ -1497,7 +1497,7 @@ static nfsd4_dec nfsd4_dec_ops[] = {
+@@ -1498,7 +1498,7 @@ static nfsd4_dec nfsd4_dec_ops[] = {
[OP_RELEASE_LOCKOWNER] = (nfsd4_dec)nfsd4_decode_release_lockowner,
};
@@ -55315,7 +54481,7 @@ index a49c11b..8cd8130 100644
[OP_ACCESS] = (nfsd4_dec)nfsd4_decode_access,
[OP_CLOSE] = (nfsd4_dec)nfsd4_decode_close,
[OP_COMMIT] = (nfsd4_dec)nfsd4_decode_commit,
-@@ -1559,7 +1559,7 @@ static nfsd4_dec nfsd41_dec_ops[] = {
+@@ -1560,7 +1560,7 @@ static nfsd4_dec nfsd41_dec_ops[] = {
};
struct nfsd4_minorversion_ops {
@@ -55325,15 +54491,16 @@ index a49c11b..8cd8130 100644
};
diff --git a/fs/nfsd/nfscache.c b/fs/nfsd/nfscache.c
-index ca05f6d..b88c3a7 100644
+index e76244e..9fe8f2f1 100644
--- a/fs/nfsd/nfscache.c
+++ b/fs/nfsd/nfscache.c
-@@ -461,13 +461,16 @@ nfsd_cache_update(struct svc_rqst *rqstp, int cachetype, __be32 *statp)
+@@ -526,14 +526,17 @@ nfsd_cache_update(struct svc_rqst *rqstp, int cachetype, __be32 *statp)
{
struct svc_cacherep *rp = rqstp->rq_cacherep;
struct kvec *resv = &rqstp->rq_res.head[0], *cachv;
- int len;
+ long len;
+ size_t bufsize = 0;
if (!rp)
return;
@@ -55349,7 +54516,7 @@ index ca05f6d..b88c3a7 100644
/* Don't cache excessive amounts of data and XDR failures */
if (!statp || len > (256 >> 2)) {
diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c
-index 2b2e239..c915b48 100644
+index 84ce601..633d226 100644
--- a/fs/nfsd/vfs.c
+++ b/fs/nfsd/vfs.c
@@ -939,7 +939,7 @@ nfsd_vfs_read(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file *file,
@@ -55463,10 +54630,10 @@ index e7bc1d7..06bd4bb 100644
}
diff --git a/fs/notify/fanotify/fanotify_user.c b/fs/notify/fanotify/fanotify_user.c
-index 5d84442..2c034ba 100644
+index 6c80083..a1e6299 100644
--- a/fs/notify/fanotify/fanotify_user.c
+++ b/fs/notify/fanotify/fanotify_user.c
-@@ -121,6 +121,7 @@ static int fill_event_metadata(struct fsnotify_group *group,
+@@ -122,6 +122,7 @@ static int fill_event_metadata(struct fsnotify_group *group,
metadata->event_len = FAN_EVENT_METADATA_LEN;
metadata->metadata_len = FAN_EVENT_METADATA_LEN;
metadata->vers = FANOTIFY_METADATA_VERSION;
@@ -55474,7 +54641,7 @@ index 5d84442..2c034ba 100644
metadata->mask = event->mask & FAN_ALL_OUTGOING_EVENTS;
metadata->pid = pid_vnr(event->tgid);
if (unlikely(event->mask & FAN_Q_OVERFLOW))
-@@ -251,8 +252,8 @@ static ssize_t copy_event_to_user(struct fsnotify_group *group,
+@@ -252,8 +253,8 @@ static ssize_t copy_event_to_user(struct fsnotify_group *group,
fd = fanotify_event_metadata.fd;
ret = -EFAULT;
@@ -55521,10 +54688,10 @@ index aa411c3..c260a84 100644
"inode 0x%lx or driver bug.", vdir->i_ino);
goto err_out;
diff --git a/fs/ntfs/file.c b/fs/ntfs/file.c
-index 5b2d4f0..c6de396 100644
+index c5670b8..01a3656 100644
--- a/fs/ntfs/file.c
+++ b/fs/ntfs/file.c
-@@ -2242,6 +2242,6 @@ const struct inode_operations ntfs_file_inode_ops = {
+@@ -2241,6 +2241,6 @@ const struct inode_operations ntfs_file_inode_ops = {
#endif /* NTFS_RW */
};
@@ -55664,7 +54831,7 @@ index 01b8516..579c4df 100644
/* Copy the blockcheck stats from the superblock probe */
osb->osb_ecc_stats = *stats;
diff --git a/fs/open.c b/fs/open.c
-index 6835446..eadf09f 100644
+index 8c74100..4239c48 100644
--- a/fs/open.c
+++ b/fs/open.c
@@ -32,6 +32,8 @@
@@ -55694,7 +54861,7 @@ index 6835446..eadf09f 100644
if (!error)
error = do_truncate(dentry, length, ATTR_MTIME|ATTR_CTIME, f.file);
sb_end_write(inode->i_sb);
-@@ -388,6 +394,9 @@ retry:
+@@ -360,6 +366,9 @@ retry:
if (__mnt_is_readonly(path.mnt))
res = -EROFS;
@@ -55704,7 +54871,7 @@ index 6835446..eadf09f 100644
out_path_release:
path_put(&path);
if (retry_estale(res, lookup_flags)) {
-@@ -419,6 +428,8 @@ retry:
+@@ -391,6 +400,8 @@ retry:
if (error)
goto dput_and_out;
@@ -55713,7 +54880,7 @@ index 6835446..eadf09f 100644
set_fs_pwd(current->fs, &path);
dput_and_out:
-@@ -448,6 +459,13 @@ SYSCALL_DEFINE1(fchdir, unsigned int, fd)
+@@ -420,6 +431,13 @@ SYSCALL_DEFINE1(fchdir, unsigned int, fd)
goto out_putf;
error = inode_permission(inode, MAY_EXEC | MAY_CHDIR);
@@ -55727,7 +54894,7 @@ index 6835446..eadf09f 100644
if (!error)
set_fs_pwd(current->fs, &f.file->f_path);
out_putf:
-@@ -477,7 +495,13 @@ retry:
+@@ -449,7 +467,13 @@ retry:
if (error)
goto dput_and_out;
@@ -55741,7 +54908,7 @@ index 6835446..eadf09f 100644
error = 0;
dput_and_out:
path_put(&path);
-@@ -499,6 +523,16 @@ static int chmod_common(struct path *path, umode_t mode)
+@@ -471,6 +495,16 @@ static int chmod_common(struct path *path, umode_t mode)
if (error)
return error;
mutex_lock(&inode->i_mutex);
@@ -55758,7 +54925,7 @@ index 6835446..eadf09f 100644
error = security_path_chmod(path, mode);
if (error)
goto out_unlock;
-@@ -559,6 +593,9 @@ static int chown_common(struct path *path, uid_t user, gid_t group)
+@@ -531,6 +565,9 @@ static int chown_common(struct path *path, uid_t user, gid_t group)
uid = make_kuid(current_user_ns(), user);
gid = make_kgid(current_user_ns(), group);
@@ -55768,7 +54935,7 @@ index 6835446..eadf09f 100644
newattrs.ia_valid = ATTR_CTIME;
if (user != (uid_t) -1) {
if (!uid_valid(uid))
-@@ -974,6 +1011,7 @@ long do_sys_open(int dfd, const char __user *filename, int flags, umode_t mode)
+@@ -946,6 +983,7 @@ long do_sys_open(int dfd, const char __user *filename, int flags, umode_t mode)
} else {
fsnotify_open(f);
fd_install(fd, f);
@@ -55777,10 +54944,28 @@ index 6835446..eadf09f 100644
}
putname(tmp);
diff --git a/fs/pipe.c b/fs/pipe.c
-index 2234f3f..f9083a1 100644
+index d2c45e1..009fe1c 100644
--- a/fs/pipe.c
+++ b/fs/pipe.c
-@@ -438,9 +438,9 @@ redo:
+@@ -56,7 +56,7 @@ unsigned int pipe_min_size = PAGE_SIZE;
+
+ static void pipe_lock_nested(struct pipe_inode_info *pipe, int subclass)
+ {
+- if (pipe->files)
++ if (atomic_read(&pipe->files))
+ mutex_lock_nested(&pipe->mutex, subclass);
+ }
+
+@@ -71,7 +71,7 @@ EXPORT_SYMBOL(pipe_lock);
+
+ void pipe_unlock(struct pipe_inode_info *pipe)
+ {
+- if (pipe->files)
++ if (atomic_read(&pipe->files))
+ mutex_unlock(&pipe->mutex);
+ }
+ EXPORT_SYMBOL(pipe_unlock);
+@@ -449,9 +449,9 @@ redo:
}
if (bufs) /* More to do? */
continue;
@@ -55792,16 +54977,16 @@ index 2234f3f..f9083a1 100644
/* syscall merging: Usually we must not sleep
* if O_NONBLOCK is set, or if we got some data.
* But if a writer sleeps in kernel space, then
-@@ -504,7 +504,7 @@ pipe_write(struct kiocb *iocb, const struct iovec *_iov,
- mutex_lock(&inode->i_mutex);
- pipe = inode->i_pipe;
+@@ -513,7 +513,7 @@ pipe_write(struct kiocb *iocb, const struct iovec *_iov,
+ ret = 0;
+ __pipe_lock(pipe);
- if (!pipe->readers) {
+ if (!atomic_read(&pipe->readers)) {
send_sig(SIGPIPE, current, 0);
ret = -EPIPE;
goto out;
-@@ -553,7 +553,7 @@ redo1:
+@@ -562,7 +562,7 @@ redo1:
for (;;) {
int bufs;
@@ -55810,7 +54995,7 @@ index 2234f3f..f9083a1 100644
send_sig(SIGPIPE, current, 0);
if (!ret)
ret = -EPIPE;
-@@ -644,9 +644,9 @@ redo2:
+@@ -653,9 +653,9 @@ redo2:
kill_fasync(&pipe->fasync_readers, SIGIO, POLL_IN);
do_wakeup = 0;
}
@@ -55821,8 +55006,8 @@ index 2234f3f..f9083a1 100644
+ atomic_dec(&pipe->waiting_writers);
}
out:
- mutex_unlock(&inode->i_mutex);
-@@ -716,7 +716,7 @@ pipe_poll(struct file *filp, poll_table *wait)
+ __pipe_unlock(pipe);
+@@ -709,7 +709,7 @@ pipe_poll(struct file *filp, poll_table *wait)
mask = 0;
if (filp->f_mode & FMODE_READ) {
mask = (nrbufs > 0) ? POLLIN | POLLRDNORM : 0;
@@ -55831,7 +55016,7 @@ index 2234f3f..f9083a1 100644
mask |= POLLHUP;
}
-@@ -726,7 +726,7 @@ pipe_poll(struct file *filp, poll_table *wait)
+@@ -719,7 +719,7 @@ pipe_poll(struct file *filp, poll_table *wait)
* Most Unices do not set POLLERR for FIFOs but on Linux they
* behave exactly like pipes for poll().
*/
@@ -55840,52 +55025,30 @@ index 2234f3f..f9083a1 100644
mask |= POLLERR;
}
-@@ -740,10 +740,10 @@ pipe_release(struct inode *inode, int decr, int decw)
-
- mutex_lock(&inode->i_mutex);
- pipe = inode->i_pipe;
-- pipe->readers -= decr;
-- pipe->writers -= decw;
-+ atomic_sub(decr, &pipe->readers);
-+ atomic_sub(decw, &pipe->writers);
-
-- if (!pipe->readers && !pipe->writers) {
-+ if (!atomic_read(&pipe->readers) && !atomic_read(&pipe->writers)) {
- free_pipe_info(inode);
- } else {
- wake_up_interruptible_sync_poll(&pipe->wait, POLLIN | POLLOUT | POLLRDNORM | POLLWRNORM | POLLERR | POLLHUP);
-@@ -833,7 +833,7 @@ pipe_read_open(struct inode *inode, struct file *filp)
+@@ -734,17 +734,17 @@ pipe_release(struct inode *inode, struct file *file)
- if (inode->i_pipe) {
- ret = 0;
-- inode->i_pipe->readers++;
-+ atomic_inc(&inode->i_pipe->readers);
- }
+ __pipe_lock(pipe);
+ if (file->f_mode & FMODE_READ)
+- pipe->readers--;
++ atomic_dec(&pipe->readers);
+ if (file->f_mode & FMODE_WRITE)
+- pipe->writers--;
++ atomic_dec(&pipe->writers);
- mutex_unlock(&inode->i_mutex);
-@@ -850,7 +850,7 @@ pipe_write_open(struct inode *inode, struct file *filp)
-
- if (inode->i_pipe) {
- ret = 0;
-- inode->i_pipe->writers++;
-+ atomic_inc(&inode->i_pipe->writers);
+- if (pipe->readers || pipe->writers) {
++ if (atomic_read(&pipe->readers) || atomic_read(&pipe->writers)) {
+ wake_up_interruptible_sync_poll(&pipe->wait, POLLIN | POLLOUT | POLLRDNORM | POLLWRNORM | POLLERR | POLLHUP);
+ kill_fasync(&pipe->fasync_readers, SIGIO, POLL_IN);
+ kill_fasync(&pipe->fasync_writers, SIGIO, POLL_OUT);
}
-
- mutex_unlock(&inode->i_mutex);
-@@ -871,9 +871,9 @@ pipe_rdwr_open(struct inode *inode, struct file *filp)
- if (inode->i_pipe) {
- ret = 0;
- if (filp->f_mode & FMODE_READ)
-- inode->i_pipe->readers++;
-+ atomic_inc(&inode->i_pipe->readers);
- if (filp->f_mode & FMODE_WRITE)
-- inode->i_pipe->writers++;
-+ atomic_inc(&inode->i_pipe->writers);
+ spin_lock(&inode->i_lock);
+- if (!--pipe->files) {
++ if (atomic_dec_and_test(&pipe->files)) {
+ inode->i_pipe = NULL;
+ kill = 1;
}
-
- mutex_unlock(&inode->i_mutex);
-@@ -965,7 +965,7 @@ void free_pipe_info(struct inode *inode)
- inode->i_pipe = NULL;
+@@ -811,7 +811,7 @@ void free_pipe_info(struct pipe_inode_info *pipe)
+ kfree(pipe);
}
-static struct vfsmount *pipe_mnt __read_mostly;
@@ -55893,16 +55056,109 @@ index 2234f3f..f9083a1 100644
/*
* pipefs_dname() is called from d_path().
-@@ -995,7 +995,8 @@ static struct inode * get_pipe_inode(void)
+@@ -841,8 +841,9 @@ static struct inode * get_pipe_inode(void)
goto fail_iput;
- inode->i_pipe = pipe;
+ inode->i_pipe = pipe;
+- pipe->files = 2;
- pipe->readers = pipe->writers = 1;
++ atomic_set(&pipe->files, 2);
+ atomic_set(&pipe->readers, 1);
+ atomic_set(&pipe->writers, 1);
- inode->i_fop = &rdwr_pipefifo_fops;
+ inode->i_fop = &pipefifo_fops;
/*
+@@ -1022,17 +1023,17 @@ static int fifo_open(struct inode *inode, struct file *filp)
+ spin_lock(&inode->i_lock);
+ if (inode->i_pipe) {
+ pipe = inode->i_pipe;
+- pipe->files++;
++ atomic_inc(&pipe->files);
+ spin_unlock(&inode->i_lock);
+ } else {
+ spin_unlock(&inode->i_lock);
+ pipe = alloc_pipe_info();
+ if (!pipe)
+ return -ENOMEM;
+- pipe->files = 1;
++ atomic_set(&pipe->files, 1);
+ spin_lock(&inode->i_lock);
+ if (unlikely(inode->i_pipe)) {
+- inode->i_pipe->files++;
++ atomic_inc(&inode->i_pipe->files);
+ spin_unlock(&inode->i_lock);
+ free_pipe_info(pipe);
+ pipe = inode->i_pipe;
+@@ -1057,10 +1058,10 @@ static int fifo_open(struct inode *inode, struct file *filp)
+ * opened, even when there is no process writing the FIFO.
+ */
+ pipe->r_counter++;
+- if (pipe->readers++ == 0)
++ if (atomic_inc_return(&pipe->readers) == 1)
+ wake_up_partner(pipe);
+
+- if (!is_pipe && !pipe->writers) {
++ if (!is_pipe && !atomic_read(&pipe->writers)) {
+ if ((filp->f_flags & O_NONBLOCK)) {
+ /* suppress POLLHUP until we have
+ * seen a writer */
+@@ -1079,14 +1080,14 @@ static int fifo_open(struct inode *inode, struct file *filp)
+ * errno=ENXIO when there is no process reading the FIFO.
+ */
+ ret = -ENXIO;
+- if (!is_pipe && (filp->f_flags & O_NONBLOCK) && !pipe->readers)
++ if (!is_pipe && (filp->f_flags & O_NONBLOCK) && !atomic_read(&pipe->readers))
+ goto err;
+
+ pipe->w_counter++;
+- if (!pipe->writers++)
++ if (atomic_inc_return(&pipe->writers) == 1)
+ wake_up_partner(pipe);
+
+- if (!is_pipe && !pipe->readers) {
++ if (!is_pipe && !atomic_read(&pipe->readers)) {
+ if (wait_for_partner(pipe, &pipe->r_counter))
+ goto err_wr;
+ }
+@@ -1100,11 +1101,11 @@ static int fifo_open(struct inode *inode, struct file *filp)
+ * the process can at least talk to itself.
+ */
+
+- pipe->readers++;
+- pipe->writers++;
++ atomic_inc(&pipe->readers);
++ atomic_inc(&pipe->writers);
+ pipe->r_counter++;
+ pipe->w_counter++;
+- if (pipe->readers == 1 || pipe->writers == 1)
++ if (atomic_read(&pipe->readers) == 1 || atomic_read(&pipe->writers) == 1)
+ wake_up_partner(pipe);
+ break;
+
+@@ -1118,20 +1119,20 @@ static int fifo_open(struct inode *inode, struct file *filp)
+ return 0;
+
+ err_rd:
+- if (!--pipe->readers)
++ if (atomic_dec_and_test(&pipe->readers))
+ wake_up_interruptible(&pipe->wait);
+ ret = -ERESTARTSYS;
+ goto err;
+
+ err_wr:
+- if (!--pipe->writers)
++ if (atomic_dec_and_test(&pipe->writers))
+ wake_up_interruptible(&pipe->wait);
+ ret = -ERESTARTSYS;
+ goto err;
+
+ err:
+ spin_lock(&inode->i_lock);
+- if (!--pipe->files) {
++ if (atomic_dec_and_test(&pipe->files)) {
+ inode->i_pipe = NULL;
+ kill = 1;
+ }
diff --git a/fs/proc/Kconfig b/fs/proc/Kconfig
index 15af622..0e9f4467 100644
--- a/fs/proc/Kconfig
@@ -56088,10 +55344,10 @@ index cbd0f1b..adec3f0 100644
static struct pid *
get_children_pid(struct inode *inode, struct pid *pid_prev, loff_t pos)
diff --git a/fs/proc/base.c b/fs/proc/base.c
-index 69078c7..3e12a75 100644
+index c3834da..b402b2b 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
-@@ -112,6 +112,14 @@ struct pid_entry {
+@@ -113,6 +113,14 @@ struct pid_entry {
union proc_op op;
};
@@ -56106,7 +55362,7 @@ index 69078c7..3e12a75 100644
#define NOD(NAME, MODE, IOP, FOP, OP) { \
.name = (NAME), \
.len = sizeof(NAME) - 1, \
-@@ -209,6 +217,9 @@ static int proc_pid_cmdline(struct task_struct *task, char * buffer)
+@@ -210,6 +218,9 @@ static int proc_pid_cmdline(struct task_struct *task, char * buffer)
if (!mm->arg_end)
goto out_mm; /* Shh! No looking before we're done */
@@ -56116,7 +55372,7 @@ index 69078c7..3e12a75 100644
len = mm->arg_end - mm->arg_start;
if (len > PAGE_SIZE)
-@@ -236,12 +247,28 @@ out:
+@@ -237,12 +248,28 @@ out:
return res;
}
@@ -56145,7 +55401,7 @@ index 69078c7..3e12a75 100644
do {
nwords += 2;
} while (mm->saved_auxv[nwords - 2] != 0); /* AT_NULL */
-@@ -255,7 +282,7 @@ static int proc_pid_auxv(struct task_struct *task, char *buffer)
+@@ -256,7 +283,7 @@ static int proc_pid_auxv(struct task_struct *task, char *buffer)
}
@@ -56154,7 +55410,7 @@ index 69078c7..3e12a75 100644
/*
* Provides a wchan file via kallsyms in a proper one-value-per-file format.
* Returns the resolved symbol. If that fails, simply return the address.
-@@ -294,7 +321,7 @@ static void unlock_trace(struct task_struct *task)
+@@ -295,7 +322,7 @@ static void unlock_trace(struct task_struct *task)
mutex_unlock(&task->signal->cred_guard_mutex);
}
@@ -56163,7 +55419,7 @@ index 69078c7..3e12a75 100644
#define MAX_STACK_TRACE_DEPTH 64
-@@ -486,7 +513,7 @@ static int proc_pid_limits(struct task_struct *task, char *buffer)
+@@ -518,7 +545,7 @@ static int proc_pid_limits(struct task_struct *task, char *buffer)
return count;
}
@@ -56172,7 +55428,7 @@ index 69078c7..3e12a75 100644
static int proc_pid_syscall(struct task_struct *task, char *buffer)
{
long nr;
-@@ -515,7 +542,7 @@ static int proc_pid_syscall(struct task_struct *task, char *buffer)
+@@ -547,7 +574,7 @@ static int proc_pid_syscall(struct task_struct *task, char *buffer)
/************************************************************************/
/* permission checks */
@@ -56181,7 +55437,7 @@ index 69078c7..3e12a75 100644
{
struct task_struct *task;
int allowed = 0;
-@@ -525,7 +552,10 @@ static int proc_fd_access_allowed(struct inode *inode)
+@@ -557,7 +584,10 @@ static int proc_fd_access_allowed(struct inode *inode)
*/
task = get_proc_task(inode);
if (task) {
@@ -56193,7 +55449,7 @@ index 69078c7..3e12a75 100644
put_task_struct(task);
}
return allowed;
-@@ -556,10 +586,35 @@ static bool has_pid_permissions(struct pid_namespace *pid,
+@@ -588,10 +618,35 @@ static bool has_pid_permissions(struct pid_namespace *pid,
struct task_struct *task,
int hide_pid_min)
{
@@ -56229,7 +55485,7 @@ index 69078c7..3e12a75 100644
return ptrace_may_access(task, PTRACE_MODE_READ);
}
-@@ -577,7 +632,11 @@ static int proc_pid_permission(struct inode *inode, int mask)
+@@ -609,7 +664,11 @@ static int proc_pid_permission(struct inode *inode, int mask)
put_task_struct(task);
if (!has_perms) {
@@ -56241,7 +55497,7 @@ index 69078c7..3e12a75 100644
/*
* Let's make getdents(), stat(), and open()
* consistent with each other. If a process
-@@ -675,6 +734,11 @@ static int __mem_open(struct inode *inode, struct file *file, unsigned int mode)
+@@ -707,6 +766,11 @@ static int __mem_open(struct inode *inode, struct file *file, unsigned int mode)
if (!task)
return -ESRCH;
@@ -56253,7 +55509,7 @@ index 69078c7..3e12a75 100644
mm = mm_access(task, mode);
put_task_struct(task);
-@@ -690,6 +754,10 @@ static int __mem_open(struct inode *inode, struct file *file, unsigned int mode)
+@@ -722,6 +786,10 @@ static int __mem_open(struct inode *inode, struct file *file, unsigned int mode)
file->private_data = mm;
@@ -56264,7 +55520,7 @@ index 69078c7..3e12a75 100644
return 0;
}
-@@ -711,6 +779,17 @@ static ssize_t mem_rw(struct file *file, char __user *buf,
+@@ -743,6 +811,17 @@ static ssize_t mem_rw(struct file *file, char __user *buf,
ssize_t copied;
char *page;
@@ -56282,7 +55538,7 @@ index 69078c7..3e12a75 100644
if (!mm)
return 0;
-@@ -723,7 +802,7 @@ static ssize_t mem_rw(struct file *file, char __user *buf,
+@@ -755,7 +834,7 @@ static ssize_t mem_rw(struct file *file, char __user *buf,
goto free;
while (count > 0) {
@@ -56291,7 +55547,7 @@ index 69078c7..3e12a75 100644
if (write && copy_from_user(page, buf, this_len)) {
copied = -EFAULT;
-@@ -815,6 +894,13 @@ static ssize_t environ_read(struct file *file, char __user *buf,
+@@ -847,6 +926,13 @@ static ssize_t environ_read(struct file *file, char __user *buf,
if (!mm)
return 0;
@@ -56305,7 +55561,7 @@ index 69078c7..3e12a75 100644
page = (char *)__get_free_page(GFP_TEMPORARY);
if (!page)
return -ENOMEM;
-@@ -824,7 +910,7 @@ static ssize_t environ_read(struct file *file, char __user *buf,
+@@ -856,7 +942,7 @@ static ssize_t environ_read(struct file *file, char __user *buf,
goto free;
while (count > 0) {
size_t this_len, max_len;
@@ -56314,7 +55570,7 @@ index 69078c7..3e12a75 100644
if (src >= (mm->env_end - mm->env_start))
break;
-@@ -1430,7 +1516,7 @@ static void *proc_pid_follow_link(struct dentry *dentry, struct nameidata *nd)
+@@ -1461,7 +1547,7 @@ static void *proc_pid_follow_link(struct dentry *dentry, struct nameidata *nd)
int error = -EACCES;
/* Are we allowed to snoop on the tasks file descriptors? */
@@ -56323,7 +55579,7 @@ index 69078c7..3e12a75 100644
goto out;
error = PROC_I(inode)->op.proc_get_link(dentry, &path);
-@@ -1474,8 +1560,18 @@ static int proc_pid_readlink(struct dentry * dentry, char __user * buffer, int b
+@@ -1505,8 +1591,18 @@ static int proc_pid_readlink(struct dentry * dentry, char __user * buffer, int b
struct path path;
/* Are we allowed to snoop on the tasks file descriptors? */
@@ -56344,7 +55600,7 @@ index 69078c7..3e12a75 100644
error = PROC_I(inode)->op.proc_get_link(dentry, &path);
if (error)
-@@ -1525,7 +1621,11 @@ struct inode *proc_pid_make_inode(struct super_block * sb, struct task_struct *t
+@@ -1556,7 +1652,11 @@ struct inode *proc_pid_make_inode(struct super_block * sb, struct task_struct *t
rcu_read_lock();
cred = __task_cred(task);
inode->i_uid = cred->euid;
@@ -56356,7 +55612,7 @@ index 69078c7..3e12a75 100644
rcu_read_unlock();
}
security_task_to_inode(task, inode);
-@@ -1561,10 +1661,19 @@ int pid_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat)
+@@ -1592,10 +1692,19 @@ int pid_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat)
return -ENOENT;
}
if ((inode->i_mode == (S_IFDIR|S_IRUGO|S_IXUGO)) ||
@@ -56376,7 +55632,7 @@ index 69078c7..3e12a75 100644
}
}
rcu_read_unlock();
-@@ -1602,11 +1711,20 @@ int pid_revalidate(struct dentry *dentry, unsigned int flags)
+@@ -1633,11 +1742,20 @@ int pid_revalidate(struct dentry *dentry, unsigned int flags)
if (task) {
if ((inode->i_mode == (S_IFDIR|S_IRUGO|S_IXUGO)) ||
@@ -56397,7 +55653,7 @@ index 69078c7..3e12a75 100644
rcu_read_unlock();
} else {
inode->i_uid = GLOBAL_ROOT_UID;
-@@ -2059,6 +2177,9 @@ static struct dentry *proc_pident_lookup(struct inode *dir,
+@@ -2196,6 +2314,9 @@ static struct dentry *proc_pident_lookup(struct inode *dir,
if (!task)
goto out_no_task;
@@ -56407,7 +55663,7 @@ index 69078c7..3e12a75 100644
/*
* Yes, it does not scale. And it should not. Don't add
* new entries into /proc/<tgid>/ without very good reasons.
-@@ -2103,6 +2224,9 @@ static int proc_pident_readdir(struct file *filp,
+@@ -2240,6 +2361,9 @@ static int proc_pident_readdir(struct file *filp,
if (!task)
goto out_no_task;
@@ -56417,7 +55673,7 @@ index 69078c7..3e12a75 100644
ret = 0;
i = filp->f_pos;
switch (i) {
-@@ -2516,7 +2640,7 @@ static const struct pid_entry tgid_base_stuff[] = {
+@@ -2653,7 +2777,7 @@ static const struct pid_entry tgid_base_stuff[] = {
REG("autogroup", S_IRUGO|S_IWUSR, proc_pid_sched_autogroup_operations),
#endif
REG("comm", S_IRUGO|S_IWUSR, proc_pid_set_comm_operations),
@@ -56426,7 +55682,7 @@ index 69078c7..3e12a75 100644
INF("syscall", S_IRUGO, proc_pid_syscall),
#endif
INF("cmdline", S_IRUGO, proc_pid_cmdline),
-@@ -2541,10 +2665,10 @@ static const struct pid_entry tgid_base_stuff[] = {
+@@ -2678,10 +2802,10 @@ static const struct pid_entry tgid_base_stuff[] = {
#ifdef CONFIG_SECURITY
DIR("attr", S_IRUGO|S_IXUGO, proc_attr_dir_inode_operations, proc_attr_dir_operations),
#endif
@@ -56439,7 +55695,7 @@ index 69078c7..3e12a75 100644
ONE("stack", S_IRUGO, proc_pid_stack),
#endif
#ifdef CONFIG_SCHEDSTATS
-@@ -2578,6 +2702,9 @@ static const struct pid_entry tgid_base_stuff[] = {
+@@ -2715,6 +2839,9 @@ static const struct pid_entry tgid_base_stuff[] = {
#ifdef CONFIG_HARDWALL
INF("hardwall", S_IRUGO, proc_pid_hardwall),
#endif
@@ -56449,7 +55705,7 @@ index 69078c7..3e12a75 100644
#ifdef CONFIG_USER_NS
REG("uid_map", S_IRUGO|S_IWUSR, proc_uid_map_operations),
REG("gid_map", S_IRUGO|S_IWUSR, proc_gid_map_operations),
-@@ -2707,7 +2834,14 @@ static struct dentry *proc_pid_instantiate(struct inode *dir,
+@@ -2847,7 +2974,14 @@ static struct dentry *proc_pid_instantiate(struct inode *dir,
if (!inode)
goto out;
@@ -56464,7 +55720,7 @@ index 69078c7..3e12a75 100644
inode->i_op = &proc_tgid_base_inode_operations;
inode->i_fop = &proc_tgid_base_operations;
inode->i_flags|=S_IMMUTABLE;
-@@ -2745,7 +2879,11 @@ struct dentry *proc_pid_lookup(struct inode *dir, struct dentry * dentry, unsign
+@@ -2885,7 +3019,11 @@ struct dentry *proc_pid_lookup(struct inode *dir, struct dentry * dentry, unsign
if (!task)
goto out;
@@ -56476,7 +55732,7 @@ index 69078c7..3e12a75 100644
put_task_struct(task);
out:
return result;
-@@ -2808,6 +2946,8 @@ static int proc_pid_fill_cache(struct file *filp, void *dirent, filldir_t filldi
+@@ -2948,6 +3086,8 @@ static int proc_pid_fill_cache(struct file *filp, void *dirent, filldir_t filldi
static int fake_filldir(void *buf, const char *name, int namelen,
loff_t offset, u64 ino, unsigned d_type)
{
@@ -56485,7 +55741,7 @@ index 69078c7..3e12a75 100644
return 0;
}
-@@ -2859,7 +2999,7 @@ static const struct pid_entry tid_base_stuff[] = {
+@@ -3007,7 +3147,7 @@ static const struct pid_entry tid_base_stuff[] = {
REG("sched", S_IRUGO|S_IWUSR, proc_pid_sched_operations),
#endif
REG("comm", S_IRUGO|S_IWUSR, proc_pid_set_comm_operations),
@@ -56494,7 +55750,7 @@ index 69078c7..3e12a75 100644
INF("syscall", S_IRUGO, proc_pid_syscall),
#endif
INF("cmdline", S_IRUGO, proc_pid_cmdline),
-@@ -2886,10 +3026,10 @@ static const struct pid_entry tid_base_stuff[] = {
+@@ -3034,10 +3174,10 @@ static const struct pid_entry tid_base_stuff[] = {
#ifdef CONFIG_SECURITY
DIR("attr", S_IRUGO|S_IXUGO, proc_attr_dir_inode_operations, proc_attr_dir_operations),
#endif
@@ -56578,13 +55834,13 @@ index d7a4a28..0201742 100644
}
diff --git a/fs/proc/inode.c b/fs/proc/inode.c
-index 869116c..820cb27 100644
+index 073aea6..0630370 100644
--- a/fs/proc/inode.c
+++ b/fs/proc/inode.c
-@@ -22,11 +22,17 @@
- #include <linux/seq_file.h>
+@@ -23,11 +23,17 @@
#include <linux/slab.h>
#include <linux/mount.h>
+ #include <linux/magic.h>
+#include <linux/grsecurity.h>
#include <asm/uaccess.h>
@@ -56599,8 +55855,8 @@ index 869116c..820cb27 100644
static void proc_evict_inode(struct inode *inode)
{
struct proc_dir_entry *de;
-@@ -54,6 +60,13 @@ static void proc_evict_inode(struct inode *inode)
- ns = PROC_I(inode)->ns;
+@@ -55,6 +61,13 @@ static void proc_evict_inode(struct inode *inode)
+ ns = PROC_I(inode)->ns.ns;
if (ns_ops && ns)
ns_ops->put(ns);
+
@@ -56613,7 +55869,7 @@ index 869116c..820cb27 100644
}
static struct kmem_cache * proc_inode_cachep;
-@@ -456,7 +469,11 @@ struct inode *proc_get_inode(struct super_block *sb, struct proc_dir_entry *de)
+@@ -385,7 +398,11 @@ struct inode *proc_get_inode(struct super_block *sb, struct proc_dir_entry *de)
if (de->mode) {
inode->i_mode = de->mode;
inode->i_uid = de->uid;
@@ -56626,24 +55882,24 @@ index 869116c..820cb27 100644
if (de->size)
inode->i_size = de->size;
diff --git a/fs/proc/internal.h b/fs/proc/internal.h
-index 85ff3a4..a512bd8 100644
+index d600fb0..3b495fe 100644
--- a/fs/proc/internal.h
+++ b/fs/proc/internal.h
-@@ -56,6 +56,9 @@ extern int proc_pid_status(struct seq_file *m, struct pid_namespace *ns,
- struct pid *pid, struct task_struct *task);
- extern int proc_pid_statm(struct seq_file *m, struct pid_namespace *ns,
- struct pid *pid, struct task_struct *task);
+@@ -155,6 +155,9 @@ extern int proc_pid_status(struct seq_file *, struct pid_namespace *,
+ struct pid *, struct task_struct *);
+ extern int proc_pid_statm(struct seq_file *, struct pid_namespace *,
+ struct pid *, struct task_struct *);
+#ifdef CONFIG_GRKERNSEC_PROC_IPADDR
+extern int proc_pid_ipaddr(struct task_struct *task, char *buffer);
+#endif
- extern loff_t mem_lseek(struct file *file, loff_t offset, int orig);
- extern const struct file_operations proc_tid_children_operations;
+ /*
+ * base.c
diff --git a/fs/proc/kcore.c b/fs/proc/kcore.c
-index eda6f01..006ae24 100644
+index 0a22194..a9fc8c1 100644
--- a/fs/proc/kcore.c
+++ b/fs/proc/kcore.c
-@@ -481,9 +481,10 @@ read_kcore(struct file *file, char __user *buffer, size_t buflen, loff_t *fpos)
+@@ -484,9 +484,10 @@ read_kcore(struct file *file, char __user *buffer, size_t buflen, loff_t *fpos)
* the addresses in the elf_phdr on our list.
*/
start = kc_offset_to_vaddr(*fpos - elf_buflen);
@@ -56656,12 +55912,14 @@ index eda6f01..006ae24 100644
while (buflen) {
struct kcore_list *m;
-@@ -512,20 +513,23 @@ read_kcore(struct file *file, char __user *buffer, size_t buflen, loff_t *fpos)
+@@ -515,20 +516,23 @@ read_kcore(struct file *file, char __user *buffer, size_t buflen, loff_t *fpos)
kfree(elf_buf);
} else {
if (kern_addr_valid(start)) {
- unsigned long n;
--
++ char *elf_buf;
++ mm_segment_t oldfs;
+
- n = copy_to_user(buffer, (char *)start, tsz);
- /*
- * We cannot distinguish between fault on source
@@ -56672,9 +55930,6 @@ index eda6f01..006ae24 100644
- if (n) {
- if (clear_user(buffer + tsz - n,
- n))
-+ char *elf_buf;
-+ mm_segment_t oldfs;
-+
+ elf_buf = kmalloc(tsz, GFP_KERNEL);
+ if (!elf_buf)
+ return -ENOMEM;
@@ -56692,7 +55947,7 @@ index eda6f01..006ae24 100644
} else {
if (clear_user(buffer, tsz))
return -EFAULT;
-@@ -545,6 +549,9 @@ read_kcore(struct file *file, char __user *buffer, size_t buflen, loff_t *fpos)
+@@ -548,6 +552,9 @@ read_kcore(struct file *file, char __user *buffer, size_t buflen, loff_t *fpos)
static int open_kcore(struct inode *inode, struct file *filp)
{
@@ -56703,10 +55958,10 @@ index eda6f01..006ae24 100644
return -EPERM;
if (kcore_need_update)
diff --git a/fs/proc/meminfo.c b/fs/proc/meminfo.c
-index 1efaaa1..834e49a 100644
+index 5aa847a..f77c8d4 100644
--- a/fs/proc/meminfo.c
+++ b/fs/proc/meminfo.c
-@@ -158,7 +158,7 @@ static int meminfo_proc_show(struct seq_file *m, void *v)
+@@ -159,7 +159,7 @@ static int meminfo_proc_show(struct seq_file *m, void *v)
vmi.used >> 10,
vmi.largest_chunk >> 10
#ifdef CONFIG_MEMORY_FAILURE
@@ -56729,7 +55984,7 @@ index ccfd99b..1b7e255 100644
seq_putc(m, '\n');
diff --git a/fs/proc/proc_net.c b/fs/proc/proc_net.c
-index b4ac657..0842bd2 100644
+index 986e832..6e8e859 100644
--- a/fs/proc/proc_net.c
+++ b/fs/proc/proc_net.c
@@ -23,6 +23,7 @@
@@ -56740,7 +55995,7 @@ index b4ac657..0842bd2 100644
#include "internal.h"
-@@ -105,6 +106,17 @@ static struct net *get_proc_task_net(struct inode *dir)
+@@ -109,6 +110,17 @@ static struct net *get_proc_task_net(struct inode *dir)
struct task_struct *task;
struct nsproxy *ns;
struct net *net = NULL;
@@ -56946,10 +56201,10 @@ index ac05f33..1e6dc7e 100644
kfree(ctl_table_arg);
goto out;
diff --git a/fs/proc/root.c b/fs/proc/root.c
-index 9c7fab1..ed1c8e0 100644
+index 41a6ea9..23eaa92 100644
--- a/fs/proc/root.c
+++ b/fs/proc/root.c
-@@ -180,7 +180,15 @@ void __init proc_root_init(void)
+@@ -182,7 +182,15 @@ void __init proc_root_init(void)
#ifdef CONFIG_PROC_DEVICETREE
proc_device_tree_init();
#endif
@@ -56966,10 +56221,10 @@ index 9c7fab1..ed1c8e0 100644
}
diff --git a/fs/proc/self.c b/fs/proc/self.c
-index aa5cc3b..c91a5d0 100644
+index 6b6a993..807cccc 100644
--- a/fs/proc/self.c
+++ b/fs/proc/self.c
-@@ -37,7 +37,7 @@ static void *proc_self_follow_link(struct dentry *dentry, struct nameidata *nd)
+@@ -39,7 +39,7 @@ static void *proc_self_follow_link(struct dentry *dentry, struct nameidata *nd)
static void proc_self_put_link(struct dentry *dentry, struct nameidata *nd,
void *cookie)
{
@@ -57200,10 +56455,10 @@ index 56123a6..5a2f6ec 100644
pid_t tid = vm_is_stack(priv->task, vma, is_pid);
diff --git a/fs/proc/vmcore.c b/fs/proc/vmcore.c
-index b870f74..e9048df 100644
+index 17f7e08..e4b1529 100644
--- a/fs/proc/vmcore.c
+++ b/fs/proc/vmcore.c
-@@ -98,9 +98,13 @@ static ssize_t read_from_oldmem(char *buf, size_t count,
+@@ -99,9 +99,13 @@ static ssize_t read_from_oldmem(char *buf, size_t count,
nr_bytes = count;
/* If pfn is not ram, return zeros for sparse dump files */
@@ -57220,7 +56475,7 @@ index b870f74..e9048df 100644
tmp = copy_oldmem_page(pfn, buf, nr_bytes,
offset, userbuf);
if (tmp < 0)
-@@ -185,7 +189,7 @@ static ssize_t read_vmcore(struct file *file, char __user *buffer,
+@@ -186,7 +190,7 @@ static ssize_t read_vmcore(struct file *file, char __user *buffer,
if (tsz > nr_bytes)
tsz = nr_bytes;
@@ -57274,10 +56529,10 @@ index 16e8abb..2dcf914 100644
if (!msg_head) {
printk(KERN_ERR
diff --git a/fs/read_write.c b/fs/read_write.c
-index e6ddc8d..9155227 100644
+index 2cefa41..c7e2fe0 100644
--- a/fs/read_write.c
+++ b/fs/read_write.c
-@@ -429,7 +429,7 @@ ssize_t __kernel_write(struct file *file, const char *buf, size_t count, loff_t
+@@ -411,7 +411,7 @@ ssize_t __kernel_write(struct file *file, const char *buf, size_t count, loff_t
old_fs = get_fs();
set_fs(get_ds());
@@ -57402,7 +56657,7 @@ index 2b7882b..1c5ef48 100644
/* balance leaf returns 0 except if combining L R and S into
diff --git a/fs/reiserfs/procfs.c b/fs/reiserfs/procfs.c
-index 9cc0740a..46bf953 100644
+index 33532f7..4846ade 100644
--- a/fs/reiserfs/procfs.c
+++ b/fs/reiserfs/procfs.c
@@ -112,7 +112,7 @@ static int show_super(struct seq_file *m, struct super_block *sb)
@@ -57457,7 +56712,7 @@ index 8c1c96c..a0f9b6d 100644
return -EINVAL;
diff --git a/fs/seq_file.c b/fs/seq_file.c
-index 38bb59f..a304f9d 100644
+index 774c1eb..b67582a 100644
--- a/fs/seq_file.c
+++ b/fs/seq_file.c
@@ -10,6 +10,7 @@
@@ -57524,10 +56779,10 @@ index 38bb59f..a304f9d 100644
if (op) {
diff --git a/fs/splice.c b/fs/splice.c
-index 29e394e..b13c247 100644
+index d37431d..81c3044 100644
--- a/fs/splice.c
+++ b/fs/splice.c
-@@ -195,7 +195,7 @@ ssize_t splice_to_pipe(struct pipe_inode_info *pipe,
+@@ -196,7 +196,7 @@ ssize_t splice_to_pipe(struct pipe_inode_info *pipe,
pipe_lock(pipe);
for (;;) {
@@ -57536,7 +56791,16 @@ index 29e394e..b13c247 100644
send_sig(SIGPIPE, current, 0);
if (!ret)
ret = -EPIPE;
-@@ -249,9 +249,9 @@ ssize_t splice_to_pipe(struct pipe_inode_info *pipe,
+@@ -219,7 +219,7 @@ ssize_t splice_to_pipe(struct pipe_inode_info *pipe,
+ page_nr++;
+ ret += buf->len;
+
+- if (pipe->files)
++ if (atomic_read(&pipe->files))
+ do_wakeup = 1;
+
+ if (!--spd->nr_pages)
+@@ -250,9 +250,9 @@ ssize_t splice_to_pipe(struct pipe_inode_info *pipe,
do_wakeup = 0;
}
@@ -57548,7 +56812,7 @@ index 29e394e..b13c247 100644
}
pipe_unlock(pipe);
-@@ -564,7 +564,7 @@ static ssize_t kernel_readv(struct file *file, const struct iovec *vec,
+@@ -565,7 +565,7 @@ static ssize_t kernel_readv(struct file *file, const struct iovec *vec,
old_fs = get_fs();
set_fs(get_ds());
/* The cast to a user pointer is valid due to the set_fs() */
@@ -57557,7 +56821,7 @@ index 29e394e..b13c247 100644
set_fs(old_fs);
return res;
-@@ -579,7 +579,7 @@ ssize_t kernel_write(struct file *file, const char *buf, size_t count,
+@@ -580,7 +580,7 @@ ssize_t kernel_write(struct file *file, const char *buf, size_t count,
old_fs = get_fs();
set_fs(get_ds());
/* The cast to a user pointer is valid due to the set_fs() */
@@ -57566,7 +56830,7 @@ index 29e394e..b13c247 100644
set_fs(old_fs);
return res;
-@@ -632,7 +632,7 @@ ssize_t default_file_splice_read(struct file *in, loff_t *ppos,
+@@ -633,7 +633,7 @@ ssize_t default_file_splice_read(struct file *in, loff_t *ppos,
goto err;
this_len = min_t(size_t, len, PAGE_CACHE_SIZE - offset);
@@ -57575,7 +56839,16 @@ index 29e394e..b13c247 100644
vec[i].iov_len = this_len;
spd.pages[i] = page;
spd.nr_pages++;
-@@ -853,10 +853,10 @@ EXPORT_SYMBOL(splice_from_pipe_feed);
+@@ -829,7 +829,7 @@ int splice_from_pipe_feed(struct pipe_inode_info *pipe, struct splice_desc *sd,
+ ops->release(pipe, buf);
+ pipe->curbuf = (pipe->curbuf + 1) & (pipe->buffers - 1);
+ pipe->nrbufs--;
+- if (pipe->files)
++ if (atomic_read(&pipe->files))
+ sd->need_wakeup = true;
+ }
+
+@@ -854,10 +854,10 @@ EXPORT_SYMBOL(splice_from_pipe_feed);
int splice_from_pipe_next(struct pipe_inode_info *pipe, struct splice_desc *sd)
{
while (!pipe->nrbufs) {
@@ -57588,7 +56861,7 @@ index 29e394e..b13c247 100644
return 0;
if (sd->flags & SPLICE_F_NONBLOCK)
-@@ -1192,7 +1192,7 @@ ssize_t splice_direct_to_actor(struct file *in, struct splice_desc *sd,
+@@ -1193,7 +1193,7 @@ ssize_t splice_direct_to_actor(struct file *in, struct splice_desc *sd,
* out of the pipe right after the splice_to_pipe(). So set
* PIPE_READERS appropriately.
*/
@@ -57597,7 +56870,7 @@ index 29e394e..b13c247 100644
current->splice_pipe = pipe;
}
-@@ -1741,9 +1741,9 @@ static int ipipe_prep(struct pipe_inode_info *pipe, unsigned int flags)
+@@ -1769,9 +1769,9 @@ static int ipipe_prep(struct pipe_inode_info *pipe, unsigned int flags)
ret = -ERESTARTSYS;
break;
}
@@ -57609,7 +56882,7 @@ index 29e394e..b13c247 100644
if (flags & SPLICE_F_NONBLOCK) {
ret = -EAGAIN;
break;
-@@ -1775,7 +1775,7 @@ static int opipe_prep(struct pipe_inode_info *pipe, unsigned int flags)
+@@ -1803,7 +1803,7 @@ static int opipe_prep(struct pipe_inode_info *pipe, unsigned int flags)
pipe_lock(pipe);
while (pipe->nrbufs >= pipe->buffers) {
@@ -57618,7 +56891,7 @@ index 29e394e..b13c247 100644
send_sig(SIGPIPE, current, 0);
ret = -EPIPE;
break;
-@@ -1788,9 +1788,9 @@ static int opipe_prep(struct pipe_inode_info *pipe, unsigned int flags)
+@@ -1816,9 +1816,9 @@ static int opipe_prep(struct pipe_inode_info *pipe, unsigned int flags)
ret = -ERESTARTSYS;
break;
}
@@ -57630,7 +56903,7 @@ index 29e394e..b13c247 100644
}
pipe_unlock(pipe);
-@@ -1826,14 +1826,14 @@ retry:
+@@ -1854,14 +1854,14 @@ retry:
pipe_double_lock(ipipe, opipe);
do {
@@ -57647,7 +56920,7 @@ index 29e394e..b13c247 100644
break;
/*
-@@ -1930,7 +1930,7 @@ static int link_pipe(struct pipe_inode_info *ipipe,
+@@ -1958,7 +1958,7 @@ static int link_pipe(struct pipe_inode_info *ipipe,
pipe_double_lock(ipipe, opipe);
do {
@@ -57656,7 +56929,7 @@ index 29e394e..b13c247 100644
send_sig(SIGPIPE, current, 0);
if (!ret)
ret = -EPIPE;
-@@ -1975,7 +1975,7 @@ static int link_pipe(struct pipe_inode_info *ipipe,
+@@ -2003,7 +2003,7 @@ static int link_pipe(struct pipe_inode_info *ipipe,
* return EAGAIN if we have the potential of some data in the
* future, otherwise just return 0
*/
@@ -57781,7 +57054,7 @@ index 15c68f9..36a8b3e 100644
if (!bb->vm_ops)
return -EINVAL;
diff --git a/fs/sysfs/dir.c b/fs/sysfs/dir.c
-index 6f31590..3c87c8a 100644
+index e8e0e71..79c28ac5 100644
--- a/fs/sysfs/dir.c
+++ b/fs/sysfs/dir.c
@@ -40,7 +40,7 @@ static DEFINE_IDA(sysfs_ino_ida);
@@ -57793,7 +57066,7 @@ index 6f31590..3c87c8a 100644
{
unsigned long hash = init_name_hash();
unsigned int len = strlen(name);
-@@ -685,6 +685,18 @@ static int create_dir(struct kobject *kobj, struct sysfs_dirent *parent_sd,
+@@ -679,6 +679,18 @@ static int create_dir(struct kobject *kobj, struct sysfs_dirent *parent_sd,
struct sysfs_dirent *sd;
int rc;
@@ -57804,7 +57077,7 @@ index 6f31590..3c87c8a 100644
+
+ if ((!strcmp(parent_name, "") && (!strcmp(name, "devices") || !strcmp(name, "fs"))) ||
+ (!strcmp(parent_name, "devices") && !strcmp(name, "system")) ||
-+ (!strcmp(parent_name, "fs") && (!strcmp(name, "selinux") || !strcmp(name, "fuse"))) ||
++ (!strcmp(parent_name, "fs") && (!strcmp(name, "selinux") || !strcmp(name, "fuse") || !strcmp(name, "ecryptfs"))) ||
+ (!strcmp(parent_name, "system") && !strcmp(name, "cpu")))
+ mode = S_IFDIR | S_IRWXU | S_IRUGO | S_IXUGO;
+#endif
@@ -58068,20 +57341,20 @@ index 9fbea87..6b19972 100644
struct posix_acl *acl;
struct posix_acl_entry *acl_e;
diff --git a/fs/xfs/xfs_bmap.c b/fs/xfs/xfs_bmap.c
-index b44af92..06073da 100644
+index 8904284..ee0e14b 100644
--- a/fs/xfs/xfs_bmap.c
+++ b/fs/xfs/xfs_bmap.c
-@@ -192,7 +192,7 @@ xfs_bmap_validate_ret(
- int nmap,
- int ret_nmap);
+@@ -765,7 +765,7 @@ xfs_bmap_validate_ret(
+
#else
+ #define xfs_bmap_check_leaf_extents(cur, ip, whichfork) do { } while (0)
-#define xfs_bmap_validate_ret(bno,len,flags,mval,onmap,nmap)
-+#define xfs_bmap_validate_ret(bno,len,flags,mval,onmap,nmap) do {} while (0)
++#define xfs_bmap_validate_ret(bno,len,flags,mval,onmap,nmap) do { } while (0)
#endif /* DEBUG */
- STATIC int
+ /*
diff --git a/fs/xfs/xfs_dir2_sf.c b/fs/xfs/xfs_dir2_sf.c
-index 1b9fc3e..e1bdde0 100644
+index 6157424..ac98f6d 100644
--- a/fs/xfs/xfs_dir2_sf.c
+++ b/fs/xfs/xfs_dir2_sf.c
@@ -851,7 +851,15 @@ xfs_dir2_sf_getdents(
@@ -58102,7 +57375,7 @@ index 1b9fc3e..e1bdde0 100644
*offset = off & 0x7fffffff;
return 0;
diff --git a/fs/xfs/xfs_ioctl.c b/fs/xfs/xfs_ioctl.c
-index d681e34..2a3f5ab 100644
+index 5e99968..45bd327 100644
--- a/fs/xfs/xfs_ioctl.c
+++ b/fs/xfs/xfs_ioctl.c
@@ -127,7 +127,7 @@ xfs_find_handle(
@@ -58129,10 +57402,10 @@ index ca9ecaa..60100c7 100644
kfree(s);
diff --git a/grsecurity/Kconfig b/grsecurity/Kconfig
new file mode 100644
-index 0000000..c9c4ac3
+index 0000000..712a85d
--- /dev/null
+++ b/grsecurity/Kconfig
-@@ -0,0 +1,1054 @@
+@@ -0,0 +1,1043 @@
+#
+# grecurity configuration
+#
@@ -58843,22 +58116,11 @@ index 0000000..c9c4ac3
+ help
+ If you say Y here, calls to mmap() and mprotect() with explicit
+ usage of PROT_WRITE and PROT_EXEC together will be logged when
-+ denied by the PAX_MPROTECT feature. If the sysctl option is
-+ enabled, a sysctl option with name "rwxmap_logging" is created.
-+
-+config GRKERNSEC_AUDIT_TEXTREL
-+ bool 'ELF text relocations logging (READ HELP)'
-+ depends on PAX_MPROTECT
-+ help
-+ If you say Y here, text relocations will be logged with the filename
-+ of the offending library or binary. The purpose of the feature is
-+ to help Linux distribution developers get rid of libraries and
-+ binaries that need text relocations which hinder the future progress
-+ of PaX. Only Linux distribution developers should say Y here, and
-+ never on a production machine, as this option creates an information
-+ leak that could aid an attacker in defeating the randomization of
-+ a single memory region. If the sysctl option is enabled, a sysctl
-+ option with name "audit_textrel" is created.
++ denied by the PAX_MPROTECT feature. This feature will also
++ log other problematic scenarios that can occur when PAX_MPROTECT
++ is enabled on a binary, like textrels and PT_GNU_STACK. If the
++ sysctl option is enabled, a sysctl option with name "rwxmap_logging"
++ is created.
+
+endmenu
+
@@ -59189,10 +58451,10 @@ index 0000000..c9c4ac3
+endmenu
diff --git a/grsecurity/Makefile b/grsecurity/Makefile
new file mode 100644
-index 0000000..1b9afa9
+index 0000000..36845aa
--- /dev/null
+++ b/grsecurity/Makefile
-@@ -0,0 +1,38 @@
+@@ -0,0 +1,42 @@
+# grsecurity's ACL system was originally written in 2001 by Michael Dalton
+# during 2001-2009 it has been completely redesigned by Brad Spengler
+# into an RBAC system
@@ -59210,6 +58472,10 @@ index 0000000..1b9afa9
+obj-$(CONFIG_GRKERNSEC) += grsec_init.o grsum.o gracl.o gracl_segv.o \
+ gracl_cap.o gracl_alloc.o gracl_shm.o grsec_mem.o gracl_fs.o \
+ gracl_learn.o grsec_log.o
++ifdef CONFIG_COMPAT
++obj-$(CONFIG_GRKERNSEC) += gracl_compat.o
++endif
++
+obj-$(CONFIG_GRKERNSEC_RESLOG) += gracl_res.o
+
+ifdef CONFIG_NET
@@ -59233,10 +58499,10 @@ index 0000000..1b9afa9
+endif
diff --git a/grsecurity/gracl.c b/grsecurity/gracl.c
new file mode 100644
-index 0000000..0d5c602
+index 0000000..6907918
--- /dev/null
+++ b/grsecurity/gracl.c
-@@ -0,0 +1,4073 @@
+@@ -0,0 +1,4178 @@
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/sched.h>
@@ -59339,6 +58605,144 @@ index 0000000..0d5c602
+extern void gr_remove_uid(uid_t uid);
+extern int gr_find_uid(uid_t uid);
+
++static int copy_acl_object_label_normal(struct acl_object_label *obj, const struct acl_object_label *userp)
++{
++ if (copy_from_user(obj, userp, sizeof(struct acl_object_label)))
++ return -EFAULT;
++
++ return 0;
++}
++
++static int copy_acl_ip_label_normal(struct acl_ip_label *ip, const struct acl_ip_label *userp)
++{
++ if (copy_from_user(ip, userp, sizeof(struct acl_ip_label)))
++ return -EFAULT;
++
++ return 0;
++}
++
++static int copy_acl_subject_label_normal(struct acl_subject_label *subj, const struct acl_subject_label *userp)
++{
++ if (copy_from_user(subj, userp, sizeof(struct acl_subject_label)))
++ return -EFAULT;
++
++ return 0;
++}
++
++static int copy_acl_role_label_normal(struct acl_role_label *role, const struct acl_role_label *userp)
++{
++ if (copy_from_user(role, userp, sizeof(struct acl_role_label)))
++ return -EFAULT;
++
++ return 0;
++}
++
++static int copy_role_allowed_ip_normal(struct role_allowed_ip *roleip, const struct role_allowed_ip *userp)
++{
++ if (copy_from_user(roleip, userp, sizeof(struct role_allowed_ip)))
++ return -EFAULT;
++
++ return 0;
++}
++
++static int copy_sprole_pw_normal(struct sprole_pw *pw, unsigned long idx, const struct sprole_pw *userp)
++{
++ if (copy_from_user(pw, userp + idx, sizeof(struct sprole_pw)))
++ return -EFAULT;
++
++ return 0;
++}
++
++static int copy_gr_hash_struct_normal(struct gr_hash_struct *hash, const struct gr_hash_struct *userp)
++{
++ if (copy_from_user(hash, userp, sizeof(struct gr_hash_struct)))
++ return -EFAULT;
++
++ return 0;
++}
++
++static int copy_role_transition_normal(struct role_transition *trans, const struct role_transition *userp)
++{
++ if (copy_from_user(trans, userp, sizeof(struct role_transition)))
++ return -EFAULT;
++
++ return 0;
++}
++
++int copy_pointer_from_array_normal(void *ptr, unsigned long idx, const void *userp)
++{
++ if (copy_from_user(ptr, userp + (idx * sizeof(void *)), sizeof(void *)))
++ return -EFAULT;
++
++ return 0;
++}
++
++static int copy_gr_arg_wrapper_normal(const char __user *buf, struct gr_arg_wrapper *uwrap)
++{
++ if (copy_from_user(uwrap, buf, sizeof (struct gr_arg_wrapper)))
++ return -EFAULT;
++
++ if ((uwrap->version != GRSECURITY_VERSION) || (uwrap->size != sizeof(struct gr_arg)))
++ return -EINVAL;
++
++ return 0;
++}
++
++static int copy_gr_arg_normal(const struct gr_arg __user *buf, struct gr_arg *arg)
++{
++ if (copy_from_user(arg, buf, sizeof (struct gr_arg)))
++ return -EFAULT;
++
++ return 0;
++}
++
++static size_t get_gr_arg_wrapper_size_normal(void)
++{
++ return sizeof(struct gr_arg_wrapper);
++}
++
++#ifdef CONFIG_COMPAT
++extern int copy_gr_arg_wrapper_compat(const char *buf, struct gr_arg_wrapper *uwrap);
++extern int copy_gr_arg_compat(const struct gr_arg __user *buf, struct gr_arg *arg);
++extern int copy_acl_object_label_compat(struct acl_object_label *obj, const struct acl_object_label *userp);
++extern int copy_acl_subject_label_compat(struct acl_subject_label *subj, const struct acl_subject_label *userp);
++extern int copy_acl_role_label_compat(struct acl_role_label *role, const struct acl_role_label *userp);
++extern int copy_role_allowed_ip_compat(struct role_allowed_ip *roleip, const struct role_allowed_ip *userp);
++extern int copy_role_transition_compat(struct role_transition *trans, const struct role_transition *userp);
++extern int copy_gr_hash_struct_compat(struct gr_hash_struct *hash, const struct gr_hash_struct *userp);
++extern int copy_pointer_from_array_compat(void *ptr, unsigned long idx, const void *userp);
++extern int copy_acl_ip_label_compat(struct acl_ip_label *ip, const struct acl_ip_label *userp);
++extern int copy_sprole_pw_compat(struct sprole_pw *pw, unsigned long idx, const struct sprole_pw *userp);
++extern size_t get_gr_arg_wrapper_size_compat(void);
++
++int (* copy_gr_arg_wrapper)(const char *buf, struct gr_arg_wrapper *uwrap) __read_only;
++int (* copy_gr_arg)(const struct gr_arg *buf, struct gr_arg *arg) __read_only;
++int (* copy_acl_object_label)(struct acl_object_label *obj, const struct acl_object_label *userp) __read_only;
++int (* copy_acl_subject_label)(struct acl_subject_label *subj, const struct acl_subject_label *userp) __read_only;
++int (* copy_acl_role_label)(struct acl_role_label *role, const struct acl_role_label *userp) __read_only;
++int (* copy_acl_ip_label)(struct acl_ip_label *ip, const struct acl_ip_label *userp) __read_only;
++int (* copy_pointer_from_array)(void *ptr, unsigned long idx, const void *userp) __read_only;
++int (* copy_sprole_pw)(struct sprole_pw *pw, unsigned long idx, const struct sprole_pw *userp) __read_only;
++int (* copy_gr_hash_struct)(struct gr_hash_struct *hash, const struct gr_hash_struct *userp) __read_only;
++int (* copy_role_transition)(struct role_transition *trans, const struct role_transition *userp) __read_only;
++int (* copy_role_allowed_ip)(struct role_allowed_ip *roleip, const struct role_allowed_ip *userp) __read_only;
++size_t (* get_gr_arg_wrapper_size)(void) __read_only;
++
++#else
++#define copy_gr_arg_wrapper copy_gr_arg_wrapper_normal
++#define copy_gr_arg copy_gr_arg_normal
++#define copy_gr_hash_struct copy_gr_hash_struct_normal
++#define copy_acl_object_label copy_acl_object_label_normal
++#define copy_acl_subject_label copy_acl_subject_label_normal
++#define copy_acl_role_label copy_acl_role_label_normal
++#define copy_acl_ip_label copy_acl_ip_label_normal
++#define copy_pointer_from_array copy_pointer_from_array_normal
++#define copy_sprole_pw copy_sprole_pw_normal
++#define copy_role_transition copy_role_transition_normal
++#define copy_role_allowed_ip copy_role_allowed_ip_normal
++#define get_gr_arg_wrapper_size get_gr_arg_wrapper_size_normal
++#endif
++
+__inline__ int
+gr_acl_is_enabled(void)
+{
@@ -60282,33 +59686,34 @@ index 0000000..0d5c602
+ return;
+}
+
-+static __u32
-+count_user_objs(struct acl_object_label *userp)
++static struct acl_subject_label *
++do_copy_user_subj(struct acl_subject_label *userp, struct acl_role_label *role, int *already_copied);
++
++static int alloc_and_copy_string(char **name, unsigned int maxlen)
+{
-+ struct acl_object_label o_tmp;
-+ __u32 num = 0;
++ unsigned int len = strnlen_user(*name, maxlen);
++ char *tmp;
+
-+ while (userp) {
-+ if (copy_from_user(&o_tmp, userp,
-+ sizeof (struct acl_object_label)))
-+ break;
++ if (!len || len >= maxlen)
++ return -EINVAL;
+
-+ userp = o_tmp.prev;
-+ num++;
-+ }
++ if ((tmp = (char *) acl_alloc(len)) == NULL)
++ return -ENOMEM;
+
-+ return num;
-+}
++ if (copy_from_user(tmp, *name, len))
++ return -EFAULT;
+
-+static struct acl_subject_label *
-+do_copy_user_subj(struct acl_subject_label *userp, struct acl_role_label *role, int *already_copied);
++ tmp[len-1] = '\0';
++ *name = tmp;
++
++ return 0;
++}
+
+static int
+copy_user_glob(struct acl_object_label *obj)
+{
+ struct acl_object_label *g_tmp, **guser;
-+ unsigned int len;
-+ char *tmp;
++ int error;
+
+ if (obj->globbed == NULL)
+ return 0;
@@ -60320,22 +59725,12 @@ index 0000000..0d5c602
+ if (g_tmp == NULL)
+ return -ENOMEM;
+
-+ if (copy_from_user(g_tmp, *guser,
-+ sizeof (struct acl_object_label)))
++ if (copy_acl_object_label(g_tmp, *guser))
+ return -EFAULT;
+
-+ len = strnlen_user(g_tmp->filename, PATH_MAX);
-+
-+ if (!len || len >= PATH_MAX)
-+ return -EINVAL;
-+
-+ if ((tmp = (char *) acl_alloc(len)) == NULL)
-+ return -ENOMEM;
-+
-+ if (copy_from_user(tmp, g_tmp->filename, len))
-+ return -EFAULT;
-+ tmp[len-1] = '\0';
-+ g_tmp->filename = tmp;
++ error = alloc_and_copy_string(&g_tmp->filename, PATH_MAX);
++ if (error)
++ return error;
+
+ *guser = g_tmp;
+ guser = &(g_tmp->next);
@@ -60349,33 +59744,21 @@ index 0000000..0d5c602
+ struct acl_role_label *role)
+{
+ struct acl_object_label *o_tmp;
-+ unsigned int len;
+ int ret;
-+ char *tmp;
+
+ while (userp) {
+ if ((o_tmp = (struct acl_object_label *)
+ acl_alloc(sizeof (struct acl_object_label))) == NULL)
+ return -ENOMEM;
+
-+ if (copy_from_user(o_tmp, userp,
-+ sizeof (struct acl_object_label)))
++ if (copy_acl_object_label(o_tmp, userp))
+ return -EFAULT;
+
+ userp = o_tmp->prev;
+
-+ len = strnlen_user(o_tmp->filename, PATH_MAX);
-+
-+ if (!len || len >= PATH_MAX)
-+ return -EINVAL;
-+
-+ if ((tmp = (char *) acl_alloc(len)) == NULL)
-+ return -ENOMEM;
-+
-+ if (copy_from_user(tmp, o_tmp->filename, len))
-+ return -EFAULT;
-+ tmp[len-1] = '\0';
-+ o_tmp->filename = tmp;
++ ret = alloc_and_copy_string(&o_tmp->filename, PATH_MAX);
++ if (ret)
++ return ret;
+
+ insert_acl_obj_label(o_tmp, subj);
+ if (!insert_name_entry(o_tmp->filename, o_tmp->inode,
@@ -60412,8 +59795,7 @@ index 0000000..0d5c602
+ __u32 num = 0;
+
+ while (userp) {
-+ if (copy_from_user(&s_tmp, userp,
-+ sizeof (struct acl_subject_label)))
++ if (copy_acl_subject_label(&s_tmp, userp))
+ break;
+
+ userp = s_tmp.prev;
@@ -60436,8 +59818,7 @@ index 0000000..0d5c602
+ acl_alloc(sizeof (struct role_allowed_ip))) == NULL)
+ return -ENOMEM;
+
-+ if (copy_from_user(rtmp, ruserip,
-+ sizeof (struct role_allowed_ip)))
++ if (copy_role_allowed_ip(rtmp, ruserip))
+ return -EFAULT;
+
+ ruserip = rtmp->prev;
@@ -60461,9 +59842,7 @@ index 0000000..0d5c602
+copy_user_transitions(struct acl_role_label *rolep)
+{
+ struct role_transition *rusertp, *rtmp = NULL, *rlast;
-+
-+ unsigned int len;
-+ char *tmp;
++ int error;
+
+ rusertp = rolep->transitions;
+
@@ -60474,24 +59853,14 @@ index 0000000..0d5c602
+ acl_alloc(sizeof (struct role_transition))) == NULL)
+ return -ENOMEM;
+
-+ if (copy_from_user(rtmp, rusertp,
-+ sizeof (struct role_transition)))
++ if (copy_role_transition(rtmp, rusertp))
+ return -EFAULT;
+
+ rusertp = rtmp->prev;
+
-+ len = strnlen_user(rtmp->rolename, GR_SPROLE_LEN);
-+
-+ if (!len || len >= GR_SPROLE_LEN)
-+ return -EINVAL;
-+
-+ if ((tmp = (char *) acl_alloc(len)) == NULL)
-+ return -ENOMEM;
-+
-+ if (copy_from_user(tmp, rtmp->rolename, len))
-+ return -EFAULT;
-+ tmp[len-1] = '\0';
-+ rtmp->rolename = tmp;
++ error = alloc_and_copy_string(&rtmp->rolename, GR_SPROLE_LEN);
++ if (error)
++ return error;
+
+ if (!rlast) {
+ rtmp->prev = NULL;
@@ -60508,12 +59877,26 @@ index 0000000..0d5c602
+ return 0;
+}
+
++static __u32 count_user_objs(const struct acl_object_label __user *userp)
++{
++ struct acl_object_label o_tmp;
++ __u32 num = 0;
++
++ while (userp) {
++ if (copy_acl_object_label(&o_tmp, userp))
++ break;
++
++ userp = o_tmp.prev;
++ num++;
++ }
++
++ return num;
++}
++
+static struct acl_subject_label *
+do_copy_user_subj(struct acl_subject_label *userp, struct acl_role_label *role, int *already_copied)
+{
+ struct acl_subject_label *s_tmp = NULL, *s_tmp2;
-+ unsigned int len;
-+ char *tmp;
+ __u32 num_objs;
+ struct acl_ip_label **i_tmp, *i_utmp2;
+ struct gr_hash_struct ghash;
@@ -60547,27 +59930,17 @@ index 0000000..0d5c602
+ subjmap->kernel = s_tmp;
+ insert_subj_map_entry(subjmap);
+
-+ if (copy_from_user(s_tmp, userp,
-+ sizeof (struct acl_subject_label)))
++ if (copy_acl_subject_label(s_tmp, userp))
+ return ERR_PTR(-EFAULT);
+
-+ len = strnlen_user(s_tmp->filename, PATH_MAX);
-+
-+ if (!len || len >= PATH_MAX)
-+ return ERR_PTR(-EINVAL);
-+
-+ if ((tmp = (char *) acl_alloc(len)) == NULL)
-+ return ERR_PTR(-ENOMEM);
-+
-+ if (copy_from_user(tmp, s_tmp->filename, len))
-+ return ERR_PTR(-EFAULT);
-+ tmp[len-1] = '\0';
-+ s_tmp->filename = tmp;
++ err = alloc_and_copy_string(&s_tmp->filename, PATH_MAX);
++ if (err)
++ return ERR_PTR(err);
+
+ if (!strcmp(s_tmp->filename, "/"))
+ role->root_label = s_tmp;
+
-+ if (copy_from_user(&ghash, s_tmp->hash, sizeof(struct gr_hash_struct)))
++ if (copy_gr_hash_struct(&ghash, s_tmp->hash))
+ return ERR_PTR(-EFAULT);
+
+ /* copy user and group transition tables */
@@ -60648,28 +60021,18 @@ index 0000000..0d5c602
+ if (!*(i_tmp + i_num))
+ return ERR_PTR(-ENOMEM);
+
-+ if (copy_from_user
-+ (&i_utmp2, s_tmp->ips + i_num,
-+ sizeof (struct acl_ip_label *)))
++ if (copy_pointer_from_array(&i_utmp2, i_num, s_tmp->ips))
+ return ERR_PTR(-EFAULT);
+
-+ if (copy_from_user
-+ (*(i_tmp + i_num), i_utmp2,
-+ sizeof (struct acl_ip_label)))
++ if (copy_acl_ip_label(*(i_tmp + i_num), i_utmp2))
+ return ERR_PTR(-EFAULT);
+
+ if ((*(i_tmp + i_num))->iface == NULL)
+ continue;
+
-+ len = strnlen_user((*(i_tmp + i_num))->iface, IFNAMSIZ);
-+ if (!len || len >= IFNAMSIZ)
-+ return ERR_PTR(-EINVAL);
-+ tmp = acl_alloc(len);
-+ if (tmp == NULL)
-+ return ERR_PTR(-ENOMEM);
-+ if (copy_from_user(tmp, (*(i_tmp + i_num))->iface, len))
-+ return ERR_PTR(-EFAULT);
-+ (*(i_tmp + i_num))->iface = tmp;
++ err = alloc_and_copy_string(&(*(i_tmp + i_num))->iface, IFNAMSIZ);
++ if (err)
++ return ERR_PTR(err);
+ }
+
+ s_tmp->ips = i_tmp;
@@ -60690,8 +60053,7 @@ index 0000000..0d5c602
+ int err;
+
+ while (userp) {
-+ if (copy_from_user(&s_pre, userp,
-+ sizeof (struct acl_subject_label)))
++ if (copy_acl_subject_label(&s_pre, userp))
+ return -EFAULT;
+
+ ret = do_copy_user_subj(userp, role, NULL);
@@ -60717,8 +60079,6 @@ index 0000000..0d5c602
+ struct gr_hash_struct *ghash;
+ uid_t *domainlist;
+ unsigned int r_num;
-+ unsigned int len;
-+ char *tmp;
+ int err = 0;
+ __u16 i;
+ __u32 num_subjs;
@@ -60739,26 +60099,17 @@ index 0000000..0d5c602
+ sptmp = (struct sprole_pw *) acl_alloc(sizeof(struct sprole_pw));
+ if (!sptmp)
+ return -ENOMEM;
-+ if (copy_from_user(sptmp, arg->sprole_pws + i,
-+ sizeof (struct sprole_pw)))
++ if (copy_sprole_pw(sptmp, i, arg->sprole_pws))
+ return -EFAULT;
+
-+ len = strnlen_user(sptmp->rolename, GR_SPROLE_LEN);
-+
-+ if (!len || len >= GR_SPROLE_LEN)
-+ return -EINVAL;
-+
-+ if ((tmp = (char *) acl_alloc(len)) == NULL)
-+ return -ENOMEM;
-+
-+ if (copy_from_user(tmp, sptmp->rolename, len))
-+ return -EFAULT;
++ err = alloc_and_copy_string((char **)&sptmp->rolename, GR_SPROLE_LEN);
++ if (err)
++ return err;
+
-+ tmp[len-1] = '\0';
+#ifdef CONFIG_GRKERNSEC_RBAC_DEBUG
-+ printk(KERN_ALERT "Copying special role %s\n", tmp);
++ printk(KERN_ALERT "Copying special role %s\n", sptmp->rolename);
+#endif
-+ sptmp->rolename = tmp;
++
+ acl_special_roles[i] = sptmp;
+ }
+
@@ -60770,27 +60121,15 @@ index 0000000..0d5c602
+ if (!r_tmp)
+ return -ENOMEM;
+
-+ if (copy_from_user(&r_utmp2, r_utmp + r_num,
-+ sizeof (struct acl_role_label *)))
-+ return -EFAULT;
-+
-+ if (copy_from_user(r_tmp, r_utmp2,
-+ sizeof (struct acl_role_label)))
++ if (copy_pointer_from_array(&r_utmp2, r_num, r_utmp))
+ return -EFAULT;
+
-+ len = strnlen_user(r_tmp->rolename, GR_SPROLE_LEN);
-+
-+ if (!len || len >= PATH_MAX)
-+ return -EINVAL;
-+
-+ if ((tmp = (char *) acl_alloc(len)) == NULL)
-+ return -ENOMEM;
-+
-+ if (copy_from_user(tmp, r_tmp->rolename, len))
++ if (copy_acl_role_label(r_tmp, r_utmp2))
+ return -EFAULT;
+
-+ tmp[len-1] = '\0';
-+ r_tmp->rolename = tmp;
++ err = alloc_and_copy_string(&r_tmp->rolename, GR_SPROLE_LEN);
++ if (err)
++ return err;
+
+ if (!strcmp(r_tmp->rolename, "default")
+ && (r_tmp->roletype & GR_ROLE_DEFAULT)) {
@@ -60802,7 +60141,7 @@ index 0000000..0d5c602
+ if ((ghash = (struct gr_hash_struct *) acl_alloc(sizeof(struct gr_hash_struct))) == NULL)
+ return -ENOMEM;
+
-+ if (copy_from_user(ghash, r_tmp->hash, sizeof(struct gr_hash_struct)))
++ if (copy_gr_hash_struct(ghash, r_tmp->hash))
+ return -EFAULT;
+
+ r_tmp->hash = ghash;
@@ -62411,13 +61750,14 @@ index 0000000..0d5c602
+}
+
+ssize_t
-+write_grsec_handler(struct file *file, const char * buf, size_t count, loff_t *ppos)
++write_grsec_handler(struct file *file, const char __user * buf, size_t count, loff_t *ppos)
+{
+ struct gr_arg_wrapper uwrap;
+ unsigned char *sprole_salt = NULL;
+ unsigned char *sprole_sum = NULL;
-+ int error = sizeof (struct gr_arg_wrapper);
++ int error = 0;
+ int error2 = 0;
++ size_t req_count;
+
+ mutex_lock(&gr_dev_mutex);
+
@@ -62426,8 +61766,42 @@ index 0000000..0d5c602
+ goto out;
+ }
+
-+ if (count != sizeof (struct gr_arg_wrapper)) {
-+ gr_log_int_int(GR_DONT_AUDIT_GOOD, GR_DEV_ACL_MSG, (int)count, (int)sizeof(struct gr_arg_wrapper));
++#ifdef CONFIG_COMPAT
++ pax_open_kernel();
++ if (is_compat_task()) {
++ copy_gr_arg_wrapper = &copy_gr_arg_wrapper_compat;
++ copy_gr_arg = &copy_gr_arg_compat;
++ copy_acl_object_label = &copy_acl_object_label_compat;
++ copy_acl_subject_label = &copy_acl_subject_label_compat;
++ copy_acl_role_label = &copy_acl_role_label_compat;
++ copy_acl_ip_label = &copy_acl_ip_label_compat;
++ copy_role_allowed_ip = &copy_role_allowed_ip_compat;
++ copy_role_transition = &copy_role_transition_compat;
++ copy_sprole_pw = &copy_sprole_pw_compat;
++ copy_gr_hash_struct = &copy_gr_hash_struct_compat;
++ copy_pointer_from_array = &copy_pointer_from_array_compat;
++ get_gr_arg_wrapper_size = &get_gr_arg_wrapper_size_compat;
++ } else {
++ copy_gr_arg_wrapper = &copy_gr_arg_wrapper_normal;
++ copy_gr_arg = &copy_gr_arg_normal;
++ copy_acl_object_label = &copy_acl_object_label_normal;
++ copy_acl_subject_label = &copy_acl_subject_label_normal;
++ copy_acl_role_label = &copy_acl_role_label_normal;
++ copy_acl_ip_label = &copy_acl_ip_label_normal;
++ copy_role_allowed_ip = &copy_role_allowed_ip_normal;
++ copy_role_transition = &copy_role_transition_normal;
++ copy_sprole_pw = &copy_sprole_pw_normal;
++ copy_gr_hash_struct = &copy_gr_hash_struct_normal;
++ copy_pointer_from_array = &copy_pointer_from_array_normal;
++ get_gr_arg_wrapper_size = &get_gr_arg_wrapper_size_normal;
++ }
++ pax_close_kernel();
++#endif
++
++ req_count = get_gr_arg_wrapper_size();
++
++ if (count != req_count) {
++ gr_log_int_int(GR_DONT_AUDIT_GOOD, GR_DEV_ACL_MSG, (int)count, (int)req_count);
+ error = -EINVAL;
+ goto out;
+ }
@@ -62438,20 +61812,13 @@ index 0000000..0d5c602
+ gr_auth_attempts = 0;
+ }
+
-+ if (copy_from_user(&uwrap, buf, sizeof (struct gr_arg_wrapper))) {
-+ error = -EFAULT;
++ error = copy_gr_arg_wrapper(buf, &uwrap);
++ if (error)
+ goto out;
-+ }
+
-+ if ((uwrap.version != GRSECURITY_VERSION) || (uwrap.size != sizeof(struct gr_arg))) {
-+ error = -EINVAL;
++ error = copy_gr_arg(uwrap.arg, gr_usermode);
++ if (error)
+ goto out;
-+ }
-+
-+ if (copy_from_user(gr_usermode, uwrap.arg, sizeof (struct gr_arg))) {
-+ error = -EFAULT;
-+ goto out;
-+ }
+
+ if (gr_usermode->mode != GR_SPROLE && gr_usermode->mode != GR_SPROLEPAM &&
+ gr_auth_attempts >= CONFIG_GRKERNSEC_ACL_MAXTRIES &&
@@ -62644,6 +62011,10 @@ index 0000000..0d5c602
+
+ out:
+ mutex_unlock(&gr_dev_mutex);
++
++ if (!error)
++ error = req_count;
++
+ return error;
+}
+
@@ -63537,6 +62908,281 @@ index 0000000..bdd51ea
+ return gr_task_acl_is_capable_nolog(current, cap);
+}
+
+diff --git a/grsecurity/gracl_compat.c b/grsecurity/gracl_compat.c
+new file mode 100644
+index 0000000..a43dd06
+--- /dev/null
++++ b/grsecurity/gracl_compat.c
+@@ -0,0 +1,269 @@
++#include <linux/kernel.h>
++#include <linux/gracl.h>
++#include <linux/compat.h>
++#include <linux/gracl_compat.h>
++
++#include <asm/uaccess.h>
++
++int copy_gr_arg_wrapper_compat(const char *buf, struct gr_arg_wrapper *uwrap)
++{
++ struct gr_arg_wrapper_compat uwrapcompat;
++
++ if (copy_from_user(&uwrapcompat, buf, sizeof(uwrapcompat)))
++ return -EFAULT;
++
++ if ((uwrapcompat.version != GRSECURITY_VERSION) ||
++ (uwrapcompat.size != sizeof(struct gr_arg_compat)))
++ return -EINVAL;
++
++ uwrap->arg = compat_ptr(uwrapcompat.arg);
++ uwrap->version = uwrapcompat.version;
++ uwrap->size = sizeof(struct gr_arg);
++
++ return 0;
++}
++
++int copy_gr_arg_compat(const struct gr_arg __user *buf, struct gr_arg *arg)
++{
++ struct gr_arg_compat argcompat;
++
++ if (copy_from_user(&argcompat, buf, sizeof(argcompat)))
++ return -EFAULT;
++
++ arg->role_db.r_table = compat_ptr(argcompat.role_db.r_table);
++ arg->role_db.num_pointers = argcompat.role_db.num_pointers;
++ arg->role_db.num_roles = argcompat.role_db.num_roles;
++ arg->role_db.num_domain_children = argcompat.role_db.num_domain_children;
++ arg->role_db.num_subjects = argcompat.role_db.num_subjects;
++ arg->role_db.num_objects = argcompat.role_db.num_objects;
++
++ memcpy(&arg->pw, &argcompat.pw, sizeof(arg->pw));
++ memcpy(&arg->salt, &argcompat.salt, sizeof(arg->salt));
++ memcpy(&arg->sum, &argcompat.sum, sizeof(arg->sum));
++ memcpy(&arg->sp_role, &argcompat.sp_role, sizeof(arg->sp_role));
++ arg->sprole_pws = compat_ptr(argcompat.sprole_pws);
++ arg->segv_device = argcompat.segv_device;
++ arg->segv_inode = argcompat.segv_inode;
++ arg->segv_uid = argcompat.segv_uid;
++ arg->num_sprole_pws = argcompat.num_sprole_pws;
++ arg->mode = argcompat.mode;
++
++ return 0;
++}
++
++int copy_acl_object_label_compat(struct acl_object_label *obj, const struct acl_object_label *userp)
++{
++ struct acl_object_label_compat objcompat;
++
++ if (copy_from_user(&objcompat, userp, sizeof(objcompat)))
++ return -EFAULT;
++
++ obj->filename = compat_ptr(objcompat.filename);
++ obj->inode = objcompat.inode;
++ obj->device = objcompat.device;
++ obj->mode = objcompat.mode;
++
++ obj->nested = compat_ptr(objcompat.nested);
++ obj->globbed = compat_ptr(objcompat.globbed);
++
++ obj->prev = compat_ptr(objcompat.prev);
++ obj->next = compat_ptr(objcompat.next);
++
++ return 0;
++}
++
++int copy_acl_subject_label_compat(struct acl_subject_label *subj, const struct acl_subject_label *userp)
++{
++ unsigned int i;
++ struct acl_subject_label_compat subjcompat;
++
++ if (copy_from_user(&subjcompat, userp, sizeof(subjcompat)))
++ return -EFAULT;
++
++ subj->filename = compat_ptr(subjcompat.filename);
++ subj->inode = subjcompat.inode;
++ subj->device = subjcompat.device;
++ subj->mode = subjcompat.mode;
++ subj->cap_mask = subjcompat.cap_mask;
++ subj->cap_lower = subjcompat.cap_lower;
++ subj->cap_invert_audit = subjcompat.cap_invert_audit;
++
++ for (i = 0; i < GR_NLIMITS; i++) {
++ if (subjcompat.res[i].rlim_cur == COMPAT_RLIM_INFINITY)
++ subj->res[i].rlim_cur = RLIM_INFINITY;
++ else
++ subj->res[i].rlim_cur = subjcompat.res[i].rlim_cur;
++ if (subjcompat.res[i].rlim_max == COMPAT_RLIM_INFINITY)
++ subj->res[i].rlim_max = RLIM_INFINITY;
++ else
++ subj->res[i].rlim_max = subjcompat.res[i].rlim_max;
++ }
++ subj->resmask = subjcompat.resmask;
++
++ subj->user_trans_type = subjcompat.user_trans_type;
++ subj->group_trans_type = subjcompat.group_trans_type;
++ subj->user_transitions = compat_ptr(subjcompat.user_transitions);
++ subj->group_transitions = compat_ptr(subjcompat.group_transitions);
++ subj->user_trans_num = subjcompat.user_trans_num;
++ subj->group_trans_num = subjcompat.group_trans_num;
++
++ memcpy(&subj->sock_families, &subjcompat.sock_families, sizeof(subj->sock_families));
++ memcpy(&subj->ip_proto, &subjcompat.ip_proto, sizeof(subj->ip_proto));
++ subj->ip_type = subjcompat.ip_type;
++ subj->ips = compat_ptr(subjcompat.ips);
++ subj->ip_num = subjcompat.ip_num;
++ subj->inaddr_any_override = subjcompat.inaddr_any_override;
++
++ subj->crashes = subjcompat.crashes;
++ subj->expires = subjcompat.expires;
++
++ subj->parent_subject = compat_ptr(subjcompat.parent_subject);
++ subj->hash = compat_ptr(subjcompat.hash);
++ subj->prev = compat_ptr(subjcompat.prev);
++ subj->next = compat_ptr(subjcompat.next);
++
++ subj->obj_hash = compat_ptr(subjcompat.obj_hash);
++ subj->obj_hash_size = subjcompat.obj_hash_size;
++ subj->pax_flags = subjcompat.pax_flags;
++
++ return 0;
++}
++
++int copy_acl_role_label_compat(struct acl_role_label *role, const struct acl_role_label *userp)
++{
++ struct acl_role_label_compat rolecompat;
++
++ if (copy_from_user(&rolecompat, userp, sizeof(rolecompat)))
++ return -EFAULT;
++
++ role->rolename = compat_ptr(rolecompat.rolename);
++ role->uidgid = rolecompat.uidgid;
++ role->roletype = rolecompat.roletype;
++
++ role->auth_attempts = rolecompat.auth_attempts;
++ role->expires = rolecompat.expires;
++
++ role->root_label = compat_ptr(rolecompat.root_label);
++ role->hash = compat_ptr(rolecompat.hash);
++
++ role->prev = compat_ptr(rolecompat.prev);
++ role->next = compat_ptr(rolecompat.next);
++
++ role->transitions = compat_ptr(rolecompat.transitions);
++ role->allowed_ips = compat_ptr(rolecompat.allowed_ips);
++ role->domain_children = compat_ptr(rolecompat.domain_children);
++ role->domain_child_num = rolecompat.domain_child_num;
++
++ role->umask = rolecompat.umask;
++
++ role->subj_hash = compat_ptr(rolecompat.subj_hash);
++ role->subj_hash_size = rolecompat.subj_hash_size;
++
++ return 0;
++}
++
++int copy_role_allowed_ip_compat(struct role_allowed_ip *roleip, const struct role_allowed_ip *userp)
++{
++ struct role_allowed_ip_compat roleip_compat;
++
++ if (copy_from_user(&roleip_compat, userp, sizeof(roleip_compat)))
++ return -EFAULT;
++
++ roleip->addr = roleip_compat.addr;
++ roleip->netmask = roleip_compat.netmask;
++
++ roleip->prev = compat_ptr(roleip_compat.prev);
++ roleip->next = compat_ptr(roleip_compat.next);
++
++ return 0;
++}
++
++int copy_role_transition_compat(struct role_transition *trans, const struct role_transition *userp)
++{
++ struct role_transition_compat trans_compat;
++
++ if (copy_from_user(&trans_compat, userp, sizeof(trans_compat)))
++ return -EFAULT;
++
++ trans->rolename = compat_ptr(trans_compat.rolename);
++
++ trans->prev = compat_ptr(trans_compat.prev);
++ trans->next = compat_ptr(trans_compat.next);
++
++ return 0;
++
++}
++
++int copy_gr_hash_struct_compat(struct gr_hash_struct *hash, const struct gr_hash_struct *userp)
++{
++ struct gr_hash_struct_compat hash_compat;
++
++ if (copy_from_user(&hash_compat, userp, sizeof(hash_compat)))
++ return -EFAULT;
++
++ hash->table = compat_ptr(hash_compat.table);
++ hash->nametable = compat_ptr(hash_compat.nametable);
++ hash->first = compat_ptr(hash_compat.first);
++
++ hash->table_size = hash_compat.table_size;
++ hash->used_size = hash_compat.used_size;
++
++ hash->type = hash_compat.type;
++
++ return 0;
++}
++
++int copy_pointer_from_array_compat(void *ptr, unsigned long idx, const void *userp)
++{
++ compat_uptr_t ptrcompat;
++
++ if (copy_from_user(&ptrcompat, userp + (idx * sizeof(ptrcompat)), sizeof(ptrcompat)))
++ return -EFAULT;
++
++ *(void **)ptr = compat_ptr(ptrcompat);
++
++ return 0;
++}
++
++int copy_acl_ip_label_compat(struct acl_ip_label *ip, const struct acl_ip_label *userp)
++{
++ struct acl_ip_label_compat ip_compat;
++
++ if (copy_from_user(&ip_compat, userp, sizeof(ip_compat)))
++ return -EFAULT;
++
++ ip->iface = compat_ptr(ip_compat.iface);
++ ip->addr = ip_compat.addr;
++ ip->netmask = ip_compat.netmask;
++ ip->low = ip_compat.low;
++ ip->high = ip_compat.high;
++ ip->mode = ip_compat.mode;
++ ip->type = ip_compat.type;
++
++ memcpy(&ip->proto, &ip_compat.proto, sizeof(ip->proto));
++
++ ip->prev = compat_ptr(ip_compat.prev);
++ ip->next = compat_ptr(ip_compat.next);
++
++ return 0;
++}
++
++int copy_sprole_pw_compat(struct sprole_pw *pw, unsigned long idx, const struct sprole_pw *userp)
++{
++ struct sprole_pw_compat pw_compat;
++
++ if (copy_from_user(&pw_compat, (const void *)userp + (sizeof(pw_compat) * idx), sizeof(pw_compat)))
++ return -EFAULT;
++
++ pw->rolename = compat_ptr(pw_compat.rolename);
++ memcpy(&pw->salt, pw_compat.salt, sizeof(pw->salt));
++ memcpy(&pw->sum, pw_compat.sum, sizeof(pw->sum));
++
++ return 0;
++}
++
++size_t get_gr_arg_wrapper_size_compat(void)
++{
++ return sizeof(struct gr_arg_wrapper_compat);
++}
++
diff --git a/grsecurity/gracl_fs.c b/grsecurity/gracl_fs.c
new file mode 100644
index 0000000..a340c17
@@ -66106,10 +65752,10 @@ index 0000000..8ca18bf
+}
diff --git a/grsecurity/grsec_init.c b/grsecurity/grsec_init.c
new file mode 100644
-index 0000000..a862e9f
+index 0000000..ab2d875
--- /dev/null
+++ b/grsecurity/grsec_init.c
-@@ -0,0 +1,283 @@
+@@ -0,0 +1,279 @@
+#include <linux/kernel.h>
+#include <linux/sched.h>
+#include <linux/mm.h>
@@ -66133,7 +65779,6 @@ index 0000000..a862e9f
+int grsec_enable_forkfail;
+int grsec_enable_audit_ptrace;
+int grsec_enable_time;
-+int grsec_enable_audit_textrel;
+int grsec_enable_group;
+kgid_t grsec_audit_gid;
+int grsec_enable_chdir;
@@ -66265,9 +65910,6 @@ index 0000000..a862e9f
+ grsec_lock = 1;
+#endif
+
-+#ifdef CONFIG_GRKERNSEC_AUDIT_TEXTREL
-+ grsec_enable_audit_textrel = 1;
-+#endif
+#ifdef CONFIG_GRKERNSEC_RWXMAP_LOG
+ grsec_enable_log_rwxmaps = 1;
+#endif
@@ -66459,15 +66101,16 @@ index 0000000..5e05e20
+}
diff --git a/grsecurity/grsec_log.c b/grsecurity/grsec_log.c
new file mode 100644
-index 0000000..7c06085
+index 0000000..dbe0a6b
--- /dev/null
+++ b/grsecurity/grsec_log.c
-@@ -0,0 +1,326 @@
+@@ -0,0 +1,341 @@
+#include <linux/kernel.h>
+#include <linux/sched.h>
+#include <linux/file.h>
+#include <linux/tty.h>
+#include <linux/fs.h>
++#include <linux/mm.h>
+#include <linux/grinternal.h>
+
+#ifdef CONFIG_TREE_PREEMPT_RCU
@@ -66614,6 +66257,7 @@ index 0000000..7c06085
+ struct vfsmount *mnt = NULL;
+ struct file *file = NULL;
+ struct task_struct *task = NULL;
++ struct vm_area_struct *vma = NULL;
+ const struct cred *cred, *pcred;
+ va_list ap;
+
@@ -66753,6 +66397,19 @@ index 0000000..7c06085
+ file = va_arg(ap, struct file *);
+ gr_log_middle_varargs(audit, msg, file ? gr_to_filename(file->f_path.dentry, file->f_path.mnt) : "<anonymous mapping>");
+ break;
++ case GR_RWXMAPVMA:
++ vma = va_arg(ap, struct vm_area_struct *);
++ if (vma->vm_file)
++ str1 = gr_to_filename(vma->vm_file->f_path.dentry, vma->vm_file->f_path.mnt);
++ else if (vma->vm_flags & (VM_GROWSDOWN | VM_GROWSUP))
++ str1 = "<stack>";
++ else if (vma->vm_start <= current->mm->brk &&
++ vma->vm_end >= current->mm->start_brk)
++ str1 = "<heap>";
++ else
++ str1 = "<anonymous mapping>";
++ gr_log_middle_varargs(audit, msg, str1);
++ break;
+ case GR_PSACCT:
+ {
+ unsigned int wday, cday;
@@ -66905,10 +66562,10 @@ index 0000000..2131422
+}
diff --git a/grsecurity/grsec_pax.c b/grsecurity/grsec_pax.c
new file mode 100644
-index 0000000..a3b12a0
+index 0000000..6ee9d50
--- /dev/null
+++ b/grsecurity/grsec_pax.c
-@@ -0,0 +1,36 @@
+@@ -0,0 +1,45 @@
+#include <linux/kernel.h>
+#include <linux/sched.h>
+#include <linux/mm.h>
@@ -66919,9 +66576,18 @@ index 0000000..a3b12a0
+void
+gr_log_textrel(struct vm_area_struct * vma)
+{
-+#ifdef CONFIG_GRKERNSEC_AUDIT_TEXTREL
-+ if (grsec_enable_audit_textrel)
-+ gr_log_textrel_ulong_ulong(GR_DO_AUDIT, GR_TEXTREL_AUDIT_MSG, vma->vm_file, vma->vm_start, vma->vm_pgoff);
++#ifdef CONFIG_GRKERNSEC_RWXMAP_LOG
++ if (grsec_enable_log_rwxmaps)
++ gr_log_textrel_ulong_ulong(GR_DONT_AUDIT, GR_TEXTREL_AUDIT_MSG, vma->vm_file, vma->vm_start, vma->vm_pgoff);
++#endif
++ return;
++}
++
++void gr_log_ptgnustack(struct file *file)
++{
++#ifdef CONFIG_GRKERNSEC_RWXMAP_LOG
++ if (grsec_enable_log_rwxmaps)
++ gr_log_rwxmap(GR_DONT_AUDIT, GR_PTGNUSTACK_MSG, file);
+#endif
+ return;
+}
@@ -66937,11 +66603,11 @@ index 0000000..a3b12a0
+}
+
+void
-+gr_log_rwxmprotect(struct file *file)
++gr_log_rwxmprotect(struct vm_area_struct *vma)
+{
+#ifdef CONFIG_GRKERNSEC_RWXMAP_LOG
+ if (grsec_enable_log_rwxmaps)
-+ gr_log_rwxmap(GR_DONT_AUDIT, GR_RWXMPROTECT_MSG, file);
++ gr_log_rwxmap_vma(GR_DONT_AUDIT, GR_RWXMPROTECT_MSG, vma);
+#endif
+ return;
+}
@@ -67485,10 +67151,10 @@ index 0000000..4030d57
+}
diff --git a/grsecurity/grsec_sysctl.c b/grsecurity/grsec_sysctl.c
new file mode 100644
-index 0000000..f55ef0f
+index 0000000..7624d1c
--- /dev/null
+++ b/grsecurity/grsec_sysctl.c
-@@ -0,0 +1,469 @@
+@@ -0,0 +1,460 @@
+#include <linux/kernel.h>
+#include <linux/sched.h>
+#include <linux/sysctl.h>
@@ -67882,15 +67548,6 @@ index 0000000..f55ef0f
+ .proc_handler = &proc_dointvec,
+ },
+#endif
-+#ifdef CONFIG_GRKERNSEC_AUDIT_TEXTREL
-+ {
-+ .procname = "audit_textrel",
-+ .data = &grsec_enable_audit_textrel,
-+ .maxlen = sizeof(int),
-+ .mode = 0600,
-+ .proc_handler = &proc_dointvec,
-+ },
-+#endif
+#ifdef CONFIG_GRKERNSEC_DMESG
+ {
+ .procname = "dmesg",
@@ -68714,10 +68371,10 @@ index a59ff51..2594a70 100644
#endif /* !__ASSEMBLY__ */
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
-index afa12c7..99d4da0 100644
+index eb58d2d..df131bf 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
-@@ -245,6 +245,7 @@
+@@ -239,6 +239,7 @@
.rodata : AT(ADDR(.rodata) - LOAD_OFFSET) { \
VMLINUX_SYMBOL(__start_rodata) = .; \
*(.rodata) *(.rodata.*) \
@@ -68725,7 +68382,7 @@ index afa12c7..99d4da0 100644
*(__vermagic) /* Kernel version magic */ \
. = ALIGN(8); \
VMLINUX_SYMBOL(__start___tracepoints_ptrs) = .; \
-@@ -755,17 +756,18 @@
+@@ -749,17 +750,18 @@
* section in the linker script will go there too. @phdr should have
* a leading colon.
*
@@ -68762,7 +68419,7 @@ index 418d270..bfd2794 100644
struct crypto_instance {
struct crypto_alg alg;
diff --git a/include/drm/drmP.h b/include/drm/drmP.h
-index f1ce786..086a7a5 100644
+index 63d17ee..716de2b 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -72,6 +72,7 @@
@@ -68788,19 +68445,20 @@ index f1ce786..086a7a5 100644
unsigned long arg);
#define DRM_IOCTL_NR(n) _IOC_NR(n)
-@@ -314,9 +317,9 @@ typedef int drm_ioctl_compat_t(struct file *filp, unsigned int cmd,
+@@ -314,10 +317,10 @@ typedef int drm_ioctl_compat_t(struct file *filp, unsigned int cmd,
struct drm_ioctl_desc {
unsigned int cmd;
int flags;
- drm_ioctl_t *func;
+ drm_ioctl_t func;
unsigned int cmd_drv;
+ const char *name;
-};
+} __do_const;
/**
* Creates a driver or general drm_ioctl_desc array entry for the given
-@@ -1014,7 +1017,7 @@ struct drm_info_list {
+@@ -1015,7 +1018,7 @@ struct drm_info_list {
int (*show)(struct seq_file*, void*); /** show callback */
u32 driver_features; /**< Required driver features for this entry */
void *data;
@@ -68809,7 +68467,7 @@ index f1ce786..086a7a5 100644
/**
* debugfs node structure. This structure represents a debugfs file.
-@@ -1087,7 +1090,7 @@ struct drm_device {
+@@ -1088,7 +1091,7 @@ struct drm_device {
/** \name Usage Counters */
/*@{ */
@@ -68818,7 +68476,7 @@ index f1ce786..086a7a5 100644
atomic_t ioctl_count; /**< Outstanding IOCTLs pending */
atomic_t vma_count; /**< Outstanding vma areas open */
int buf_use; /**< Buffers in use -- cannot alloc */
-@@ -1098,7 +1101,7 @@ struct drm_device {
+@@ -1099,7 +1102,7 @@ struct drm_device {
/*@{ */
unsigned long counters;
enum drm_stat_type types[15];
@@ -68889,14 +68547,15 @@ index c1da539..1dcec55 100644
struct atmphy_ops {
int (*start)(struct atm_dev *dev);
diff --git a/include/linux/binfmts.h b/include/linux/binfmts.h
-index c3a0914..ec5d48a 100644
+index 70cf138..0418ee2 100644
--- a/include/linux/binfmts.h
+++ b/include/linux/binfmts.h
-@@ -73,8 +73,9 @@ struct linux_binfmt {
+@@ -73,8 +73,10 @@ struct linux_binfmt {
int (*load_binary)(struct linux_binprm *);
int (*load_shlib)(struct file *);
int (*core_dump)(struct coredump_params *cprm);
+ void (*handle_mprotect)(struct vm_area_struct *vma, unsigned long newflags);
++ void (*handle_mmap)(struct file *);
unsigned long min_coredump; /* minimal dump size */
-};
+} __do_const;
@@ -68904,10 +68563,10 @@ index c3a0914..ec5d48a 100644
extern void __register_binfmt(struct linux_binfmt *fmt, int insert);
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
-index 33f358f..7f2c27f 100644
+index 2fdb4a4..54aad7e 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
-@@ -1499,7 +1499,7 @@ struct block_device_operations {
+@@ -1526,7 +1526,7 @@ struct block_device_operations {
/* this callback is with swap_lock and sometimes page table lock held */
void (*swap_slot_free_notify) (struct block_device *, unsigned long);
struct module *owner;
@@ -68975,7 +68634,7 @@ index 8609d57..86e4d79 100644
int (*generic_packet) (struct cdrom_device_info *,
struct packet_command *);
diff --git a/include/linux/cleancache.h b/include/linux/cleancache.h
-index 42e55de..1cd0e66 100644
+index 4ce9056..86caac6 100644
--- a/include/linux/cleancache.h
+++ b/include/linux/cleancache.h
@@ -31,7 +31,7 @@ struct cleancache_ops {
@@ -68985,40 +68644,44 @@ index 42e55de..1cd0e66 100644
-};
+} __no_const;
- extern struct cleancache_ops
+ extern struct cleancache_ops *
cleancache_register_ops(struct cleancache_ops *ops);
+diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h
+index 1186098..f87e53d 100644
+--- a/include/linux/clk-provider.h
++++ b/include/linux/clk-provider.h
+@@ -132,6 +132,7 @@ struct clk_ops {
+ unsigned long);
+ void (*init)(struct clk_hw *hw);
+ };
++typedef struct clk_ops __no_const clk_ops_no_const;
+
+ /**
+ * struct clk_init_data - holds init data that's common to all clocks and is
diff --git a/include/linux/compat.h b/include/linux/compat.h
-index 377cd8c..2479845 100644
+index 7f0c1dd..b5729c6 100644
--- a/include/linux/compat.h
+++ b/include/linux/compat.h
-@@ -332,14 +332,14 @@ long compat_sys_msgsnd(int first, int second, int third, void __user *uptr);
- long compat_sys_msgrcv(int first, int second, int msgtyp, int third,
- int version, void __user *uptr);
- long compat_sys_shmat(int first, int second, compat_uptr_t third, int version,
-- void __user *uptr);
-+ void __user *uptr) __intentional_overflow(0);
- #else
- long compat_sys_semctl(int semid, int semnum, int cmd, int arg);
- long compat_sys_msgsnd(int msqid, struct compat_msgbuf __user *msgp,
+@@ -312,7 +312,7 @@ compat_sys_get_robust_list(int pid, compat_uptr_t __user *head_ptr,
+ compat_size_t __user *len_ptr);
+
+ asmlinkage long compat_sys_ipc(u32, int, int, u32, compat_uptr_t, u32);
+-asmlinkage long compat_sys_shmat(int shmid, compat_uptr_t shmaddr, int shmflg);
++asmlinkage long compat_sys_shmat(int shmid, compat_uptr_t shmaddr, int shmflg) __intentional_overflow(0);
+ asmlinkage long compat_sys_semctl(int semid, int semnum, int cmd, int arg);
+ asmlinkage long compat_sys_msgsnd(int msqid, compat_uptr_t msgp,
compat_ssize_t msgsz, int msgflg);
- long compat_sys_msgrcv(int msqid, struct compat_msgbuf __user *msgp,
- compat_ssize_t msgsz, long msgtyp, int msgflg);
--long compat_sys_shmat(int shmid, compat_uptr_t shmaddr, int shmflg);
-+long compat_sys_shmat(int shmid, compat_uptr_t shmaddr, int shmflg) __intentional_overflow(0);
- #endif
- long compat_sys_msgctl(int first, int second, void __user *uptr);
- long compat_sys_shmctl(int first, int second, void __user *uptr);
-@@ -442,7 +442,7 @@ extern int compat_ptrace_request(struct task_struct *child,
+@@ -419,7 +419,7 @@ extern int compat_ptrace_request(struct task_struct *child,
extern long compat_arch_ptrace(struct task_struct *child, compat_long_t request,
compat_ulong_t addr, compat_ulong_t data);
asmlinkage long compat_sys_ptrace(compat_long_t request, compat_long_t pid,
- compat_long_t addr, compat_long_t data);
+ compat_ulong_t addr, compat_ulong_t data);
+ asmlinkage long compat_sys_lookup_dcookie(u32, u32, char __user *, size_t);
/*
- * epoll (fs/eventpoll.c) compat bits follow ...
diff --git a/include/linux/compiler-gcc4.h b/include/linux/compiler-gcc4.h