aboutsummaryrefslogtreecommitdiffstats
path: root/main
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2012-01-24 12:08:07 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2012-01-24 15:06:09 +0000
commit441cf9f59a263ca7f85b96ec71f0d50b5e223be5 (patch)
tree238d57847db69d5069ff27a1be69d8ad8e06e128 /main
parent04dd0f555be6ee54c06d08db0516fbccc8a5d8d7 (diff)
downloadaports-441cf9f59a263ca7f85b96ec71f0d50b5e223be5.tar.gz
aports-441cf9f59a263ca7f85b96ec71f0d50b5e223be5.tar.bz2
aports-441cf9f59a263ca7f85b96ec71f0d50b5e223be5.tar.xz
main/linux-grsec: upgrade to 3.2.1 and update config
- set utf8 as default charset for filesystem NLS and FAT - enable xattr for squashfs - enable latencytop - disable IOMega ZIP drives - disable PCMCIA SCSI drivers - disable CAN subsystem - disable CAIF sysbsystem - disable Power Supply drivers - disable Voltage and regulators - disable Dallas 1-wire support
Diffstat (limited to 'main')
-rw-r--r--main/linux-grsec/0001-ip_gre-dont-increase-dev-needed_headroom-on-a-live-d.patch50
-rw-r--r--main/linux-grsec/APKBUILD22
-rw-r--r--main/linux-grsec/grsec-timblogiw-noconst.patch13
-rw-r--r--main/linux-grsec/grsecurity-2.2.2-3.2.1-201201221501.patch (renamed from main/linux-grsec/grsecurity-2.2.2-3.0.17-unofficial.patch)17855
-rw-r--r--main/linux-grsec/kernelconfig.x86974
-rw-r--r--main/linux-grsec/kernelconfig.x86_641004
-rw-r--r--main/linux-grsec/net-flow-remove-sleeping-and-deferral-mechanism-from-flow_cache_flush.patch85
7 files changed, 9409 insertions, 10594 deletions
diff --git a/main/linux-grsec/0001-ip_gre-dont-increase-dev-needed_headroom-on-a-live-d.patch b/main/linux-grsec/0001-ip_gre-dont-increase-dev-needed_headroom-on-a-live-d.patch
deleted file mode 100644
index d43160f1fa..0000000000
--- a/main/linux-grsec/0001-ip_gre-dont-increase-dev-needed_headroom-on-a-live-d.patch
+++ /dev/null
@@ -1,50 +0,0 @@
-From 113ab386c7d6625cff284fb10952ff69a58c18a4 Mon Sep 17 00:00:00 2001
-From: Eric Dumazet <eric.dumazet@gmail.com>
-Date: Fri, 14 Oct 2011 04:57:46 +0000
-Subject: [PATCH] ip_gre: dont increase dev->needed_headroom on a live device
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-It seems ip_gre is able to change dev->needed_headroom on the fly.
-
-Its is not legal unfortunately and triggers a BUG in raw_sendmsg()
-
-skb = sock_alloc_send_skb(sk, ... + LL_ALLOCATED_SPACE(rt->dst.dev)
-
-< another cpu change dev->needed_headromm (making it bigger)
-
-...
-skb_reserve(skb, LL_RESERVED_SPACE(rt->dst.dev));
-
-We end with LL_RESERVED_SPACE() being bigger than LL_ALLOCATED_SPACE()
--> we crash later because skb head is exhausted.
-
-Bug introduced in commit 243aad83 in 2.6.34 (ip_gre: include route
-header_len in max_headroom calculation)
-
-Reported-by: Elmar Vonlanthen <evonlanthen@gmail.com>
-Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
-CC: Timo Teräs <timo.teras@iki.fi>
-CC: Herbert Xu <herbert@gondor.apana.org.au>
-Signed-off-by: David S. Miller <davem@davemloft.net>
----
- net/ipv4/ip_gre.c | 2 --
- 1 files changed, 0 insertions(+), 2 deletions(-)
-
-diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c
-index d7bb94c..d55110e 100644
---- a/net/ipv4/ip_gre.c
-+++ b/net/ipv4/ip_gre.c
-@@ -835,8 +835,6 @@ static netdev_tx_t ipgre_tunnel_xmit(struct sk_buff *skb, struct net_device *dev
- if (skb_headroom(skb) < max_headroom || skb_shared(skb)||
- (skb_cloned(skb) && !skb_clone_writable(skb, 0))) {
- struct sk_buff *new_skb = skb_realloc_headroom(skb, max_headroom);
-- if (max_headroom > dev->needed_headroom)
-- dev->needed_headroom = max_headroom;
- if (!new_skb) {
- ip_rt_put(rt);
- dev->stats.tx_dropped++;
---
-1.7.7
-
diff --git a/main/linux-grsec/APKBUILD b/main/linux-grsec/APKBUILD
index 986a2341f4..8ef503f326 100644
--- a/main/linux-grsec/APKBUILD
+++ b/main/linux-grsec/APKBUILD
@@ -2,8 +2,8 @@
_flavor=grsec
pkgname=linux-${_flavor}
-pkgver=3.0.17
-_kernver=3.0
+pkgver=3.2.1
+_kernver=3.2
pkgrel=0
pkgdesc="Linux kernel with grsecurity"
url=http://grsecurity.net
@@ -14,15 +14,12 @@ _config=${config:-kernelconfig.${CARCH}}
install=
source="ftp://ftp.kernel.org/pub/linux/kernel/v3.0/linux-$_kernver.tar.bz2
ftp://ftp.kernel.org/pub/linux/kernel/v3.0/patch-$pkgver.bz2
- grsecurity-2.2.2-$pkgver-unofficial.patch
- grsec-timblogiw-noconst.patch
+ grsecurity-2.2.2-3.2.1-201201221501.patch
- 0001-ip_gre-dont-increase-dev-needed_headroom-on-a-live-d.patch
0004-arp-flush-arp-cache-on-device-change.patch
x86-centaur-enable-cx8-for-via-eden-too.patch
linux-3.0.x-regression-with-ipv4-routes-having-mtu.patch
- net-flow-remove-sleeping-and-deferral-mechanism-from-flow_cache_flush.patch
kernelconfig.x86
kernelconfig.x86_64
@@ -142,14 +139,11 @@ dev() {
"$subpkgdir"/lib/modules/${_abi_release}/build
}
-md5sums="398e95866794def22b12dfbc15ce89c0 linux-3.0.tar.bz2
-8beef6d04bfa8b26446378682b332cfe patch-3.0.17.bz2
-3c0fcf923a27a963ae86a3e694cb6bbd grsecurity-2.2.2-3.0.17-unofficial.patch
-c41cf0ee9794f393423c6b2093072260 grsec-timblogiw-noconst.patch
-ebb99ef6ad8cd2d9fd8f49d5c5849057 0001-ip_gre-dont-increase-dev-needed_headroom-on-a-live-d.patch
+md5sums="7ceb61f87c097fc17509844b71268935 linux-3.2.tar.bz2
+31fc34340f11118873463a1d59d47b7f patch-3.2.1.bz2
+2248338d08df062a843a0b601064e781 grsecurity-2.2.2-3.2.1-201201221501.patch
776adeeb5272093574f8836c5037dd7d 0004-arp-flush-arp-cache-on-device-change.patch
f3eda7112ef074a4121ec6de943c63ee x86-centaur-enable-cx8-for-via-eden-too.patch
62cc7d7b5ba7ef05b72ff91c0411c189 linux-3.0.x-regression-with-ipv4-routes-having-mtu.patch
-b25335e8fcbf8c969230d55ac4e75cf8 net-flow-remove-sleeping-and-deferral-mechanism-from-flow_cache_flush.patch
-587b1fb2f6a5c9ba714900b856f57f09 kernelconfig.x86
-99836ffe918bbdef7da1a56a3d075c7a kernelconfig.x86_64"
+c21699aa138e209cd889582c2ef80e61 kernelconfig.x86
+af26ec54258f5cde5fa41c434abae34e kernelconfig.x86_64"
diff --git a/main/linux-grsec/grsec-timblogiw-noconst.patch b/main/linux-grsec/grsec-timblogiw-noconst.patch
deleted file mode 100644
index 0f402aca93..0000000000
--- a/main/linux-grsec/grsec-timblogiw-noconst.patch
+++ /dev/null
@@ -1,13 +0,0 @@
-diff --git a/drivers/media/video/timblogiw.c b/drivers/media/video/timblogiw.c
-index 45ccd26..8a0916d 100644
---- a/drivers/media/video/timblogiw.c
-+++ b/drivers/media/video/timblogiw.c
-@@ -767,7 +767,7 @@ static __devinitconst v4l2_ioctl_ops_no_const timblogiw_ioctl_ops = {
- .vidioc_enum_framesizes = timblogiw_enum_framesizes,
- };
-
--static __devinitconst struct v4l2_file_operations timblogiw_fops = {
-+static __devinitconst v4l2_file_operations_no_const timblogiw_fops = {
- .owner = THIS_MODULE,
- .open = timblogiw_open,
- .release = timblogiw_close,
diff --git a/main/linux-grsec/grsecurity-2.2.2-3.0.17-unofficial.patch b/main/linux-grsec/grsecurity-2.2.2-3.2.1-201201221501.patch
index c4c0b6ef42..ff965370cf 100644
--- a/main/linux-grsec/grsecurity-2.2.2-3.0.17-unofficial.patch
+++ b/main/linux-grsec/grsecurity-2.2.2-3.2.1-201201221501.patch
@@ -1,5 +1,5 @@
diff --git a/Documentation/dontdiff b/Documentation/dontdiff
-index dfa6fc6..cdef560 100644
+index dfa6fc6..0095943 100644
--- a/Documentation/dontdiff
+++ b/Documentation/dontdiff
@@ -5,6 +5,7 @@
@@ -10,7 +10,15 @@ index dfa6fc6..cdef560 100644
*.dsp
*.dvi
*.elf
-@@ -48,9 +49,11 @@
+@@ -14,6 +15,7 @@
+ *.gcov
+ *.gen.S
+ *.gif
++*.gmo
+ *.grep
+ *.grp
+ *.gz
+@@ -48,9 +50,11 @@
*.tab.h
*.tex
*.ver
@@ -22,7 +30,7 @@ index dfa6fc6..cdef560 100644
*_vga16.c
*~
\#*#
-@@ -70,6 +73,7 @@ Kerntypes
+@@ -70,6 +74,7 @@ Kerntypes
Module.markers
Module.symvers
PENDING
@@ -30,7 +38,13 @@ index dfa6fc6..cdef560 100644
SCCS
System.map*
TAGS
-@@ -98,14 +102,18 @@ bzImage*
+@@ -93,19 +98,24 @@ bounds.h
+ bsetup
+ btfixupprep
+ build
++builtin-policy.h
+ bvmlinux
+ bzImage*
capability_names.h
capflags.c
classlist.h*
@@ -49,7 +63,15 @@ index dfa6fc6..cdef560 100644
conmakehash
consolemap_deftbl.c*
cpustr.h
-@@ -126,12 +134,14 @@ fore200e_pca_fw.c*
+@@ -119,6 +129,7 @@ dslm
+ elf2ecoff
+ elfconfig.h*
+ evergreen_reg_safe.h
++exception_policy.conf
+ fixdep
+ flask.h
+ fore200e_mkfirm
+@@ -126,12 +137,15 @@ fore200e_pca_fw.c*
gconf
gconf.glade.h
gen-devlist
@@ -61,10 +83,11 @@ index dfa6fc6..cdef560 100644
genksyms
*_gray256.c
+hash
++hid-example
hpet_example
hugepage-mmap
hugepage-shm
-@@ -146,7 +156,7 @@ int32.c
+@@ -146,7 +160,7 @@ int32.c
int4.c
int8.c
kallsyms
@@ -73,7 +96,7 @@ index dfa6fc6..cdef560 100644
keywords.c
ksym.c*
ksym.h*
-@@ -154,7 +164,6 @@ kxgettext
+@@ -154,7 +168,6 @@ kxgettext
lkc_defs.h
lex.c
lex.*.c
@@ -81,15 +104,16 @@ index dfa6fc6..cdef560 100644
logo_*.c
logo_*_clut224.c
logo_*_mono.c
-@@ -166,7 +175,6 @@ machtypes.h
+@@ -166,14 +179,15 @@ machtypes.h
map
map_hugetlb
maui_boot.h
-media
mconf
++mdp
miboot*
mk_elfconfig
-@@ -174,6 +182,7 @@ mkboot
+ mkboot
mkbugboot
mkcpustr
mkdep
@@ -97,7 +121,7 @@ index dfa6fc6..cdef560 100644
mkprep
mkregtable
mktables
-@@ -209,6 +218,7 @@ r300_reg_safe.h
+@@ -209,6 +223,7 @@ r300_reg_safe.h
r420_reg_safe.h
r600_reg_safe.h
recordmcount
@@ -105,7 +129,7 @@ index dfa6fc6..cdef560 100644
relocs
rlim_names.h
rn50_reg_safe.h
-@@ -219,6 +229,7 @@ setup
+@@ -219,6 +234,7 @@ setup
setup.bin
setup.elf
sImage
@@ -113,7 +137,7 @@ index dfa6fc6..cdef560 100644
sm_tbl*
split-include
syscalltab.h
-@@ -229,6 +240,7 @@ tftpboot.img
+@@ -229,6 +245,7 @@ tftpboot.img
timeconst.h
times.h*
trix_boot.h
@@ -121,7 +145,7 @@ index dfa6fc6..cdef560 100644
utsrelease.h*
vdso-syms.lds
vdso.lds
-@@ -246,7 +258,9 @@ vmlinux
+@@ -246,7 +263,9 @@ vmlinux
vmlinux-*
vmlinux.aout
vmlinux.bin.all
@@ -131,7 +155,7 @@ index dfa6fc6..cdef560 100644
vmlinuz
voffset.h
vsyscall.lds
-@@ -254,6 +268,7 @@ vsyscall_32.lds
+@@ -254,9 +273,11 @@ vsyscall_32.lds
wanxlfw.inc
uImage
unifdef
@@ -139,11 +163,15 @@ index dfa6fc6..cdef560 100644
wakeup.bin
wakeup.elf
wakeup.lds
+ zImage*
+ zconf.hash.c
++zconf.lex.c
+ zoffset.h
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
-index aa47be7..1fbd18f 100644
+index 81c287f..d456d02 100644
--- a/Documentation/kernel-parameters.txt
+++ b/Documentation/kernel-parameters.txt
-@@ -1883,6 +1883,13 @@ bytes respectively. Such letter suffixes can also be entirely omitted.
+@@ -1935,6 +1935,13 @@ 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.
@@ -158,7 +186,7 @@ index aa47be7..1fbd18f 100644
pcd. [PARIDE]
diff --git a/Makefile b/Makefile
-index f4f577b..9e9b120 100644
+index c5edffa..26654d7 100644
--- a/Makefile
+++ b/Makefile
@@ -245,8 +245,9 @@ CONFIG_SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \
@@ -168,25 +196,12 @@ index f4f577b..9e9b120 100644
-HOSTCFLAGS = -Wall -Wmissing-prototypes -Wstrict-prototypes -O2 -fomit-frame-pointer
-HOSTCXXFLAGS = -O2
+HOSTCFLAGS = -Wall -W -Wmissing-prototypes -Wstrict-prototypes -Wno-unused-parameter -Wno-missing-field-initializers -O2 -fomit-frame-pointer -fno-delete-null-pointer-checks
-+HOSTCFLAGS += $(call cc-option, -Wno-empty-body)
-+HOSTCXXFLAGS = -O2 -fno-delete-null-pointer-checks
++HOSTCLFAGS += $(call cc-option, -Wno-empty-body)
++HOSTCXXFLAGS = -O2 -Wall -W -fno-delete-null-pointer-checks
# Decide whether to build built-in, modular, or both.
# Normally, just do built-in.
-@@ -365,10 +366,12 @@ LINUXINCLUDE := -I$(srctree)/arch/$(hdr-arch)/include \
- KBUILD_CPPFLAGS := -D__KERNEL__
-
- KBUILD_CFLAGS := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \
-+ -W -Wno-unused-parameter -Wno-missing-field-initializers \
- -fno-strict-aliasing -fno-common \
- -Werror-implicit-function-declaration \
- -Wno-format-security \
- -fno-delete-null-pointer-checks
-+KBUILD_CFLAGS += $(call cc-option, -Wno-empty-body)
- KBUILD_AFLAGS_KERNEL :=
- KBUILD_CFLAGS_KERNEL :=
- KBUILD_AFLAGS := -D__ASSEMBLY__
-@@ -407,8 +410,8 @@ export RCS_TAR_IGNORE := --exclude SCCS --exclude BitKeeper --exclude .svn --exc
+@@ -407,8 +408,8 @@ export RCS_TAR_IGNORE := --exclude SCCS --exclude BitKeeper --exclude .svn --exc
# Rules shared between *config targets and build targets
# Basic helpers built in scripts/
@@ -197,20 +212,25 @@ index f4f577b..9e9b120 100644
$(Q)$(MAKE) $(build)=scripts/basic
$(Q)rm -f .tmp_quiet_recordmcount
-@@ -564,6 +567,36 @@ else
+@@ -564,6 +565,46 @@ else
KBUILD_CFLAGS += -O2
endif
++ifndef DISABLE_PAX_PLUGINS
+ifeq ($(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-plugin.sh "$(HOSTCC)" "$(CC)"), y)
++ifndef DISABLE_PAX_CONSTIFY_PLUGIN
+CONSTIFY_PLUGIN := -fplugin=$(objtree)/tools/gcc/constify_plugin.so -DCONSTIFY_PLUGIN
++endif
+ifdef CONFIG_PAX_MEMORY_STACKLEAK
-+STACKLEAK_PLUGIN := -fplugin=$(objtree)/tools/gcc/stackleak_plugin.so -fplugin-arg-stackleak_plugin-track-lowest-sp=100
++STACKLEAK_PLUGIN := -fplugin=$(objtree)/tools/gcc/stackleak_plugin.so -DSTACKLEAK_PLUGIN
++STACKLEAK_PLUGIN += -fplugin-arg-stackleak_plugin-track-lowest-sp=100
+endif
+ifdef CONFIG_KALLOCSTAT_PLUGIN
+KALLOCSTAT_PLUGIN := -fplugin=$(objtree)/tools/gcc/kallocstat_plugin.so
+endif
+ifdef CONFIG_PAX_KERNEXEC_PLUGIN
+KERNEXEC_PLUGIN := -fplugin=$(objtree)/tools/gcc/kernexec_plugin.so
++KERNEXEC_PLUGIN += -fplugin-arg-kernexec_plugin-method=$(CONFIG_PAX_KERNEXEC_PLUGIN_METHOD)
+endif
+ifdef CONFIG_CHECKER_PLUGIN
+ifeq ($(call cc-ifversion, -ge, 0406, y), y)
@@ -219,22 +239,27 @@ index f4f577b..9e9b120 100644
+endif
+GCC_PLUGINS := $(CONSTIFY_PLUGIN) $(STACKLEAK_PLUGIN) $(KALLOCSTAT_PLUGIN) $(KERNEXEC_PLUGIN) $(CHECKER_PLUGIN)
+export CONSTIFY_PLUGIN STACKLEAK_PLUGIN KERNEXEC_PLUGIN CHECKER_PLUGIN
++ifeq ($(KBUILD_EXTMOD),)
+gcc-plugins:
+ $(Q)$(MAKE) $(build)=tools/gcc
+else
++gcc-plugins: ;
++endif
++else
+gcc-plugins:
+ifeq ($(call cc-ifversion, -ge, 0405, y), y)
-+ $(error Your gcc installation does not support plugins. If the necessary headers for plugin support are missing, they should be installed. On Debian, apt-get install gcc-<ver>-plugin-dev.))
++ $(error Your gcc installation does not support plugins. If the necessary headers for plugin support are missing, they should be installed. On Debian, apt-get install gcc-<ver>-plugin-dev. If you choose to ignore this error and lessen the improvements provided by this patch, re-run make with the DISABLE_PAX_PLUGINS=y argument.))
+else
+ $(Q)echo "warning, your gcc version does not support plugins, you should upgrade it to gcc 4.5 at least"
+endif
-+ $(Q)echo "PAX_MEMORY_STACKLEAK and constification will be less secure"
++ $(Q)echo "PAX_MEMORY_STACKLEAK and other features will be less secure"
++endif
+endif
+
include $(srctree)/arch/$(SRCARCH)/Makefile
ifneq ($(CONFIG_FRAME_WARN),0)
-@@ -708,7 +741,7 @@ export mod_strip_cmd
+@@ -708,7 +749,7 @@ export mod_strip_cmd
ifeq ($(KBUILD_EXTMOD),)
@@ -243,7 +268,7 @@ index f4f577b..9e9b120 100644
vmlinux-dirs := $(patsubst %/,%,$(filter %/, $(init-y) $(init-m) \
$(core-y) $(core-m) $(drivers-y) $(drivers-m) \
-@@ -932,6 +965,7 @@ vmlinux.o: $(modpost-init) $(vmlinux-main) FORCE
+@@ -932,6 +973,7 @@ vmlinux.o: $(modpost-init) $(vmlinux-main) FORCE
# The actual objects are generated when descending,
# make sure no implicit rule kicks in
@@ -251,7 +276,7 @@ index f4f577b..9e9b120 100644
$(sort $(vmlinux-init) $(vmlinux-main)) $(vmlinux-lds): $(vmlinux-dirs) ;
# Handle descending into subdirectories listed in $(vmlinux-dirs)
-@@ -941,7 +975,7 @@ $(sort $(vmlinux-init) $(vmlinux-main)) $(vmlinux-lds): $(vmlinux-dirs) ;
+@@ -941,7 +983,7 @@ $(sort $(vmlinux-init) $(vmlinux-main)) $(vmlinux-lds): $(vmlinux-dirs) ;
# Error messages still appears in the original language
PHONY += $(vmlinux-dirs)
@@ -260,15 +285,15 @@ index f4f577b..9e9b120 100644
$(Q)$(MAKE) $(build)=$@
# Store (new) KERNELRELASE string in include/config/kernel.release
-@@ -986,6 +1020,7 @@ prepare0: archprepare FORCE
- $(Q)$(MAKE) $(build)=. missing-syscalls
+@@ -985,6 +1027,7 @@ prepare0: archprepare FORCE
+ $(Q)$(MAKE) $(build)=.
# All the preparing..
+prepare: KBUILD_CFLAGS := $(filter-out $(GCC_PLUGINS),$(KBUILD_CFLAGS))
prepare: prepare0
# Generate some files
-@@ -1087,6 +1122,7 @@ all: modules
+@@ -1086,6 +1129,7 @@ all: modules
# using awk while concatenating to the final file.
PHONY += modules
@@ -276,7 +301,7 @@ index f4f577b..9e9b120 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.';
-@@ -1102,7 +1138,7 @@ modules.builtin: $(vmlinux-dirs:%=%/modules.builtin)
+@@ -1101,7 +1145,7 @@ modules.builtin: $(vmlinux-dirs:%=%/modules.builtin)
# Target to prepare building external modules
PHONY += modules_prepare
@@ -285,16 +310,15 @@ index f4f577b..9e9b120 100644
# Target to install modules
PHONY += modules_install
-@@ -1198,7 +1234,7 @@ distclean: mrproper
- @find $(srctree) $(RCS_FIND_IGNORE) \
+@@ -1198,6 +1242,7 @@ distclean: mrproper
\( -name '*.orig' -o -name '*.rej' -o -name '*~' \
-o -name '*.bak' -o -name '#*#' -o -name '.*.orig' \
-- -o -name '.*.rej' -o -size 0 \
-+ -o -name '.*.rej' -o -name '*.so' -o -size 0 \
+ -o -name '.*.rej' \
++ -o -name '.*.rej' -o -name '*.so' \
-o -name '*%' -o -name '.*.cmd' -o -name 'core' \) \
-type f -print | xargs rm -f
-@@ -1359,6 +1395,7 @@ PHONY += $(module-dirs) modules
+@@ -1358,6 +1403,7 @@ PHONY += $(module-dirs) modules
$(module-dirs): crmodverdir $(objtree)/Module.symvers
$(Q)$(MAKE) $(build)=$(patsubst _module_%,%,$@)
@@ -302,7 +326,7 @@ index f4f577b..9e9b120 100644
modules: $(module-dirs)
@$(kecho) ' Building modules, stage 2.';
$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost
-@@ -1485,17 +1522,19 @@ else
+@@ -1484,17 +1530,19 @@ else
target-dir = $(if $(KBUILD_EXTMOD),$(dir $<),$(dir $@))
endif
@@ -326,7 +350,7 @@ index f4f577b..9e9b120 100644
$(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
%.symtypes: %.c prepare scripts FORCE
$(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@)
-@@ -1505,11 +1544,13 @@ endif
+@@ -1504,11 +1552,13 @@ endif
$(cmd_crmodverdir)
$(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1) \
$(build)=$(build-dir)
@@ -383,10 +407,10 @@ index de98a73..bd4f1f8 100644
#define _PAGE_NORMAL(x) __pgprot(_PAGE_VALID | __ACCESS_BITS | (x))
diff --git a/arch/alpha/kernel/module.c b/arch/alpha/kernel/module.c
-index ebc3c89..20cfa63 100644
+index 2fd00b7..cfd5069 100644
--- a/arch/alpha/kernel/module.c
+++ b/arch/alpha/kernel/module.c
-@@ -182,7 +182,7 @@ apply_relocate_add(Elf64_Shdr *sechdrs, const char *strtab,
+@@ -160,7 +160,7 @@ apply_relocate_add(Elf64_Shdr *sechdrs, const char *strtab,
/* The small sections were sorted to the end of the segment.
The following should definitely cover them. */
@@ -396,10 +420,10 @@ index ebc3c89..20cfa63 100644
for (i = 0; i < n; i++) {
diff --git a/arch/alpha/kernel/osf_sys.c b/arch/alpha/kernel/osf_sys.c
-index 326f0a2..baed83e 100644
+index 01e8715..be0e80f 100644
--- a/arch/alpha/kernel/osf_sys.c
+++ b/arch/alpha/kernel/osf_sys.c
-@@ -1145,7 +1145,7 @@ arch_get_unmapped_area_1(unsigned long addr, unsigned long len,
+@@ -1147,7 +1147,7 @@ arch_get_unmapped_area_1(unsigned long addr, unsigned long len,
/* At this point: (!vma || addr < vma->vm_end). */
if (limit - len < addr)
return -ENOMEM;
@@ -408,7 +432,7 @@ index 326f0a2..baed83e 100644
return addr;
addr = vma->vm_end;
vma = vma->vm_next;
-@@ -1181,6 +1181,10 @@ arch_get_unmapped_area(struct file *filp, unsigned long addr,
+@@ -1183,6 +1183,10 @@ arch_get_unmapped_area(struct file *filp, unsigned long addr,
merely specific addresses, but regions of memory -- perhaps
this feature should be incorporated into all ports? */
@@ -419,7 +443,7 @@ index 326f0a2..baed83e 100644
if (addr) {
addr = arch_get_unmapped_area_1 (PAGE_ALIGN(addr), len, limit);
if (addr != (unsigned long) -ENOMEM)
-@@ -1188,8 +1192,8 @@ arch_get_unmapped_area(struct file *filp, unsigned long addr,
+@@ -1190,8 +1194,8 @@ arch_get_unmapped_area(struct file *filp, unsigned long addr,
}
/* Next, try allocating at TASK_UNMAPPED_BASE. */
@@ -431,7 +455,7 @@ index 326f0a2..baed83e 100644
return addr;
diff --git a/arch/alpha/mm/fault.c b/arch/alpha/mm/fault.c
-index fadd5f8..3168191 100644
+index fadd5f8..904e73a 100644
--- a/arch/alpha/mm/fault.c
+++ b/arch/alpha/mm/fault.c
@@ -54,6 +54,124 @@ __load_new_mm_context(struct mm_struct *next_mm)
@@ -541,7 +565,7 @@ index fadd5f8..3168191 100644
+ return 1;
+}
+
-+void pax_report_insns(void *pc, void *sp)
++void pax_report_insns(struct pt_regs *regs, void *pc, void *sp)
+{
+ unsigned long i;
+
@@ -590,6 +614,25 @@ index fadd5f8..3168191 100644
} else if (!cause) {
/* Allow reads even for write-only mappings */
if (!(vma->vm_flags & (VM_READ | VM_WRITE)))
+diff --git a/arch/arm/include/asm/atomic.h b/arch/arm/include/asm/atomic.h
+index 86976d0..8a57797 100644
+--- a/arch/arm/include/asm/atomic.h
++++ b/arch/arm/include/asm/atomic.h
+@@ -239,6 +239,14 @@ typedef struct {
+ u64 __aligned(8) counter;
+ } atomic64_t;
+
++#ifdef CONFIG_PAX_REFCOUNT
++typedef struct {
++ u64 __aligned(8) counter;
++} atomic64_unchecked_t;
++#else
++typedef atomic64_t atomic64_unchecked_t;
++#endif
++
+ #define ATOMIC64_INIT(i) { (i) }
+
+ static inline u64 atomic64_read(atomic64_t *v)
diff --git a/arch/arm/include/asm/elf.h b/arch/arm/include/asm/elf.h
index 0e9ce8d..6ef1e03 100644
--- a/arch/arm/include/asm/elf.h
@@ -693,10 +736,10 @@ index b293616..96310e5 100644
n = __copy_to_user(to, from, n);
return n;
diff --git a/arch/arm/kernel/armksyms.c b/arch/arm/kernel/armksyms.c
-index acca35a..f7debc1 100644
+index 5b0bce6..becd81c 100644
--- a/arch/arm/kernel/armksyms.c
+++ b/arch/arm/kernel/armksyms.c
-@@ -98,8 +98,8 @@ EXPORT_SYMBOL(__strncpy_from_user);
+@@ -95,8 +95,8 @@ EXPORT_SYMBOL(__strncpy_from_user);
#ifdef CONFIG_MMU
EXPORT_SYMBOL(copy_page);
@@ -708,7 +751,7 @@ index acca35a..f7debc1 100644
EXPORT_SYMBOL(__get_user_1);
diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c
-index 74ae833..8749ecb 100644
+index 3d0c6fb..3dcae52 100644
--- a/arch/arm/kernel/process.c
+++ b/arch/arm/kernel/process.c
@@ -28,7 +28,6 @@
@@ -717,9 +760,9 @@ index 74ae833..8749ecb 100644
#include <linux/uaccess.h>
-#include <linux/random.h>
#include <linux/hw_breakpoint.h>
+ #include <linux/cpuidle.h>
- #include <asm/cacheflush.h>
-@@ -482,12 +481,6 @@ unsigned long get_wchan(struct task_struct *p)
+@@ -484,12 +483,6 @@ unsigned long get_wchan(struct task_struct *p)
return 0;
}
@@ -733,19 +776,19 @@ index 74ae833..8749ecb 100644
/*
* The vectors page is always readable from user space for the
diff --git a/arch/arm/kernel/traps.c b/arch/arm/kernel/traps.c
-index 6807cb1..552fd48 100644
+index 99a5727..a3d5bb1 100644
--- a/arch/arm/kernel/traps.c
+++ b/arch/arm/kernel/traps.c
-@@ -257,6 +257,8 @@ static int __die(const char *str, int err, struct thread_info *thread, struct pt
+@@ -259,6 +259,8 @@ static int __die(const char *str, int err, struct thread_info *thread, struct pt
- static DEFINE_SPINLOCK(die_lock);
+ static DEFINE_RAW_SPINLOCK(die_lock);
+extern void gr_handle_kernel_exploit(void);
+
/*
* This function is protected against re-entrancy.
*/
-@@ -284,6 +286,9 @@ void die(const char *str, struct pt_regs *regs, int err)
+@@ -288,6 +290,9 @@ void die(const char *str, struct pt_regs *regs, int err)
panic("Fatal exception in interrupt");
if (panic_on_oops)
panic("Fatal exception");
@@ -867,10 +910,10 @@ index d0ece2a..5ae2f39 100644
.pushsection .fixup,"ax"
.align 0
diff --git a/arch/arm/lib/uaccess_with_memcpy.c b/arch/arm/lib/uaccess_with_memcpy.c
-index 8b9b136..70d5100 100644
+index 025f742..8432b08 100644
--- a/arch/arm/lib/uaccess_with_memcpy.c
+++ b/arch/arm/lib/uaccess_with_memcpy.c
-@@ -103,7 +103,7 @@ out:
+@@ -104,7 +104,7 @@ out:
}
unsigned long
@@ -893,10 +936,10 @@ index 2b2d51c..0127490 100644
static int mbox_show(struct seq_file *s, void *data)
{
diff --git a/arch/arm/mm/fault.c b/arch/arm/mm/fault.c
-index bc0e1d8..9f27107 100644
+index aa33949..b242a2f 100644
--- a/arch/arm/mm/fault.c
+++ b/arch/arm/mm/fault.c
-@@ -182,6 +182,13 @@ __do_user_fault(struct task_struct *tsk, unsigned long addr,
+@@ -183,6 +183,13 @@ __do_user_fault(struct task_struct *tsk, unsigned long addr,
}
#endif
@@ -910,12 +953,12 @@ index bc0e1d8..9f27107 100644
tsk->thread.address = addr;
tsk->thread.error_code = fsr;
tsk->thread.trap_no = 14;
-@@ -379,6 +386,33 @@ do_page_fault(unsigned long addr, unsigned int fsr, struct pt_regs *regs)
+@@ -384,6 +391,33 @@ do_page_fault(unsigned long addr, unsigned int fsr, struct pt_regs *regs)
}
#endif /* CONFIG_MMU */
+#ifdef CONFIG_PAX_PAGEEXEC
-+void pax_report_insns(void *pc, void *sp)
++void pax_report_insns(struct pt_regs *regs, void *pc, void *sp)
+{
+ long i;
+
@@ -945,10 +988,10 @@ index bc0e1d8..9f27107 100644
* First Level Translation Fault Handler
*
diff --git a/arch/arm/mm/mmap.c b/arch/arm/mm/mmap.c
-index 74be05f..f605b8c 100644
+index 44b628e..623ee2a 100644
--- a/arch/arm/mm/mmap.c
+++ b/arch/arm/mm/mmap.c
-@@ -65,6 +65,10 @@ arch_get_unmapped_area(struct file *filp, unsigned long addr,
+@@ -54,6 +54,10 @@ arch_get_unmapped_area(struct file *filp, unsigned long addr,
if (len > TASK_SIZE)
return -ENOMEM;
@@ -959,7 +1002,7 @@ index 74be05f..f605b8c 100644
if (addr) {
if (do_align)
addr = COLOUR_ALIGN(addr, pgoff);
-@@ -72,15 +76,14 @@ arch_get_unmapped_area(struct file *filp, unsigned long addr,
+@@ -61,15 +65,14 @@ arch_get_unmapped_area(struct file *filp, unsigned long addr,
addr = PAGE_ALIGN(addr);
vma = find_vma(mm, addr);
@@ -979,7 +1022,7 @@ index 74be05f..f605b8c 100644
}
/* 8 bits of randomness in 20 address space bits */
if ((current->flags & PF_RANDOMIZE) &&
-@@ -100,14 +103,14 @@ full_search:
+@@ -89,14 +92,14 @@ full_search:
* Start a new search - just in case we missed
* some holes.
*/
@@ -1032,7 +1075,7 @@ index b7f5c68..556135c 100644
#undef D
diff --git a/arch/avr32/mm/fault.c b/arch/avr32/mm/fault.c
-index f7040a1..16169bf 100644
+index f7040a1..db9f300 100644
--- a/arch/avr32/mm/fault.c
+++ b/arch/avr32/mm/fault.c
@@ -41,6 +41,23 @@ static inline int notify_page_fault(struct pt_regs *regs, int trap)
@@ -1040,7 +1083,7 @@ index f7040a1..16169bf 100644
int exception_trace = 1;
+#ifdef CONFIG_PAX_PAGEEXEC
-+void pax_report_insns(void *pc, void *sp)
++void pax_report_insns(struct pt_regs *regs, void *pc, void *sp)
+{
+ unsigned long i;
+
@@ -1170,7 +1213,7 @@ index 1a97af3..7529d31 100644
#define PAGE_KERNEL __pgprot(__DIRTY_BITS | _PAGE_PL_0 | _PAGE_AR_RWX)
#define PAGE_KERNELRX __pgprot(__ACCESS_BITS | _PAGE_PL_0 | _PAGE_AR_RX)
diff --git a/arch/ia64/include/asm/spinlock.h b/arch/ia64/include/asm/spinlock.h
-index 1a91c91..120e693 100644
+index b77768d..e0795eb 100644
--- a/arch/ia64/include/asm/spinlock.h
+++ b/arch/ia64/include/asm/spinlock.h
@@ -72,7 +72,7 @@ static __always_inline void __ticket_spin_unlock(arch_spinlock_t *lock)
@@ -1205,10 +1248,10 @@ index 449c8c0..432a3d2 100644
__cu_len; \
})
diff --git a/arch/ia64/kernel/module.c b/arch/ia64/kernel/module.c
-index 1481b0a..e7d38ff 100644
+index 24603be..948052d 100644
--- a/arch/ia64/kernel/module.c
+++ b/arch/ia64/kernel/module.c
-@@ -315,8 +315,7 @@ module_alloc (unsigned long size)
+@@ -307,8 +307,7 @@ plt_target (struct plt_entry *plt)
void
module_free (struct module *mod, void *module_region)
{
@@ -1218,7 +1261,7 @@ index 1481b0a..e7d38ff 100644
unw_remove_unwind_table(mod->arch.init_unw_table);
mod->arch.init_unw_table = NULL;
}
-@@ -502,15 +501,39 @@ module_frob_arch_sections (Elf_Ehdr *ehdr, Elf_Shdr *sechdrs, char *secstrings,
+@@ -494,15 +493,39 @@ module_frob_arch_sections (Elf_Ehdr *ehdr, Elf_Shdr *sechdrs, char *secstrings,
}
static inline int
@@ -1260,7 +1303,7 @@ index 1481b0a..e7d38ff 100644
}
static inline int
-@@ -693,7 +716,14 @@ do_reloc (struct module *mod, uint8_t r_type, Elf64_Sym *sym, uint64_t addend,
+@@ -685,7 +708,14 @@ do_reloc (struct module *mod, uint8_t r_type, Elf64_Sym *sym, uint64_t addend,
break;
case RV_BDREL:
@@ -1276,7 +1319,7 @@ index 1481b0a..e7d38ff 100644
break;
case RV_LTV:
-@@ -828,15 +858,15 @@ apply_relocate_add (Elf64_Shdr *sechdrs, const char *strtab, unsigned int symind
+@@ -820,15 +850,15 @@ apply_relocate_add (Elf64_Shdr *sechdrs, const char *strtab, unsigned int symind
* addresses have been selected...
*/
uint64_t gp;
@@ -1346,7 +1389,7 @@ index 53c0ba0..2accdde 100644
* ensure percpu data fits
* into percpu page size
diff --git a/arch/ia64/mm/fault.c b/arch/ia64/mm/fault.c
-index 20b3593..58762be 100644
+index 20b3593..1ce77f0 100644
--- a/arch/ia64/mm/fault.c
+++ b/arch/ia64/mm/fault.c
@@ -73,6 +73,23 @@ mapped_kernel_page_is_present (unsigned long address)
@@ -1354,7 +1397,7 @@ index 20b3593..58762be 100644
}
+#ifdef CONFIG_PAX_PAGEEXEC
-+void pax_report_insns(void *pc, void *sp)
++void pax_report_insns(struct pt_regs *regs, void *pc, void *sp)
+{
+ unsigned long i;
+
@@ -1546,10 +1589,10 @@ index ff44823..97f8906 100644
/*
diff --git a/arch/mips/kernel/process.c b/arch/mips/kernel/process.c
-index d2112d3..142ad93 100644
+index c47f96e..661d418 100644
--- a/arch/mips/kernel/process.c
+++ b/arch/mips/kernel/process.c
-@@ -473,15 +473,3 @@ unsigned long get_wchan(struct task_struct *task)
+@@ -481,15 +481,3 @@ unsigned long get_wchan(struct task_struct *task)
out:
return pc;
}
@@ -1566,7 +1609,7 @@ index d2112d3..142ad93 100644
- return sp & ALMASK;
-}
diff --git a/arch/mips/mm/fault.c b/arch/mips/mm/fault.c
-index 137ee76..1bc42da 100644
+index 937cf33..adb39bb 100644
--- a/arch/mips/mm/fault.c
+++ b/arch/mips/mm/fault.c
@@ -28,6 +28,23 @@
@@ -1574,7 +1617,7 @@ index 137ee76..1bc42da 100644
#include <linux/kdebug.h>
+#ifdef CONFIG_PAX_PAGEEXEC
-+void pax_report_insns(void *pc, void *sp)
++void pax_report_insns(struct pt_regs *regs, void *pc, void *sp)
+{
+ unsigned long i;
+
@@ -1594,13 +1637,13 @@ index 137ee76..1bc42da 100644
* This routine handles page faults. It determines the address,
* and the problem, and then passes it off to one of the appropriate
diff --git a/arch/mips/mm/mmap.c b/arch/mips/mm/mmap.c
-index ae3c20a..8e2402e 100644
+index 302d779..7d35bf8 100644
--- a/arch/mips/mm/mmap.c
+++ b/arch/mips/mm/mmap.c
-@@ -48,14 +48,18 @@ unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr,
- do_color_align = 0;
- if (filp || (flags & MAP_SHARED))
+@@ -95,6 +95,11 @@ static unsigned long arch_get_unmapped_area_common(struct file *filp,
do_color_align = 1;
+
+ /* requesting a specific address */
+
+#ifdef CONFIG_PAX_RANDMMAP
+ if (!(current->mm->pax_flags & MF_PAX_RANDMMAP))
@@ -1609,27 +1652,46 @@ index ae3c20a..8e2402e 100644
if (addr) {
if (do_color_align)
addr = COLOUR_ALIGN(addr, pgoff);
- else
+@@ -102,8 +107,7 @@ static unsigned long arch_get_unmapped_area_common(struct file *filp,
addr = PAGE_ALIGN(addr);
- vmm = find_vma(current->mm, addr);
+
+ vma = find_vma(mm, addr);
- if (TASK_SIZE - len >= addr &&
-- (!vmm || addr + len <= vmm->vm_start))
+- (!vma || addr + len <= vma->vm_start))
+ if (TASK_SIZE - len >= addr && check_heap_stack_gap(vmm, addr, len))
return addr;
}
- addr = current->mm->mmap_base;
-@@ -68,7 +72,7 @@ unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr,
- /* At this point: (!vmm || addr < vmm->vm_end). */
- if (TASK_SIZE - len < addr)
- return -ENOMEM;
-- if (!vmm || addr + len <= vmm->vm_start)
-+ if (check_heap_stack_gap(vmm, addr, len))
- return addr;
- addr = vmm->vm_end;
- if (do_color_align)
-@@ -93,30 +97,3 @@ void arch_pick_mmap_layout(struct mm_struct *mm)
- mm->get_unmapped_area = arch_get_unmapped_area;
- mm->unmap_area = arch_unmap_area;
+
+@@ -118,7 +122,7 @@ static unsigned long arch_get_unmapped_area_common(struct file *filp,
+ /* At this point: (!vma || addr < vma->vm_end). */
+ if (TASK_SIZE - len < addr)
+ return -ENOMEM;
+- if (!vma || addr + len <= vma->vm_start)
++ if (check_heap_stack_gap(vmm, addr, len))
+ return addr;
+ addr = vma->vm_end;
+ if (do_color_align)
+@@ -145,7 +149,7 @@ static unsigned long arch_get_unmapped_area_common(struct file *filp,
+ /* make sure it can fit in the remaining address space */
+ if (likely(addr > len)) {
+ vma = find_vma(mm, addr - len);
+- if (!vma || addr <= vma->vm_start) {
++ if (check_heap_stack_gap(vmm, addr - len, len))
+ /* cache the address as a hint for next time */
+ return mm->free_area_cache = addr - len;
+ }
+@@ -165,7 +169,7 @@ static unsigned long arch_get_unmapped_area_common(struct file *filp,
+ * return with success:
+ */
+ vma = find_vma(mm, addr);
+- if (likely(!vma || addr + len <= vma->vm_start)) {
++ if (check_heap_stack_gap(vmm, addr, len)) {
+ /* cache the address as a hint for next time */
+ return mm->free_area_cache = addr;
+ }
+@@ -242,30 +246,3 @@ void arch_pick_mmap_layout(struct mm_struct *mm)
+ mm->unmap_area = arch_unmap_area_topdown;
+ }
}
-
-static inline unsigned long brk_rnd(void)
@@ -1699,7 +1761,7 @@ index 22dadeb..f6c2be4 100644
#define PAGE_KERNEL_EXEC __pgprot(_PAGE_KERNEL_EXEC)
#define PAGE_KERNEL_RWX __pgprot(_PAGE_KERNEL_RWX)
diff --git a/arch/parisc/kernel/module.c b/arch/parisc/kernel/module.c
-index cedbbb8..f9c332e 100644
+index 5e34ccf..672bc9c 100644
--- a/arch/parisc/kernel/module.c
+++ b/arch/parisc/kernel/module.c
@@ -98,16 +98,38 @@
@@ -1792,7 +1854,7 @@ index cedbbb8..f9c332e 100644
return (Elf_Addr)fdesc;
}
#endif /* CONFIG_64BIT */
-@@ -857,7 +879,7 @@ register_unwind_table(struct module *me,
+@@ -845,7 +867,7 @@ register_unwind_table(struct module *me,
table = (unsigned char *)sechdrs[me->arch.unwind_section].sh_addr;
end = table + sechdrs[me->arch.unwind_section].sh_size;
@@ -1833,7 +1895,7 @@ index c9b9322..02d8940 100644
if (filp) {
addr = get_shared_area(filp->f_mapping, addr, len, pgoff);
diff --git a/arch/parisc/kernel/traps.c b/arch/parisc/kernel/traps.c
-index 8b58bf0..7afff03 100644
+index f19e660..414fe24 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)
@@ -1848,7 +1910,7 @@ index 8b58bf0..7afff03 100644
fault_space = regs->iasq[0];
diff --git a/arch/parisc/mm/fault.c b/arch/parisc/mm/fault.c
-index 18162ce..4d274ba 100644
+index 18162ce..94de376 100644
--- a/arch/parisc/mm/fault.c
+++ b/arch/parisc/mm/fault.c
@@ -15,6 +15,7 @@
@@ -1966,7 +2028,7 @@ index 18162ce..4d274ba 100644
+ return 1;
+}
+
-+void pax_report_insns(void *pc, void *sp)
++void pax_report_insns(struct pt_regs *regs, void *pc, void *sp)
+{
+ unsigned long i;
+
@@ -2021,7 +2083,7 @@ index 18162ce..4d274ba 100644
/*
* If for any reason at all we couldn't handle the fault, make
diff --git a/arch/powerpc/include/asm/elf.h b/arch/powerpc/include/asm/elf.h
-index 2b917c6..9859a0c 100644
+index 3bf9cca..e7457d0 100644
--- a/arch/powerpc/include/asm/elf.h
+++ b/arch/powerpc/include/asm/elf.h
@@ -178,8 +178,19 @@ typedef elf_fpreg_t elf_vsrreghalf_t32[ELF_NVSRHALFREG];
@@ -2082,10 +2144,10 @@ index d4a7f64..451de1c 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 2cd664e..1d2e8a7 100644
+index dd9c4fd..a2ced87 100644
--- a/arch/powerpc/include/asm/page.h
+++ b/arch/powerpc/include/asm/page.h
-@@ -129,8 +129,9 @@ extern phys_addr_t kernstart_addr;
+@@ -141,8 +141,9 @@ extern phys_addr_t kernstart_addr;
* and needs to be executable. This means the whole heap ends
* up being executable.
*/
@@ -2097,21 +2159,21 @@ index 2cd664e..1d2e8a7 100644
#define VM_DATA_DEFAULT_FLAGS64 (VM_READ | VM_WRITE | \
VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
-@@ -158,6 +159,9 @@ extern phys_addr_t kernstart_addr;
+@@ -170,6 +171,9 @@ extern phys_addr_t kernstart_addr;
#define is_kernel_addr(x) ((x) >= PAGE_OFFSET)
#endif
+#define ktla_ktva(addr) (addr)
+#define ktva_ktla(addr) (addr)
+
- #ifndef __ASSEMBLY__
-
- #undef STRICT_MM_TYPECHECKS
+ /*
+ * 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 9356262..ea96148 100644
+index fb40ede..d3ce956 100644
--- a/arch/powerpc/include/asm/page_64.h
+++ b/arch/powerpc/include/asm/page_64.h
-@@ -155,15 +155,18 @@ do { \
+@@ -144,15 +144,18 @@ do { \
* stack by default, so in the absence of a PT_GNU_STACK program header
* we turn execute permission off.
*/
@@ -2157,10 +2219,10 @@ 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 c5cae0d..7cd4581 100644
+index 559da19..7e5835c 100644
--- a/arch/powerpc/include/asm/reg.h
+++ b/arch/powerpc/include/asm/reg.h
-@@ -209,6 +209,7 @@
+@@ -212,6 +212,7 @@
#define SPRN_DBCR 0x136 /* e300 Data Breakpoint Control Reg */
#define SPRN_DSISR 0x012 /* Data Storage Interrupt Status Register */
#define DSISR_NOHPTE 0x40000000 /* no translation found */
@@ -2169,10 +2231,10 @@ index c5cae0d..7cd4581 100644
#define DSISR_ISSTORE 0x02000000 /* access was a store */
#define DSISR_DABRMATCH 0x00400000 /* hit data breakpoint */
diff --git a/arch/powerpc/include/asm/system.h b/arch/powerpc/include/asm/system.h
-index 2dc595d..30cb50d 100644
+index e30a13d..2b7d994 100644
--- a/arch/powerpc/include/asm/system.h
+++ b/arch/powerpc/include/asm/system.h
-@@ -531,7 +531,7 @@ __cmpxchg_local(volatile void *ptr, unsigned long old, unsigned long new,
+@@ -530,7 +530,7 @@ __cmpxchg_local(volatile void *ptr, unsigned long old, unsigned long new,
#define cmpxchg64_local(ptr, o, n) __cmpxchg64_local_generic((ptr), (o), (n))
#endif
@@ -2363,10 +2425,10 @@ index bd0fb84..a42a14b 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 d24d440..e0c0a37 100644
+index 429983c..7af363b 100644
--- a/arch/powerpc/kernel/exceptions-64e.S
+++ b/arch/powerpc/kernel/exceptions-64e.S
-@@ -567,6 +567,7 @@ storage_fault_common:
+@@ -587,6 +587,7 @@ storage_fault_common:
std r14,_DAR(r1)
std r15,_DSISR(r1)
addi r3,r1,STACK_FRAME_OVERHEAD
@@ -2374,7 +2436,7 @@ index d24d440..e0c0a37 100644
mr r4,r14
mr r5,r15
ld r14,PACA_EXGEN+EX_R14(r13)
-@@ -576,8 +577,7 @@ storage_fault_common:
+@@ -596,8 +597,7 @@ storage_fault_common:
cmpdi r3,0
bne- 1f
b .ret_from_except_lite
@@ -2385,10 +2447,10 @@ index d24d440..e0c0a37 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 a85f487..6a07bde 100644
+index cf9c69b..ebc9640 100644
--- a/arch/powerpc/kernel/exceptions-64s.S
+++ b/arch/powerpc/kernel/exceptions-64s.S
-@@ -956,10 +956,10 @@ handle_page_fault:
+@@ -1004,10 +1004,10 @@ handle_page_fault:
11: ld r4,_DAR(r1)
ld r5,_DSISR(r1)
addi r3,r1,STACK_FRAME_OVERHEAD
@@ -2400,51 +2462,8 @@ index a85f487..6a07bde 100644
mr r5,r3
addi r3,r1,STACK_FRAME_OVERHEAD
lwz r4,_DAR(r1)
-diff --git a/arch/powerpc/kernel/module.c b/arch/powerpc/kernel/module.c
-index 49cee9d..e8be236 100644
---- a/arch/powerpc/kernel/module.c
-+++ b/arch/powerpc/kernel/module.c
-@@ -31,11 +31,24 @@
-
- LIST_HEAD(module_bug_list);
-
-+#ifdef CONFIG_PAX_KERNEXEC
- void *module_alloc(unsigned long size)
- {
- if (size == 0)
- return NULL;
-
-+ return vmalloc(size);
-+}
-+
-+void *module_alloc_exec(unsigned long size)
-+#else
-+void *module_alloc(unsigned long size)
-+#endif
-+
-+{
-+ if (size == 0)
-+ return NULL;
-+
- return vmalloc_exec(size);
- }
-
-@@ -45,6 +58,13 @@ void module_free(struct module *mod, void *module_region)
- vfree(module_region);
- }
-
-+#ifdef CONFIG_PAX_KERNEXEC
-+void module_free_exec(struct module *mod, void *module_region)
-+{
-+ module_free(mod, module_region);
-+}
-+#endif
-+
- static const Elf_Shdr *find_section(const Elf_Ehdr *hdr,
- const Elf_Shdr *sechdrs,
- const char *name)
diff --git a/arch/powerpc/kernel/module_32.c b/arch/powerpc/kernel/module_32.c
-index f832773..0507238 100644
+index 0b6d796..d760ddb 100644
--- a/arch/powerpc/kernel/module_32.c
+++ b/arch/powerpc/kernel/module_32.c
@@ -162,7 +162,7 @@ int module_frob_arch_sections(Elf32_Ehdr *hdr,
@@ -2456,7 +2475,7 @@ index f832773..0507238 100644
return -ENOEXEC;
}
-@@ -203,11 +203,16 @@ static uint32_t do_plt_call(void *location,
+@@ -192,11 +192,16 @@ static uint32_t do_plt_call(void *location,
DEBUGP("Doing plt for call to 0x%x at 0x%x\n", val, (unsigned int)location);
/* Init, or core PLT? */
@@ -2477,10 +2496,10 @@ index f832773..0507238 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 91e52df..8bfc682 100644
+index 6457574..08b28d3 100644
--- a/arch/powerpc/kernel/process.c
+++ b/arch/powerpc/kernel/process.c
-@@ -676,8 +676,8 @@ void show_regs(struct pt_regs * regs)
+@@ -660,8 +660,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
*/
@@ -2491,7 +2510,7 @@ index 91e52df..8bfc682 100644
#endif
show_stack(current, (unsigned long *) regs->gpr[1]);
if (!user_mode(regs))
-@@ -1183,10 +1183,10 @@ void show_stack(struct task_struct *tsk, unsigned long *stack)
+@@ -1165,10 +1165,10 @@ void show_stack(struct task_struct *tsk, unsigned long *stack)
newsp = stack[0];
ip = stack[STACK_FRAME_LR_SAVE];
if (!firstframe || ip != lr) {
@@ -2504,7 +2523,7 @@ index 91e52df..8bfc682 100644
(void *)current->ret_stack[curr_frame].ret);
curr_frame--;
}
-@@ -1206,7 +1206,7 @@ void show_stack(struct task_struct *tsk, unsigned long *stack)
+@@ -1188,7 +1188,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;
@@ -2513,7 +2532,7 @@ index 91e52df..8bfc682 100644
regs->trap, (void *)regs->nip, (void *)lr);
firstframe = 1;
}
-@@ -1281,58 +1281,3 @@ void thread_info_cache_init(void)
+@@ -1263,58 +1263,3 @@ void thread_info_cache_init(void)
}
#endif /* THREAD_SHIFT < PAGE_SHIFT */
@@ -2573,7 +2592,7 @@ index 91e52df..8bfc682 100644
- return ret;
-}
diff --git a/arch/powerpc/kernel/signal_32.c b/arch/powerpc/kernel/signal_32.c
-index 78b76dc..7f232ef 100644
+index 836a5a1..27289a3 100644
--- a/arch/powerpc/kernel/signal_32.c
+++ b/arch/powerpc/kernel/signal_32.c
@@ -859,7 +859,7 @@ int handle_rt_signal32(unsigned long sig, struct k_sigaction *ka,
@@ -2586,10 +2605,10 @@ index 78b76dc..7f232ef 100644
goto badframe;
regs->link = current->mm->context.vdso_base + vdso32_rt_sigtramp;
diff --git a/arch/powerpc/kernel/signal_64.c b/arch/powerpc/kernel/signal_64.c
-index e91c736..742ec06 100644
+index a50b5ec..547078a 100644
--- a/arch/powerpc/kernel/signal_64.c
+++ b/arch/powerpc/kernel/signal_64.c
-@@ -430,7 +430,7 @@ int handle_rt_signal64(int signr, struct k_sigaction *ka, siginfo_t *info,
+@@ -429,7 +429,7 @@ int handle_rt_signal64(int signr, struct k_sigaction *ka, siginfo_t *info,
current->thread.fpscr.val = 0;
/* Set up to return from userspace. */
@@ -2599,7 +2618,7 @@ index e91c736..742ec06 100644
} else {
err |= setup_trampoline(__NR_rt_sigreturn, &frame->tramp[0]);
diff --git a/arch/powerpc/kernel/traps.c b/arch/powerpc/kernel/traps.c
-index 1a01414..ce48876 100644
+index 5459d14..10f8070 100644
--- a/arch/powerpc/kernel/traps.c
+++ b/arch/powerpc/kernel/traps.c
@@ -98,6 +98,8 @@ static void pmac_backlight_unblank(void)
@@ -2621,10 +2640,10 @@ index 1a01414..ce48876 100644
do_exit(err);
diff --git a/arch/powerpc/kernel/vdso.c b/arch/powerpc/kernel/vdso.c
-index 142ab10..236e61a 100644
+index 7d14bb6..1305601 100644
--- a/arch/powerpc/kernel/vdso.c
+++ b/arch/powerpc/kernel/vdso.c
-@@ -36,6 +36,7 @@
+@@ -35,6 +35,7 @@
#include <asm/firmware.h>
#include <asm/vdso.h>
#include <asm/vdso_datapage.h>
@@ -2632,7 +2651,7 @@ index 142ab10..236e61a 100644
#include "setup.h"
-@@ -220,7 +221,7 @@ int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp)
+@@ -219,7 +220,7 @@ int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp)
vdso_base = VDSO32_MBASE;
#endif
@@ -2641,7 +2660,7 @@ index 142ab10..236e61a 100644
/* vDSO has a problem and was disabled, just don't "enable" it for the
* process
-@@ -240,7 +241,7 @@ int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp)
+@@ -239,7 +240,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),
@@ -2686,7 +2705,7 @@ index 5eea6f3..5d10396 100644
EXPORT_SYMBOL(copy_in_user);
diff --git a/arch/powerpc/mm/fault.c b/arch/powerpc/mm/fault.c
-index ad35f66..a9f6aac 100644
+index 5efe8c9..db9ceef 100644
--- a/arch/powerpc/mm/fault.c
+++ b/arch/powerpc/mm/fault.c
@@ -32,6 +32,10 @@
@@ -2723,7 +2742,7 @@ index ad35f66..a9f6aac 100644
+ return 1;
+}
+
-+void pax_report_insns(void *pc, void *sp)
++void pax_report_insns(struct pt_regs *regs, void *pc, void *sp)
+{
+ unsigned long i;
+
@@ -2821,7 +2840,7 @@ index 5a783d8..c23e14b 100644
mm->unmap_area = arch_unmap_area_topdown;
}
diff --git a/arch/powerpc/mm/slice.c b/arch/powerpc/mm/slice.c
-index ba51948..23009d9 100644
+index 73709f7..6b90313 100644
--- a/arch/powerpc/mm/slice.c
+++ b/arch/powerpc/mm/slice.c
@@ -98,7 +98,7 @@ static int slice_area_is_free(struct mm_struct *mm, unsigned long addr,
@@ -2891,7 +2910,7 @@ index ba51948..23009d9 100644
if (!fixed && addr) {
addr = _ALIGN_UP(addr, 1ul << pshift);
diff --git a/arch/s390/include/asm/elf.h b/arch/s390/include/asm/elf.h
-index 64b61bf..7ec1411 100644
+index 547f1a6..3fff354 100644
--- a/arch/s390/include/asm/elf.h
+++ b/arch/s390/include/asm/elf.h
@@ -162,8 +162,14 @@ extern unsigned int vdso_enabled;
@@ -2911,7 +2930,7 @@ index 64b61bf..7ec1411 100644
/* This yields a mask that user programs can use to figure out what
instruction set this CPU supports. */
-@@ -210,7 +216,4 @@ struct linux_binprm;
+@@ -211,7 +217,4 @@ struct linux_binprm;
#define ARCH_HAS_SETUP_ADDITIONAL_PAGES 1
int arch_setup_additional_pages(struct linux_binprm *, int);
@@ -2920,10 +2939,10 @@ index 64b61bf..7ec1411 100644
-
#endif
diff --git a/arch/s390/include/asm/system.h b/arch/s390/include/asm/system.h
-index d382629..3c80d03 100644
+index ef573c1..75a1ce6 100644
--- a/arch/s390/include/asm/system.h
+++ b/arch/s390/include/asm/system.h
-@@ -255,7 +255,7 @@ extern void (*_machine_restart)(char *command);
+@@ -262,7 +262,7 @@ extern void (*_machine_restart)(char *command);
extern void (*_machine_halt)(void);
extern void (*_machine_power_off)(void);
@@ -2969,10 +2988,10 @@ index 2b23885..e136e31 100644
copy_from_user_overflow();
return n;
diff --git a/arch/s390/kernel/module.c b/arch/s390/kernel/module.c
-index f7167ee..e22b6d5 100644
+index dfcb343..eda788a 100644
--- a/arch/s390/kernel/module.c
+++ b/arch/s390/kernel/module.c
-@@ -168,11 +168,11 @@ module_frob_arch_sections(Elf_Ehdr *hdr, Elf_Shdr *sechdrs,
+@@ -161,11 +161,11 @@ module_frob_arch_sections(Elf_Ehdr *hdr, Elf_Shdr *sechdrs,
/* Increase core size by size of got & plt and set start
offsets for got and plt. */
@@ -2989,7 +3008,7 @@ index f7167ee..e22b6d5 100644
return 0;
}
-@@ -258,7 +258,7 @@ apply_rela(Elf_Rela *rela, Elf_Addr base, Elf_Sym *symtab,
+@@ -242,7 +242,7 @@ apply_rela(Elf_Rela *rela, Elf_Addr base, Elf_Sym *symtab,
if (info->got_initialized == 0) {
Elf_Addr *gotent;
@@ -2998,7 +3017,7 @@ index f7167ee..e22b6d5 100644
info->got_offset;
*gotent = val;
info->got_initialized = 1;
-@@ -282,7 +282,7 @@ apply_rela(Elf_Rela *rela, Elf_Addr base, Elf_Sym *symtab,
+@@ -266,7 +266,7 @@ apply_rela(Elf_Rela *rela, Elf_Addr base, Elf_Sym *symtab,
else if (r_type == R_390_GOTENT ||
r_type == R_390_GOTPLTENT)
*(unsigned int *) loc =
@@ -3007,7 +3026,7 @@ index f7167ee..e22b6d5 100644
else if (r_type == R_390_GOT64 ||
r_type == R_390_GOTPLT64)
*(unsigned long *) loc = val;
-@@ -296,7 +296,7 @@ apply_rela(Elf_Rela *rela, Elf_Addr base, Elf_Sym *symtab,
+@@ -280,7 +280,7 @@ apply_rela(Elf_Rela *rela, Elf_Addr base, Elf_Sym *symtab,
case R_390_PLTOFF64: /* 16 bit offset from GOT to PLT. */
if (info->plt_initialized == 0) {
unsigned int *ip;
@@ -3016,7 +3035,7 @@ index f7167ee..e22b6d5 100644
info->plt_offset;
#ifndef CONFIG_64BIT
ip[0] = 0x0d105810; /* basr 1,0; l 1,6(1); br 1 */
-@@ -321,7 +321,7 @@ apply_rela(Elf_Rela *rela, Elf_Addr base, Elf_Sym *symtab,
+@@ -305,7 +305,7 @@ apply_rela(Elf_Rela *rela, Elf_Addr base, Elf_Sym *symtab,
val - loc + 0xffffUL < 0x1ffffeUL) ||
(r_type == R_390_PLT32DBL &&
val - loc + 0xffffffffULL < 0x1fffffffeULL)))
@@ -3025,7 +3044,7 @@ index f7167ee..e22b6d5 100644
me->arch.plt_offset +
info->plt_offset;
val += rela->r_addend - loc;
-@@ -343,7 +343,7 @@ apply_rela(Elf_Rela *rela, Elf_Addr base, Elf_Sym *symtab,
+@@ -327,7 +327,7 @@ apply_rela(Elf_Rela *rela, Elf_Addr base, Elf_Sym *symtab,
case R_390_GOTOFF32: /* 32 bit offset to GOT. */
case R_390_GOTOFF64: /* 64 bit offset to GOT. */
val = val + rela->r_addend -
@@ -3034,7 +3053,7 @@ index f7167ee..e22b6d5 100644
if (r_type == R_390_GOTOFF16)
*(unsigned short *) loc = val;
else if (r_type == R_390_GOTOFF32)
-@@ -353,7 +353,7 @@ apply_rela(Elf_Rela *rela, Elf_Addr base, Elf_Sym *symtab,
+@@ -337,7 +337,7 @@ apply_rela(Elf_Rela *rela, Elf_Addr base, Elf_Sym *symtab,
break;
case R_390_GOTPC: /* 32 bit PC relative offset to GOT. */
case R_390_GOTPCDBL: /* 32 bit PC rel. off. to GOT shifted by 1. */
@@ -3044,10 +3063,10 @@ index f7167ee..e22b6d5 100644
if (r_type == R_390_GOTPC)
*(unsigned int *) loc = val;
diff --git a/arch/s390/kernel/process.c b/arch/s390/kernel/process.c
-index 541a750..8739853 100644
+index 9451b21..ed8956f 100644
--- a/arch/s390/kernel/process.c
+++ b/arch/s390/kernel/process.c
-@@ -319,39 +319,3 @@ unsigned long get_wchan(struct task_struct *p)
+@@ -321,39 +321,3 @@ unsigned long get_wchan(struct task_struct *p)
}
return 0;
}
@@ -3087,24 +3106,11 @@ index 541a750..8739853 100644
- return base;
- return ret;
-}
-diff --git a/arch/s390/kernel/setup.c b/arch/s390/kernel/setup.c
-index 0c35dee..540939a 100644
---- a/arch/s390/kernel/setup.c
-+++ b/arch/s390/kernel/setup.c
-@@ -271,7 +271,7 @@ static int __init early_parse_mem(char *p)
- }
- early_param("mem", early_parse_mem);
-
--unsigned int user_mode = HOME_SPACE_MODE;
-+unsigned int user_mode = SECONDARY_SPACE_MODE;
- EXPORT_SYMBOL_GPL(user_mode);
-
- static int set_amode_and_uaccess(unsigned long user_amode,
diff --git a/arch/s390/mm/mmap.c b/arch/s390/mm/mmap.c
-index c9a9f7f..60d0315 100644
+index f09c748..cf9ec1d 100644
--- a/arch/s390/mm/mmap.c
+++ b/arch/s390/mm/mmap.c
-@@ -91,10 +91,22 @@ void arch_pick_mmap_layout(struct mm_struct *mm)
+@@ -92,10 +92,22 @@ void arch_pick_mmap_layout(struct mm_struct *mm)
*/
if (mmap_is_legacy()) {
mm->mmap_base = TASK_UNMAPPED_BASE;
@@ -3127,7 +3133,7 @@ index c9a9f7f..60d0315 100644
mm->get_unmapped_area = arch_get_unmapped_area_topdown;
mm->unmap_area = arch_unmap_area_topdown;
}
-@@ -166,10 +178,22 @@ void arch_pick_mmap_layout(struct mm_struct *mm)
+@@ -167,10 +179,22 @@ void arch_pick_mmap_layout(struct mm_struct *mm)
*/
if (mmap_is_legacy()) {
mm->mmap_base = TASK_UNMAPPED_BASE;
@@ -3268,7 +3274,7 @@ index ad1fb5d..fc5315b 100644
VMLINUX_MAIN += $(drivers-y) $(net-y)
diff --git a/arch/sparc/include/asm/atomic_64.h b/arch/sparc/include/asm/atomic_64.h
-index bdb2ff8..0e3008f 100644
+index 9f421df..b81fc12 100644
--- a/arch/sparc/include/asm/atomic_64.h
+++ b/arch/sparc/include/asm/atomic_64.h
@@ -14,18 +14,40 @@
@@ -3353,7 +3359,7 @@ index bdb2ff8..0e3008f 100644
#define atomic64_inc_and_test(v) (atomic64_inc_return(v) == 0)
#define atomic_sub_and_test(i, v) (atomic_sub_ret(i, v) == 0)
-@@ -59,30 +101,65 @@ extern long atomic64_sub_ret(long, atomic64_t *);
+@@ -59,25 +101,60 @@ extern long atomic64_sub_ret(long, atomic64_t *);
#define atomic64_dec_and_test(v) (atomic64_sub_ret(1, v) == 0)
#define atomic_inc(v) atomic_add(1, v)
@@ -3392,7 +3398,7 @@ index bdb2ff8..0e3008f 100644
+ return xchg(&v->counter, new);
+}
- static inline int atomic_add_unless(atomic_t *v, int a, int u)
+ static inline int __atomic_add_unless(atomic_t *v, int a, int u)
{
- int c, old;
+ int c, old, new;
@@ -3417,13 +3423,7 @@ index bdb2ff8..0e3008f 100644
if (likely(old == c))
break;
c = old;
- }
-- return c != (u);
-+ return c != u;
- }
-
- #define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0)
-@@ -90,20 +167,35 @@ static inline int atomic_add_unless(atomic_t *v, int a, int u)
+@@ -89,20 +166,35 @@ static inline int __atomic_add_unless(atomic_t *v, int a, int u)
#define atomic64_cmpxchg(v, o, n) \
((__typeof__((v)->counter))cmpxchg(&((v)->counter), (o), (n)))
#define atomic64_xchg(v, new) (xchg(&((v)->counter), new))
@@ -3513,7 +3513,7 @@ index 7df8b7f..4946269 100644
#define ELF_HWCAP sparc64_elf_hwcap
diff --git a/arch/sparc/include/asm/pgtable_32.h b/arch/sparc/include/asm/pgtable_32.h
-index 5b31a8e..1d92567 100644
+index a790cc6..091ed94 100644
--- a/arch/sparc/include/asm/pgtable_32.h
+++ b/arch/sparc/include/asm/pgtable_32.h
@@ -45,6 +45,13 @@ BTFIXUPDEF_SIMM13(user_ptrs_per_pgd)
@@ -3548,7 +3548,7 @@ index 5b31a8e..1d92567 100644
#ifdef MODULE
diff --git a/arch/sparc/include/asm/pgtsrmmu.h b/arch/sparc/include/asm/pgtsrmmu.h
-index 1407c07..7e10231 100644
+index f6ae2b2..b03ffc7 100644
--- a/arch/sparc/include/asm/pgtsrmmu.h
+++ b/arch/sparc/include/asm/pgtsrmmu.h
@@ -115,6 +115,13 @@
@@ -3800,13 +3800,13 @@ index 3e1449f..5293a0e 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);
@@ -3825,7 +3825,7 @@ index cb85458..e063f17 100644
extra-y := head_$(BITS).o
extra-y += init_task.o
diff --git a/arch/sparc/kernel/process_32.c b/arch/sparc/kernel/process_32.c
-index c8cc461..4e2b1b4 100644
+index f793742..4d880af 100644
--- a/arch/sparc/kernel/process_32.c
+++ b/arch/sparc/kernel/process_32.c
@@ -204,7 +204,7 @@ void __show_backtrace(unsigned long fp)
@@ -3864,7 +3864,7 @@ index c8cc461..4e2b1b4 100644
} while (++count < 16);
printk("\n");
diff --git a/arch/sparc/kernel/process_64.c b/arch/sparc/kernel/process_64.c
-index c158a95..f041966 100644
+index 3739a06..48b2ff0 100644
--- a/arch/sparc/kernel/process_64.c
+++ b/arch/sparc/kernel/process_64.c
@@ -180,14 +180,14 @@ static void show_regwindow(struct pt_regs *regs)
@@ -3925,7 +3925,7 @@ index 42b282f..28ce9f2 100644
addr = vmm->vm_end;
if (flags & MAP_SHARED)
diff --git a/arch/sparc/kernel/sys_sparc_64.c b/arch/sparc/kernel/sys_sparc_64.c
-index 908b47a..aa9e584 100644
+index 441521a..b767073 100644
--- a/arch/sparc/kernel/sys_sparc_64.c
+++ b/arch/sparc/kernel/sys_sparc_64.c
@@ -124,7 +124,7 @@ unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr, unsi
@@ -4076,10 +4076,10 @@ index 908b47a..aa9e584 100644
mm->unmap_area = arch_unmap_area_topdown;
}
diff --git a/arch/sparc/kernel/traps_32.c b/arch/sparc/kernel/traps_32.c
-index c0490c7..84959d1 100644
+index 591f20c..0f1b925 100644
--- a/arch/sparc/kernel/traps_32.c
+++ b/arch/sparc/kernel/traps_32.c
-@@ -44,6 +44,8 @@ static void instruction_dump(unsigned long *pc)
+@@ -45,6 +45,8 @@ static void instruction_dump(unsigned long *pc)
#define __SAVE __asm__ __volatile__("save %sp, -0x40, %sp\n\t")
#define __RESTORE __asm__ __volatile__("restore %g0, %g0, %g0\n\t")
@@ -4088,7 +4088,7 @@ index c0490c7..84959d1 100644
void die_if_kernel(char *str, struct pt_regs *regs)
{
static int die_counter;
-@@ -76,15 +78,17 @@ void die_if_kernel(char *str, struct pt_regs *regs)
+@@ -77,15 +79,17 @@ void die_if_kernel(char *str, struct pt_regs *regs)
count++ < 30 &&
(((unsigned long) rw) >= PAGE_OFFSET) &&
!(((unsigned long) rw) & 0x7)) {
@@ -4250,7 +4250,7 @@ index 0cbdaa4..438e4c9 100644
}
EXPORT_SYMBOL(die_if_kernel);
diff --git a/arch/sparc/kernel/unaligned_64.c b/arch/sparc/kernel/unaligned_64.c
-index 9043106..22ca20a 100644
+index 76e4ac1..78f8bb1 100644
--- a/arch/sparc/kernel/unaligned_64.c
+++ b/arch/sparc/kernel/unaligned_64.c
@@ -279,7 +279,7 @@ static void log_unaligned(struct pt_regs *regs)
@@ -4537,7 +4537,7 @@ index 1b30bb3..b4a16c7 100644
/* Atomic bit operations. */
diff --git a/arch/sparc/mm/Makefile b/arch/sparc/mm/Makefile
-index 79836a7..62f47a2 100644
+index 301421c..e2535d1 100644
--- a/arch/sparc/mm/Makefile
+++ b/arch/sparc/mm/Makefile
@@ -2,7 +2,7 @@
@@ -4547,15 +4547,15 @@ index 79836a7..62f47a2 100644
-ccflags-y := -Werror
+#ccflags-y := -Werror
- obj-$(CONFIG_SPARC64) += ultra.o tlb.o tsb.o
+ obj-$(CONFIG_SPARC64) += ultra.o tlb.o tsb.o gup.o
obj-y += fault_$(BITS).o
diff --git a/arch/sparc/mm/fault_32.c b/arch/sparc/mm/fault_32.c
-index 7543ddb..60a8b0b 100644
+index 8023fd7..c8e89e9 100644
--- a/arch/sparc/mm/fault_32.c
+++ b/arch/sparc/mm/fault_32.c
-@@ -22,6 +22,9 @@
+@@ -21,6 +21,9 @@
+ #include <linux/perf_event.h>
#include <linux/interrupt.h>
- #include <linux/module.h>
#include <linux/kdebug.h>
+#include <linux/slab.h>
+#include <linux/pagemap.h>
@@ -4563,7 +4563,7 @@ index 7543ddb..60a8b0b 100644
#include <asm/system.h>
#include <asm/page.h>
-@@ -209,6 +212,268 @@ static unsigned long compute_si_addr(struct pt_regs *regs, int text_fault)
+@@ -208,6 +211,268 @@ static unsigned long compute_si_addr(struct pt_regs *regs, int text_fault)
return safe_compute_effective_address(regs, insn);
}
@@ -4813,7 +4813,7 @@ index 7543ddb..60a8b0b 100644
+ return 1;
+}
+
-+void pax_report_insns(void *pc, void *sp)
++void pax_report_insns(struct pt_regs *regs, void *pc, void *sp)
+{
+ unsigned long i;
+
@@ -4832,7 +4832,7 @@ index 7543ddb..60a8b0b 100644
static noinline void do_fault_siginfo(int code, int sig, struct pt_regs *regs,
int text_fault)
{
-@@ -281,6 +546,24 @@ good_area:
+@@ -280,6 +545,24 @@ good_area:
if(!(vma->vm_flags & VM_WRITE))
goto bad_area;
} else {
@@ -4858,7 +4858,7 @@ index 7543ddb..60a8b0b 100644
if(!(vma->vm_flags & (VM_READ | VM_EXEC)))
goto bad_area;
diff --git a/arch/sparc/mm/fault_64.c b/arch/sparc/mm/fault_64.c
-index f92ce56..869924b 100644
+index 504c062..6fcb9c6 100644
--- a/arch/sparc/mm/fault_64.c
+++ b/arch/sparc/mm/fault_64.c
@@ -21,6 +21,9 @@
@@ -5319,7 +5319,7 @@ index f92ce56..869924b 100644
+ return 1;
+}
+
-+void pax_report_insns(void *pc, void *sp)
++void pax_report_insns(struct pt_regs *regs, void *pc, void *sp)
+{
+ unsigned long i;
+
@@ -5369,10 +5369,10 @@ index f92ce56..869924b 100644
* load/store/atomic was a write or not, it only says that there
* was no match. So in such a case we (carefully) read the
diff --git a/arch/sparc/mm/hugetlbpage.c b/arch/sparc/mm/hugetlbpage.c
-index f4e9764..5682724 100644
+index 07e1453..0a7d9e9 100644
--- a/arch/sparc/mm/hugetlbpage.c
+++ b/arch/sparc/mm/hugetlbpage.c
-@@ -68,7 +68,7 @@ full_search:
+@@ -67,7 +67,7 @@ full_search:
}
return -ENOMEM;
}
@@ -5381,7 +5381,7 @@ index f4e9764..5682724 100644
/*
* Remember the place where we stopped the search:
*/
-@@ -107,7 +107,7 @@ hugetlb_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0,
+@@ -106,7 +106,7 @@ hugetlb_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0,
/* make sure it can fit in the remaining address space */
if (likely(addr > len)) {
vma = find_vma(mm, addr-len);
@@ -5390,7 +5390,7 @@ index f4e9764..5682724 100644
/* remember the address as a hint for next time */
return (mm->free_area_cache = addr-len);
}
-@@ -116,16 +116,17 @@ hugetlb_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0,
+@@ -115,16 +115,17 @@ hugetlb_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0,
if (unlikely(mm->mmap_base < len))
goto bottomup;
@@ -5410,7 +5410,7 @@ index f4e9764..5682724 100644
/* remember the address as a hint for next time */
return (mm->free_area_cache = addr);
}
-@@ -135,8 +136,8 @@ hugetlb_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0,
+@@ -134,8 +135,8 @@ hugetlb_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0,
mm->cached_hole_size = vma->vm_start - addr;
/* try just below the current vma->vm_start */
@@ -5421,7 +5421,7 @@ index f4e9764..5682724 100644
bottomup:
/*
-@@ -182,8 +183,7 @@ hugetlb_get_unmapped_area(struct file *file, unsigned long addr,
+@@ -181,8 +182,7 @@ hugetlb_get_unmapped_area(struct file *file, unsigned long addr,
if (addr) {
addr = ALIGN(addr, HPAGE_SIZE);
vma = find_vma(mm, addr);
@@ -5488,20 +5488,20 @@ index cbef74e..c38fead 100644
page_kernel = pgprot_val(SRMMU_PAGE_KERNEL);
diff --git a/arch/um/Makefile b/arch/um/Makefile
-index fab8121..389e108 100644
+index 7730af6..cce5b19 100644
--- a/arch/um/Makefile
+++ b/arch/um/Makefile
-@@ -49,6 +49,10 @@ USER_CFLAGS = $(patsubst $(KERNEL_DEFINES),,$(patsubst -D__KERNEL__,,\
+@@ -61,6 +61,10 @@ USER_CFLAGS = $(patsubst $(KERNEL_DEFINES),,$(patsubst -D__KERNEL__,,\
$(patsubst -I%,,$(KBUILD_CFLAGS)))) $(ARCH_INCLUDE) $(MODE_INCLUDE) \
- $(filter -I%,$(CFLAGS)) -D_FILE_OFFSET_BITS=64
+ $(filter -I%,$(CFLAGS)) -D_FILE_OFFSET_BITS=64 -idirafter include
+ifdef CONSTIFY_PLUGIN
+USER_CFLAGS += $(CONSTIFY_PLUGIN) -fplugin-arg-constify_plugin-no-constify
+endif
+
- include $(srctree)/$(ARCH_DIR)/Makefile-$(SUBARCH)
-
#This will adjust *FLAGS accordingly to the platform.
+ include $(srctree)/$(ARCH_DIR)/Makefile-os-$(OS)
+
diff --git a/arch/um/include/asm/kmap_types.h b/arch/um/include/asm/kmap_types.h
index 6c03acd..a5e0215 100644
--- a/arch/um/include/asm/kmap_types.h
@@ -5515,7 +5515,7 @@ index 6c03acd..a5e0215 100644
};
diff --git a/arch/um/include/asm/page.h b/arch/um/include/asm/page.h
-index 4cc9b6c..02e5029 100644
+index 7cfc3ce..cbd1a58 100644
--- a/arch/um/include/asm/page.h
+++ b/arch/um/include/asm/page.h
@@ -14,6 +14,9 @@
@@ -5529,10 +5529,10 @@ index 4cc9b6c..02e5029 100644
struct page;
diff --git a/arch/um/kernel/process.c b/arch/um/kernel/process.c
-index fab4371..dfaf1a5 100644
+index c533835..84db18e 100644
--- a/arch/um/kernel/process.c
+++ b/arch/um/kernel/process.c
-@@ -404,22 +404,6 @@ int singlestepping(void * t)
+@@ -406,22 +406,6 @@ int singlestepping(void * t)
return 2;
}
@@ -5555,63 +5555,11 @@ index fab4371..dfaf1a5 100644
unsigned long get_wchan(struct task_struct *p)
{
unsigned long stack_page, sp, ip;
-diff --git a/arch/um/sys-i386/shared/sysdep/system.h b/arch/um/sys-i386/shared/sysdep/system.h
-index d1b93c4..ae1b7fd 100644
---- a/arch/um/sys-i386/shared/sysdep/system.h
-+++ b/arch/um/sys-i386/shared/sysdep/system.h
-@@ -17,7 +17,7 @@
- # define AT_VECTOR_SIZE_ARCH 1
- #endif
-
--extern unsigned long arch_align_stack(unsigned long sp);
-+#define arch_align_stack(x) ((x) & ~0xfUL)
-
- void default_idle(void);
-
-diff --git a/arch/um/sys-i386/syscalls.c b/arch/um/sys-i386/syscalls.c
-index 70ca357..728d1cc 100644
---- a/arch/um/sys-i386/syscalls.c
-+++ b/arch/um/sys-i386/syscalls.c
-@@ -11,6 +11,21 @@
- #include "asm/uaccess.h"
- #include "asm/unistd.h"
-
-+int i386_mmap_check(unsigned long addr, unsigned long len, unsigned long flags)
-+{
-+ unsigned long pax_task_size = TASK_SIZE;
-+
-+#ifdef CONFIG_PAX_SEGMEXEC
-+ if (current->mm->pax_flags & MF_PAX_SEGMEXEC)
-+ pax_task_size = SEGMEXEC_TASK_SIZE;
-+#endif
-+
-+ if (len > pax_task_size || addr > pax_task_size - len)
-+ return -EINVAL;
-+
-+ return 0;
-+}
-+
- /*
- * The prototype on i386 is:
- *
-diff --git a/arch/um/sys-x86_64/shared/sysdep/system.h b/arch/um/sys-x86_64/shared/sysdep/system.h
-index d1b93c4..ae1b7fd 100644
---- a/arch/um/sys-x86_64/shared/sysdep/system.h
-+++ b/arch/um/sys-x86_64/shared/sysdep/system.h
-@@ -17,7 +17,7 @@
- # define AT_VECTOR_SIZE_ARCH 1
- #endif
-
--extern unsigned long arch_align_stack(unsigned long sp);
-+#define arch_align_stack(x) ((x) & ~0xfUL)
-
- void default_idle(void);
-
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
-index 37357a5..a246776 100644
+index efb4294..61bc18c 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
-@@ -229,7 +229,7 @@ config X86_HT
+@@ -235,7 +235,7 @@ config X86_HT
config X86_32_LAZY_GS
def_bool y
@@ -5620,7 +5568,7 @@ index 37357a5..a246776 100644
config ARCH_HWEIGHT_CFLAGS
string
-@@ -1018,7 +1018,7 @@ choice
+@@ -1022,7 +1022,7 @@ choice
config NOHIGHMEM
bool "off"
@@ -5629,7 +5577,7 @@ index 37357a5..a246776 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
-@@ -1055,7 +1055,7 @@ config NOHIGHMEM
+@@ -1059,7 +1059,7 @@ config NOHIGHMEM
config HIGHMEM4G
bool "4GB"
@@ -5638,7 +5586,7 @@ index 37357a5..a246776 100644
---help---
Select this if you have a 32-bit processor and between 1 and 4
gigabytes of physical RAM.
-@@ -1109,7 +1109,7 @@ config PAGE_OFFSET
+@@ -1113,7 +1113,7 @@ config PAGE_OFFSET
hex
default 0xB0000000 if VMSPLIT_3G_OPT
default 0x80000000 if VMSPLIT_2G
@@ -5647,7 +5595,7 @@ index 37357a5..a246776 100644
default 0x40000000 if VMSPLIT_1G
default 0xC0000000
depends on X86_32
-@@ -1483,6 +1483,7 @@ config SECCOMP
+@@ -1496,6 +1496,7 @@ config SECCOMP
config CC_STACKPROTECTOR
bool "Enable -fstack-protector buffer overflow detection (EXPERIMENTAL)"
@@ -5655,7 +5603,7 @@ index 37357a5..a246776 100644
---help---
This option turns on the -fstack-protector GCC feature. This
feature puts, at the beginning of functions, a canary value on
-@@ -1540,6 +1541,7 @@ config KEXEC_JUMP
+@@ -1553,6 +1554,7 @@ config KEXEC_JUMP
config PHYSICAL_START
hex "Physical address where the kernel is loaded" if (EXPERT || CRASH_DUMP)
default "0x1000000"
@@ -5663,7 +5611,7 @@ index 37357a5..a246776 100644
---help---
This gives the physical address where the kernel is loaded.
-@@ -1603,6 +1605,7 @@ config X86_NEED_RELOCS
+@@ -1616,6 +1618,7 @@ config X86_NEED_RELOCS
config PHYSICAL_ALIGN
hex "Alignment value to which kernel should be aligned" if X86_32
default "0x1000000"
@@ -5671,7 +5619,7 @@ index 37357a5..a246776 100644
range 0x2000 0x1000000
---help---
This value puts the alignment restrictions on physical address
-@@ -1634,9 +1637,10 @@ config HOTPLUG_CPU
+@@ -1647,9 +1650,10 @@ config HOTPLUG_CPU
Say N if you want to disable CPU hotplug.
config COMPAT_VDSO
@@ -5684,10 +5632,10 @@ index 37357a5..a246776 100644
Map the 32-bit VDSO to the predictable old-style address too.
diff --git a/arch/x86/Kconfig.cpu b/arch/x86/Kconfig.cpu
-index 6a7cfdf..2730244 100644
+index e3ca7e0..b30b28a 100644
--- a/arch/x86/Kconfig.cpu
+++ b/arch/x86/Kconfig.cpu
-@@ -338,7 +338,7 @@ config X86_PPRO_FENCE
+@@ -341,7 +341,7 @@ config X86_PPRO_FENCE
config X86_F00F_BUG
def_bool y
@@ -5696,7 +5644,7 @@ index 6a7cfdf..2730244 100644
config X86_INVD_BUG
def_bool y
-@@ -362,7 +362,7 @@ config X86_POPAD_OK
+@@ -365,7 +365,7 @@ config X86_POPAD_OK
config X86_ALIGNMENT_16
def_bool y
@@ -5705,7 +5653,7 @@ index 6a7cfdf..2730244 100644
config X86_INTEL_USERCOPY
def_bool y
-@@ -408,7 +408,7 @@ config X86_CMPXCHG64
+@@ -411,7 +411,7 @@ config X86_CMPXCHG64
# generates cmov.
config X86_CMOV
def_bool y
@@ -5715,7 +5663,7 @@ index 6a7cfdf..2730244 100644
config X86_MINIMUM_CPU_FAMILY
int
diff --git a/arch/x86/Kconfig.debug b/arch/x86/Kconfig.debug
-index c0f8a5c..6404f61 100644
+index bf56e17..05f9891 100644
--- a/arch/x86/Kconfig.debug
+++ b/arch/x86/Kconfig.debug
@@ -81,7 +81,7 @@ config X86_PTDUMP
@@ -5737,17 +5685,17 @@ index c0f8a5c..6404f61 100644
This option helps catch unintended modifications to loadable
kernel module's text and read-only data. It also prevents execution
diff --git a/arch/x86/Makefile b/arch/x86/Makefile
-index b02e509..c1ca0df 100644
+index b02e509..2631e48 100644
--- a/arch/x86/Makefile
+++ b/arch/x86/Makefile
-@@ -44,6 +44,7 @@ ifeq ($(CONFIG_X86_32),y)
- else
- BITS := 64
+@@ -46,6 +46,7 @@ else
UTS_MACHINE := x86_64
-+ biarch := $(call cc-option,-m64)
CHECKFLAGS += -D__x86_64__ -m64
++ biarch := $(call cc-option,-m64)
KBUILD_AFLAGS += -m64
+ KBUILD_CFLAGS += -m64
+
@@ -195,3 +196,12 @@ define archhelp
echo ' FDARGS="..." arguments for the booted kernel'
echo ' FDINITRD=file initrd for the booted kernel'
@@ -5762,10 +5710,10 @@ index b02e509..c1ca0df 100644
+archprepare:
+ $(if $(LDFLAGS_BUILD_ID),,$(error $(OLD_LD)))
diff --git a/arch/x86/boot/Makefile b/arch/x86/boot/Makefile
-index f7cb086..69c1acd 100644
+index 95365a8..52f857b 100644
--- a/arch/x86/boot/Makefile
+++ b/arch/x86/boot/Makefile
-@@ -69,6 +69,9 @@ KBUILD_CFLAGS := $(LINUXINCLUDE) -g -Os -D_SETUP -D__KERNEL__ \
+@@ -63,6 +63,9 @@ KBUILD_CFLAGS := $(LINUXINCLUDE) -g -Os -D_SETUP -D__KERNEL__ \
$(call cc-option, -fno-stack-protector) \
$(call cc-option, -mpreferred-stack-boundary=2)
KBUILD_CFLAGS += $(call cc-option, -m32)
@@ -6205,7 +6153,7 @@ index 4d3ff03..e4972ff 100644
err = check_flags();
}
diff --git a/arch/x86/boot/header.S b/arch/x86/boot/header.S
-index 93e689f..504ba09 100644
+index bdb4d45..0476680 100644
--- a/arch/x86/boot/header.S
+++ b/arch/x86/boot/header.S
@@ -224,7 +224,7 @@ setup_data: .quad 0 # 64-bit physical pointer to
@@ -6256,7 +6204,7 @@ index 43eda28..5ab5fdb 100644
unsigned int v;
diff --git a/arch/x86/crypto/aes-x86_64-asm_64.S b/arch/x86/crypto/aes-x86_64-asm_64.S
-index 5b577d5..eb7f25e 100644
+index 5b577d5..3c1fed4 100644
--- a/arch/x86/crypto/aes-x86_64-asm_64.S
+++ b/arch/x86/crypto/aes-x86_64-asm_64.S
@@ -8,6 +8,8 @@
@@ -6272,13 +6220,259 @@ index 5b577d5..eb7f25e 100644
je B192; \
leaq 32(r9),r9;
-+#define ret pax_force_retaddr; ret
++#define ret pax_force_retaddr 0, 1; ret
+
#define epilogue(r1,r2,r3,r4,r5,r6,r7,r8,r9) \
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 be6d9e3..21fbbca 100644
+--- a/arch/x86/crypto/aesni-intel_asm.S
++++ b/arch/x86/crypto/aesni-intel_asm.S
+@@ -31,6 +31,7 @@
+
+ #include <linux/linkage.h>
+ #include <asm/inst.h>
++#include <asm/alternative-asm.h>
+
+ #ifdef __x86_64__
+ .data
+@@ -1436,7 +1437,9 @@ _return_T_done_decrypt:
+ pop %r14
+ pop %r13
+ pop %r12
++ pax_force_retaddr 0, 1
+ ret
++ENDPROC(aesni_gcm_dec)
+
+
+ /*****************************************************************************
+@@ -1699,7 +1702,9 @@ _return_T_done_encrypt:
+ pop %r14
+ pop %r13
+ pop %r12
++ pax_force_retaddr 0, 1
+ ret
++ENDPROC(aesni_gcm_enc)
+
+ #endif
+
+@@ -1714,6 +1719,7 @@ _key_expansion_256a:
+ pxor %xmm1, %xmm0
+ movaps %xmm0, (TKEYP)
+ add $0x10, TKEYP
++ pax_force_retaddr_bts
+ ret
+
+ .align 4
+@@ -1738,6 +1744,7 @@ _key_expansion_192a:
+ shufps $0b01001110, %xmm2, %xmm1
+ movaps %xmm1, 0x10(TKEYP)
+ add $0x20, TKEYP
++ pax_force_retaddr_bts
+ ret
+
+ .align 4
+@@ -1757,6 +1764,7 @@ _key_expansion_192b:
+
+ movaps %xmm0, (TKEYP)
+ add $0x10, TKEYP
++ pax_force_retaddr_bts
+ ret
+
+ .align 4
+@@ -1769,6 +1777,7 @@ _key_expansion_256b:
+ pxor %xmm1, %xmm2
+ movaps %xmm2, (TKEYP)
+ add $0x10, TKEYP
++ pax_force_retaddr_bts
+ ret
+
+ /*
+@@ -1881,7 +1890,9 @@ ENTRY(aesni_set_key)
+ #ifndef __x86_64__
+ popl KEYP
+ #endif
++ pax_force_retaddr 0, 1
+ ret
++ENDPROC(aesni_set_key)
+
+ /*
+ * void aesni_enc(struct crypto_aes_ctx *ctx, u8 *dst, const u8 *src)
+@@ -1902,7 +1913,9 @@ ENTRY(aesni_enc)
+ popl KLEN
+ popl KEYP
+ #endif
++ pax_force_retaddr 0, 1
+ ret
++ENDPROC(aesni_enc)
+
+ /*
+ * _aesni_enc1: internal ABI
+@@ -1959,6 +1972,7 @@ _aesni_enc1:
+ AESENC KEY STATE
+ movaps 0x70(TKEYP), KEY
+ AESENCLAST KEY STATE
++ pax_force_retaddr_bts
+ ret
+
+ /*
+@@ -2067,6 +2081,7 @@ _aesni_enc4:
+ AESENCLAST KEY STATE2
+ AESENCLAST KEY STATE3
+ AESENCLAST KEY STATE4
++ pax_force_retaddr_bts
+ ret
+
+ /*
+@@ -2089,7 +2104,9 @@ ENTRY(aesni_dec)
+ popl KLEN
+ popl KEYP
+ #endif
++ pax_force_retaddr 0, 1
+ ret
++ENDPROC(aesni_dec)
+
+ /*
+ * _aesni_dec1: internal ABI
+@@ -2146,6 +2163,7 @@ _aesni_dec1:
+ AESDEC KEY STATE
+ movaps 0x70(TKEYP), KEY
+ AESDECLAST KEY STATE
++ pax_force_retaddr_bts
+ ret
+
+ /*
+@@ -2254,6 +2272,7 @@ _aesni_dec4:
+ AESDECLAST KEY STATE2
+ AESDECLAST KEY STATE3
+ AESDECLAST KEY STATE4
++ pax_force_retaddr_bts
+ ret
+
+ /*
+@@ -2311,7 +2330,9 @@ ENTRY(aesni_ecb_enc)
+ popl KEYP
+ popl LEN
+ #endif
++ pax_force_retaddr 0, 1
+ ret
++ENDPROC(aesni_ecb_enc)
+
+ /*
+ * void aesni_ecb_dec(struct crypto_aes_ctx *ctx, const u8 *dst, u8 *src,
+@@ -2369,7 +2390,9 @@ ENTRY(aesni_ecb_dec)
+ popl KEYP
+ popl LEN
+ #endif
++ pax_force_retaddr 0, 1
+ ret
++ENDPROC(aesni_ecb_dec)
+
+ /*
+ * void aesni_cbc_enc(struct crypto_aes_ctx *ctx, const u8 *dst, u8 *src,
+@@ -2410,7 +2433,9 @@ ENTRY(aesni_cbc_enc)
+ popl LEN
+ popl IVP
+ #endif
++ pax_force_retaddr 0, 1
+ ret
++ENDPROC(aesni_cbc_enc)
+
+ /*
+ * void aesni_cbc_dec(struct crypto_aes_ctx *ctx, const u8 *dst, u8 *src,
+@@ -2498,7 +2523,9 @@ ENTRY(aesni_cbc_dec)
+ popl LEN
+ popl IVP
+ #endif
++ pax_force_retaddr 0, 1
+ ret
++ENDPROC(aesni_cbc_dec)
+
+ #ifdef __x86_64__
+ .align 16
+@@ -2524,6 +2551,7 @@ _aesni_inc_init:
+ mov $1, TCTR_LOW
+ MOVQ_R64_XMM TCTR_LOW INC
+ MOVQ_R64_XMM CTR TCTR_LOW
++ pax_force_retaddr_bts
+ ret
+
+ /*
+@@ -2552,6 +2580,7 @@ _aesni_inc:
+ .Linc_low:
+ movaps CTR, IV
+ PSHUFB_XMM BSWAP_MASK IV
++ pax_force_retaddr_bts
+ ret
+
+ /*
+@@ -2612,5 +2641,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
+diff --git a/arch/x86/crypto/blowfish-x86_64-asm_64.S b/arch/x86/crypto/blowfish-x86_64-asm_64.S
+index 391d245..67f35c2 100644
+--- a/arch/x86/crypto/blowfish-x86_64-asm_64.S
++++ b/arch/x86/crypto/blowfish-x86_64-asm_64.S
+@@ -20,6 +20,8 @@
+ *
+ */
+
++#include <asm/alternative-asm.h>
++
+ .file "blowfish-x86_64-asm.S"
+ .text
+
+@@ -151,9 +153,11 @@ __blowfish_enc_blk:
+ jnz __enc_xor;
+
+ write_block();
++ pax_force_retaddr 0, 1
+ ret;
+ __enc_xor:
+ xor_block();
++ pax_force_retaddr 0, 1
+ ret;
+
+ .align 8
+@@ -188,6 +192,7 @@ blowfish_dec_blk:
+
+ movq %r11, %rbp;
+
++ pax_force_retaddr 0, 1
+ ret;
+
+ /**********************************************************************
+@@ -342,6 +347,7 @@ __blowfish_enc_blk_4way:
+
+ popq %rbx;
+ popq %rbp;
++ pax_force_retaddr 0, 1
+ ret;
+
+ __enc_xor4:
+@@ -349,6 +355,7 @@ __enc_xor4:
+
+ popq %rbx;
+ popq %rbp;
++ pax_force_retaddr 0, 1
+ ret;
+
+ .align 8
+@@ -386,5 +393,6 @@ blowfish_dec_blk_4way:
+ popq %rbx;
+ popq %rbp;
+
++ pax_force_retaddr 0, 1
+ ret;
+
diff --git a/arch/x86/crypto/salsa20-x86_64-asm_64.S b/arch/x86/crypto/salsa20-x86_64-asm_64.S
-index 6214a9b..5c0f959 100644
+index 6214a9b..1f4fc9a 100644
--- a/arch/x86/crypto/salsa20-x86_64-asm_64.S
+++ b/arch/x86/crypto/salsa20-x86_64-asm_64.S
@@ -1,3 +1,5 @@
@@ -6291,7 +6485,7 @@ index 6214a9b..5c0f959 100644
add %r11,%rsp
mov %rdi,%rax
mov %rsi,%rdx
-+ pax_force_retaddr
++ pax_force_retaddr 0, 1
ret
# bytesatleast65:
._bytesatleast65:
@@ -6309,8 +6503,65 @@ index 6214a9b..5c0f959 100644
mov %rsi,%rdx
+ pax_force_retaddr
ret
+diff --git a/arch/x86/crypto/sha1_ssse3_asm.S b/arch/x86/crypto/sha1_ssse3_asm.S
+index b2c2f57..8470cab 100644
+--- a/arch/x86/crypto/sha1_ssse3_asm.S
++++ b/arch/x86/crypto/sha1_ssse3_asm.S
+@@ -28,6 +28,8 @@
+ * (at your option) any later version.
+ */
+
++#include <asm/alternative-asm.h>
++
+ #define CTX %rdi // arg1
+ #define BUF %rsi // arg2
+ #define CNT %rdx // arg3
+@@ -104,6 +106,7 @@
+ pop %r12
+ pop %rbp
+ pop %rbx
++ pax_force_retaddr 0, 1
+ ret
+
+ .size \name, .-\name
+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 5b012a2..36d5364 100644
+--- a/arch/x86/crypto/twofish-x86_64-asm_64-3way.S
++++ b/arch/x86/crypto/twofish-x86_64-asm_64-3way.S
+@@ -20,6 +20,8 @@
+ *
+ */
+
++#include <asm/alternative-asm.h>
++
+ .file "twofish-x86_64-asm-3way.S"
+ .text
+
+@@ -260,6 +262,7 @@ __twofish_enc_blk_3way:
+ popq %r13;
+ popq %r14;
+ popq %r15;
++ pax_force_retaddr 0, 1
+ ret;
+
+ __enc_xor3:
+@@ -271,6 +274,7 @@ __enc_xor3:
+ popq %r13;
+ popq %r14;
+ popq %r15;
++ pax_force_retaddr 0, 1
+ ret;
+
+ .global twofish_dec_blk_3way
+@@ -312,5 +316,6 @@ twofish_dec_blk_3way:
+ popq %r13;
+ popq %r14;
+ popq %r15;
++ pax_force_retaddr 0, 1
+ ret;
+
diff --git a/arch/x86/crypto/twofish-x86_64-asm_64.S b/arch/x86/crypto/twofish-x86_64-asm_64.S
-index 573aa10..7289973 100644
+index 7bcf3fc..f53832f 100644
--- a/arch/x86/crypto/twofish-x86_64-asm_64.S
+++ b/arch/x86/crypto/twofish-x86_64-asm_64.S
@@ -21,6 +21,7 @@
@@ -6321,19 +6572,19 @@ index 573aa10..7289973 100644
#define a_offset 0
#define b_offset 4
-@@ -269,6 +270,7 @@ twofish_enc_blk:
+@@ -268,6 +269,7 @@ twofish_enc_blk:
popq R1
movq $1,%rax
-+ pax_force_retaddr
++ pax_force_retaddr 0, 1
ret
twofish_dec_blk:
-@@ -321,4 +323,5 @@ twofish_dec_blk:
+@@ -319,4 +321,5 @@ twofish_dec_blk:
popq R1
movq $1,%rax
-+ pax_force_retaddr
++ pax_force_retaddr 0, 1
ret
diff --git a/arch/x86/ia32/ia32_aout.c b/arch/x86/ia32/ia32_aout.c
index fd84387..0b4af7d 100644
@@ -6349,10 +6600,10 @@ index fd84387..0b4af7d 100644
set_fs(KERNEL_DS);
has_dumped = 1;
diff --git a/arch/x86/ia32/ia32_signal.c b/arch/x86/ia32/ia32_signal.c
-index 588a7aa..a3468b0 100644
+index 6557769..ef6ae89 100644
--- a/arch/x86/ia32/ia32_signal.c
+++ b/arch/x86/ia32/ia32_signal.c
-@@ -167,7 +167,7 @@ asmlinkage long sys32_sigaltstack(const stack_ia32_t __user *uss_ptr,
+@@ -169,7 +169,7 @@ asmlinkage long sys32_sigaltstack(const stack_ia32_t __user *uss_ptr,
}
seg = get_fs();
set_fs(KERNEL_DS);
@@ -6361,7 +6612,7 @@ index 588a7aa..a3468b0 100644
set_fs(seg);
if (ret >= 0 && uoss_ptr) {
if (!access_ok(VERIFY_WRITE, uoss_ptr, sizeof(stack_ia32_t)))
-@@ -374,7 +374,7 @@ static int ia32_setup_sigcontext(struct sigcontext_ia32 __user *sc,
+@@ -370,7 +370,7 @@ static int ia32_setup_sigcontext(struct sigcontext_ia32 __user *sc,
*/
static void __user *get_sigframe(struct k_sigaction *ka, struct pt_regs *regs,
size_t frame_size,
@@ -6370,7 +6621,7 @@ index 588a7aa..a3468b0 100644
{
unsigned long sp;
-@@ -395,7 +395,7 @@ static void __user *get_sigframe(struct k_sigaction *ka, struct pt_regs *regs,
+@@ -391,7 +391,7 @@ static void __user *get_sigframe(struct k_sigaction *ka, struct pt_regs *regs,
if (used_math()) {
sp = sp - sig_xstate_ia32_size;
@@ -6379,7 +6630,7 @@ index 588a7aa..a3468b0 100644
if (save_i387_xstate_ia32(*fpstate) < 0)
return (void __user *) -1L;
}
-@@ -403,7 +403,7 @@ static void __user *get_sigframe(struct k_sigaction *ka, struct pt_regs *regs,
+@@ -399,7 +399,7 @@ static void __user *get_sigframe(struct k_sigaction *ka, struct pt_regs *regs,
sp -= frame_size;
/* Align the stack pointer according to the i386 ABI,
* i.e. so that on function entry ((sp + 4) & 15) == 0. */
@@ -6388,7 +6639,7 @@ index 588a7aa..a3468b0 100644
return (void __user *) sp;
}
-@@ -461,7 +461,7 @@ int ia32_setup_frame(int sig, struct k_sigaction *ka,
+@@ -457,7 +457,7 @@ int ia32_setup_frame(int sig, struct k_sigaction *ka,
* These are actually not used anymore, but left because some
* gdb versions depend on them as a marker.
*/
@@ -6397,7 +6648,7 @@ index 588a7aa..a3468b0 100644
} put_user_catch(err);
if (err)
-@@ -503,7 +503,7 @@ int ia32_setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
+@@ -499,7 +499,7 @@ int ia32_setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
0xb8,
__NR_ia32_rt_sigreturn,
0x80cd,
@@ -6406,7 +6657,7 @@ index 588a7aa..a3468b0 100644
};
frame = get_sigframe(ka, regs, sizeof(*frame), &fpstate);
-@@ -533,16 +533,18 @@ int ia32_setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
+@@ -529,16 +529,18 @@ int ia32_setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
if (ka->sa.sa_flags & SA_RESTORER)
restorer = ka->sa.sa_restorer;
@@ -6429,7 +6680,7 @@ index 588a7aa..a3468b0 100644
if (err)
diff --git a/arch/x86/ia32/ia32entry.S b/arch/x86/ia32/ia32entry.S
-index c1870dd..c60154f 100644
+index a6253ec..4ad2120 100644
--- a/arch/x86/ia32/ia32entry.S
+++ b/arch/x86/ia32/ia32entry.S
@@ -13,7 +13,9 @@
@@ -6442,11 +6693,12 @@ index c1870dd..c60154f 100644
/* Avoid __ASSEMBLER__'ifying <linux/audit.h> just for this. */
#include <linux/elf-em.h>
-@@ -95,6 +97,29 @@ ENTRY(native_irq_enable_sysexit)
+@@ -95,6 +97,32 @@ ENTRY(native_irq_enable_sysexit)
ENDPROC(native_irq_enable_sysexit)
#endif
+ .macro pax_enter_kernel_user
++ pax_set_fptr_mask
+#ifdef CONFIG_PAX_MEMORY_UDEREF
+ call pax_enter_kernel_user
+#endif
@@ -6458,62 +6710,101 @@ index c1870dd..c60154f 100644
+#endif
+#ifdef CONFIG_PAX_RANDKSTACK
+ pushq %rax
++ pushq %r11
+ call pax_randomize_kstack
++ popq %r11
+ popq %rax
+#endif
+ .endm
+
-+ .macro pax_erase_kstack
++.macro pax_erase_kstack
+#ifdef CONFIG_PAX_MEMORY_STACKLEAK
+ call pax_erase_kstack
+#endif
-+ .endm
++.endm
+
/*
* 32bit SYSENTER instruction entry.
*
-@@ -121,7 +146,7 @@ ENTRY(ia32_sysenter_target)
+@@ -121,12 +149,6 @@ ENTRY(ia32_sysenter_target)
CFI_REGISTER rsp,rbp
SWAPGS_UNSAFE_STACK
movq PER_CPU_VAR(kernel_stack), %rsp
- addq $(KERNEL_STACK_OFFSET),%rsp
-+ pax_enter_kernel_user
- /*
- * No need to follow this irqs on/off section: the syscall
- * disabled irqs, here we enable it straight after entry:
-@@ -134,7 +159,8 @@ ENTRY(ia32_sysenter_target)
+- /*
+- * No need to follow this irqs on/off section: the syscall
+- * disabled irqs, here we enable it straight after entry:
+- */
+- ENABLE_INTERRUPTS(CLBR_NONE)
+ movl %ebp,%ebp /* zero extension */
+ pushq_cfi $__USER32_DS
+ /*CFI_REL_OFFSET ss,0*/
+@@ -134,25 +156,39 @@ ENTRY(ia32_sysenter_target)
CFI_REL_OFFSET rsp,0
pushfq_cfi
/*CFI_REL_OFFSET rflags,0*/
- movl 8*3-THREAD_SIZE+TI_sysenter_return(%rsp), %r10d
-+ GET_THREAD_INFO(%r10)
-+ movl TI_sysenter_return(%r10), %r10d
- CFI_REGISTER rip,r10
+- CFI_REGISTER rip,r10
++ orl $X86_EFLAGS_IF,(%rsp)
++ GET_THREAD_INFO(%r11)
++ movl TI_sysenter_return(%r11), %r11d
++ CFI_REGISTER rip,r11
pushq_cfi $__USER32_CS
/*CFI_REL_OFFSET cs,0*/
-@@ -146,6 +172,12 @@ ENTRY(ia32_sysenter_target)
- SAVE_ARGS 0,0,1
+ movl %eax, %eax
+- pushq_cfi %r10
++ pushq_cfi %r11
+ CFI_REL_OFFSET rip,0
+ pushq_cfi %rax
+ cld
+ SAVE_ARGS 0,1,0
++ pax_enter_kernel_user
++ /*
++ * No need to follow this irqs on/off section: the syscall
++ * disabled irqs, here we enable it straight after entry:
++ */
++ ENABLE_INTERRUPTS(CLBR_NONE)
/* no need to do an access_ok check here because rbp has been
32bit zero extended */
+
+#ifdef CONFIG_PAX_MEMORY_UDEREF
-+ mov $PAX_USER_SHADOW_BASE,%r10
-+ add %r10,%rbp
++ mov $PAX_USER_SHADOW_BASE,%r11
++ add %r11,%rbp
+#endif
+
1: movl (%rbp),%ebp
.section __ex_table,"a"
.quad 1b,ia32_badarg
-@@ -168,6 +200,8 @@ sysenter_dispatch:
- testl $_TIF_ALLWORK_MASK,TI_flags(%r10)
+ .previous
+- GET_THREAD_INFO(%r10)
+- orl $TS_COMPAT,TI_status(%r10)
+- testl $_TIF_WORK_SYSCALL_ENTRY,TI_flags(%r10)
++ GET_THREAD_INFO(%r11)
++ orl $TS_COMPAT,TI_status(%r11)
++ testl $_TIF_WORK_SYSCALL_ENTRY,TI_flags(%r11)
+ CFI_REMEMBER_STATE
+ jnz sysenter_tracesys
+ cmpq $(IA32_NR_syscalls-1),%rax
+@@ -162,13 +198,15 @@ sysenter_do_call:
+ sysenter_dispatch:
+ call *ia32_sys_call_table(,%rax,8)
+ movq %rax,RAX-ARGOFFSET(%rsp)
+- GET_THREAD_INFO(%r10)
++ GET_THREAD_INFO(%r11)
+ DISABLE_INTERRUPTS(CLBR_NONE)
+ TRACE_IRQS_OFF
+- testl $_TIF_ALLWORK_MASK,TI_flags(%r10)
++ testl $_TIF_ALLWORK_MASK,TI_flags(%r11)
jnz sysexit_audit
sysexit_from_sys_call:
+- andl $~TS_COMPAT,TI_status(%r10)
+ pax_exit_kernel_user
+ pax_erase_kstack
- andl $~TS_COMPAT,TI_status(%r10)
++ andl $~TS_COMPAT,TI_status(%r11)
/* clear IF, that popfq doesn't enable interrupts early */
andl $~0x200,EFLAGS-R11(%rsp)
-@@ -194,6 +228,9 @@ sysexit_from_sys_call:
+ movl RIP-R11(%rsp),%edx /* User %eip */
+@@ -194,6 +232,9 @@ sysexit_from_sys_call:
movl %eax,%esi /* 2nd arg: syscall number */
movl $AUDIT_ARCH_I386,%edi /* 1st arg: audit arch */
call audit_syscall_entry
@@ -6523,7 +6814,40 @@ index c1870dd..c60154f 100644
movl RAX-ARGOFFSET(%rsp),%eax /* reload syscall number */
cmpq $(IA32_NR_syscalls-1),%rax
ja ia32_badsys
-@@ -246,6 +283,9 @@ sysenter_tracesys:
+@@ -205,7 +246,7 @@ sysexit_from_sys_call:
+ .endm
+
+ .macro auditsys_exit exit
+- testl $(_TIF_ALLWORK_MASK & ~_TIF_SYSCALL_AUDIT),TI_flags(%r10)
++ testl $(_TIF_ALLWORK_MASK & ~_TIF_SYSCALL_AUDIT),TI_flags(%r11)
+ jnz ia32_ret_from_sys_call
+ TRACE_IRQS_ON
+ sti
+@@ -215,12 +256,12 @@ sysexit_from_sys_call:
+ movzbl %al,%edi /* zero-extend that into %edi */
+ inc %edi /* first arg, 0->1(AUDITSC_SUCCESS), 1->2(AUDITSC_FAILURE) */
+ call audit_syscall_exit
+- GET_THREAD_INFO(%r10)
++ GET_THREAD_INFO(%r11)
+ movl RAX-ARGOFFSET(%rsp),%eax /* reload syscall return value */
+ movl $(_TIF_ALLWORK_MASK & ~_TIF_SYSCALL_AUDIT),%edi
+ cli
+ TRACE_IRQS_OFF
+- testl %edi,TI_flags(%r10)
++ testl %edi,TI_flags(%r11)
+ jz \exit
+ CLEAR_RREGS -ARGOFFSET
+ jmp int_with_check
+@@ -238,7 +279,7 @@ sysexit_audit:
+
+ sysenter_tracesys:
+ #ifdef CONFIG_AUDITSYSCALL
+- testl $(_TIF_WORK_SYSCALL_ENTRY & ~_TIF_SYSCALL_AUDIT),TI_flags(%r10)
++ testl $(_TIF_WORK_SYSCALL_ENTRY & ~_TIF_SYSCALL_AUDIT),TI_flags(%r11)
+ jz sysenter_auditsys
+ #endif
+ SAVE_REST
+@@ -246,6 +287,9 @@ sysenter_tracesys:
movq $-ENOSYS,RAX(%rsp)/* ptrace can change this for a bad syscall */
movq %rsp,%rdi /* &pt_regs -> arg1 */
call syscall_trace_enter
@@ -6533,7 +6857,7 @@ index c1870dd..c60154f 100644
LOAD_ARGS32 ARGOFFSET /* reload args from stack in case ptrace changed it */
RESTORE_REST
cmpq $(IA32_NR_syscalls-1),%rax
-@@ -277,19 +317,24 @@ ENDPROC(ia32_sysenter_target)
+@@ -277,19 +321,20 @@ ENDPROC(ia32_sysenter_target)
ENTRY(ia32_cstar_target)
CFI_STARTPROC32 simple
CFI_SIGNAL_FRAME
@@ -6545,43 +6869,68 @@ index c1870dd..c60154f 100644
movl %esp,%r8d
CFI_REGISTER rsp,r8
movq PER_CPU_VAR(kernel_stack),%rsp
-+
-+#ifdef CONFIG_PAX_MEMORY_UDEREF
++ SAVE_ARGS 8*6,0,0
+ pax_enter_kernel_user
-+#endif
-+
/*
* No need to follow this irqs on/off section: the syscall
* disabled irqs and here we enable it straight after entry:
*/
ENABLE_INTERRUPTS(CLBR_NONE)
-- SAVE_ARGS 8,1,1
-+ SAVE_ARGS 8*6,1,1
+- SAVE_ARGS 8,0,0
movl %eax,%eax /* zero extension */
movq %rax,ORIG_RAX-ARGOFFSET(%rsp)
movq %rcx,RIP-ARGOFFSET(%rsp)
-@@ -305,6 +350,12 @@ ENTRY(ia32_cstar_target)
+@@ -305,13 +350,19 @@ ENTRY(ia32_cstar_target)
/* no need to do an access_ok check here because r8 has been
32bit zero extended */
/* hardware stack frame is complete now */
+
+#ifdef CONFIG_PAX_MEMORY_UDEREF
-+ mov $PAX_USER_SHADOW_BASE,%r10
-+ add %r10,%r8
++ mov $PAX_USER_SHADOW_BASE,%r11
++ add %r11,%r8
+#endif
+
1: movl (%r8),%r9d
.section __ex_table,"a"
.quad 1b,ia32_badarg
-@@ -327,6 +378,8 @@ cstar_dispatch:
- testl $_TIF_ALLWORK_MASK,TI_flags(%r10)
+ .previous
+- GET_THREAD_INFO(%r10)
+- orl $TS_COMPAT,TI_status(%r10)
+- testl $_TIF_WORK_SYSCALL_ENTRY,TI_flags(%r10)
++ GET_THREAD_INFO(%r11)
++ orl $TS_COMPAT,TI_status(%r11)
++ testl $_TIF_WORK_SYSCALL_ENTRY,TI_flags(%r11)
+ CFI_REMEMBER_STATE
+ jnz cstar_tracesys
+ cmpq $IA32_NR_syscalls-1,%rax
+@@ -321,13 +372,15 @@ cstar_do_call:
+ cstar_dispatch:
+ call *ia32_sys_call_table(,%rax,8)
+ movq %rax,RAX-ARGOFFSET(%rsp)
+- GET_THREAD_INFO(%r10)
++ GET_THREAD_INFO(%r11)
+ DISABLE_INTERRUPTS(CLBR_NONE)
+ TRACE_IRQS_OFF
+- testl $_TIF_ALLWORK_MASK,TI_flags(%r10)
++ testl $_TIF_ALLWORK_MASK,TI_flags(%r11)
jnz sysretl_audit
sysretl_from_sys_call:
+- andl $~TS_COMPAT,TI_status(%r10)
+ pax_exit_kernel_user
+ pax_erase_kstack
- andl $~TS_COMPAT,TI_status(%r10)
- RESTORE_ARGS 1,-ARG_SKIP,1,1,1
++ andl $~TS_COMPAT,TI_status(%r11)
+ RESTORE_ARGS 0,-ARG_SKIP,0,0,0
movl RIP-ARGOFFSET(%rsp),%ecx
+ CFI_REGISTER rip,rcx
+@@ -355,7 +408,7 @@ sysretl_audit:
+
+ cstar_tracesys:
+ #ifdef CONFIG_AUDITSYSCALL
+- testl $(_TIF_WORK_SYSCALL_ENTRY & ~_TIF_SYSCALL_AUDIT),TI_flags(%r10)
++ testl $(_TIF_WORK_SYSCALL_ENTRY & ~_TIF_SYSCALL_AUDIT),TI_flags(%r11)
+ jz cstar_auditsys
+ #endif
+ xchgl %r9d,%ebp
@@ -364,6 +417,9 @@ cstar_tracesys:
movq $-ENOSYS,RAX(%rsp) /* ptrace can change this for a bad syscall */
movq %rsp,%rdi /* &pt_regs -> arg1 */
@@ -6592,14 +6941,36 @@ index c1870dd..c60154f 100644
LOAD_ARGS32 ARGOFFSET, 1 /* reload args from stack in case ptrace changed it */
RESTORE_REST
xchgl %ebp,%r9d
-@@ -409,6 +465,7 @@ ENTRY(ia32_syscall)
+@@ -409,20 +465,21 @@ ENTRY(ia32_syscall)
CFI_REL_OFFSET rip,RIP-RIP
PARAVIRT_ADJUST_EXCEPTION_FRAME
SWAPGS
+- /*
+- * No need to follow this irqs on/off section: the syscall
+- * disabled irqs and here we enable it straight after entry:
+- */
+- ENABLE_INTERRUPTS(CLBR_NONE)
+ movl %eax,%eax
+ pushq_cfi %rax
+ cld
+ /* note the registers are not zero extended to the sf.
+ this could be a problem. */
+ SAVE_ARGS 0,1,0
+- GET_THREAD_INFO(%r10)
+- orl $TS_COMPAT,TI_status(%r10)
+- testl $_TIF_WORK_SYSCALL_ENTRY,TI_flags(%r10)
+ pax_enter_kernel_user
- /*
- * No need to follow this irqs on/off section: the syscall
- * disabled irqs and here we enable it straight after entry:
++ /*
++ * No need to follow this irqs on/off section: the syscall
++ * disabled irqs and here we enable it straight after entry:
++ */
++ ENABLE_INTERRUPTS(CLBR_NONE)
++ GET_THREAD_INFO(%r11)
++ orl $TS_COMPAT,TI_status(%r11)
++ testl $_TIF_WORK_SYSCALL_ENTRY,TI_flags(%r11)
+ jnz ia32_tracesys
+ cmpq $(IA32_NR_syscalls-1),%rax
+ ja ia32_badsys
@@ -441,6 +498,9 @@ ia32_tracesys:
movq $-ENOSYS,RAX(%rsp) /* ptrace can change this for a bad syscall */
movq %rsp,%rdi /* &pt_regs -> arg1 */
@@ -6619,7 +6990,7 @@ index c1870dd..c60154f 100644
CFI_ENDPROC
diff --git a/arch/x86/ia32/sys_ia32.c b/arch/x86/ia32/sys_ia32.c
-index 5852519..ac198bc 100644
+index f6f5c53..b358b28 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,
@@ -6690,35 +7061,73 @@ index 5852519..ac198bc 100644
set_fs(old_fs);
diff --git a/arch/x86/include/asm/alternative-asm.h b/arch/x86/include/asm/alternative-asm.h
-index 94d420b..f7854e1 100644
+index 091508b..e245ff2 100644
--- a/arch/x86/include/asm/alternative-asm.h
+++ b/arch/x86/include/asm/alternative-asm.h
-@@ -15,6 +15,20 @@
+@@ -4,10 +4,10 @@
+
+ #ifdef CONFIG_SMP
+ .macro LOCK_PREFIX
+-1: lock
++672: lock
+ .section .smp_locks,"a"
+ .balign 4
+- .long 1b - .
++ .long 672b - .
+ .previous
+ .endm
+ #else
+@@ -15,6 +15,45 @@
.endm
#endif
+#ifdef CONFIG_PAX_KERNEXEC_PLUGIN
-+ .macro pax_force_retaddr rip=0
++ .macro pax_force_retaddr_bts rip=0
++ btsq $63,\rip(%rsp)
++ .endm
++#ifdef CONFIG_PAX_KERNEXEC_PLUGIN_METHOD_BTS
++ .macro pax_force_retaddr rip=0, reload=0
+ btsq $63,\rip(%rsp)
+ .endm
+ .macro pax_force_fptr ptr
+ btsq $63,\ptr
+ .endm
++ .macro pax_set_fptr_mask
++ .endm
++#endif
++#ifdef CONFIG_PAX_KERNEXEC_PLUGIN_METHOD_OR
++ .macro pax_force_retaddr rip=0, reload=0
++ .if \reload
++ pax_set_fptr_mask
++ .endif
++ orq %r10,\rip(%rsp)
++ .endm
++ .macro pax_force_fptr ptr
++ orq %r10,\ptr
++ .endm
++ .macro pax_set_fptr_mask
++ movabs $0x8000000000000000,%r10
++ .endm
++#endif
+#else
-+ .macro pax_force_retaddr rip=0
++ .macro pax_force_retaddr rip=0, reload=0
+ .endm
+ .macro pax_force_fptr ptr
+ .endm
++ .macro pax_force_retaddr_bts rip=0
++ .endm
++ .macro pax_set_fptr_mask
++ .endm
+#endif
+
.macro altinstruction_entry orig alt feature orig_len alt_len
- .align 8
- .quad \orig
+ .long \orig - .
+ .long \alt - .
diff --git a/arch/x86/include/asm/alternative.h b/arch/x86/include/asm/alternative.h
-index bf535f9..ae78f95 100644
+index 37ad100..7d47faa 100644
--- a/arch/x86/include/asm/alternative.h
+++ b/arch/x86/include/asm/alternative.h
-@@ -93,7 +93,7 @@ static inline int alternatives_text_reserved(void *start, void *end)
+@@ -89,7 +89,7 @@ static inline int alternatives_text_reserved(void *start, void *end)
".section .discard,\"aw\",@progbits\n" \
" .byte 0xff + (664f-663f) - (662b-661b)\n" /* rlen <= slen */ \
".previous\n" \
@@ -6728,7 +7137,7 @@ index bf535f9..ae78f95 100644
".previous"
diff --git a/arch/x86/include/asm/apic.h b/arch/x86/include/asm/apic.h
-index 244ac77..0963a9d 100644
+index 1a6c09a..fec2432 100644
--- a/arch/x86/include/asm/apic.h
+++ b/arch/x86/include/asm/apic.h
@@ -45,7 +45,7 @@ static inline void generic_apic_probe(void)
@@ -6763,7 +7172,7 @@ index 20370c6..a2eb9b0 100644
"popl %%ebp\n\t"
"popl %%edi\n\t"
diff --git a/arch/x86/include/asm/atomic.h b/arch/x86/include/asm/atomic.h
-index 952a826..8a9371d 100644
+index 58cb6d4..ca9010d 100644
--- a/arch/x86/include/asm/atomic.h
+++ b/arch/x86/include/asm/atomic.h
@@ -22,7 +22,18 @@
@@ -7016,54 +7425,51 @@ index 952a826..8a9371d 100644
: "+m" (v->counter), "=qm" (c)
: "ir" (i) : "memory");
return c;
-@@ -180,6 +342,46 @@ static inline int atomic_add_return(int i, atomic_t *v)
+@@ -179,7 +341,7 @@ static inline int atomic_add_return(int i, atomic_t *v)
+ goto no_xadd;
#endif
/* Modern 486+ processor */
- __i = i;
-+ asm volatile(LOCK_PREFIX "xaddl %0, %1\n"
-+
-+#ifdef CONFIG_PAX_REFCOUNT
-+ "jno 0f\n"
-+ "movl %0, %1\n"
-+ "int $4\n0:\n"
-+ _ASM_EXTABLE(0b, 0b)
-+#endif
-+
-+ : "+r" (i), "+m" (v->counter)
-+ : : "memory");
-+ return i + __i;
-+
-+#ifdef CONFIG_M386
-+no_xadd: /* Legacy 386 processor */
-+ local_irq_save(flags);
-+ __i = atomic_read(v);
-+ atomic_set(v, i + __i);
-+ local_irq_restore(flags);
-+ return i + __i;
-+#endif
-+}
-+
-+/**
+- return i + xadd(&v->counter, i);
++ return i + xadd_check_overflow(&v->counter, i);
+
+ #ifdef CONFIG_M386
+ no_xadd: /* Legacy 386 processor */
+@@ -192,6 +354,34 @@ no_xadd: /* Legacy 386 processor */
+ }
+
+ /**
+ * atomic_add_return_unchecked - add integer and return
-+ * @v: pointer of type atomic_unchecked_t
+ * @i: integer value to add
++ * @v: pointer of type atomic_unchecked_t
+ *
+ * Atomically adds @i to @v and returns @i + @v
+ */
+static inline int atomic_add_return_unchecked(int i, atomic_unchecked_t *v)
+{
-+ int __i;
+#ifdef CONFIG_M386
++ int __i;
+ unsigned long flags;
+ if (unlikely(boot_cpu_data.x86 <= 3))
+ goto no_xadd;
+#endif
+ /* Modern 486+ processor */
-+ __i = i;
- asm volatile(LOCK_PREFIX "xaddl %0, %1"
- : "+r" (i), "+m" (v->counter)
- : : "memory");
-@@ -208,6 +410,10 @@ static inline int atomic_sub_return(int i, atomic_t *v)
++ return i + xadd(&v->counter, i);
++
++#ifdef CONFIG_M386
++no_xadd: /* Legacy 386 processor */
++ raw_local_irq_save(flags);
++ __i = atomic_read_unchecked(v);
++ atomic_set_unchecked(v, i + __i);
++ raw_local_irq_restore(flags);
++ return i + __i;
++#endif
++}
++
++/**
+ * atomic_sub_return - subtract integer and return
+ * @v: pointer of type atomic_t
+ * @i: integer value to subtract
+@@ -204,6 +394,10 @@ static inline int atomic_sub_return(int i, atomic_t *v)
}
#define atomic_inc_return(v) (atomic_add_return(1, v))
@@ -7074,7 +7480,7 @@ index 952a826..8a9371d 100644
#define atomic_dec_return(v) (atomic_sub_return(1, v))
static inline int atomic_cmpxchg(atomic_t *v, int old, int new)
-@@ -215,11 +421,21 @@ static inline int atomic_cmpxchg(atomic_t *v, int old, int new)
+@@ -211,11 +405,21 @@ static inline int atomic_cmpxchg(atomic_t *v, int old, int new)
return cmpxchg(&v->counter, old, new);
}
@@ -7094,11 +7500,11 @@ index 952a826..8a9371d 100644
+}
+
/**
- * atomic_add_unless - add unless the number is already a given value
+ * __atomic_add_unless - add unless the number is already a given value
* @v: pointer of type atomic_t
-@@ -231,21 +447,77 @@ static inline int atomic_xchg(atomic_t *v, int new)
+@@ -227,12 +431,25 @@ static inline int atomic_xchg(atomic_t *v, int new)
*/
- static inline int atomic_add_unless(atomic_t *v, int a, int u)
+ static inline int __atomic_add_unless(atomic_t *v, int a, int u)
{
- int c, old;
+ int c, old, new;
@@ -7125,13 +7531,10 @@ index 952a826..8a9371d 100644
if (likely(old == c))
break;
c = old;
- }
-- return c != (u);
-+ return c != u;
+@@ -240,6 +457,48 @@ static inline int __atomic_add_unless(atomic_t *v, int a, int u)
+ return c;
}
- #define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0)
-
+/**
+ * atomic_inc_not_zero_hint - increment if not null
+ * @v: pointer of type atomic_t
@@ -7151,7 +7554,7 @@ index 952a826..8a9371d 100644
+
+ /* sanity test, should be removed by compiler if hint is a constant */
+ if (!hint)
-+ return atomic_inc_not_zero(v);
++ return __atomic_add_unless(v, 1, 0);
+
+ do {
+ asm volatile("incl %0\n"
@@ -7174,12 +7577,11 @@ index 952a826..8a9371d 100644
+
+ return 0;
+}
-+
+
/*
* atomic_dec_if_positive - decrement by 1 if old value positive
- * @v: pointer of type atomic_t
diff --git a/arch/x86/include/asm/atomic64_32.h b/arch/x86/include/asm/atomic64_32.h
-index 2a934aa..42d2411 100644
+index 24098aa..1e37723 100644
--- a/arch/x86/include/asm/atomic64_32.h
+++ b/arch/x86/include/asm/atomic64_32.h
@@ -12,6 +12,14 @@ typedef struct {
@@ -7332,7 +7734,7 @@ index 2a934aa..42d2411 100644
* @i: integer value to subtract
* @v: pointer to type atomic64_t
diff --git a/arch/x86/include/asm/atomic64_64.h b/arch/x86/include/asm/atomic64_64.h
-index 49fd1ea..8c58977 100644
+index 0e1cbfc..5623683 100644
--- a/arch/x86/include/asm/atomic64_64.h
+++ b/arch/x86/include/asm/atomic64_64.h
@@ -18,7 +18,19 @@
@@ -7565,23 +7967,11 @@ index 49fd1ea..8c58977 100644
: "=m" (v->counter), "=qm" (c)
: "er" (i), "m" (v->counter) : "memory");
return c;
-@@ -171,7 +317,31 @@ static inline int atomic64_add_negative(long i, atomic64_t *v)
+@@ -170,6 +316,18 @@ static inline int atomic64_add_negative(long i, atomic64_t *v)
+ */
static inline long atomic64_add_return(long i, atomic64_t *v)
{
- long __i = i;
-- asm volatile(LOCK_PREFIX "xaddq %0, %1;"
-+ asm volatile(LOCK_PREFIX "xaddq %0, %1\n"
-+
-+#ifdef CONFIG_PAX_REFCOUNT
-+ "jno 0f\n"
-+ "movq %0, %1\n"
-+ "int $4\n0:\n"
-+ _ASM_EXTABLE(0b, 0b)
-+#endif
-+
-+ : "+r" (i), "+m" (v->counter)
-+ : : "memory");
-+ return i + __i;
++ return i + xadd_check_overflow(&v->counter, i);
+}
+
+/**
@@ -7593,12 +7983,10 @@ index 49fd1ea..8c58977 100644
+ */
+static inline long atomic64_add_return_unchecked(long i, atomic64_unchecked_t *v)
+{
-+ long __i = i;
-+ asm volatile(LOCK_PREFIX "xaddq %0, %1"
- : "+r" (i), "+m" (v->counter)
- : : "memory");
- return i + __i;
-@@ -183,6 +353,10 @@ static inline long atomic64_sub_return(long i, atomic64_t *v)
+ return i + xadd(&v->counter, i);
+ }
+
+@@ -179,6 +337,10 @@ static inline long atomic64_sub_return(long i, atomic64_t *v)
}
#define atomic64_inc_return(v) (atomic64_add_return(1, (v)))
@@ -7609,7 +7997,7 @@ index 49fd1ea..8c58977 100644
#define atomic64_dec_return(v) (atomic64_sub_return(1, (v)))
static inline long atomic64_cmpxchg(atomic64_t *v, long old, long new)
-@@ -190,6 +364,11 @@ static inline long atomic64_cmpxchg(atomic64_t *v, long old, long new)
+@@ -186,6 +348,11 @@ static inline long atomic64_cmpxchg(atomic64_t *v, long old, long new)
return cmpxchg(&v->counter, old, new);
}
@@ -7621,7 +8009,7 @@ index 49fd1ea..8c58977 100644
static inline long atomic64_xchg(atomic64_t *v, long new)
{
return xchg(&v->counter, new);
-@@ -206,17 +385,30 @@ static inline long atomic64_xchg(atomic64_t *v, long new)
+@@ -202,17 +369,30 @@ static inline long atomic64_xchg(atomic64_t *v, long new)
*/
static inline int atomic64_add_unless(atomic64_t *v, long a, long u)
{
@@ -7657,7 +8045,7 @@ index 49fd1ea..8c58977 100644
#define atomic64_inc_not_zero(v) atomic64_add_unless((v), 1, 0)
diff --git a/arch/x86/include/asm/bitops.h b/arch/x86/include/asm/bitops.h
-index 69d5813..0b1900e 100644
+index 1775d6e..b65017f 100644
--- a/arch/x86/include/asm/bitops.h
+++ b/arch/x86/include/asm/bitops.h
@@ -38,7 +38,7 @@
@@ -7760,11 +8148,66 @@ index 46fc474..b02b0f9 100644
len, sum, NULL, err_ptr);
if (len)
+diff --git a/arch/x86/include/asm/cmpxchg.h b/arch/x86/include/asm/cmpxchg.h
+index 5d3acdf..6447a02 100644
+--- a/arch/x86/include/asm/cmpxchg.h
++++ b/arch/x86/include/asm/cmpxchg.h
+@@ -14,6 +14,8 @@ extern void __cmpxchg_wrong_size(void)
+ __compiletime_error("Bad argument size for cmpxchg");
+ extern void __xadd_wrong_size(void)
+ __compiletime_error("Bad argument size for xadd");
++extern void __xadd_check_overflow_wrong_size(void)
++ __compiletime_error("Bad argument size for xadd_check_overflow");
+
+ /*
+ * Constants for operation sizes. On 32-bit, the 64-bit size it set to
+@@ -195,6 +197,34 @@ extern void __xadd_wrong_size(void)
+ __ret; \
+ })
+
++#define __xadd_check_overflow(ptr, inc, lock) \
++ ({ \
++ __typeof__ (*(ptr)) __ret = (inc); \
++ switch (sizeof(*(ptr))) { \
++ case __X86_CASE_L: \
++ asm volatile (lock "xaddl %0, %1\n" \
++ "jno 0f\n" \
++ "mov %0,%1\n" \
++ "int $4\n0:\n" \
++ _ASM_EXTABLE(0b, 0b) \
++ : "+r" (__ret), "+m" (*(ptr)) \
++ : : "memory", "cc"); \
++ break; \
++ case __X86_CASE_Q: \
++ asm volatile (lock "xaddq %q0, %1\n" \
++ "jno 0f\n" \
++ "mov %0,%1\n" \
++ "int $4\n0:\n" \
++ _ASM_EXTABLE(0b, 0b) \
++ : "+r" (__ret), "+m" (*(ptr)) \
++ : : "memory", "cc"); \
++ break; \
++ default: \
++ __xadd_check_overflow_wrong_size(); \
++ } \
++ __ret; \
++ })
++
+ /*
+ * xadd() adds "inc" to "*ptr" and atomically returns the previous
+ * value of "*ptr".
+@@ -207,4 +237,6 @@ extern void __xadd_wrong_size(void)
+ #define xadd_sync(ptr, inc) __xadd((ptr), (inc), "lock; ")
+ #define xadd_local(ptr, inc) __xadd((ptr), (inc), "")
+
++#define xadd_check_overflow(ptr, inc) __xadd_check_overflow((ptr), (inc), LOCK_PREFIX)
++
+ #endif /* ASM_X86_CMPXCHG_H */
diff --git a/arch/x86/include/asm/cpufeature.h b/arch/x86/include/asm/cpufeature.h
-index 71cc380..071cbbb 100644
+index f3444f7..051a196 100644
--- a/arch/x86/include/asm/cpufeature.h
+++ b/arch/x86/include/asm/cpufeature.h
-@@ -358,7 +358,7 @@ static __always_inline __pure bool __static_cpu_has(u16 bit)
+@@ -363,7 +363,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"
@@ -7774,7 +8217,7 @@ index 71cc380..071cbbb 100644
"4:\n"
".previous\n"
diff --git a/arch/x86/include/asm/desc.h b/arch/x86/include/asm/desc.h
-index 7b439d9..1b5aa91 100644
+index 41935fa..3b40db8 100644
--- a/arch/x86/include/asm/desc.h
+++ b/arch/x86/include/asm/desc.h
@@ -4,6 +4,7 @@
@@ -7986,10 +8429,10 @@ index 908b969..a1f4eb4 100644
#define BIOS_ROM_BASE 0xffe00000
diff --git a/arch/x86/include/asm/elf.h b/arch/x86/include/asm/elf.h
-index f2ad216..eb24c96 100644
+index 5f962df..7289f09 100644
--- a/arch/x86/include/asm/elf.h
+++ b/arch/x86/include/asm/elf.h
-@@ -237,7 +237,25 @@ extern int force_personality32;
+@@ -238,7 +238,25 @@ extern int force_personality32;
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. */
@@ -8015,7 +8458,7 @@ index f2ad216..eb24c96 100644
/* This yields a mask that user programs can use to figure out what
instruction set this CPU supports. This could be done in user space,
-@@ -290,9 +308,7 @@ do { \
+@@ -291,9 +309,7 @@ do { \
#define ARCH_DLINFO \
do { \
@@ -8026,7 +8469,7 @@ index f2ad216..eb24c96 100644
} while (0)
#define AT_SYSINFO 32
-@@ -303,7 +319,7 @@ do { \
+@@ -304,7 +320,7 @@ do { \
#endif /* !CONFIG_X86_32 */
@@ -8035,14 +8478,16 @@ index f2ad216..eb24c96 100644
#define VDSO_ENTRY \
((unsigned long)VDSO32_SYMBOL(VDSO_CURRENT_BASE, vsyscall))
-@@ -317,7 +333,4 @@ extern int arch_setup_additional_pages(struct linux_binprm *bprm,
+@@ -318,9 +334,6 @@ extern int arch_setup_additional_pages(struct linux_binprm *bprm,
extern int syscall32_setup_pages(struct linux_binprm *, int exstack);
#define compat_arch_setup_additional_pages syscall32_setup_pages
-extern unsigned long arch_randomize_brk(struct mm_struct *mm);
-#define arch_randomize_brk arch_randomize_brk
-
- #endif /* _ASM_X86_ELF_H */
+ /*
+ * True on X86_32 or when emulating IA32 on X86_64
+ */
diff --git a/arch/x86/include/asm/emergency-restart.h b/arch/x86/include/asm/emergency-restart.h
index cc70c1c..d96d011 100644
--- a/arch/x86/include/asm/emergency-restart.h
@@ -8118,10 +8563,10 @@ index d09bb03..4ea4194 100644
: "memory"
);
diff --git a/arch/x86/include/asm/hw_irq.h b/arch/x86/include/asm/hw_irq.h
-index bb9efe8..c6da984 100644
+index eb92a6e..b98b2f4 100644
--- a/arch/x86/include/asm/hw_irq.h
+++ b/arch/x86/include/asm/hw_irq.h
-@@ -137,8 +137,8 @@ extern void setup_ioapic_dest(void);
+@@ -136,8 +136,8 @@ extern void setup_ioapic_dest(void);
extern void enable_IO_APIC(void);
/* Statistics */
@@ -8186,10 +8631,10 @@ index c9e09ea..73888df 100644
clts();
}
diff --git a/arch/x86/include/asm/io.h b/arch/x86/include/asm/io.h
-index d02804d..f0a62d9 100644
+index d8e8eef..99f81ae 100644
--- a/arch/x86/include/asm/io.h
+++ b/arch/x86/include/asm/io.h
-@@ -196,6 +196,17 @@ extern void set_iounmap_nonlazy(void);
+@@ -194,6 +194,17 @@ extern void set_iounmap_nonlazy(void);
#include <linux/vmalloc.h>
@@ -8208,10 +8653,10 @@ index d02804d..f0a62d9 100644
* Convert a virtual cached pointer to an uncached pointer
*/
diff --git a/arch/x86/include/asm/irqflags.h b/arch/x86/include/asm/irqflags.h
-index 5745ce8..949fb75 100644
+index bba3cf8..06bc8da 100644
--- a/arch/x86/include/asm/irqflags.h
+++ b/arch/x86/include/asm/irqflags.h
-@@ -140,6 +140,11 @@ static inline unsigned long arch_local_irq_save(void)
+@@ -141,6 +141,11 @@ static inline notrace unsigned long arch_local_irq_save(void)
sti; \
sysexit
@@ -8244,29 +8689,29 @@ index 5478825..839e88c 100644
#define flush_insn_slot(p) do { } while (0)
diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h
-index d2ac8e2..39db8ad 100644
+index b4973f4..7c4d3fc 100644
--- a/arch/x86/include/asm/kvm_host.h
+++ b/arch/x86/include/asm/kvm_host.h
-@@ -441,7 +441,7 @@ struct kvm_arch {
- unsigned int n_used_mmu_pages;
+@@ -459,7 +459,7 @@ struct kvm_arch {
unsigned int n_requested_mmu_pages;
unsigned int n_max_mmu_pages;
+ unsigned int indirect_shadow_pages;
- atomic_t invlpg_counter;
+ atomic_unchecked_t invlpg_counter;
struct hlist_head mmu_page_hash[KVM_NUM_MMU_PAGES];
/*
* Hash table of struct kvm_mmu_page.
-@@ -619,7 +619,7 @@ struct kvm_x86_ops {
+@@ -638,7 +638,7 @@ struct kvm_x86_ops {
+ int (*check_intercept)(struct kvm_vcpu *vcpu,
+ struct x86_instruction_info *info,
enum x86_intercept_stage stage);
-
- const struct trace_print_flags *exit_reasons_str;
-};
+} __do_const;
struct kvm_arch_async_pf {
u32 token;
diff --git a/arch/x86/include/asm/local.h b/arch/x86/include/asm/local.h
-index 2e99724..e6110cc 100644
+index 9cdae5d..300d20f 100644
--- a/arch/x86/include/asm/local.h
+++ b/arch/x86/include/asm/local.h
@@ -18,26 +18,58 @@ typedef struct {
@@ -8475,7 +8920,7 @@ index 5f55e69..e20bfb1 100644
#ifdef CONFIG_SMP
diff --git a/arch/x86/include/asm/mmu_context.h b/arch/x86/include/asm/mmu_context.h
-index 8b5393e..b6d1178 100644
+index 6902152..399f3a2 100644
--- a/arch/x86/include/asm/mmu_context.h
+++ b/arch/x86/include/asm/mmu_context.h
@@ -24,6 +24,18 @@ void destroy_context(struct mm_struct *mm);
@@ -8592,14 +9037,14 @@ index 8b5393e..b6d1178 100644
+#endif
+
}
-- }
- #endif
-+ }
++#endif
+ }
+-#endif
}
#define activate_mm(prev, next) \
diff --git a/arch/x86/include/asm/module.h b/arch/x86/include/asm/module.h
-index 9eae775..c5ec276 100644
+index 9eae775..c914fea 100644
--- a/arch/x86/include/asm/module.h
+++ b/arch/x86/include/asm/module.h
@@ -5,6 +5,7 @@
@@ -8610,14 +9055,16 @@ index 9eae775..c5ec276 100644
#elif defined CONFIG_M386
#define MODULE_PROC_FAMILY "386 "
#elif defined CONFIG_M486
-@@ -59,8 +60,18 @@
+@@ -59,8 +60,20 @@
#error unknown processor family
#endif
-#ifdef CONFIG_X86_32
-# define MODULE_ARCH_VERMAGIC MODULE_PROC_FAMILY
-+#ifdef CONFIG_PAX_KERNEXEC
-+#define MODULE_PAX_KERNEXEC "KERNEXEC "
++#ifdef CONFIG_PAX_KERNEXEC_PLUGIN_METHOD_BTS
++#define MODULE_PAX_KERNEXEC "KERNEXEC_BTS "
++#elif defined(CONFIG_PAX_KERNEXEC_PLUGIN_METHOD_OR)
++#define MODULE_PAX_KERNEXEC "KERNEXEC_OR "
+#else
+#define MODULE_PAX_KERNEXEC ""
#endif
@@ -8645,10 +9092,10 @@ index 7639dbf..e08a58c 100644
extern unsigned long __phys_addr(unsigned long);
#define __phys_reloc_hide(x) (x)
diff --git a/arch/x86/include/asm/paravirt.h b/arch/x86/include/asm/paravirt.h
-index ebbc4d8..38597f4 100644
+index a7d2db9..edb023e 100644
--- a/arch/x86/include/asm/paravirt.h
+++ b/arch/x86/include/asm/paravirt.h
-@@ -658,6 +658,18 @@ static inline void set_pgd(pgd_t *pgdp, pgd_t pgd)
+@@ -667,6 +667,18 @@ static inline void set_pgd(pgd_t *pgdp, pgd_t pgd)
val);
}
@@ -8667,7 +9114,7 @@ index ebbc4d8..38597f4 100644
static inline void pgd_clear(pgd_t *pgdp)
{
set_pgd(pgdp, __pgd(0));
-@@ -739,6 +751,21 @@ static inline void __set_fixmap(unsigned /* enum fixed_addresses */ idx,
+@@ -748,6 +760,21 @@ static inline void __set_fixmap(unsigned /* enum fixed_addresses */ idx,
pv_mmu_ops.set_fixmap(idx, phys, flags);
}
@@ -8689,7 +9136,7 @@ index ebbc4d8..38597f4 100644
#if defined(CONFIG_SMP) && defined(CONFIG_PARAVIRT_SPINLOCKS)
static inline int arch_spin_is_locked(struct arch_spinlock *lock)
-@@ -955,7 +982,7 @@ extern void default_banner(void);
+@@ -964,7 +991,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)
@@ -8698,7 +9145,7 @@ index ebbc4d8..38597f4 100644
#endif
#define INTERRUPT_RETURN \
-@@ -1032,6 +1059,21 @@ extern void default_banner(void);
+@@ -1041,6 +1068,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))
@@ -8721,10 +9168,10 @@ index ebbc4d8..38597f4 100644
#endif /* __ASSEMBLY__ */
diff --git a/arch/x86/include/asm/paravirt_types.h b/arch/x86/include/asm/paravirt_types.h
-index 8288509..437d0ff 100644
+index 8e8b9a4..f07d725 100644
--- a/arch/x86/include/asm/paravirt_types.h
+++ b/arch/x86/include/asm/paravirt_types.h
-@@ -78,19 +78,19 @@ struct pv_init_ops {
+@@ -84,20 +84,20 @@ struct pv_init_ops {
*/
unsigned (*patch)(u8 type, u16 clobber, void *insnbuf,
unsigned long addr, unsigned len);
@@ -8741,13 +9188,14 @@ index 8288509..437d0ff 100644
struct pv_time_ops {
unsigned long long (*sched_clock)(void);
+ unsigned long long (*steal_clock)(int cpu);
unsigned long (*get_tsc_khz)(void);
-};
+} __no_const;
struct pv_cpu_ops {
/* hooks for various privileged instructions */
-@@ -186,7 +186,7 @@ struct pv_cpu_ops {
+@@ -193,7 +193,7 @@ struct pv_cpu_ops {
void (*start_context_switch)(struct task_struct *prev);
void (*end_context_switch)(struct task_struct *next);
@@ -8756,7 +9204,7 @@ index 8288509..437d0ff 100644
struct pv_irq_ops {
/*
-@@ -217,7 +217,7 @@ struct pv_apic_ops {
+@@ -224,7 +224,7 @@ struct pv_apic_ops {
unsigned long start_eip,
unsigned long start_esp);
#endif
@@ -8765,7 +9213,7 @@ index 8288509..437d0ff 100644
struct pv_mmu_ops {
unsigned long (*read_cr2)(void);
-@@ -306,6 +306,7 @@ struct pv_mmu_ops {
+@@ -313,6 +313,7 @@ struct pv_mmu_ops {
struct paravirt_callee_save make_pud;
void (*set_pgd)(pgd_t *pudp, pgd_t pgdval);
@@ -8773,7 +9221,7 @@ index 8288509..437d0ff 100644
#endif /* PAGETABLE_LEVELS == 4 */
#endif /* PAGETABLE_LEVELS >= 3 */
-@@ -317,6 +318,12 @@ struct pv_mmu_ops {
+@@ -324,6 +325,12 @@ struct pv_mmu_ops {
an mfn. We can tell which is which from the index. */
void (*set_fixmap)(unsigned /* enum fixed_addresses */ idx,
phys_addr_t phys, pgprot_t flags);
@@ -8786,7 +9234,7 @@ index 8288509..437d0ff 100644
};
struct arch_spinlock;
-@@ -327,7 +334,7 @@ struct pv_lock_ops {
+@@ -334,7 +341,7 @@ struct pv_lock_ops {
void (*spin_lock_flags)(struct arch_spinlock *lock, unsigned long flags);
int (*spin_trylock)(struct arch_spinlock *lock);
void (*spin_unlock)(struct arch_spinlock *lock);
@@ -9110,14 +9558,15 @@ index ed5903b..c7fe163 100644
#define MODULES_END VMALLOC_END
#define MODULES_LEN (MODULES_VADDR - MODULES_END)
diff --git a/arch/x86/include/asm/pgtable_64.h b/arch/x86/include/asm/pgtable_64.h
-index 975f709..3a89693 100644
+index 975f709..107976d 100644
--- a/arch/x86/include/asm/pgtable_64.h
+++ b/arch/x86/include/asm/pgtable_64.h
-@@ -16,10 +16,13 @@
+@@ -16,10 +16,14 @@
extern pud_t level3_kernel_pgt[512];
extern pud_t level3_ident_pgt[512];
-+extern pud_t level3_vmalloc_pgt[512];
++extern pud_t level3_vmalloc_start_pgt[512];
++extern pud_t level3_vmalloc_end_pgt[512];
+extern pud_t level3_vmemmap_pgt[512];
+extern pud_t level2_vmemmap_pgt[512];
extern pmd_t level2_kernel_pgt[512];
@@ -9129,7 +9578,7 @@ index 975f709..3a89693 100644
#define swapper_pg_dir init_level4_pgt
-@@ -61,7 +64,9 @@ static inline void native_set_pte_atomic(pte_t *ptep, pte_t pte)
+@@ -61,7 +65,9 @@ static inline void native_set_pte_atomic(pte_t *ptep, pte_t pte)
static inline void native_set_pmd(pmd_t *pmdp, pmd_t pmd)
{
@@ -9139,7 +9588,7 @@ index 975f709..3a89693 100644
}
static inline void native_pmd_clear(pmd_t *pmd)
-@@ -107,6 +112,13 @@ static inline void native_pud_clear(pud_t *pud)
+@@ -107,6 +113,13 @@ static inline void native_pud_clear(pud_t *pud)
static inline void native_set_pgd(pgd_t *pgdp, pgd_t pgd)
{
@@ -9169,7 +9618,7 @@ index 766ea16..5b96cb3 100644
#endif /* _ASM_X86_PGTABLE_64_DEFS_H */
diff --git a/arch/x86/include/asm/pgtable_types.h b/arch/x86/include/asm/pgtable_types.h
-index d56187c..8e16dc8 100644
+index 013286a..8b42f4f 100644
--- a/arch/x86/include/asm/pgtable_types.h
+++ b/arch/x86/include/asm/pgtable_types.h
@@ -16,13 +16,12 @@
@@ -9219,18 +9668,16 @@ index d56187c..8e16dc8 100644
#define __PAGE_KERNEL_EXEC \
(_PAGE_PRESENT | _PAGE_RW | _PAGE_DIRTY | _PAGE_ACCESSED | _PAGE_GLOBAL)
#define __PAGE_KERNEL (__PAGE_KERNEL_EXEC | _PAGE_NX)
-@@ -106,8 +109,8 @@
+@@ -106,7 +109,7 @@
#define __PAGE_KERNEL_WC (__PAGE_KERNEL | _PAGE_CACHE_WC)
#define __PAGE_KERNEL_NOCACHE (__PAGE_KERNEL | _PAGE_PCD | _PAGE_PWT)
#define __PAGE_KERNEL_UC_MINUS (__PAGE_KERNEL | _PAGE_PCD)
-#define __PAGE_KERNEL_VSYSCALL (__PAGE_KERNEL_RX | _PAGE_USER)
--#define __PAGE_KERNEL_VSYSCALL_NOCACHE (__PAGE_KERNEL_VSYSCALL | _PAGE_PCD | _PAGE_PWT)
+#define __PAGE_KERNEL_VSYSCALL (__PAGE_KERNEL_RO | _PAGE_USER)
-+#define __PAGE_KERNEL_VSYSCALL_NOCACHE (__PAGE_KERNEL_RO | _PAGE_PCD | _PAGE_PWT | _PAGE_USER)
+ #define __PAGE_KERNEL_VVAR (__PAGE_KERNEL_RO | _PAGE_USER)
+ #define __PAGE_KERNEL_VVAR_NOCACHE (__PAGE_KERNEL_VVAR | _PAGE_PCD | _PAGE_PWT)
#define __PAGE_KERNEL_LARGE (__PAGE_KERNEL | _PAGE_PSE)
- #define __PAGE_KERNEL_LARGE_NOCACHE (__PAGE_KERNEL | _PAGE_CACHE_UC | _PAGE_PSE)
- #define __PAGE_KERNEL_LARGE_EXEC (__PAGE_KERNEL_EXEC | _PAGE_PSE)
-@@ -166,8 +169,8 @@
+@@ -168,8 +171,8 @@
* bits are combined, this will alow user to access the high address mapped
* VDSO in the presence of CONFIG_COMPAT_VDSO
*/
@@ -9241,7 +9688,7 @@ index d56187c..8e16dc8 100644
#define PGD_IDENT_ATTR 0x001 /* PRESENT (no other attributes) */
#endif
-@@ -205,7 +208,17 @@ static inline pgdval_t pgd_flags(pgd_t pgd)
+@@ -207,7 +210,17 @@ static inline pgdval_t pgd_flags(pgd_t pgd)
{
return native_pgd_val(pgd) & PTE_FLAGS_MASK;
}
@@ -9259,7 +9706,7 @@ index d56187c..8e16dc8 100644
#if PAGETABLE_LEVELS > 3
typedef struct { pudval_t pud; } pud_t;
-@@ -219,8 +232,6 @@ static inline pudval_t native_pud_val(pud_t pud)
+@@ -221,8 +234,6 @@ static inline pudval_t native_pud_val(pud_t pud)
return pud.pud;
}
#else
@@ -9268,7 +9715,7 @@ index d56187c..8e16dc8 100644
static inline pudval_t native_pud_val(pud_t pud)
{
return native_pgd_val(pud.pgd);
-@@ -240,8 +251,6 @@ static inline pmdval_t native_pmd_val(pmd_t pmd)
+@@ -242,8 +253,6 @@ static inline pmdval_t native_pmd_val(pmd_t pmd)
return pmd.pmd;
}
#else
@@ -9277,7 +9724,7 @@ index d56187c..8e16dc8 100644
static inline pmdval_t native_pmd_val(pmd_t pmd)
{
return native_pgd_val(pmd.pud.pgd);
-@@ -281,7 +290,6 @@ typedef struct page *pgtable_t;
+@@ -283,7 +292,6 @@ typedef struct page *pgtable_t;
extern pteval_t __supported_pte_mask;
extern void set_nx(void);
@@ -9286,10 +9733,10 @@ index d56187c..8e16dc8 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 2193715..fa70b92 100644
+index b650435..eefa566 100644
--- a/arch/x86/include/asm/processor.h
+++ b/arch/x86/include/asm/processor.h
-@@ -266,7 +266,7 @@ struct tss_struct {
+@@ -268,7 +268,7 @@ struct tss_struct {
} ____cacheline_aligned;
@@ -9392,10 +9839,10 @@ index 2193715..fa70b92 100644
/* Get/set a process' ability to use the timestamp counter instruction */
diff --git a/arch/x86/include/asm/ptrace.h b/arch/x86/include/asm/ptrace.h
-index 94e7618..55ac793 100644
+index 3566454..4bdfb8c 100644
--- a/arch/x86/include/asm/ptrace.h
+++ b/arch/x86/include/asm/ptrace.h
-@@ -153,28 +153,29 @@ static inline unsigned long regs_return_value(struct pt_regs *regs)
+@@ -156,28 +156,29 @@ static inline unsigned long regs_return_value(struct pt_regs *regs)
}
/*
@@ -9431,8 +9878,27 @@ index 94e7618..55ac793 100644
#endif
}
+@@ -193,15 +194,16 @@ static inline int v8086_mode(struct pt_regs *regs)
+ #ifdef CONFIG_X86_64
+ static inline bool user_64bit_mode(struct pt_regs *regs)
+ {
++ unsigned long cs = regs->cs & 0xffff;
+ #ifndef CONFIG_PARAVIRT
+ /*
+ * On non-paravirt systems, this is the only long mode CPL 3
+ * selector. We do not allow long mode selectors in the LDT.
+ */
+- return regs->cs == __USER_CS;
++ return cs == __USER_CS;
+ #else
+ /* Headers are too twisted for this to go in paravirt.h. */
+- return regs->cs == __USER_CS || regs->cs == pv_info.extra_user_64bit_cs;
++ return cs == __USER_CS || cs == pv_info.extra_user_64bit_cs;
+ #endif
+ }
+ #endif
diff --git a/arch/x86/include/asm/reboot.h b/arch/x86/include/asm/reboot.h
-index 3250e3d..20db631 100644
+index 92f29706..a79cbbb 100644
--- a/arch/x86/include/asm/reboot.h
+++ b/arch/x86/include/asm/reboot.h
@@ -6,19 +6,19 @@
@@ -9462,7 +9928,7 @@ index 3250e3d..20db631 100644
#define MRR_BIOS 0
#define MRR_APM 1
diff --git a/arch/x86/include/asm/rwsem.h b/arch/x86/include/asm/rwsem.h
-index df4cd32..27ae072 100644
+index 2dbe4a7..ce1db00 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)
@@ -9572,25 +10038,17 @@ index df4cd32..27ae072 100644
: "+m" (sem->count)
: "er" (delta));
}
-@@ -206,7 +262,15 @@ static inline long rwsem_atomic_update(long delta, struct rw_semaphore *sem)
+@@ -204,7 +260,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)
{
- long tmp = delta;
-
-- asm volatile(LOCK_PREFIX "xadd %0,%1"
-+ asm volatile(LOCK_PREFIX "xadd %0,%1\n"
-+
-+#ifdef CONFIG_PAX_REFCOUNT
-+ "jno 0f\n"
-+ "mov %0,%1\n"
-+ "int $4\n0:\n"
-+ _ASM_EXTABLE(0b, 0b)
-+#endif
-+
- : "+r" (tmp), "+m" (sem->count)
- : : "memory");
+- return delta + xadd(&sem->count, delta);
++ return delta + xadd_check_overflow(&sem->count, delta);
+ }
+ #endif /* __KERNEL__ */
diff --git a/arch/x86/include/asm/segment.h b/arch/x86/include/asm/segment.h
-index cd84f72..d909986 100644
+index 5e64171..f58957e 100644
--- a/arch/x86/include/asm/segment.h
+++ b/arch/x86/include/asm/segment.h
@@ -64,10 +64,15 @@
@@ -9643,7 +10101,7 @@ index cd84f72..d909986 100644
#else
@@ -165,6 +178,8 @@
- #define __USER32_CS (GDT_ENTRY_DEFAULT_USER32_CS * 8 + 3)
+ #define __USER32_CS (GDT_ENTRY_DEFAULT_USER32_CS*8+3)
#define __USER32_DS __USER_DS
+#define GDT_ENTRY_KERNEXEC_KERNEL_CS 7
@@ -9699,17 +10157,17 @@ index 73b11bc..d4a3b63 100644
#endif
diff --git a/arch/x86/include/asm/spinlock.h b/arch/x86/include/asm/spinlock.h
-index 3089f70..db20eed 100644
+index 972c260..43ab1fd 100644
--- a/arch/x86/include/asm/spinlock.h
+++ b/arch/x86/include/asm/spinlock.h
-@@ -249,6 +249,14 @@ static inline int arch_write_can_lock(arch_rwlock_t *lock)
+@@ -188,6 +188,14 @@ static inline int arch_write_can_lock(arch_rwlock_t *lock)
static inline void arch_read_lock(arch_rwlock_t *rw)
{
- asm volatile(LOCK_PREFIX " subl $1,(%0)\n\t"
+ asm volatile(LOCK_PREFIX READ_LOCK_SIZE(dec) " (%0)\n\t"
+
+#ifdef CONFIG_PAX_REFCOUNT
+ "jno 0f\n"
-+ LOCK_PREFIX " addl $1,(%0)\n"
++ LOCK_PREFIX READ_LOCK_SIZE(inc) " (%0)\n"
+ "int $4\n0:\n"
+ _ASM_EXTABLE(0b, 0b)
+#endif
@@ -9717,14 +10175,14 @@ index 3089f70..db20eed 100644
"jns 1f\n"
"call __read_lock_failed\n\t"
"1:\n"
-@@ -258,6 +266,14 @@ static inline void arch_read_lock(arch_rwlock_t *rw)
+@@ -197,6 +205,14 @@ static inline void arch_read_lock(arch_rwlock_t *rw)
static inline void arch_write_lock(arch_rwlock_t *rw)
{
- asm volatile(LOCK_PREFIX " subl %1,(%0)\n\t"
+ asm volatile(LOCK_PREFIX WRITE_LOCK_SUB(%1) "(%0)\n\t"
+
+#ifdef CONFIG_PAX_REFCOUNT
+ "jno 0f\n"
-+ LOCK_PREFIX " addl %1,(%0)\n"
++ LOCK_PREFIX WRITE_LOCK_ADD(%1) "(%0)\n"
+ "int $4\n0:\n"
+ _ASM_EXTABLE(0b, 0b)
+#endif
@@ -9732,36 +10190,36 @@ index 3089f70..db20eed 100644
"jz 1f\n"
"call __write_lock_failed\n\t"
"1:\n"
-@@ -286,12 +302,29 @@ static inline int arch_write_trylock(arch_rwlock_t *lock)
+@@ -226,13 +242,29 @@ static inline int arch_write_trylock(arch_rwlock_t *lock)
static inline void arch_read_unlock(arch_rwlock_t *rw)
{
-- asm volatile(LOCK_PREFIX "incl %0" :"+m" (rw->lock) : : "memory");
-+ asm volatile(LOCK_PREFIX "incl %0\n"
+- asm volatile(LOCK_PREFIX READ_LOCK_SIZE(inc) " %0"
++ asm volatile(LOCK_PREFIX READ_LOCK_SIZE(inc) " %0\n"
+
+#ifdef CONFIG_PAX_REFCOUNT
+ "jno 0f\n"
-+ LOCK_PREFIX "decl %0\n"
++ LOCK_PREFIX READ_LOCK_SIZE(dec) " %0\n"
+ "int $4\n0:\n"
+ _ASM_EXTABLE(0b, 0b)
+#endif
+
-+ :"+m" (rw->lock) : : "memory");
+ :"+m" (rw->lock) : : "memory");
}
static inline void arch_write_unlock(arch_rwlock_t *rw)
{
-- asm volatile(LOCK_PREFIX "addl %1, %0"
-+ asm volatile(LOCK_PREFIX "addl %1, %0\n"
+- asm volatile(LOCK_PREFIX WRITE_LOCK_ADD(%1) "%0"
++ asm volatile(LOCK_PREFIX WRITE_LOCK_ADD(%1) "%0\n"
+
+#ifdef CONFIG_PAX_REFCOUNT
+ "jno 0f\n"
-+ LOCK_PREFIX "subl %1, %0\n"
++ LOCK_PREFIX WRITE_LOCK_SUB(%1) "%0\n"
+ "int $4\n0:\n"
+ _ASM_EXTABLE(0b, 0b)
+#endif
+
- : "+m" (rw->lock) : "i" (RW_LOCK_BIAS) : "memory");
+ : "+m" (rw->write) : "i" (RW_LOCK_BIAS) : "memory");
}
diff --git a/arch/x86/include/asm/stackprotector.h b/arch/x86/include/asm/stackprotector.h
@@ -9805,7 +10263,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,
@@ -9817,15 +10283,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;
@@ -9854,7 +10311,7 @@ index cb23852..2dde194 100644
asmlinkage long sys32_sched_rr_get_interval(compat_pid_t,
diff --git a/arch/x86/include/asm/system.h b/arch/x86/include/asm/system.h
-index c2ff2a1..4349184 100644
+index 2d2f01c..f985723 100644
--- a/arch/x86/include/asm/system.h
+++ b/arch/x86/include/asm/system.h
@@ -129,7 +129,7 @@ do { \
@@ -9884,7 +10341,7 @@ index c2ff2a1..4349184 100644
}
static inline void native_clts(void)
-@@ -397,12 +397,12 @@ void enable_hlt(void);
+@@ -397,13 +397,13 @@ void enable_hlt(void);
void cpu_idle_wait(void);
@@ -9893,6 +10350,7 @@ index c2ff2a1..4349184 100644
extern void free_init_pages(char *what, unsigned long begin, unsigned long end);
void default_idle(void);
+ bool set_pm_idle_to_default(void);
-void stop_this_cpu(void *dummy);
+void stop_this_cpu(void *dummy) __noreturn;
@@ -9900,7 +10358,7 @@ index c2ff2a1..4349184 100644
/*
* Force strict CPU ordering.
diff --git a/arch/x86/include/asm/thread_info.h b/arch/x86/include/asm/thread_info.h
-index 1f2e61e..05e6f1e 100644
+index a1fe5c1..ee326d8 100644
--- a/arch/x86/include/asm/thread_info.h
+++ b/arch/x86/include/asm/thread_info.h
@@ -10,6 +10,7 @@
@@ -9912,7 +10370,7 @@ index 1f2e61e..05e6f1e 100644
/*
* low level task data that entry.S needs immediate access to
@@ -24,7 +25,6 @@ struct exec_domain;
- #include <asm/atomic.h>
+ #include <linux/atomic.h>
struct thread_info {
- struct task_struct *task; /* main task structure */
@@ -9949,38 +10407,24 @@ index 1f2e61e..05e6f1e 100644
#define init_stack (init_thread_union.stack)
#else /* !__ASSEMBLY__ */
-@@ -170,6 +164,23 @@ struct thread_info {
+@@ -170,45 +164,40 @@ struct thread_info {
ret; \
})
-+#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 percpu_read_stable(current_tinfo);
-+}
-+#endif
-+
- #ifdef CONFIG_X86_32
-
- #define STACK_WARN (THREAD_SIZE/8)
-@@ -180,35 +191,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)
-{
@@ -9990,15 +10434,40 @@ index 1f2e61e..05e6f1e 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 percpu_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 */
@@ -10051,7 +10520,7 @@ index 1f2e61e..05e6f1e 100644
#endif
#endif /* _ASM_X86_THREAD_INFO_H */
diff --git a/arch/x86/include/asm/uaccess.h b/arch/x86/include/asm/uaccess.h
-index 99ddd14..e31427c 100644
+index 36361bf..324f262 100644
--- a/arch/x86/include/asm/uaccess.h
+++ b/arch/x86/include/asm/uaccess.h
@@ -7,12 +7,15 @@
@@ -10274,22 +10743,20 @@ index 99ddd14..e31427c 100644
#ifdef CONFIG_X86_WP_WORKS_OK
diff --git a/arch/x86/include/asm/uaccess_32.h b/arch/x86/include/asm/uaccess_32.h
-index 566e803..89f1e60 100644
+index 566e803..b9521e9 100644
--- a/arch/x86/include/asm/uaccess_32.h
+++ b/arch/x86/include/asm/uaccess_32.h
-@@ -43,6 +43,11 @@ unsigned long __must_check __copy_from_user_ll_nocache_nozero
+@@ -43,6 +43,9 @@ unsigned long __must_check __copy_from_user_ll_nocache_nozero
static __always_inline unsigned long __must_check
__copy_to_user_inatomic(void __user *to, const void *from, unsigned long n)
{
-+ pax_track_stack();
-+
+ if ((long)n < 0)
+ return n;
+
if (__builtin_constant_p(n)) {
unsigned long ret;
-@@ -61,6 +66,8 @@ __copy_to_user_inatomic(void __user *to, const void *from, unsigned long n)
+@@ -61,6 +64,8 @@ __copy_to_user_inatomic(void __user *to, const void *from, unsigned long n)
return ret;
}
}
@@ -10298,7 +10765,7 @@ index 566e803..89f1e60 100644
return __copy_to_user_ll(to, from, n);
}
-@@ -82,12 +89,16 @@ static __always_inline unsigned long __must_check
+@@ -82,12 +87,16 @@ static __always_inline unsigned long __must_check
__copy_to_user(void __user *to, const void *from, unsigned long n)
{
might_fault();
@@ -10315,20 +10782,18 @@ index 566e803..89f1e60 100644
/* Avoid zeroing the tail if the copy fails..
* If 'n' is constant and 1, 2, or 4, we do still zero on a failure,
* but as the zeroing behaviour is only significant when n is not
-@@ -137,6 +148,12 @@ static __always_inline unsigned long
+@@ -137,6 +146,10 @@ static __always_inline unsigned long
__copy_from_user(void *to, const void __user *from, unsigned long n)
{
might_fault();
+
-+ pax_track_stack();
-+
+ if ((long)n < 0)
+ return n;
+
if (__builtin_constant_p(n)) {
unsigned long ret;
-@@ -152,6 +169,8 @@ __copy_from_user(void *to, const void __user *from, unsigned long n)
+@@ -152,6 +165,8 @@ __copy_from_user(void *to, const void __user *from, unsigned long n)
return ret;
}
}
@@ -10337,7 +10802,7 @@ index 566e803..89f1e60 100644
return __copy_from_user_ll(to, from, n);
}
-@@ -159,6 +178,10 @@ static __always_inline unsigned long __copy_from_user_nocache(void *to,
+@@ -159,6 +174,10 @@ static __always_inline unsigned long __copy_from_user_nocache(void *to,
const void __user *from, unsigned long n)
{
might_fault();
@@ -10348,23 +10813,23 @@ index 566e803..89f1e60 100644
if (__builtin_constant_p(n)) {
unsigned long ret;
-@@ -181,15 +204,19 @@ static __always_inline unsigned long
+@@ -181,15 +200,19 @@ static __always_inline unsigned long
__copy_from_user_inatomic_nocache(void *to, const void __user *from,
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")
@@ -10375,7 +10840,7 @@ index 566e803..89f1e60 100644
extern void copy_from_user_overflow(void)
#ifdef CONFIG_DEBUG_STRICT_USER_COPY_CHECKS
-@@ -199,17 +226,61 @@ extern void copy_from_user_overflow(void)
+@@ -199,17 +222,61 @@ extern void copy_from_user_overflow(void)
#endif
;
@@ -10445,7 +10910,7 @@ index 566e803..89f1e60 100644
}
diff --git a/arch/x86/include/asm/uaccess_64.h b/arch/x86/include/asm/uaccess_64.h
-index 1c66d30..c299480 100644
+index 1c66d30..23ab77d 100644
--- a/arch/x86/include/asm/uaccess_64.h
+++ b/arch/x86/include/asm/uaccess_64.h
@@ -10,6 +10,9 @@
@@ -10458,25 +10923,41 @@ index 1c66d30..c299480 100644
/*
* Copy To/From Userspace
-@@ -36,26 +39,26 @@ copy_user_generic(void *to, const void *from, unsigned len)
+@@ -17,12 +20,12 @@
+
+ /* Handles exceptions in both to and from, but doesn't do access_ok */
+ __must_check unsigned long
+-copy_user_generic_string(void *to, const void *from, unsigned len);
++copy_user_generic_string(void *to, const void *from, unsigned long len);
+ __must_check unsigned long
+-copy_user_generic_unrolled(void *to, const void *from, unsigned len);
++copy_user_generic_unrolled(void *to, const void *from, unsigned long len);
+
+ static __always_inline __must_check unsigned long
+-copy_user_generic(void *to, const void *from, unsigned len)
++copy_user_generic(void *to, const void *from, unsigned long len)
+ {
+ unsigned ret;
+
+@@ -36,138 +39,222 @@ copy_user_generic(void *to, const void *from, unsigned len)
return ret;
}
--__must_check unsigned long
--_copy_to_user(void __user *to, const void *from, unsigned len);
--__must_check unsigned long
--_copy_from_user(void *to, const void __user *from, unsigned len);
+static __always_inline __must_check unsigned long
-+__copy_to_user(void __user *to, const void *from, unsigned len);
++__copy_to_user(void __user *to, const void *from, unsigned long len);
+static __always_inline __must_check unsigned long
-+__copy_from_user(void *to, const void __user *from, unsigned len);
++__copy_from_user(void *to, const void __user *from, unsigned long len);
__must_check unsigned long
- copy_in_user(void __user *to, const void __user *from, unsigned len);
+-_copy_to_user(void __user *to, const void *from, unsigned len);
+-__must_check unsigned long
+-_copy_from_user(void *to, const void __user *from, unsigned len);
+-__must_check unsigned long
+-copy_in_user(void __user *to, const void __user *from, unsigned len);
++copy_in_user(void __user *to, const void __user *from, unsigned long len);
static inline unsigned long __must_check copy_from_user(void *to,
const void __user *from,
-- unsigned long n)
-+ unsigned n)
+ unsigned long n)
{
- int sz = __compiletime_object_size(to);
-
@@ -10490,7 +10971,7 @@ index 1c66d30..c299480 100644
+
+ if (access_ok(VERIFY_READ, from, n))
+ n = __copy_from_user(to, from, n);
-+ else if ((int)n > 0) {
++ else if (n < INT_MAX) {
+ if (!__builtin_constant_p(n))
+ check_object_size(to, n, false);
+ memset(to, 0, n);
@@ -10498,7 +10979,9 @@ index 1c66d30..c299480 100644
return n;
}
-@@ -64,110 +67,198 @@ int copy_to_user(void __user *dst, const void *src, unsigned size)
+ static __always_inline __must_check
+-int copy_to_user(void __user *dst, const void *src, unsigned size)
++int copy_to_user(void __user *dst, const void *src, unsigned long size)
{
might_fault();
@@ -10510,7 +10993,7 @@ index 1c66d30..c299480 100644
static __always_inline __must_check
-int __copy_from_user(void *dst, const void __user *src, unsigned size)
-+unsigned long __copy_from_user(void *dst, const void __user *src, unsigned size)
++unsigned long __copy_from_user(void *dst, const void __user *src, unsigned long size)
{
- int ret = 0;
+ int sz = __compiletime_object_size(dst);
@@ -10520,9 +11003,7 @@ index 1c66d30..c299480 100644
- if (!__builtin_constant_p(size))
- return copy_user_generic(dst, (__force void *)src, size);
+
-+ pax_track_stack();
-+
-+ if ((int)size < 0)
++ if (size > INT_MAX)
+ return size;
+
+#ifdef CONFIG_PAX_MEMORY_UDEREF
@@ -10600,7 +11081,7 @@ index 1c66d30..c299480 100644
static __always_inline __must_check
-int __copy_to_user(void __user *dst, const void *src, unsigned size)
-+unsigned long __copy_to_user(void __user *dst, const void *src, unsigned size)
++unsigned long __copy_to_user(void __user *dst, const void *src, unsigned long size)
{
- int ret = 0;
+ int sz = __compiletime_object_size(src);
@@ -10610,9 +11091,7 @@ index 1c66d30..c299480 100644
- if (!__builtin_constant_p(size))
- return copy_user_generic((__force void *)dst, src, size);
+
-+ pax_track_stack();
-+
-+ if ((int)size < 0)
++ if (size > INT_MAX)
+ return size;
+
+#ifdef CONFIG_PAX_MEMORY_UDEREF
@@ -10690,7 +11169,7 @@ index 1c66d30..c299480 100644
static __always_inline __must_check
-int __copy_in_user(void __user *dst, const void __user *src, unsigned size)
-+unsigned long __copy_in_user(void __user *dst, const void __user *src, unsigned size)
++unsigned long __copy_in_user(void __user *dst, const void __user *src, unsigned long size)
{
- int ret = 0;
+ unsigned ret = 0;
@@ -10700,7 +11179,7 @@ index 1c66d30..c299480 100644
- return copy_user_generic((__force void *)dst,
- (__force void *)src, size);
+
-+ if ((int)size < 0)
++ if (size > INT_MAX)
+ return size;
+
+#ifdef CONFIG_PAX_MEMORY_UDEREF
@@ -10730,7 +11209,7 @@ index 1c66d30..c299480 100644
ret, "b", "b", "=q", 1);
if (likely(!ret))
__put_user_asm(tmp, (u8 __user *)dst,
-@@ -176,7 +267,7 @@ int __copy_in_user(void __user *dst, const void __user *src, unsigned size)
+@@ -176,7 +263,7 @@ int __copy_in_user(void __user *dst, const void __user *src, unsigned size)
}
case 2: {
u16 tmp;
@@ -10739,7 +11218,7 @@ index 1c66d30..c299480 100644
ret, "w", "w", "=r", 2);
if (likely(!ret))
__put_user_asm(tmp, (u16 __user *)dst,
-@@ -186,7 +277,7 @@ int __copy_in_user(void __user *dst, const void __user *src, unsigned size)
+@@ -186,7 +273,7 @@ int __copy_in_user(void __user *dst, const void __user *src, unsigned size)
case 4: {
u32 tmp;
@@ -10748,7 +11227,7 @@ index 1c66d30..c299480 100644
ret, "l", "k", "=r", 4);
if (likely(!ret))
__put_user_asm(tmp, (u32 __user *)dst,
-@@ -195,7 +286,7 @@ int __copy_in_user(void __user *dst, const void __user *src, unsigned size)
+@@ -195,7 +282,7 @@ int __copy_in_user(void __user *dst, const void __user *src, unsigned size)
}
case 8: {
u64 tmp;
@@ -10757,7 +11236,7 @@ index 1c66d30..c299480 100644
ret, "q", "", "=r", 8);
if (likely(!ret))
__put_user_asm(tmp, (u64 __user *)dst,
-@@ -203,8 +294,16 @@ int __copy_in_user(void __user *dst, const void __user *src, unsigned size)
+@@ -203,8 +290,16 @@ int __copy_in_user(void __user *dst, const void __user *src, unsigned size)
return ret;
}
default:
@@ -10776,14 +11255,15 @@ index 1c66d30..c299480 100644
}
}
-@@ -221,33 +320,72 @@ __must_check unsigned long __clear_user(void __user *mem, unsigned long len);
+@@ -219,35 +314,72 @@ __must_check unsigned long clear_user(void __user *mem, unsigned long len);
+ __must_check unsigned long __clear_user(void __user *mem, unsigned long len);
+
static __must_check __always_inline int
- __copy_from_user_inatomic(void *dst, const void __user *src, unsigned size)
+-__copy_from_user_inatomic(void *dst, const void __user *src, unsigned size)
++__copy_from_user_inatomic(void *dst, const void __user *src, unsigned long size)
{
- return copy_user_generic(dst, (__force const void *)src, size);
-+ pax_track_stack();
-+
-+ if ((int)size < 0)
++ if (size > INT_MAX)
+ return size;
+
+#ifdef CONFIG_PAX_MEMORY_UDEREF
@@ -10798,11 +11278,12 @@ index 1c66d30..c299480 100644
}
-static __must_check __always_inline int
+-__copy_to_user_inatomic(void __user *dst, const void *src, unsigned size)
+static __must_check __always_inline unsigned long
- __copy_to_user_inatomic(void __user *dst, const void *src, unsigned size)
++__copy_to_user_inatomic(void __user *dst, const void *src, unsigned long size)
{
- return copy_user_generic((__force void *)dst, src, size);
-+ if ((int)size < 0)
++ if (size > INT_MAX)
+ return size;
+
+#ifdef CONFIG_PAX_MEMORY_UDEREF
@@ -10817,16 +11298,17 @@ index 1c66d30..c299480 100644
}
-extern long __copy_user_nocache(void *dst, const void __user *src,
+- unsigned size, int zerorest);
+extern unsigned long __copy_user_nocache(void *dst, const void __user *src,
- unsigned size, int zerorest);
++ unsigned long size, int zerorest);
-static inline int
-__copy_from_user_nocache(void *dst, const void __user *src, unsigned size)
-+static inline unsigned long __copy_from_user_nocache(void *dst, const void __user *src, unsigned size)
++static inline unsigned long __copy_from_user_nocache(void *dst, const void __user *src, unsigned long size)
{
might_sleep();
+
-+ if ((int)size < 0)
++ if (size > INT_MAX)
+ return size;
+
+#ifdef CONFIG_PAX_MEMORY_UDEREF
@@ -10839,10 +11321,11 @@ index 1c66d30..c299480 100644
-static inline int
-__copy_from_user_inatomic_nocache(void *dst, const void __user *src,
+- unsigned size)
+static inline unsigned long __copy_from_user_inatomic_nocache(void *dst, const void __user *src,
- unsigned size)
++ unsigned long size)
{
-+ if ((int)size < 0)
++ if (size > INT_MAX)
+ return size;
+
+#ifdef CONFIG_PAX_MEMORY_UDEREF
@@ -10856,7 +11339,7 @@ index 1c66d30..c299480 100644
-unsigned long
-copy_user_handle_tail(char *to, char *from, unsigned len, unsigned zerorest);
+extern unsigned long
-+copy_user_handle_tail(char __user *to, char __user *from, unsigned len, unsigned zerorest);
++copy_user_handle_tail(char __user *to, char __user *from, unsigned long len, unsigned zerorest);
#endif /* _ASM_X86_UACCESS_64_H */
diff --git a/arch/x86/include/asm/vdso.h b/arch/x86/include/asm/vdso.h
@@ -10873,7 +11356,7 @@ index bb05228..d763d5b 100644
#endif
diff --git a/arch/x86/include/asm/x86_init.h b/arch/x86/include/asm/x86_init.h
-index d3d8590..d296b5f 100644
+index 1971e65..1e3559b 100644
--- a/arch/x86/include/asm/x86_init.h
+++ b/arch/x86/include/asm/x86_init.h
@@ -28,7 +28,7 @@ struct x86_init_mpparse {
@@ -10975,16 +11458,16 @@ index d3d8590..d296b5f 100644
/**
* struct x86_platform_ops - platform specific runtime functions
-@@ -166,7 +166,7 @@ struct x86_platform_ops {
- bool (*is_untracked_pat_range)(u64 start, u64 end);
+@@ -169,7 +169,7 @@ struct x86_platform_ops {
void (*nmi_init)(void);
+ unsigned char (*get_nmi_reason)(void);
int (*i8042_detect)(void);
-};
+} __no_const;
struct pci_dev;
-@@ -174,7 +174,7 @@ struct x86_msi_ops {
+@@ -177,7 +177,7 @@ struct x86_msi_ops {
int (*setup_msi_irqs)(struct pci_dev *dev, int nvec, int type);
void (*teardown_msi_irq)(unsigned int irq);
void (*teardown_msi_irqs)(struct pci_dev *dev);
@@ -11100,10 +11583,33 @@ index 13ab720..95d5442 100644
bogus_magic:
jmp bogus_magic
diff --git a/arch/x86/kernel/alternative.c b/arch/x86/kernel/alternative.c
-index a81f2d5..f6c90fb 100644
+index 1f84794..e23f862 100644
--- a/arch/x86/kernel/alternative.c
+++ b/arch/x86/kernel/alternative.c
-@@ -313,7 +313,7 @@ static void alternatives_smp_lock(const s32 *start, const s32 *end,
+@@ -276,6 +276,13 @@ void __init_or_module apply_alternatives(struct alt_instr *start,
+ */
+ for (a = start; a < end; a++) {
+ instr = (u8 *)&a->instr_offset + a->instr_offset;
++
++#if defined(CONFIG_X86_32) && defined(CONFIG_PAX_KERNEXEC)
++ instr += ____LOAD_PHYSICAL_ADDR - LOAD_PHYSICAL_ADDR;
++ if (instr < (u8 *)_text || (u8 *)_einittext <= instr)
++ instr -= ____LOAD_PHYSICAL_ADDR - LOAD_PHYSICAL_ADDR;
++#endif
++
+ replacement = (u8 *)&a->repl_offset + a->repl_offset;
+ BUG_ON(a->replacementlen > a->instrlen);
+ BUG_ON(a->instrlen > sizeof(insnbuf));
+@@ -307,10 +314,16 @@ static void alternatives_smp_lock(const s32 *start, const s32 *end,
+ for (poff = start; poff < end; poff++) {
+ u8 *ptr = (u8 *)poff + *poff;
+
++#if defined(CONFIG_X86_32) && defined(CONFIG_PAX_KERNEXEC)
++ ptr += ____LOAD_PHYSICAL_ADDR - LOAD_PHYSICAL_ADDR;
++ if (ptr < (u8 *)_text || (u8 *)_einittext <= ptr)
++ ptr -= ____LOAD_PHYSICAL_ADDR - LOAD_PHYSICAL_ADDR;
++#endif
++
if (!*poff || ptr < text || ptr >= text_end)
continue;
/* turn DS segment override prefix into lock prefix */
@@ -11112,7 +11618,16 @@ index a81f2d5..f6c90fb 100644
text_poke(ptr, ((unsigned char []){0xf0}), 1);
};
mutex_unlock(&text_mutex);
-@@ -334,7 +334,7 @@ static void alternatives_smp_unlock(const s32 *start, const s32 *end,
+@@ -328,10 +341,16 @@ static void alternatives_smp_unlock(const s32 *start, const s32 *end,
+ for (poff = start; poff < end; poff++) {
+ u8 *ptr = (u8 *)poff + *poff;
+
++#if defined(CONFIG_X86_32) && defined(CONFIG_PAX_KERNEXEC)
++ ptr += ____LOAD_PHYSICAL_ADDR - LOAD_PHYSICAL_ADDR;
++ if (ptr < (u8 *)_text || (u8 *)_einittext <= ptr)
++ ptr -= ____LOAD_PHYSICAL_ADDR - LOAD_PHYSICAL_ADDR;
++#endif
++
if (!*poff || ptr < text || ptr >= text_end)
continue;
/* turn lock prefix into DS segment override prefix */
@@ -11121,7 +11636,7 @@ index a81f2d5..f6c90fb 100644
text_poke(ptr, ((unsigned char []){0x3E}), 1);
};
mutex_unlock(&text_mutex);
-@@ -503,7 +503,7 @@ void __init_or_module apply_paravirt(struct paravirt_patch_site *start,
+@@ -500,7 +519,7 @@ void __init_or_module apply_paravirt(struct paravirt_patch_site *start,
BUG_ON(p->len > MAX_PATCH_LEN);
/* prep the buffer with the original instructions */
@@ -11130,7 +11645,7 @@ index a81f2d5..f6c90fb 100644
used = pv_init_ops.patch(p->instrtype, p->clobbers, insnbuf,
(unsigned long)p->instr, p->len);
-@@ -571,7 +571,7 @@ void __init alternative_instructions(void)
+@@ -568,7 +587,7 @@ void __init alternative_instructions(void)
if (smp_alt_once)
free_init_pages("SMP alternatives",
(unsigned long)__smp_locks,
@@ -11139,7 +11654,7 @@ index a81f2d5..f6c90fb 100644
restart_nmi();
}
-@@ -588,13 +588,17 @@ void __init alternative_instructions(void)
+@@ -585,13 +604,17 @@ void __init alternative_instructions(void)
* instructions. And on the local CPU you need to be protected again NMI or MCE
* handlers seeing an inconsistent instruction while you patch.
*/
@@ -11159,7 +11674,7 @@ index a81f2d5..f6c90fb 100644
local_irq_restore(flags);
/* Could also do a CLFLUSH here to speed up CPU recovery; but
that causes hangs on some VIA CPUs. */
-@@ -616,36 +620,22 @@ void *__init_or_module text_poke_early(void *addr, const void *opcode,
+@@ -613,36 +636,22 @@ void *__init_or_module text_poke_early(void *addr, const void *opcode,
*/
void *__kprobes text_poke(void *addr, const void *opcode, size_t len)
{
@@ -11205,10 +11720,10 @@ index a81f2d5..f6c90fb 100644
}
diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c
-index b9338b8..0df3f9d 100644
+index f98d84c..e402a69 100644
--- a/arch/x86/kernel/apic/apic.c
+++ b/arch/x86/kernel/apic/apic.c
-@@ -173,7 +173,7 @@ int first_system_vector = 0xfe;
+@@ -174,7 +174,7 @@ int first_system_vector = 0xfe;
/*
* Debug level, exported for io_apic.c
*/
@@ -11217,7 +11732,7 @@ index b9338b8..0df3f9d 100644
int pic_mode;
-@@ -1834,7 +1834,7 @@ void smp_error_interrupt(struct pt_regs *regs)
+@@ -1853,7 +1853,7 @@ void smp_error_interrupt(struct pt_regs *regs)
apic_write(APIC_ESR, 0);
v1 = apic_read(APIC_ESR);
ack_APIC_irq();
@@ -11226,20 +11741,11 @@ index b9338b8..0df3f9d 100644
apic_printk(APIC_DEBUG, KERN_DEBUG "APIC error on CPU%d: %02x(%02x)",
smp_processor_id(), v0 , v1);
-@@ -2190,6 +2190,8 @@ static int __cpuinit apic_cluster_num(void)
- u16 *bios_cpu_apicid;
- DECLARE_BITMAP(clustermap, NUM_APIC_CLUSTERS);
-
-+ pax_track_stack();
-+
- bios_cpu_apicid = early_per_cpu_ptr(x86_bios_cpu_apicid);
- bitmap_zero(clustermap, NUM_APIC_CLUSTERS);
-
diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c
-index e529339..2457731 100644
+index 6d939d7..0697fcc 100644
--- a/arch/x86/kernel/apic/io_apic.c
+++ b/arch/x86/kernel/apic/io_apic.c
-@@ -1028,7 +1028,7 @@ int IO_APIC_get_PCI_irq_vector(int bus, int slot, int pin,
+@@ -1096,7 +1096,7 @@ int IO_APIC_get_PCI_irq_vector(int bus, int slot, int pin,
}
EXPORT_SYMBOL(IO_APIC_get_PCI_irq_vector);
@@ -11248,7 +11754,7 @@ index e529339..2457731 100644
{
/* Used to the online set of cpus does not change
* during assign_irq_vector.
-@@ -1036,7 +1036,7 @@ void lock_vector_lock(void)
+@@ -1104,7 +1104,7 @@ void lock_vector_lock(void)
raw_spin_lock(&vector_lock);
}
@@ -11257,16 +11763,16 @@ index e529339..2457731 100644
{
raw_spin_unlock(&vector_lock);
}
-@@ -2364,7 +2364,7 @@ static void ack_apic_edge(struct irq_data *data)
+@@ -2510,7 +2510,7 @@ static void ack_apic_edge(struct irq_data *data)
ack_APIC_irq();
}
-atomic_t irq_mis_count;
+atomic_unchecked_t irq_mis_count;
- /*
- * IO-APIC versions below 0x20 don't support EOI register.
-@@ -2472,7 +2472,7 @@ static void ack_apic_level(struct irq_data *data)
+ static void ack_apic_level(struct irq_data *data)
+ {
+@@ -2576,7 +2576,7 @@ static void ack_apic_level(struct irq_data *data)
* at the cpu.
*/
if (!(v & (1 << (i & 0x1f)))) {
@@ -11276,10 +11782,10 @@ index e529339..2457731 100644
eoi_ioapic_irq(irq, cfg);
}
diff --git a/arch/x86/kernel/apm_32.c b/arch/x86/kernel/apm_32.c
-index 965a766..3b2cc55 100644
+index a46bd38..6b906d7 100644
--- a/arch/x86/kernel/apm_32.c
+++ b/arch/x86/kernel/apm_32.c
-@@ -413,7 +413,7 @@ static DEFINE_MUTEX(apm_mutex);
+@@ -411,7 +411,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.
*/
@@ -11288,7 +11794,7 @@ index 965a766..3b2cc55 100644
(unsigned long)__va(0x400UL), PAGE_SIZE - 0x400 - 1);
static const char driver_version[] = "1.16ac"; /* no spaces */
-@@ -591,7 +591,10 @@ static long __apm_bios_call(void *_call)
+@@ -589,7 +589,10 @@ static long __apm_bios_call(void *_call)
BUG_ON(cpu != 0);
gdt = get_cpu_gdt_table(cpu);
save_desc_40 = gdt[0x40 / 8];
@@ -11299,7 +11805,7 @@ index 965a766..3b2cc55 100644
apm_irq_save(flags);
APM_DO_SAVE_SEGS;
-@@ -600,7 +603,11 @@ static long __apm_bios_call(void *_call)
+@@ -598,7 +601,11 @@ static long __apm_bios_call(void *_call)
&call->esi);
APM_DO_RESTORE_SEGS;
apm_irq_restore(flags);
@@ -11311,7 +11817,7 @@ index 965a766..3b2cc55 100644
put_cpu();
return call->eax & 0xff;
-@@ -667,7 +674,10 @@ static long __apm_bios_call_simple(void *_call)
+@@ -665,7 +672,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];
@@ -11322,7 +11828,7 @@ index 965a766..3b2cc55 100644
apm_irq_save(flags);
APM_DO_SAVE_SEGS;
-@@ -675,7 +685,11 @@ static long __apm_bios_call_simple(void *_call)
+@@ -673,7 +683,11 @@ static long __apm_bios_call_simple(void *_call)
&call->eax);
APM_DO_RESTORE_SEGS;
apm_irq_restore(flags);
@@ -11334,7 +11840,7 @@ index 965a766..3b2cc55 100644
put_cpu();
return error;
}
-@@ -2349,12 +2363,15 @@ static int __init apm_init(void)
+@@ -2347,12 +2361,15 @@ static int __init apm_init(void)
* code to that CPU.
*/
gdt = get_cpu_gdt_table(0);
@@ -11370,16 +11876,16 @@ index 4f13faf..87db5d2 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();
@@ -11403,7 +11909,7 @@ index e72a119..6e2955d 100644
BLANK();
diff --git a/arch/x86/kernel/cpu/Makefile b/arch/x86/kernel/cpu/Makefile
-index 6042981..e638266 100644
+index 25f24dc..4094a7f 100644
--- a/arch/x86/kernel/cpu/Makefile
+++ b/arch/x86/kernel/cpu/Makefile
@@ -8,10 +8,6 @@ CFLAGS_REMOVE_common.o = -pg
@@ -11418,10 +11924,10 @@ index 6042981..e638266 100644
obj-y += proc.o capflags.o powerflags.o common.o
obj-y += vmware.o hypervisor.o sched.o mshyperv.o
diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c
-index b13ed39..603286c 100644
+index 0bab2b1..d0a1bf8 100644
--- a/arch/x86/kernel/cpu/amd.c
+++ b/arch/x86/kernel/cpu/amd.c
-@@ -647,7 +647,7 @@ static unsigned int __cpuinit amd_size_cache(struct cpuinfo_x86 *c,
+@@ -664,7 +664,7 @@ static unsigned int __cpuinit amd_size_cache(struct cpuinfo_x86 *c,
unsigned int size)
{
/* AMD errata T13 (order #21922) */
@@ -11431,10 +11937,10 @@ index b13ed39..603286c 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 22a073d..bfb3195 100644
+index aa003b1..47ea638 100644
--- a/arch/x86/kernel/cpu/common.c
+++ b/arch/x86/kernel/cpu/common.c
-@@ -83,60 +83,6 @@ static const struct cpu_dev __cpuinitconst default_cpu = {
+@@ -84,60 +84,6 @@ static const struct cpu_dev __cpuinitconst default_cpu = {
static const struct cpu_dev *this_cpu __cpuinitdata = &default_cpu;
@@ -11495,7 +12001,7 @@ index 22a073d..bfb3195 100644
static int __init x86_xsave_setup(char *s)
{
setup_clear_cpu_cap(X86_FEATURE_XSAVE);
-@@ -371,7 +317,7 @@ void switch_to_new_gdt(int cpu)
+@@ -372,7 +318,7 @@ void switch_to_new_gdt(int cpu)
{
struct desc_ptr gdt_descr;
@@ -11504,18 +12010,18 @@ index 22a073d..bfb3195 100644
gdt_descr.size = GDT_SIZE - 1;
load_gdt(&gdt_descr);
/* Reload the per-cpu base */
-@@ -840,6 +786,10 @@ static void __cpuinit identify_cpu(struct cpuinfo_x86 *c)
+@@ -844,6 +790,10 @@ static void __cpuinit identify_cpu(struct cpuinfo_x86 *c)
/* Filter out anything that depends on CPUID levels we don't have */
filter_cpuid_features(c, true);
-+#if defined(CONFIG_PAX_SEGMEXEC) || defined(CONFIG_PAX_KERNEXEC) || (defined(CONFIG_PAX_MEMORY_UDEREF) && defined(CONFIG_X86_32))
++#if defined(CONFIG_X86_32) && (defined(CONFIG_PAX_SEGMEXEC) || defined(CONFIG_PAX_KERNEXEC) || defined(CONFIG_PAX_MEMORY_UDEREF))
+ setup_clear_cpu_cap(X86_FEATURE_SEP);
+#endif
+
/* If the model name is still unset, do table lookup. */
if (!c->x86_model_id[0]) {
const char *p;
-@@ -1019,6 +969,9 @@ static __init int setup_disablecpuid(char *arg)
+@@ -1024,6 +974,9 @@ static __init int setup_disablecpuid(char *arg)
}
__setup("clearcpuid=", setup_disablecpuid);
@@ -11525,7 +12031,7 @@ index 22a073d..bfb3195 100644
#ifdef CONFIG_X86_64
struct desc_ptr idt_descr = { NR_VECTORS * 16 - 1, (unsigned long) idt_table };
-@@ -1034,7 +987,7 @@ DEFINE_PER_CPU(struct task_struct *, current_task) ____cacheline_aligned =
+@@ -1039,7 +992,7 @@ DEFINE_PER_CPU(struct task_struct *, current_task) ____cacheline_aligned =
EXPORT_PER_CPU_SYMBOL(current_task);
DEFINE_PER_CPU(unsigned long, kernel_stack) =
@@ -11534,7 +12040,7 @@ index 22a073d..bfb3195 100644
EXPORT_PER_CPU_SYMBOL(kernel_stack);
DEFINE_PER_CPU(char *, irq_stack_ptr) =
-@@ -1099,7 +1052,7 @@ struct pt_regs * __cpuinit idle_regs(struct pt_regs *regs)
+@@ -1104,7 +1057,7 @@ struct pt_regs * __cpuinit idle_regs(struct pt_regs *regs)
{
memset(regs, 0, sizeof(struct pt_regs));
regs->fs = __KERNEL_PERCPU;
@@ -11543,7 +12049,7 @@ index 22a073d..bfb3195 100644
return regs;
}
-@@ -1154,7 +1107,7 @@ void __cpuinit cpu_init(void)
+@@ -1159,7 +1112,7 @@ void __cpuinit cpu_init(void)
int i;
cpu = stack_smp_processor_id();
@@ -11552,7 +12058,7 @@ index 22a073d..bfb3195 100644
oist = &per_cpu(orig_ist, cpu);
#ifdef CONFIG_NUMA
-@@ -1180,7 +1133,7 @@ void __cpuinit cpu_init(void)
+@@ -1185,7 +1138,7 @@ void __cpuinit cpu_init(void)
switch_to_new_gdt(cpu);
loadsegment(fs, 0);
@@ -11561,7 +12067,7 @@ index 22a073d..bfb3195 100644
memset(me->thread.tls_array, 0, GDT_ENTRY_TLS_ENTRIES * 8);
syscall_init();
-@@ -1189,7 +1142,6 @@ void __cpuinit cpu_init(void)
+@@ -1194,7 +1147,6 @@ void __cpuinit cpu_init(void)
wrmsrl(MSR_KERNEL_GS_BASE, 0);
barrier();
@@ -11569,7 +12075,7 @@ index 22a073d..bfb3195 100644
if (cpu != 0)
enable_x2apic();
-@@ -1243,7 +1195,7 @@ void __cpuinit cpu_init(void)
+@@ -1248,7 +1200,7 @@ void __cpuinit cpu_init(void)
{
int cpu = smp_processor_id();
struct task_struct *curr = current;
@@ -11579,10 +12085,10 @@ index 22a073d..bfb3195 100644
if (cpumask_test_and_set_cpu(cpu, cpu_initialized_mask)) {
diff --git a/arch/x86/kernel/cpu/intel.c b/arch/x86/kernel/cpu/intel.c
-index ed6086e..a1dcf29 100644
+index 5231312..a78a987 100644
--- a/arch/x86/kernel/cpu/intel.c
+++ b/arch/x86/kernel/cpu/intel.c
-@@ -172,7 +172,7 @@ static void __cpuinit trap_init_f00f_bug(void)
+@@ -174,7 +174,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.
*/
@@ -11591,34 +12097,19 @@ index ed6086e..a1dcf29 100644
load_idt(&idt_descr);
}
#endif
-diff --git a/arch/x86/kernel/cpu/mcheck/mce-inject.c b/arch/x86/kernel/cpu/mcheck/mce-inject.c
-index 0ed633c..82cef2a 100644
---- a/arch/x86/kernel/cpu/mcheck/mce-inject.c
-+++ b/arch/x86/kernel/cpu/mcheck/mce-inject.c
-@@ -215,7 +215,9 @@ static int inject_init(void)
- if (!alloc_cpumask_var(&mce_inject_cpumask, GFP_KERNEL))
- return -ENOMEM;
- printk(KERN_INFO "Machine check injector initialized\n");
-- mce_chrdev_ops.write = mce_write;
-+ pax_open_kernel();
-+ *(void **)&mce_chrdev_ops.write = mce_write;
-+ pax_close_kernel();
- register_die_notifier(&mce_raise_nb);
- return 0;
- }
diff --git a/arch/x86/kernel/cpu/mcheck/mce.c b/arch/x86/kernel/cpu/mcheck/mce.c
-index ff1ae9b..f2d105b 100644
+index 2af127d..8ff7ac0 100644
--- a/arch/x86/kernel/cpu/mcheck/mce.c
+++ b/arch/x86/kernel/cpu/mcheck/mce.c
-@@ -46,6 +46,7 @@
- #include <asm/ipi.h>
+@@ -42,6 +42,7 @@
+ #include <asm/processor.h>
#include <asm/mce.h>
#include <asm/msr.h>
+#include <asm/local.h>
#include "mce-internal.h"
-@@ -208,7 +209,7 @@ static void print_mce(struct mce *m)
+@@ -202,7 +203,7 @@ static void print_mce(struct mce *m)
!(m->mcgstatus & MCG_STATUS_EIPV) ? " !INEXACT!" : "",
m->cs, m->ip);
@@ -11627,7 +12118,7 @@ index ff1ae9b..f2d105b 100644
print_symbol("{%s}", m->ip);
pr_cont("\n");
}
-@@ -236,10 +237,10 @@ static void print_mce(struct mce *m)
+@@ -235,10 +236,10 @@ static void print_mce(struct mce *m)
#define PANIC_TIMEOUT 5 /* 5 seconds */
@@ -11640,7 +12131,7 @@ index ff1ae9b..f2d105b 100644
/* Panic in progress. Enable interrupts and wait for final IPI */
static void wait_for_panic(void)
-@@ -263,7 +264,7 @@ static void mce_panic(char *msg, struct mce *final, char *exp)
+@@ -262,7 +263,7 @@ static void mce_panic(char *msg, struct mce *final, char *exp)
/*
* Make sure only one CPU runs in machine check panic
*/
@@ -11649,7 +12140,7 @@ index ff1ae9b..f2d105b 100644
wait_for_panic();
barrier();
-@@ -271,7 +272,7 @@ static void mce_panic(char *msg, struct mce *final, char *exp)
+@@ -270,7 +271,7 @@ static void mce_panic(char *msg, struct mce *final, char *exp)
console_verbose();
} else {
/* Don't log too much for fake panic */
@@ -11658,7 +12149,7 @@ index ff1ae9b..f2d105b 100644
return;
}
/* First print corrected ones that are still unlogged */
-@@ -638,7 +639,7 @@ static int mce_timed_out(u64 *t)
+@@ -610,7 +611,7 @@ static int mce_timed_out(u64 *t)
* might have been modified by someone else.
*/
rmb();
@@ -11667,42 +12158,62 @@ index ff1ae9b..f2d105b 100644
wait_for_panic();
if (!monarch_timeout)
goto out;
-@@ -1452,14 +1453,14 @@ void __cpuinit mcheck_cpu_init(struct cpuinfo_x86 *c)
+@@ -1398,7 +1399,7 @@ static void unexpected_machine_check(struct pt_regs *regs, long error_code)
+ }
+
+ /* Call the installed machine check handler for this CPU setup. */
+-void (*machine_check_vector)(struct pt_regs *, long error_code) =
++void (*machine_check_vector)(struct pt_regs *, long error_code) __read_only =
+ unexpected_machine_check;
+
+ /*
+@@ -1421,7 +1422,9 @@ void __cpuinit mcheck_cpu_init(struct cpuinfo_x86 *c)
+ return;
+ }
+
++ pax_open_kernel();
+ machine_check_vector = do_machine_check;
++ pax_close_kernel();
+
+ __mcheck_cpu_init_generic();
+ __mcheck_cpu_init_vendor(c);
+@@ -1435,7 +1438,7 @@ void __cpuinit mcheck_cpu_init(struct cpuinfo_x86 *c)
*/
- static DEFINE_SPINLOCK(mce_state_lock);
--static int open_count; /* #times opened */
-+static local_t open_count; /* #times opened */
- static int open_exclu; /* already open exclusive? */
+ static DEFINE_SPINLOCK(mce_chrdev_state_lock);
+-static int mce_chrdev_open_count; /* #times opened */
++static local_t mce_chrdev_open_count; /* #times opened */
+ static int mce_chrdev_open_exclu; /* already open exclusive? */
- static int mce_open(struct inode *inode, struct file *file)
- {
- spin_lock(&mce_state_lock);
+ static int mce_chrdev_open(struct inode *inode, struct file *file)
+@@ -1443,7 +1446,7 @@ static int mce_chrdev_open(struct inode *inode, struct file *file)
+ spin_lock(&mce_chrdev_state_lock);
-- if (open_exclu || (open_count && (file->f_flags & O_EXCL))) {
-+ if (open_exclu || (local_read(&open_count) && (file->f_flags & O_EXCL))) {
- spin_unlock(&mce_state_lock);
+ if (mce_chrdev_open_exclu ||
+- (mce_chrdev_open_count && (file->f_flags & O_EXCL))) {
++ (local_read(&mce_chrdev_open_count) && (file->f_flags & O_EXCL))) {
+ spin_unlock(&mce_chrdev_state_lock);
return -EBUSY;
-@@ -1467,7 +1468,7 @@ static int mce_open(struct inode *inode, struct file *file)
+@@ -1451,7 +1454,7 @@ static int mce_chrdev_open(struct inode *inode, struct file *file)
if (file->f_flags & O_EXCL)
- open_exclu = 1;
-- open_count++;
-+ local_inc(&open_count);
+ mce_chrdev_open_exclu = 1;
+- mce_chrdev_open_count++;
++ local_inc(&mce_chrdev_open_count);
- spin_unlock(&mce_state_lock);
+ spin_unlock(&mce_chrdev_state_lock);
-@@ -1478,7 +1479,7 @@ static int mce_release(struct inode *inode, struct file *file)
+@@ -1462,7 +1465,7 @@ static int mce_chrdev_release(struct inode *inode, struct file *file)
{
- spin_lock(&mce_state_lock);
+ spin_lock(&mce_chrdev_state_lock);
-- open_count--;
-+ local_dec(&open_count);
- open_exclu = 0;
+- mce_chrdev_open_count--;
++ local_dec(&mce_chrdev_open_count);
+ mce_chrdev_open_exclu = 0;
- spin_unlock(&mce_state_lock);
-@@ -2163,7 +2164,7 @@ struct dentry *mce_get_debugfs_dir(void)
+ spin_unlock(&mce_chrdev_state_lock);
+@@ -2171,7 +2174,7 @@ struct dentry *mce_get_debugfs_dir(void)
static void mce_reset(void)
{
cpu_missing = 0;
@@ -11711,8 +12222,36 @@ index ff1ae9b..f2d105b 100644
atomic_set(&mce_executing, 0);
atomic_set(&mce_callin, 0);
atomic_set(&global_nwo, 0);
+diff --git a/arch/x86/kernel/cpu/mcheck/p5.c b/arch/x86/kernel/cpu/mcheck/p5.c
+index 5c0e653..1e82c7c 100644
+--- a/arch/x86/kernel/cpu/mcheck/p5.c
++++ b/arch/x86/kernel/cpu/mcheck/p5.c
+@@ -50,7 +50,9 @@ void intel_p5_mcheck_init(struct cpuinfo_x86 *c)
+ if (!cpu_has(c, X86_FEATURE_MCE))
+ return;
+
++ pax_open_kernel();
+ machine_check_vector = pentium_machine_check;
++ pax_close_kernel();
+ /* Make sure the vector pointer is visible before we enable MCEs: */
+ wmb();
+
+diff --git a/arch/x86/kernel/cpu/mcheck/winchip.c b/arch/x86/kernel/cpu/mcheck/winchip.c
+index 54060f5..e6ba93d 100644
+--- a/arch/x86/kernel/cpu/mcheck/winchip.c
++++ b/arch/x86/kernel/cpu/mcheck/winchip.c
+@@ -24,7 +24,9 @@ void winchip_mcheck_init(struct cpuinfo_x86 *c)
+ {
+ u32 lo, hi;
+
++ pax_open_kernel();
+ machine_check_vector = winchip_machine_check;
++ pax_close_kernel();
+ /* Make sure the vector pointer is visible before we enable MCEs: */
+ wmb();
+
diff --git a/arch/x86/kernel/cpu/mtrr/main.c b/arch/x86/kernel/cpu/mtrr/main.c
-index 3d17bc7..b106841 100644
+index 6b96110..0da73eb 100644
--- a/arch/x86/kernel/cpu/mtrr/main.c
+++ b/arch/x86/kernel/cpu/mtrr/main.c
@@ -62,7 +62,7 @@ static DEFINE_MUTEX(mtrr_mutex);
@@ -11738,19 +12277,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 bf6d692..90ee554 100644
+index 2bda212..78cc605 100644
--- a/arch/x86/kernel/cpu/perf_event.c
+++ b/arch/x86/kernel/cpu/perf_event.c
-@@ -781,6 +781,8 @@ static int x86_schedule_events(struct cpu_hw_events *cpuc, int n, int *assign)
- int i, j, w, wmax, num = 0;
- struct hw_perf_event *hwc;
-
-+ pax_track_stack();
-+
- bitmap_zero(used_mask, X86_PMC_IDX_MAX);
-
- for (i = 0; i < n; i++) {
-@@ -1875,7 +1877,7 @@ perf_callchain_user(struct perf_callchain_entry *entry, struct pt_regs *regs)
+@@ -1529,7 +1529,7 @@ perf_callchain_user(struct perf_callchain_entry *entry, struct pt_regs *regs)
break;
perf_callchain_store(entry, frame.return_address);
@@ -11760,13 +12290,16 @@ index bf6d692..90ee554 100644
}
diff --git a/arch/x86/kernel/crash.c b/arch/x86/kernel/crash.c
-index 764c7c2..c5d9c7b 100644
+index 13ad899..f642b9a 100644
--- a/arch/x86/kernel/crash.c
+++ b/arch/x86/kernel/crash.c
-@@ -42,7 +42,7 @@ static void kdump_nmi_callback(int cpu, struct die_args *args)
- regs = args->regs;
-
+@@ -36,10 +36,8 @@ static void kdump_nmi_callback(int cpu, struct pt_regs *regs)
+ {
#ifdef CONFIG_X86_32
+ struct pt_regs fixed_regs;
+-#endif
+
+-#ifdef CONFIG_X86_32
- if (!user_mode_vm(regs)) {
+ if (!user_mode(regs)) {
crash_fixup_ss_esp(&fixed_regs, regs);
@@ -11955,7 +12488,7 @@ index 1aae78f..aab3a3d 100644
if (__die(str, regs, err))
diff --git a/arch/x86/kernel/dumpstack_32.c b/arch/x86/kernel/dumpstack_32.c
-index 3b97a80..2d7ebd5 100644
+index c99f9ed..2a15d80 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,
@@ -12005,14 +12538,14 @@ index 3b97a80..2d7ebd5 100644
}
for (i = 0; i < code_len; i++, ip++) {
@@ -119,7 +118,7 @@ void show_registers(struct pt_regs *regs)
- printk(" Bad EIP value.");
+ printk(KERN_CONT " Bad EIP value.");
break;
}
- if (ip == (u8 *)regs->ip)
+ if (ip == (u8 *)regs->ip + cs_base)
- printk("<%02x> ", c);
+ printk(KERN_CONT "<%02x> ", c);
else
- printk("%02x ", c);
+ printk(KERN_CONT "%02x ", c);
@@ -132,6 +131,7 @@ int is_valid_bugaddr(unsigned long ip)
{
unsigned short ud2;
@@ -12021,11 +12554,27 @@ index 3b97a80..2d7ebd5 100644
if (ip < PAGE_OFFSET)
return 0;
if (probe_kernel_address((unsigned short *)ip, ud2))
+@@ -139,3 +139,15 @@ int is_valid_bugaddr(unsigned long ip)
+
+ return ud2 == 0x0b0f;
+ }
++
++#ifdef CONFIG_PAX_MEMORY_STACKLEAK
++void pax_check_alloca(unsigned long size)
++{
++ unsigned long sp = (unsigned long)&sp, stack_left;
++
++ /* all kernel stacks are of the same size */
++ stack_left = sp & (THREAD_SIZE - 1);
++ BUG_ON(stack_left < 256 || size >= stack_left - 256);
++}
++EXPORT_SYMBOL(pax_check_alloca);
++#endif
diff --git a/arch/x86/kernel/dumpstack_64.c b/arch/x86/kernel/dumpstack_64.c
-index e71c98d..8d00db8 100644
+index 6d728d9..279514e 100644
--- a/arch/x86/kernel/dumpstack_64.c
+++ b/arch/x86/kernel/dumpstack_64.c
-@@ -147,9 +147,9 @@ void dump_trace(struct task_struct *task, struct pt_regs *regs,
+@@ -119,9 +119,9 @@ void dump_trace(struct task_struct *task, struct pt_regs *regs,
unsigned long *irq_stack_end =
(unsigned long *)per_cpu(irq_stack_ptr, cpu);
unsigned used = 0;
@@ -12036,7 +12585,7 @@ index e71c98d..8d00db8 100644
if (!task)
task = current;
-@@ -167,10 +167,10 @@ void dump_trace(struct task_struct *task, struct pt_regs *regs,
+@@ -142,10 +142,10 @@ void dump_trace(struct task_struct *task, struct pt_regs *regs,
* current stack address. If the stacks consist of nested
* exceptions
*/
@@ -12048,7 +12597,7 @@ index e71c98d..8d00db8 100644
estack_end = in_exception_stack(cpu, (unsigned long)stack,
&used, &id);
-@@ -178,7 +178,7 @@ void dump_trace(struct task_struct *task, struct pt_regs *regs,
+@@ -153,7 +153,7 @@ void dump_trace(struct task_struct *task, struct pt_regs *regs,
if (ops->stack(data, id) < 0)
break;
@@ -12057,7 +12606,7 @@ index e71c98d..8d00db8 100644
data, estack_end, &graph);
ops->stack(data, "<EOE>");
/*
-@@ -197,7 +197,7 @@ void dump_trace(struct task_struct *task, struct pt_regs *regs,
+@@ -172,7 +172,7 @@ void dump_trace(struct task_struct *task, struct pt_regs *regs,
if (in_irq_stack(stack, irq_stack, irq_stack_end)) {
if (ops->stack(data, "IRQ") < 0)
break;
@@ -12066,7 +12615,7 @@ index e71c98d..8d00db8 100644
ops, data, irq_stack_end, &graph);
/*
* We link to the next stack (which would be
-@@ -218,7 +218,8 @@ void dump_trace(struct task_struct *task, struct pt_regs *regs,
+@@ -191,7 +191,8 @@ void dump_trace(struct task_struct *task, struct pt_regs *regs,
/*
* This handles the process stack:
*/
@@ -12076,8 +12625,59 @@ index e71c98d..8d00db8 100644
put_cpu();
}
EXPORT_SYMBOL(dump_trace);
+@@ -305,3 +306,50 @@ int is_valid_bugaddr(unsigned long ip)
+
+ return ud2 == 0x0b0f;
+ }
++
++#ifdef CONFIG_PAX_MEMORY_STACKLEAK
++void pax_check_alloca(unsigned long size)
++{
++ unsigned long sp = (unsigned long)&sp, stack_start, stack_end;
++ unsigned cpu, used;
++ char *id;
++
++ /* check the process stack first */
++ stack_start = (unsigned long)task_stack_page(current);
++ stack_end = stack_start + THREAD_SIZE;
++ if (likely(stack_start <= sp && sp < stack_end)) {
++ unsigned long stack_left = sp & (THREAD_SIZE - 1);
++ BUG_ON(stack_left < 256 || size >= stack_left - 256);
++ return;
++ }
++
++ cpu = get_cpu();
++
++ /* check the irq stacks */
++ stack_end = (unsigned long)per_cpu(irq_stack_ptr, cpu);
++ stack_start = stack_end - IRQ_STACK_SIZE;
++ if (stack_start <= sp && sp < stack_end) {
++ unsigned long stack_left = sp & (IRQ_STACK_SIZE - 1);
++ put_cpu();
++ BUG_ON(stack_left < 256 || size >= stack_left - 256);
++ return;
++ }
++
++ /* check the exception stacks */
++ used = 0;
++ stack_end = (unsigned long)in_exception_stack(cpu, sp, &used, &id);
++ stack_start = stack_end - EXCEPTION_STKSZ;
++ if (stack_end && stack_start <= sp && sp < stack_end) {
++ unsigned long stack_left = sp & (EXCEPTION_STKSZ - 1);
++ put_cpu();
++ BUG_ON(stack_left < 256 || size >= stack_left - 256);
++ return;
++ }
++
++ put_cpu();
++
++ /* unknown stack */
++ BUG();
++}
++EXPORT_SYMBOL(pax_check_alloca);
++#endif
diff --git a/arch/x86/kernel/early_printk.c b/arch/x86/kernel/early_printk.c
-index cd28a35..2601699 100644
+index cd28a35..c72ed9a 100644
--- a/arch/x86/kernel/early_printk.c
+++ b/arch/x86/kernel/early_printk.c
@@ -7,6 +7,7 @@
@@ -12088,20 +12688,11 @@ index cd28a35..2601699 100644
#include <asm/io.h>
#include <asm/processor.h>
#include <asm/fcntl.h>
-@@ -179,6 +180,8 @@ asmlinkage void early_printk(const char *fmt, ...)
- int n;
- va_list ap;
-
-+ pax_track_stack();
-+
- va_start(ap, fmt);
- n = vscnprintf(buf, sizeof(buf), fmt, ap);
- early_console->write(early_console, buf, n);
diff --git a/arch/x86/kernel/entry_32.S b/arch/x86/kernel/entry_32.S
-index 5c1a9197..6bc1991 100644
+index f3f6f53..0841b66 100644
--- a/arch/x86/kernel/entry_32.S
+++ b/arch/x86/kernel/entry_32.S
-@@ -185,13 +185,146 @@
+@@ -186,13 +186,146 @@
/*CFI_REL_OFFSET gs, PT_GS*/
.endm
.macro SET_KERNEL_GS reg
@@ -12249,7 +12840,7 @@ index 5c1a9197..6bc1991 100644
cld
PUSH_GS
pushl_cfi %fs
-@@ -214,7 +347,7 @@
+@@ -215,7 +348,7 @@
CFI_REL_OFFSET ecx, 0
pushl_cfi %ebx
CFI_REL_OFFSET ebx, 0
@@ -12258,7 +12849,7 @@ index 5c1a9197..6bc1991 100644
movl %edx, %ds
movl %edx, %es
movl $(__KERNEL_PERCPU), %edx
-@@ -222,6 +355,15 @@
+@@ -223,6 +356,15 @@
SET_KERNEL_GS %edx
.endm
@@ -12274,7 +12865,7 @@ index 5c1a9197..6bc1991 100644
.macro RESTORE_INT_REGS
popl_cfi %ebx
CFI_RESTORE ebx
-@@ -307,7 +449,7 @@ ENTRY(ret_from_fork)
+@@ -308,7 +450,7 @@ ENTRY(ret_from_fork)
popfl_cfi
jmp syscall_exit
CFI_ENDPROC
@@ -12283,7 +12874,7 @@ index 5c1a9197..6bc1991 100644
/*
* Interrupt exit functions should be protected against kprobes
-@@ -332,7 +474,15 @@ check_userspace:
+@@ -333,7 +475,15 @@ check_userspace:
movb PT_CS(%esp), %al
andl $(X86_EFLAGS_VM | SEGMENT_RPL_MASK), %eax
cmpl $USER_RPL, %eax
@@ -12299,7 +12890,7 @@ index 5c1a9197..6bc1991 100644
ENTRY(resume_userspace)
LOCKDEP_SYS_EXIT
-@@ -344,8 +494,8 @@ ENTRY(resume_userspace)
+@@ -345,8 +495,8 @@ ENTRY(resume_userspace)
andl $_TIF_WORK_MASK, %ecx # is there any work to be done on
# int/exception return?
jne work_pending
@@ -12310,7 +12901,7 @@ index 5c1a9197..6bc1991 100644
#ifdef CONFIG_PREEMPT
ENTRY(resume_kernel)
-@@ -360,7 +510,7 @@ need_resched:
+@@ -361,7 +511,7 @@ need_resched:
jz restore_all
call preempt_schedule_irq
jmp need_resched
@@ -12319,7 +12910,7 @@ index 5c1a9197..6bc1991 100644
#endif
CFI_ENDPROC
/*
-@@ -394,23 +544,34 @@ sysenter_past_esp:
+@@ -395,23 +545,34 @@ sysenter_past_esp:
/*CFI_REL_OFFSET cs, 0*/
/*
* Push current_thread_info()->sysenter_return to the stack.
@@ -12357,7 +12948,7 @@ index 5c1a9197..6bc1991 100644
movl %ebp,PT_EBP(%esp)
.section __ex_table,"a"
.align 4
-@@ -433,12 +594,24 @@ sysenter_do_call:
+@@ -434,12 +595,24 @@ sysenter_do_call:
testl $_TIF_ALLWORK_MASK, %ecx
jne sysexit_audit
sysenter_exit:
@@ -12382,7 +12973,7 @@ index 5c1a9197..6bc1991 100644
PTGS_TO_GS
ENABLE_INTERRUPTS_SYSEXIT
-@@ -455,6 +628,9 @@ sysenter_audit:
+@@ -456,6 +629,9 @@ sysenter_audit:
movl %eax,%edx /* 2nd arg: syscall number */
movl $AUDIT_ARCH_I386,%eax /* 1st arg: audit arch */
call audit_syscall_entry
@@ -12392,7 +12983,7 @@ index 5c1a9197..6bc1991 100644
pushl_cfi %ebx
movl PT_EAX(%esp),%eax /* reload syscall number */
jmp sysenter_do_call
-@@ -481,11 +657,17 @@ sysexit_audit:
+@@ -482,11 +658,17 @@ sysexit_audit:
CFI_ENDPROC
.pushsection .fixup,"ax"
@@ -12412,7 +13003,7 @@ index 5c1a9197..6bc1991 100644
.popsection
PTGS_TO_GS_EX
ENDPROC(ia32_sysenter_target)
-@@ -518,6 +700,15 @@ syscall_exit:
+@@ -519,6 +701,15 @@ syscall_exit:
testl $_TIF_ALLWORK_MASK, %ecx # current->work
jne syscall_exit_work
@@ -12428,7 +13019,7 @@ index 5c1a9197..6bc1991 100644
restore_all:
TRACE_IRQS_IRET
restore_all_notrace:
-@@ -577,14 +768,34 @@ ldt_ss:
+@@ -578,14 +769,34 @@ ldt_ss:
* compensating for the offset by changing to the ESPFIX segment with
* a base address that matches for the difference.
*/
@@ -12466,7 +13057,7 @@ index 5c1a9197..6bc1991 100644
pushl_cfi $__ESPFIX_SS
pushl_cfi %eax /* new kernel esp */
/* Disable interrupts, but do not irqtrace this section: we
-@@ -613,34 +824,28 @@ work_resched:
+@@ -614,34 +825,28 @@ work_resched:
movl TI_flags(%ebp), %ecx
andl $_TIF_WORK_MASK, %ecx # is there any work to be done other
# than syscall tracing?
@@ -12506,7 +13097,7 @@ index 5c1a9197..6bc1991 100644
# perform syscall exit tracing
ALIGN
-@@ -648,11 +853,14 @@ syscall_trace_entry:
+@@ -649,11 +854,14 @@ syscall_trace_entry:
movl $-ENOSYS,PT_EAX(%esp)
movl %esp, %eax
call syscall_trace_enter
@@ -12522,7 +13113,7 @@ index 5c1a9197..6bc1991 100644
# perform syscall exit tracing
ALIGN
-@@ -665,20 +873,24 @@ syscall_exit_work:
+@@ -666,20 +874,24 @@ syscall_exit_work:
movl %esp, %eax
call syscall_trace_leave
jmp resume_userspace
@@ -12550,7 +13141,7 @@ index 5c1a9197..6bc1991 100644
CFI_ENDPROC
/*
* End of kprobes section
-@@ -752,6 +964,36 @@ ptregs_clone:
+@@ -753,6 +965,36 @@ ptregs_clone:
CFI_ENDPROC
ENDPROC(ptregs_clone)
@@ -12587,7 +13178,7 @@ index 5c1a9197..6bc1991 100644
.macro FIXUP_ESPFIX_STACK
/*
* Switch back for ESPFIX stack to the normal zerobased stack
-@@ -761,8 +1003,15 @@ ENDPROC(ptregs_clone)
+@@ -762,8 +1004,15 @@ ENDPROC(ptregs_clone)
* normal stack and adjusts ESP with the matching offset.
*/
/* fixup the stack */
@@ -12605,7 +13196,7 @@ index 5c1a9197..6bc1991 100644
shl $16, %eax
addl %esp, %eax /* the adjusted stack pointer */
pushl_cfi $__KERNEL_DS
-@@ -815,7 +1064,7 @@ vector=vector+1
+@@ -816,7 +1065,7 @@ vector=vector+1
.endr
2: jmp common_interrupt
.endr
@@ -12614,7 +13205,7 @@ index 5c1a9197..6bc1991 100644
.previous
END(interrupt)
-@@ -863,7 +1112,7 @@ ENTRY(coprocessor_error)
+@@ -864,7 +1113,7 @@ ENTRY(coprocessor_error)
pushl_cfi $do_coprocessor_error
jmp error_code
CFI_ENDPROC
@@ -12623,7 +13214,7 @@ index 5c1a9197..6bc1991 100644
ENTRY(simd_coprocessor_error)
RING0_INT_FRAME
-@@ -889,7 +1138,7 @@ ENTRY(simd_coprocessor_error)
+@@ -885,7 +1134,7 @@ ENTRY(simd_coprocessor_error)
#endif
jmp error_code
CFI_ENDPROC
@@ -12632,7 +13223,7 @@ index 5c1a9197..6bc1991 100644
ENTRY(device_not_available)
RING0_INT_FRAME
-@@ -897,7 +1146,7 @@ ENTRY(device_not_available)
+@@ -893,7 +1142,7 @@ ENTRY(device_not_available)
pushl_cfi $do_device_not_available
jmp error_code
CFI_ENDPROC
@@ -12641,7 +13232,7 @@ index 5c1a9197..6bc1991 100644
#ifdef CONFIG_PARAVIRT
ENTRY(native_iret)
-@@ -906,12 +1155,12 @@ ENTRY(native_iret)
+@@ -902,12 +1151,12 @@ ENTRY(native_iret)
.align 4
.long native_iret, iret_exc
.previous
@@ -12656,7 +13247,7 @@ index 5c1a9197..6bc1991 100644
#endif
ENTRY(overflow)
-@@ -920,7 +1169,7 @@ ENTRY(overflow)
+@@ -916,7 +1165,7 @@ ENTRY(overflow)
pushl_cfi $do_overflow
jmp error_code
CFI_ENDPROC
@@ -12665,7 +13256,7 @@ index 5c1a9197..6bc1991 100644
ENTRY(bounds)
RING0_INT_FRAME
-@@ -928,7 +1177,7 @@ ENTRY(bounds)
+@@ -924,7 +1173,7 @@ ENTRY(bounds)
pushl_cfi $do_bounds
jmp error_code
CFI_ENDPROC
@@ -12674,7 +13265,7 @@ index 5c1a9197..6bc1991 100644
ENTRY(invalid_op)
RING0_INT_FRAME
-@@ -936,7 +1185,7 @@ ENTRY(invalid_op)
+@@ -932,7 +1181,7 @@ ENTRY(invalid_op)
pushl_cfi $do_invalid_op
jmp error_code
CFI_ENDPROC
@@ -12683,7 +13274,7 @@ index 5c1a9197..6bc1991 100644
ENTRY(coprocessor_segment_overrun)
RING0_INT_FRAME
-@@ -944,35 +1193,35 @@ ENTRY(coprocessor_segment_overrun)
+@@ -940,35 +1189,35 @@ ENTRY(coprocessor_segment_overrun)
pushl_cfi $do_coprocessor_segment_overrun
jmp error_code
CFI_ENDPROC
@@ -12724,7 +13315,7 @@ index 5c1a9197..6bc1991 100644
ENTRY(divide_error)
RING0_INT_FRAME
-@@ -980,7 +1229,7 @@ ENTRY(divide_error)
+@@ -976,7 +1225,7 @@ ENTRY(divide_error)
pushl_cfi $do_divide_error
jmp error_code
CFI_ENDPROC
@@ -12733,7 +13324,7 @@ index 5c1a9197..6bc1991 100644
#ifdef CONFIG_X86_MCE
ENTRY(machine_check)
-@@ -989,7 +1238,7 @@ ENTRY(machine_check)
+@@ -985,7 +1234,7 @@ ENTRY(machine_check)
pushl_cfi machine_check_vector
jmp error_code
CFI_ENDPROC
@@ -12742,7 +13333,7 @@ index 5c1a9197..6bc1991 100644
#endif
ENTRY(spurious_interrupt_bug)
-@@ -998,7 +1247,7 @@ ENTRY(spurious_interrupt_bug)
+@@ -994,7 +1243,7 @@ ENTRY(spurious_interrupt_bug)
pushl_cfi $do_spurious_interrupt_bug
jmp error_code
CFI_ENDPROC
@@ -12751,7 +13342,7 @@ index 5c1a9197..6bc1991 100644
/*
* End of kprobes section
*/
-@@ -1113,7 +1362,7 @@ BUILD_INTERRUPT3(xen_hvm_callback_vector, XEN_HVM_EVTCHN_CALLBACK,
+@@ -1109,7 +1358,7 @@ BUILD_INTERRUPT3(xen_hvm_callback_vector, XEN_HVM_EVTCHN_CALLBACK,
ENTRY(mcount)
ret
@@ -12760,7 +13351,7 @@ index 5c1a9197..6bc1991 100644
ENTRY(ftrace_caller)
cmpl $0, function_trace_stop
-@@ -1142,7 +1391,7 @@ ftrace_graph_call:
+@@ -1138,7 +1387,7 @@ ftrace_graph_call:
.globl ftrace_stub
ftrace_stub:
ret
@@ -12769,7 +13360,7 @@ index 5c1a9197..6bc1991 100644
#else /* ! CONFIG_DYNAMIC_FTRACE */
-@@ -1178,7 +1427,7 @@ trace:
+@@ -1174,7 +1423,7 @@ trace:
popl %ecx
popl %eax
jmp ftrace_stub
@@ -12778,7 +13369,7 @@ index 5c1a9197..6bc1991 100644
#endif /* CONFIG_DYNAMIC_FTRACE */
#endif /* CONFIG_FUNCTION_TRACER */
-@@ -1199,7 +1448,7 @@ ENTRY(ftrace_graph_caller)
+@@ -1195,7 +1444,7 @@ ENTRY(ftrace_graph_caller)
popl %ecx
popl %eax
ret
@@ -12787,7 +13378,7 @@ index 5c1a9197..6bc1991 100644
.globl return_to_handler
return_to_handler:
-@@ -1213,7 +1462,6 @@ return_to_handler:
+@@ -1209,7 +1458,6 @@ return_to_handler:
jmp *%ecx
#endif
@@ -12795,7 +13386,7 @@ index 5c1a9197..6bc1991 100644
#include "syscall_table_32.S"
syscall_table_size=(.-sys_call_table)
-@@ -1259,15 +1507,18 @@ error_code:
+@@ -1255,15 +1503,18 @@ error_code:
movl $-1, PT_ORIG_EAX(%esp) # no syscall to restart
REG_TO_PTGS %ecx
SET_KERNEL_GS %ecx
@@ -12816,7 +13407,7 @@ index 5c1a9197..6bc1991 100644
/*
* Debug traps and NMI can happen at the one SYSENTER instruction
-@@ -1309,7 +1560,7 @@ debug_stack_correct:
+@@ -1305,7 +1556,7 @@ debug_stack_correct:
call do_debug
jmp ret_from_exception
CFI_ENDPROC
@@ -12825,7 +13416,7 @@ index 5c1a9197..6bc1991 100644
/*
* NMI is doubly nasty. It can happen _while_ we're handling
-@@ -1346,6 +1597,9 @@ nmi_stack_correct:
+@@ -1342,6 +1593,9 @@ nmi_stack_correct:
xorl %edx,%edx # zero error code
movl %esp,%eax # pt_regs pointer
call do_nmi
@@ -12835,7 +13426,7 @@ index 5c1a9197..6bc1991 100644
jmp restore_all_notrace
CFI_ENDPROC
-@@ -1382,12 +1636,15 @@ nmi_espfix_stack:
+@@ -1378,12 +1632,15 @@ nmi_espfix_stack:
FIXUP_ESPFIX_STACK # %eax == %esp
xorl %edx,%edx # zero error code
call do_nmi
@@ -12852,7 +13443,7 @@ index 5c1a9197..6bc1991 100644
ENTRY(int3)
RING0_INT_FRAME
-@@ -1399,14 +1656,14 @@ ENTRY(int3)
+@@ -1395,14 +1652,14 @@ ENTRY(int3)
call do_int3
jmp ret_from_exception
CFI_ENDPROC
@@ -12869,7 +13460,7 @@ index 5c1a9197..6bc1991 100644
#ifdef CONFIG_KVM_GUEST
ENTRY(async_page_fault)
-@@ -1414,7 +1671,7 @@ ENTRY(async_page_fault)
+@@ -1410,7 +1667,7 @@ ENTRY(async_page_fault)
pushl_cfi $do_async_page_fault
jmp error_code
CFI_ENDPROC
@@ -12879,10 +13470,10 @@ index 5c1a9197..6bc1991 100644
/*
diff --git a/arch/x86/kernel/entry_64.S b/arch/x86/kernel/entry_64.S
-index 8a445a0..f4d3cbd 100644
+index faf8d5e..f58c441 100644
--- a/arch/x86/kernel/entry_64.S
+++ b/arch/x86/kernel/entry_64.S
-@@ -53,6 +53,8 @@
+@@ -55,6 +55,8 @@
#include <asm/paravirt.h>
#include <asm/ftrace.h>
#include <asm/percpu.h>
@@ -12891,7 +13482,7 @@ index 8a445a0..f4d3cbd 100644
/* Avoid __ASSEMBLER__'ifying <linux/audit.h> just for this. */
#include <linux/elf-em.h>
-@@ -66,8 +68,9 @@
+@@ -68,8 +70,9 @@
#ifdef CONFIG_FUNCTION_TRACER
#ifdef CONFIG_DYNAMIC_FTRACE
ENTRY(mcount)
@@ -12902,7 +13493,7 @@ index 8a445a0..f4d3cbd 100644
ENTRY(ftrace_caller)
cmpl $0, function_trace_stop
-@@ -90,8 +93,9 @@ GLOBAL(ftrace_graph_call)
+@@ -92,8 +95,9 @@ GLOBAL(ftrace_graph_call)
#endif
GLOBAL(ftrace_stub)
@@ -12913,7 +13504,7 @@ index 8a445a0..f4d3cbd 100644
#else /* ! CONFIG_DYNAMIC_FTRACE */
ENTRY(mcount)
-@@ -110,6 +114,7 @@ ENTRY(mcount)
+@@ -112,6 +116,7 @@ ENTRY(mcount)
#endif
GLOBAL(ftrace_stub)
@@ -12921,7 +13512,7 @@ index 8a445a0..f4d3cbd 100644
retq
trace:
-@@ -119,12 +124,13 @@ trace:
+@@ -121,12 +126,13 @@ trace:
movq 8(%rbp), %rsi
subq $MCOUNT_INSN_SIZE, %rdi
@@ -12936,7 +13527,7 @@ index 8a445a0..f4d3cbd 100644
#endif /* CONFIG_DYNAMIC_FTRACE */
#endif /* CONFIG_FUNCTION_TRACER */
-@@ -144,8 +150,9 @@ ENTRY(ftrace_graph_caller)
+@@ -146,8 +152,9 @@ ENTRY(ftrace_graph_caller)
MCOUNT_RESTORE_FRAME
@@ -12947,7 +13538,7 @@ index 8a445a0..f4d3cbd 100644
GLOBAL(return_to_handler)
subq $24, %rsp
-@@ -161,6 +168,7 @@ GLOBAL(return_to_handler)
+@@ -163,6 +170,7 @@ GLOBAL(return_to_handler)
movq 8(%rsp), %rdx
movq (%rsp), %rax
addq $24, %rsp
@@ -12955,7 +13546,7 @@ index 8a445a0..f4d3cbd 100644
jmp *%rdi
#endif
-@@ -176,6 +184,269 @@ ENTRY(native_usergs_sysret64)
+@@ -178,6 +186,282 @@ ENTRY(native_usergs_sysret64)
ENDPROC(native_usergs_sysret64)
#endif /* CONFIG_PARAVIRT */
@@ -12974,6 +13565,7 @@ index 8a445a0..f4d3cbd 100644
+ .endm
+
+ .macro pax_enter_kernel
++ pax_set_fptr_mask
+#ifdef CONFIG_PAX_KERNEXEC
+ call pax_enter_kernel
+#endif
@@ -12995,14 +13587,11 @@ index 8a445a0..f4d3cbd 100644
+
+ GET_CR0_INTO_RDI
+ bts $16,%rdi
-+ jnc 1f
++ jnc 3f
+ mov %cs,%edi
+ cmp $__KERNEL_CS,%edi
-+ jz 3f
-+ ljmpq __KERNEL_CS,3f
-+1: ljmpq __KERNEXEC_KERNEL_CS,2f
-+2: SET_RDI_INTO_CR0
-+3:
++ jnz 2f
++1:
+
+#ifdef CONFIG_PARAVIRT
+ PV_RESTORE_REGS(CLBR_RDI)
@@ -13011,6 +13600,11 @@ index 8a445a0..f4d3cbd 100644
+ popq %rdi
+ pax_force_retaddr
+ retq
++
++2: ljmpq __KERNEL_CS,1f
++3: ljmpq __KERNEXEC_KERNEL_CS,4f
++4: SET_RDI_INTO_CR0
++ jmp 1b
+ENDPROC(pax_enter_kernel)
+
+ENTRY(pax_exit_kernel)
@@ -13022,12 +13616,8 @@ index 8a445a0..f4d3cbd 100644
+
+ mov %cs,%rdi
+ cmp $__KERNEXEC_KERNEL_CS,%edi
-+ jnz 2f
-+ GET_CR0_INTO_RDI
-+ btr $16,%rdi
-+ ljmpq __KERNEL_CS,1f
-+1: SET_RDI_INTO_CR0
-+2:
++ jz 2f
++1:
+
+#ifdef CONFIG_PARAVIRT
+ PV_RESTORE_REGS(CLBR_RDI);
@@ -13036,10 +13626,24 @@ index 8a445a0..f4d3cbd 100644
+ popq %rdi
+ pax_force_retaddr
+ retq
++
++2: GET_CR0_INTO_RDI
++ btr $16,%rdi
++ ljmpq __KERNEL_CS,3f
++3: SET_RDI_INTO_CR0
++ jmp 1b
++#ifdef CONFIG_PARAVIRT
++ PV_RESTORE_REGS(CLBR_RDI);
++#endif
++
++ popq %rdi
++ pax_force_retaddr
++ retq
+ENDPROC(pax_exit_kernel)
+#endif
+
+ .macro pax_enter_kernel_user
++ pax_set_fptr_mask
+#ifdef CONFIG_PAX_MEMORY_UDEREF
+ call pax_enter_kernel_user
+#endif
@@ -13050,9 +13654,9 @@ index 8a445a0..f4d3cbd 100644
+ call pax_exit_kernel_user
+#endif
+#ifdef CONFIG_PAX_RANDKSTACK
-+ push %rax
++ pushq %rax
+ call pax_randomize_kstack
-+ pop %rax
++ popq %rax
+#endif
+ .endm
+
@@ -13164,24 +13768,24 @@ index 8a445a0..f4d3cbd 100644
+ENDPROC(pax_exit_kernel_user)
+#endif
+
-+ .macro pax_erase_kstack
++.macro pax_erase_kstack
+#ifdef CONFIG_PAX_MEMORY_STACKLEAK
+ call pax_erase_kstack
+#endif
-+ .endm
++.endm
+
+#ifdef CONFIG_PAX_MEMORY_STACKLEAK
+/*
-+ * r10: thread_info
++ * r11: thread_info
+ * rcx, rdx: can be clobbered
+ */
+ENTRY(pax_erase_kstack)
+ pushq %rdi
+ pushq %rax
-+ pushq %r10
++ pushq %r11
+
-+ GET_THREAD_INFO(%r10)
-+ mov TI_lowest_stack(%r10), %rdi
++ GET_THREAD_INFO(%r11)
++ mov TI_lowest_stack(%r11), %rdi
+ mov $-0xBEEF, %rax
+ std
+
@@ -13211,11 +13815,11 @@ index 8a445a0..f4d3cbd 100644
+ shr $3, %ecx
+ rep stosq
+
-+ mov TI_task_thread_sp0(%r10), %rdi
++ mov TI_task_thread_sp0(%r11), %rdi
+ sub $256, %rdi
-+ mov %rdi, TI_lowest_stack(%r10)
++ mov %rdi, TI_lowest_stack(%r11)
+
-+ popq %r10
++ popq %r11
+ popq %rax
+ popq %rdi
+ pax_force_retaddr
@@ -13225,28 +13829,27 @@ index 8a445a0..f4d3cbd 100644
.macro TRACE_IRQS_IRETQ offset=ARGOFFSET
#ifdef CONFIG_TRACE_IRQFLAGS
-@@ -318,7 +589,7 @@ ENTRY(save_args)
- leaq -RBP+8(%rsp),%rdi /* arg1 for handler */
- movq_cfi rbp, 8 /* push %rbp */
- leaq 8(%rsp), %rbp /* mov %rsp, %ebp */
+@@ -231,8 +515,8 @@ ENDPROC(native_usergs_sysret64)
+ .endm
+
+ .macro UNFAKE_STACK_FRAME
+- addq $8*6, %rsp
+- CFI_ADJUST_CFA_OFFSET -(6*8)
++ addq $8*6 + ARG_SKIP, %rsp
++ CFI_ADJUST_CFA_OFFSET -(6*8 + ARG_SKIP)
+ .endm
+
+ /*
+@@ -319,7 +603,7 @@ ENDPROC(native_usergs_sysret64)
+ movq %rsp, %rsi
+
+ leaq -RBP(%rsp),%rdi /* arg1 for handler */
- testl $3, CS(%rdi)
+ testb $3, CS(%rdi)
je 1f
SWAPGS
/*
-@@ -338,9 +609,10 @@ ENTRY(save_args)
- * We entered an interrupt context - irqs are off:
- */
- 2: TRACE_IRQS_OFF
-+ pax_force_retaddr
- ret
- CFI_ENDPROC
--END(save_args)
-+ENDPROC(save_args)
- .popsection
-
- ENTRY(save_rest)
-@@ -354,9 +626,10 @@ ENTRY(save_rest)
+@@ -355,9 +639,10 @@ ENTRY(save_rest)
movq_cfi r15, R15+16
movq %r11, 8(%rsp) /* return address */
FIXUP_TOP_OF_STACK %r11, 16
@@ -13258,12 +13861,12 @@ index 8a445a0..f4d3cbd 100644
/* save complete stack frame */
.pushsection .kprobes.text, "ax"
-@@ -385,9 +658,10 @@ ENTRY(save_paranoid)
+@@ -386,9 +671,10 @@ ENTRY(save_paranoid)
js 1f /* negative -> in kernel */
SWAPGS
xorl %ebx,%ebx
-1: ret
-+1: pax_force_retaddr
++1: pax_force_retaddr_bts
+ ret
CFI_ENDPROC
-END(save_paranoid)
@@ -13271,7 +13874,7 @@ index 8a445a0..f4d3cbd 100644
.popsection
/*
-@@ -409,7 +683,7 @@ ENTRY(ret_from_fork)
+@@ -410,7 +696,7 @@ ENTRY(ret_from_fork)
RESTORE_REST
@@ -13280,7 +13883,7 @@ index 8a445a0..f4d3cbd 100644
je int_ret_from_sys_call
testl $_TIF_IA32, TI_flags(%rcx) # 32-bit compat task needs IRET
-@@ -419,7 +693,7 @@ ENTRY(ret_from_fork)
+@@ -420,7 +706,7 @@ ENTRY(ret_from_fork)
jmp ret_from_sys_call # go to the SYSRET fastpath
CFI_ENDPROC
@@ -13289,7 +13892,7 @@ index 8a445a0..f4d3cbd 100644
/*
* System call entry. Up to 6 arguments in registers are supported.
-@@ -455,7 +729,7 @@ END(ret_from_fork)
+@@ -456,7 +742,7 @@ END(ret_from_fork)
ENTRY(system_call)
CFI_STARTPROC simple
CFI_SIGNAL_FRAME
@@ -13298,22 +13901,31 @@ index 8a445a0..f4d3cbd 100644
CFI_REGISTER rip,rcx
/*CFI_REGISTER rflags,r11*/
SWAPGS_UNSAFE_STACK
-@@ -468,12 +742,13 @@ ENTRY(system_call_after_swapgs)
+@@ -469,12 +755,13 @@ ENTRY(system_call_after_swapgs)
movq %rsp,PER_CPU_VAR(old_rsp)
movq PER_CPU_VAR(kernel_stack),%rsp
++ SAVE_ARGS 8*6,0
+ pax_enter_kernel_user
/*
* No need to follow this irqs off/on section - it's straight
* and short:
*/
ENABLE_INTERRUPTS(CLBR_NONE)
-- SAVE_ARGS 8,1
-+ SAVE_ARGS 8*6,1
+- SAVE_ARGS 8,0
movq %rax,ORIG_RAX-ARGOFFSET(%rsp)
movq %rcx,RIP-ARGOFFSET(%rsp)
CFI_REL_OFFSET rip,RIP-ARGOFFSET
-@@ -502,6 +777,8 @@ sysret_check:
+@@ -484,7 +771,7 @@ ENTRY(system_call_after_swapgs)
+ system_call_fastpath:
+ cmpq $__NR_syscall_max,%rax
+ ja badsys
+- movq %r10,%rcx
++ movq R10-ARGOFFSET(%rsp),%rcx
+ call *sys_call_table(,%rax,8) # XXX: rip relative
+ movq %rax,RAX-ARGOFFSET(%rsp)
+ /*
+@@ -503,6 +790,8 @@ sysret_check:
andl %edi,%edx
jnz sysret_careful
CFI_REMEMBER_STATE
@@ -13322,7 +13934,15 @@ index 8a445a0..f4d3cbd 100644
/*
* sysretq will re-enable interrupts:
*/
-@@ -560,6 +837,9 @@ auditsys:
+@@ -554,14 +843,18 @@ badsys:
+ * jump back to the normal fast path.
+ */
+ auditsys:
+- movq %r10,%r9 /* 6th arg: 4th syscall arg */
++ movq R10-ARGOFFSET(%rsp),%r9 /* 6th arg: 4th syscall arg */
+ movq %rdx,%r8 /* 5th arg: 3rd syscall arg */
+ movq %rsi,%rcx /* 4th arg: 2nd syscall arg */
+ movq %rdi,%rdx /* 3rd arg: 1st syscall arg */
movq %rax,%rsi /* 2nd arg: syscall number */
movl $AUDIT_ARCH_X86_64,%edi /* 1st arg: audit arch */
call audit_syscall_entry
@@ -13330,9 +13950,11 @@ index 8a445a0..f4d3cbd 100644
+ pax_erase_kstack
+
LOAD_ARGS 0 /* reload call-clobbered registers */
++ pax_set_fptr_mask
jmp system_call_fastpath
-@@ -590,6 +870,9 @@ tracesys:
+ /*
+@@ -591,16 +884,20 @@ tracesys:
FIXUP_TOP_OF_STACK %rdi
movq %rsp,%rdi
call syscall_trace_enter
@@ -13342,7 +13964,19 @@ index 8a445a0..f4d3cbd 100644
/*
* Reload arg registers from stack in case ptrace changed them.
* We don't reload %rax because syscall_trace_enter() returned
-@@ -611,7 +894,7 @@ tracesys:
+ * the value it wants us to use in the table lookup.
+ */
+ LOAD_ARGS ARGOFFSET, 1
++ pax_set_fptr_mask
+ RESTORE_REST
+ cmpq $__NR_syscall_max,%rax
+ ja int_ret_from_sys_call /* RAX(%rsp) set to -ENOSYS above */
+- movq %r10,%rcx /* fixup for C */
++ movq R10-ARGOFFSET(%rsp),%rcx /* fixup for C */
+ call *sys_call_table(,%rax,8)
+ movq %rax,RAX-ARGOFFSET(%rsp)
+ /* Use IRET because user could have changed frame */
+@@ -612,7 +909,7 @@ tracesys:
GLOBAL(int_ret_from_sys_call)
DISABLE_INTERRUPTS(CLBR_NONE)
TRACE_IRQS_OFF
@@ -13351,7 +13985,7 @@ index 8a445a0..f4d3cbd 100644
je retint_restore_args
movl $_TIF_ALLWORK_MASK,%edi
/* edi: mask to check */
-@@ -668,7 +951,7 @@ int_restore_rest:
+@@ -669,7 +966,7 @@ int_restore_rest:
TRACE_IRQS_OFF
jmp int_with_check
CFI_ENDPROC
@@ -13360,7 +13994,7 @@ index 8a445a0..f4d3cbd 100644
/*
* Certain special system calls that need to save a complete full stack frame.
-@@ -684,7 +967,7 @@ ENTRY(\label)
+@@ -685,7 +982,7 @@ ENTRY(\label)
call \func
jmp ptregscall_common
CFI_ENDPROC
@@ -13369,7 +14003,7 @@ index 8a445a0..f4d3cbd 100644
.endm
PTREGSCALL stub_clone, sys_clone, %r8
-@@ -702,9 +985,10 @@ ENTRY(ptregscall_common)
+@@ -703,9 +1000,10 @@ ENTRY(ptregscall_common)
movq_cfi_restore R12+8, r12
movq_cfi_restore RBP+8, rbp
movq_cfi_restore RBX+8, rbx
@@ -13381,7 +14015,7 @@ index 8a445a0..f4d3cbd 100644
ENTRY(stub_execve)
CFI_STARTPROC
-@@ -719,7 +1003,7 @@ ENTRY(stub_execve)
+@@ -720,7 +1018,7 @@ ENTRY(stub_execve)
RESTORE_REST
jmp int_ret_from_sys_call
CFI_ENDPROC
@@ -13390,7 +14024,7 @@ index 8a445a0..f4d3cbd 100644
/*
* sigreturn is special because it needs to restore all registers on return.
-@@ -737,7 +1021,7 @@ ENTRY(stub_rt_sigreturn)
+@@ -738,7 +1036,7 @@ ENTRY(stub_rt_sigreturn)
RESTORE_REST
jmp int_ret_from_sys_call
CFI_ENDPROC
@@ -13399,7 +14033,7 @@ index 8a445a0..f4d3cbd 100644
/*
* Build the entry stubs and pointer table with some assembler magic.
-@@ -772,7 +1056,7 @@ vector=vector+1
+@@ -773,7 +1071,7 @@ vector=vector+1
2: jmp common_interrupt
.endr
CFI_ENDPROC
@@ -13408,10 +14042,10 @@ index 8a445a0..f4d3cbd 100644
.previous
END(interrupt)
-@@ -793,6 +1077,16 @@ END(interrupt)
+@@ -793,6 +1091,16 @@ END(interrupt)
+ subq $ORIG_RAX-RBP, %rsp
CFI_ADJUST_CFA_OFFSET ORIG_RAX-RBP
- call save_args
- PARTIAL_FRAME 0
+ SAVE_ARGS_IRQ
+#ifdef CONFIG_PAX_MEMORY_UDEREF
+ testb $3, CS(%rdi)
+ jnz 1f
@@ -13425,8 +14059,8 @@ index 8a445a0..f4d3cbd 100644
call \func
.endm
-@@ -825,7 +1119,7 @@ ret_from_intr:
- CFI_ADJUST_CFA_OFFSET -8
+@@ -824,7 +1132,7 @@ ret_from_intr:
+
exit_intr:
GET_THREAD_INFO(%rcx)
- testl $3,CS-ARGOFFSET(%rsp)
@@ -13434,7 +14068,7 @@ index 8a445a0..f4d3cbd 100644
je retint_kernel
/* Interrupt came from user space */
-@@ -847,12 +1141,16 @@ retint_swapgs: /* return to user-space */
+@@ -846,12 +1154,16 @@ retint_swapgs: /* return to user-space */
* The iretq could re-enable interrupts:
*/
DISABLE_INTERRUPTS(CLBR_ANY)
@@ -13451,7 +14085,7 @@ index 8a445a0..f4d3cbd 100644
/*
* The iretq could re-enable interrupts:
*/
-@@ -941,7 +1239,7 @@ ENTRY(retint_kernel)
+@@ -940,7 +1252,7 @@ ENTRY(retint_kernel)
#endif
CFI_ENDPROC
@@ -13460,7 +14094,7 @@ index 8a445a0..f4d3cbd 100644
/*
* End of kprobes section
*/
-@@ -957,7 +1255,7 @@ ENTRY(\sym)
+@@ -956,7 +1268,7 @@ ENTRY(\sym)
interrupt \do_sym
jmp ret_from_intr
CFI_ENDPROC
@@ -13469,7 +14103,7 @@ index 8a445a0..f4d3cbd 100644
.endm
#ifdef CONFIG_SMP
-@@ -1027,12 +1325,22 @@ ENTRY(\sym)
+@@ -1021,12 +1333,22 @@ ENTRY(\sym)
CFI_ADJUST_CFA_OFFSET ORIG_RAX-R15
call error_entry
DEFAULT_FRAME 0
@@ -13493,7 +14127,7 @@ index 8a445a0..f4d3cbd 100644
.endm
.macro paranoidzeroentry sym do_sym
-@@ -1044,15 +1352,25 @@ ENTRY(\sym)
+@@ -1038,15 +1360,25 @@ ENTRY(\sym)
CFI_ADJUST_CFA_OFFSET ORIG_RAX-R15
call save_paranoid
TRACE_IRQS_OFF
@@ -13521,7 +14155,7 @@ index 8a445a0..f4d3cbd 100644
.macro paranoidzeroentry_ist sym do_sym ist
ENTRY(\sym)
INTR_FRAME
-@@ -1062,14 +1380,30 @@ ENTRY(\sym)
+@@ -1056,14 +1388,30 @@ ENTRY(\sym)
CFI_ADJUST_CFA_OFFSET ORIG_RAX-R15
call save_paranoid
TRACE_IRQS_OFF
@@ -13553,7 +14187,7 @@ index 8a445a0..f4d3cbd 100644
.endm
.macro errorentry sym do_sym
-@@ -1080,13 +1414,23 @@ ENTRY(\sym)
+@@ -1074,13 +1422,23 @@ ENTRY(\sym)
CFI_ADJUST_CFA_OFFSET ORIG_RAX-R15
call error_entry
DEFAULT_FRAME 0
@@ -13578,7 +14212,7 @@ index 8a445a0..f4d3cbd 100644
.endm
/* error code is on the stack already */
-@@ -1099,13 +1443,23 @@ ENTRY(\sym)
+@@ -1093,13 +1451,23 @@ ENTRY(\sym)
call save_paranoid
DEFAULT_FRAME 0
TRACE_IRQS_OFF
@@ -13603,7 +14237,7 @@ index 8a445a0..f4d3cbd 100644
.endm
zeroentry divide_error do_divide_error
-@@ -1134,9 +1488,10 @@ gs_change:
+@@ -1129,9 +1497,10 @@ gs_change:
2: mfence /* workaround */
SWAPGS
popfq_cfi
@@ -13615,7 +14249,7 @@ index 8a445a0..f4d3cbd 100644
.section __ex_table,"a"
.align 8
-@@ -1158,13 +1513,14 @@ ENTRY(kernel_thread_helper)
+@@ -1153,13 +1522,14 @@ ENTRY(kernel_thread_helper)
* Here we are in the child and the registers are set as they were
* at kernel_thread() invocation in the parent.
*/
@@ -13631,9 +14265,11 @@ index 8a445a0..f4d3cbd 100644
/*
* execve(). This function needs to use IRET, not SYSRET, to set up all state properly.
-@@ -1193,9 +1549,10 @@ ENTRY(kernel_execve)
+@@ -1186,11 +1556,11 @@ ENTRY(kernel_execve)
+ RESTORE_REST
+ testq %rax,%rax
je int_ret_from_sys_call
- RESTORE_ARGS
+- RESTORE_ARGS
UNFAKE_STACK_FRAME
+ pax_force_retaddr
ret
@@ -13643,7 +14279,7 @@ index 8a445a0..f4d3cbd 100644
/* Call softirq on interrupt stack. Interrupts are off. */
ENTRY(call_softirq)
-@@ -1213,9 +1570,10 @@ ENTRY(call_softirq)
+@@ -1208,9 +1578,10 @@ ENTRY(call_softirq)
CFI_DEF_CFA_REGISTER rsp
CFI_ADJUST_CFA_OFFSET -8
decl PER_CPU_VAR(irq_count)
@@ -13655,7 +14291,7 @@ index 8a445a0..f4d3cbd 100644
#ifdef CONFIG_XEN
zeroentry xen_hypervisor_callback xen_do_hypervisor_callback
-@@ -1253,7 +1611,7 @@ ENTRY(xen_do_hypervisor_callback) # do_hypervisor_callback(struct *pt_regs)
+@@ -1248,7 +1619,7 @@ ENTRY(xen_do_hypervisor_callback) # do_hypervisor_callback(struct *pt_regs)
decl PER_CPU_VAR(irq_count)
jmp error_exit
CFI_ENDPROC
@@ -13664,7 +14300,7 @@ index 8a445a0..f4d3cbd 100644
/*
* Hypervisor uses this for application faults while it executes.
-@@ -1312,7 +1670,7 @@ ENTRY(xen_failsafe_callback)
+@@ -1307,7 +1678,7 @@ ENTRY(xen_failsafe_callback)
SAVE_ALL
jmp error_exit
CFI_ENDPROC
@@ -13673,7 +14309,7 @@ index 8a445a0..f4d3cbd 100644
apicinterrupt XEN_HVM_EVTCHN_CALLBACK \
xen_hvm_callback_vector xen_evtchn_do_upcall
-@@ -1361,16 +1719,31 @@ ENTRY(paranoid_exit)
+@@ -1356,16 +1727,31 @@ ENTRY(paranoid_exit)
TRACE_IRQS_OFF
testl %ebx,%ebx /* swapgs needed? */
jnz paranoid_restore
@@ -13685,7 +14321,7 @@ index 8a445a0..f4d3cbd 100644
+ TRACE_IRQS_IRETQ 0
+ SWAPGS_UNSAFE_STACK
+ RESTORE_ALL 8
-+ pax_force_retaddr
++ pax_force_retaddr_bts
+ jmp irq_return
+#endif
paranoid_swapgs:
@@ -13702,11 +14338,11 @@ index 8a445a0..f4d3cbd 100644
+ pax_exit_kernel
TRACE_IRQS_IRETQ 0
RESTORE_ALL 8
-+ pax_force_retaddr
++ pax_force_retaddr_bts
jmp irq_return
paranoid_userspace:
GET_THREAD_INFO(%rcx)
-@@ -1399,7 +1772,7 @@ paranoid_schedule:
+@@ -1394,7 +1780,7 @@ paranoid_schedule:
TRACE_IRQS_OFF
jmp paranoid_userspace
CFI_ENDPROC
@@ -13715,7 +14351,7 @@ index 8a445a0..f4d3cbd 100644
/*
* Exception entry point. This expects an error code/orig_rax on the stack.
-@@ -1426,12 +1799,13 @@ ENTRY(error_entry)
+@@ -1421,12 +1807,13 @@ ENTRY(error_entry)
movq_cfi r14, R14+8
movq_cfi r15, R15+8
xorl %ebx,%ebx
@@ -13726,11 +14362,11 @@ index 8a445a0..f4d3cbd 100644
SWAPGS
error_sti:
TRACE_IRQS_OFF
-+ pax_force_retaddr
++ pax_force_retaddr_bts
ret
/*
-@@ -1458,7 +1832,7 @@ bstep_iret:
+@@ -1453,7 +1840,7 @@ bstep_iret:
movq %rcx,RIP+8(%rsp)
jmp error_swapgs
CFI_ENDPROC
@@ -13739,7 +14375,7 @@ index 8a445a0..f4d3cbd 100644
/* ebx: no swapgs flag (1: don't need swapgs, 0: need it) */
-@@ -1478,7 +1852,7 @@ ENTRY(error_exit)
+@@ -1473,7 +1860,7 @@ ENTRY(error_exit)
jnz retint_careful
jmp retint_swapgs
CFI_ENDPROC
@@ -13748,7 +14384,7 @@ index 8a445a0..f4d3cbd 100644
/* runs on exception stack */
-@@ -1490,6 +1864,16 @@ ENTRY(nmi)
+@@ -1485,6 +1872,16 @@ ENTRY(nmi)
CFI_ADJUST_CFA_OFFSET ORIG_RAX-R15
call save_paranoid
DEFAULT_FRAME 0
@@ -13765,7 +14401,7 @@ index 8a445a0..f4d3cbd 100644
/* paranoidentry do_nmi, 0; without TRACE_IRQS_OFF */
movq %rsp,%rdi
movq $-1,%rsi
-@@ -1500,12 +1884,28 @@ ENTRY(nmi)
+@@ -1495,12 +1892,28 @@ ENTRY(nmi)
DISABLE_INTERRUPTS(CLBR_NONE)
testl %ebx,%ebx /* swapgs needed? */
jnz nmi_restore
@@ -13776,7 +14412,7 @@ index 8a445a0..f4d3cbd 100644
+ pax_exit_kernel
+ SWAPGS_UNSAFE_STACK
+ RESTORE_ALL 8
-+ pax_force_retaddr
++ pax_force_retaddr_bts
+ jmp irq_return
+#endif
nmi_swapgs:
@@ -13791,11 +14427,11 @@ index 8a445a0..f4d3cbd 100644
nmi_restore:
+ pax_exit_kernel
RESTORE_ALL 8
-+ pax_force_retaddr
++ pax_force_retaddr_bts
jmp irq_return
nmi_userspace:
GET_THREAD_INFO(%rcx)
-@@ -1534,14 +1934,14 @@ nmi_schedule:
+@@ -1529,14 +1942,14 @@ nmi_schedule:
jmp paranoid_exit
CFI_ENDPROC
#endif
@@ -14333,33 +14969,37 @@ index ce0be7c..c41476e 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 e11e394..d5a4a69 100644
+index e11e394..9aebc5d 100644
--- a/arch/x86/kernel/head_64.S
+++ b/arch/x86/kernel/head_64.S
-@@ -19,6 +19,7 @@
+@@ -19,6 +19,8 @@
#include <asm/cache.h>
#include <asm/processor-flags.h>
#include <asm/percpu.h>
+#include <asm/cpufeature.h>
++#include <asm/alternative-asm.h>
#ifdef CONFIG_PARAVIRT
#include <asm/asm-offsets.h>
-@@ -38,6 +39,10 @@ L4_PAGE_OFFSET = pgd_index(__PAGE_OFFSET)
+@@ -38,6 +40,12 @@ L4_PAGE_OFFSET = pgd_index(__PAGE_OFFSET)
L3_PAGE_OFFSET = pud_index(__PAGE_OFFSET)
L4_START_KERNEL = pgd_index(__START_KERNEL_map)
L3_START_KERNEL = pud_index(__START_KERNEL_map)
+L4_VMALLOC_START = pgd_index(VMALLOC_START)
+L3_VMALLOC_START = pud_index(VMALLOC_START)
++L4_VMALLOC_END = pgd_index(VMALLOC_END)
++L3_VMALLOC_END = pud_index(VMALLOC_END)
+L4_VMEMMAP_START = pgd_index(VMEMMAP_START)
+L3_VMEMMAP_START = pud_index(VMEMMAP_START)
.text
__HEAD
-@@ -85,35 +90,22 @@ startup_64:
+@@ -85,35 +93,23 @@ startup_64:
*/
addq %rbp, init_level4_pgt + 0(%rip)
addq %rbp, init_level4_pgt + (L4_PAGE_OFFSET*8)(%rip)
+ addq %rbp, init_level4_pgt + (L4_VMALLOC_START*8)(%rip)
++ addq %rbp, init_level4_pgt + (L4_VMALLOC_END*8)(%rip)
+ addq %rbp, init_level4_pgt + (L4_VMEMMAP_START*8)(%rip)
addq %rbp, init_level4_pgt + (L4_START_KERNEL*8)(%rip)
@@ -14370,8 +15010,12 @@ index e11e394..d5a4a69 100644
- addq %rbp, level3_kernel_pgt + (510*8)(%rip)
- addq %rbp, level3_kernel_pgt + (511*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*8+8)(%rip)
+
+ addq %rbp, level2_fixmap_pgt + (506*8)(%rip)
-
- /* Add an Identity mapping if I am above 1G */
- leaq _text(%rip), %rdi
@@ -14381,14 +15025,11 @@ index e11e394..d5a4a69 100644
- shrq $PUD_SHIFT, %rax
- andq $(PTRS_PER_PUD - 1), %rax
- jz ident_complete
-+ addq %rbp, level3_vmemmap_pgt + (L3_VMEMMAP_START*8)(%rip)
-
+-
- leaq (level2_spare_pgt - __START_KERNEL_map + _KERNPG_TABLE)(%rbp), %rdx
- leaq level3_ident_pgt(%rip), %rbx
- movq %rdx, 0(%rbx, %rax, 8)
-+ addq %rbp, level3_kernel_pgt + (L3_START_KERNEL*8)(%rip)
-+ addq %rbp, level3_kernel_pgt + (L3_START_KERNEL*8+8)(%rip)
-
+-
- movq %rdi, %rax
- shrq $PMD_SHIFT, %rax
- andq $(PTRS_PER_PMD - 1), %rax
@@ -14396,12 +15037,11 @@ index e11e394..d5a4a69 100644
- leaq level2_spare_pgt(%rip), %rbx
- movq %rdx, 0(%rbx, %rax, 8)
-ident_complete:
-+ addq %rbp, level2_fixmap_pgt + (506*8)(%rip)
+ addq %rbp, level2_fixmap_pgt + (507*8)(%rip)
/*
* Fixup the kernel text+data virtual addresses. Note that
-@@ -160,8 +152,8 @@ ENTRY(secondary_startup_64)
+@@ -160,8 +156,8 @@ ENTRY(secondary_startup_64)
* after the boot processor executes this code.
*/
@@ -14412,7 +15052,7 @@ index e11e394..d5a4a69 100644
movq %rax, %cr4
/* Setup early boot stage 4 level pagetables. */
-@@ -183,9 +175,14 @@ ENTRY(secondary_startup_64)
+@@ -183,9 +179,17 @@ ENTRY(secondary_startup_64)
movl $MSR_EFER, %ecx
rdmsr
btsl $_EFER_SCE, %eax /* Enable System Call */
@@ -14421,14 +15061,25 @@ index e11e394..d5a4a69 100644
jnc 1f
btsl $_EFER_NX, %eax
+ leaq init_level4_pgt(%rip), %rdi
++#ifndef CONFIG_EFI
+ btsq $_PAGE_BIT_NX, 8*L4_PAGE_OFFSET(%rdi)
++#endif
+ btsq $_PAGE_BIT_NX, 8*L4_VMALLOC_START(%rdi)
++ btsq $_PAGE_BIT_NX, 8*L4_VMALLOC_END(%rdi)
+ btsq $_PAGE_BIT_NX, 8*L4_VMEMMAP_START(%rdi)
+ btsq $_PAGE_BIT_NX, __supported_pte_mask(%rip)
1: wrmsr /* Make changes effective */
/* Setup cr0 */
-@@ -269,7 +266,7 @@ ENTRY(secondary_startup_64)
+@@ -247,6 +251,7 @@ ENTRY(secondary_startup_64)
+ * jump. In addition we need to ensure %cs is set so we make this
+ * a far return.
+ */
++ pax_set_fptr_mask
+ movq initial_code(%rip),%rax
+ pushq $0 # fake return address to stop unwinder
+ pushq $__KERNEL_CS # set correct cs
+@@ -269,7 +274,7 @@ ENTRY(secondary_startup_64)
bad_address:
jmp bad_address
@@ -14437,7 +15088,7 @@ index e11e394..d5a4a69 100644
#ifdef CONFIG_EARLY_PRINTK
.globl early_idt_handlers
early_idt_handlers:
-@@ -314,18 +311,23 @@ ENTRY(early_idt_handler)
+@@ -314,18 +319,23 @@ ENTRY(early_idt_handler)
#endif /* EARLY_PRINTK */
1: hlt
jmp 1b
@@ -14454,15 +15105,15 @@ index e11e394..d5a4a69 100644
.asciz "PANIC: early exception %02lx rip %lx:%lx error %lx cr2 %lx\n"
early_idt_ripmsg:
.asciz "RIP %s\n"
--#endif /* CONFIG_EARLY_PRINTK */
- .previous
-+#endif /* CONFIG_EARLY_PRINTK */
++ .previous
+ #endif /* CONFIG_EARLY_PRINTK */
+- .previous
+ .section .rodata,"a",@progbits
#define NEXT_PAGE(name) \
.balign PAGE_SIZE; \
ENTRY(name)
-@@ -338,7 +340,6 @@ ENTRY(name)
+@@ -338,7 +348,6 @@ ENTRY(name)
i = i + 1 ; \
.endr
@@ -14470,12 +15121,14 @@ index e11e394..d5a4a69 100644
/*
* This default setting generates an ident mapping at address 0x100000
* and a mapping for the kernel that precisely maps virtual address
-@@ -349,13 +350,36 @@ NEXT_PAGE(init_level4_pgt)
+@@ -349,13 +358,41 @@ 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
+ .org init_level4_pgt + L4_VMALLOC_START*8, 0
-+ .quad level3_vmalloc_pgt - __START_KERNEL_map + _KERNPG_TABLE
++ .quad level3_vmalloc_start_pgt - __START_KERNEL_map + _KERNPG_TABLE
++ .org init_level4_pgt + L4_VMALLOC_END*8, 0
++ .quad level3_vmalloc_end_pgt - __START_KERNEL_map + _KERNPG_TABLE
+ .org init_level4_pgt + L4_VMEMMAP_START*8, 0
+ .quad level3_vmemmap_pgt - __START_KERNEL_map + _KERNPG_TABLE
.org init_level4_pgt + L4_START_KERNEL*8, 0
@@ -14498,7 +15151,10 @@ index e11e394..d5a4a69 100644
+ .fill 510,8,0
+#endif
+
-+NEXT_PAGE(level3_vmalloc_pgt)
++NEXT_PAGE(level3_vmalloc_start_pgt)
++ .fill 512,8,0
++
++NEXT_PAGE(level3_vmalloc_end_pgt)
+ .fill 512,8,0
+
+NEXT_PAGE(level3_vmemmap_pgt)
@@ -14507,7 +15163,7 @@ index e11e394..d5a4a69 100644
NEXT_PAGE(level3_kernel_pgt)
.fill L3_START_KERNEL,8,0
-@@ -363,20 +387,23 @@ NEXT_PAGE(level3_kernel_pgt)
+@@ -363,20 +400,23 @@ NEXT_PAGE(level3_kernel_pgt)
.quad level2_kernel_pgt - __START_KERNEL_map + _KERNPG_TABLE
.quad level2_fixmap_pgt - __START_KERNEL_map + _PAGE_TABLE
@@ -14539,7 +15195,7 @@ index e11e394..d5a4a69 100644
NEXT_PAGE(level2_kernel_pgt)
/*
-@@ -389,33 +416,55 @@ NEXT_PAGE(level2_kernel_pgt)
+@@ -389,33 +429,55 @@ NEXT_PAGE(level2_kernel_pgt)
* If you want to increase this then increase MODULES_VADDR
* too.)
*/
@@ -14631,7 +15287,7 @@ index 9c3bd4a..e1d9b35 100644
+EXPORT_SYMBOL(__LOAD_PHYSICAL_ADDR);
+#endif
diff --git a/arch/x86/kernel/i8259.c b/arch/x86/kernel/i8259.c
-index 65b8f5c..a938251 100644
+index 6104852..6114160 100644
--- a/arch/x86/kernel/i8259.c
+++ b/arch/x86/kernel/i8259.c
@@ -210,7 +210,7 @@ spurious_8259A_irq:
@@ -14713,10 +15369,10 @@ index 8c96897..be66bfa 100644
return -EPERM;
}
diff --git a/arch/x86/kernel/irq.c b/arch/x86/kernel/irq.c
-index 6c0802e..bea25ae 100644
+index 429e0c9..17b3ece 100644
--- a/arch/x86/kernel/irq.c
+++ b/arch/x86/kernel/irq.c
-@@ -17,7 +17,7 @@
+@@ -18,7 +18,7 @@
#include <asm/mce.h>
#include <asm/hw_irq.h>
@@ -14725,7 +15381,7 @@ index 6c0802e..bea25ae 100644
/* Function pointer for generic interrupt vector handling */
void (*x86_platform_ipi_callback)(void) = NULL;
-@@ -116,9 +116,9 @@ int arch_show_interrupts(struct seq_file *p, int prec)
+@@ -117,9 +117,9 @@ int arch_show_interrupts(struct seq_file *p, int prec)
seq_printf(p, "%10u ", per_cpu(mce_poll_count, j));
seq_printf(p, " Machine check polls\n");
#endif
@@ -14737,7 +15393,7 @@ index 6c0802e..bea25ae 100644
#endif
return 0;
}
-@@ -158,10 +158,10 @@ u64 arch_irq_stat_cpu(unsigned int cpu)
+@@ -159,10 +159,10 @@ u64 arch_irq_stat_cpu(unsigned int cpu)
u64 arch_irq_stat(void)
{
@@ -14893,8 +15549,21 @@ index 7209070..cbcd71a 100644
/*
* Shouldn't happen, we returned above if in_interrupt():
*/
+diff --git a/arch/x86/kernel/irq_64.c b/arch/x86/kernel/irq_64.c
+index 69bca46..0bac999 100644
+--- a/arch/x86/kernel/irq_64.c
++++ b/arch/x86/kernel/irq_64.c
+@@ -38,7 +38,7 @@ static inline void stack_overflow_check(struct pt_regs *regs)
+ #ifdef CONFIG_DEBUG_STACKOVERFLOW
+ u64 curbase = (u64)task_stack_page(current);
+
+- if (user_mode_vm(regs))
++ if (user_mode(regs))
+ return;
+
+ WARN_ONCE(regs->sp >= curbase &&
diff --git a/arch/x86/kernel/kgdb.c b/arch/x86/kernel/kgdb.c
-index 5f9ecff..122d84b 100644
+index faba577..93b9e71 100644
--- a/arch/x86/kernel/kgdb.c
+++ b/arch/x86/kernel/kgdb.c
@@ -124,11 +124,11 @@ char *dbg_get_reg(int regno, void *mem, struct pt_regs *regs)
@@ -14926,9 +15595,9 @@ index 5f9ecff..122d84b 100644
raw_smp_processor_id());
}
-@@ -534,7 +534,7 @@ static int __kgdb_notify(struct die_args *args, unsigned long cmd)
- return NOTIFY_DONE;
+@@ -543,7 +543,7 @@ static int __kgdb_notify(struct die_args *args, unsigned long cmd)
+ switch (cmd) {
case DIE_DEBUG:
- if (atomic_read(&kgdb_cpu_doing_single_step) != -1) {
+ if (atomic_read_unchecked(&kgdb_cpu_doing_single_step) != -1) {
@@ -14936,10 +15605,10 @@ index 5f9ecff..122d84b 100644
return single_step_cont(regs, args);
break;
diff --git a/arch/x86/kernel/kprobes.c b/arch/x86/kernel/kprobes.c
-index 794bc95..c6e29e9 100644
+index 7da647d..5d3c4c1 100644
--- a/arch/x86/kernel/kprobes.c
+++ b/arch/x86/kernel/kprobes.c
-@@ -117,8 +117,11 @@ static void __kprobes __synthesize_relative_insn(void *from, void *to, u8 op)
+@@ -118,8 +118,11 @@ static void __kprobes __synthesize_relative_insn(void *from, void *to, u8 op)
} __attribute__((packed)) *insn;
insn = (struct __arch_relative_insn *)from;
@@ -14951,7 +15620,7 @@ index 794bc95..c6e29e9 100644
}
/* Insert a jump instruction at address 'from', which jumps to address 'to'.*/
-@@ -155,7 +158,7 @@ static int __kprobes can_boost(kprobe_opcode_t *opcodes)
+@@ -156,7 +159,7 @@ static int __kprobes can_boost(kprobe_opcode_t *opcodes)
kprobe_opcode_t opcode;
kprobe_opcode_t *orig_opcodes = opcodes;
@@ -14960,7 +15629,7 @@ index 794bc95..c6e29e9 100644
return 0; /* Page fault may occur on this address. */
retry:
-@@ -316,7 +319,9 @@ static int __kprobes __copy_instruction(u8 *dest, u8 *src, int recover)
+@@ -317,7 +320,9 @@ static int __kprobes __copy_instruction(u8 *dest, u8 *src, int recover)
}
}
insn_get_length(&insn);
@@ -14970,7 +15639,7 @@ index 794bc95..c6e29e9 100644
#ifdef CONFIG_X86_64
if (insn_rip_relative(&insn)) {
-@@ -340,7 +345,9 @@ static int __kprobes __copy_instruction(u8 *dest, u8 *src, int recover)
+@@ -341,7 +346,9 @@ static int __kprobes __copy_instruction(u8 *dest, u8 *src, int recover)
(u8 *) dest;
BUG_ON((s64) (s32) newdisp != newdisp); /* Sanity check. */
disp = (u8 *) dest + insn_offset_displacement(&insn);
@@ -14980,7 +15649,7 @@ index 794bc95..c6e29e9 100644
}
#endif
return insn.length;
-@@ -354,12 +361,12 @@ static void __kprobes arch_copy_kprobe(struct kprobe *p)
+@@ -355,12 +362,12 @@ static void __kprobes arch_copy_kprobe(struct kprobe *p)
*/
__copy_instruction(p->ainsn.insn, p->addr, 0);
@@ -14995,7 +15664,7 @@ index 794bc95..c6e29e9 100644
}
int __kprobes arch_prepare_kprobe(struct kprobe *p)
-@@ -476,7 +483,7 @@ static void __kprobes setup_singlestep(struct kprobe *p, struct pt_regs *regs,
+@@ -477,7 +484,7 @@ static void __kprobes setup_singlestep(struct kprobe *p, struct pt_regs *regs,
* nor set current_kprobe, because it doesn't use single
* stepping.
*/
@@ -15004,7 +15673,7 @@ index 794bc95..c6e29e9 100644
preempt_enable_no_resched();
return;
}
-@@ -495,7 +502,7 @@ static void __kprobes setup_singlestep(struct kprobe *p, struct pt_regs *regs,
+@@ -496,7 +503,7 @@ static void __kprobes setup_singlestep(struct kprobe *p, struct pt_regs *regs,
if (p->opcode == BREAKPOINT_INSTRUCTION)
regs->ip = (unsigned long)p->addr;
else
@@ -15013,7 +15682,7 @@ index 794bc95..c6e29e9 100644
}
/*
-@@ -574,7 +581,7 @@ static int __kprobes kprobe_handler(struct pt_regs *regs)
+@@ -575,7 +582,7 @@ static int __kprobes kprobe_handler(struct pt_regs *regs)
setup_singlestep(p, regs, kcb, 0);
return 1;
}
@@ -15022,7 +15691,7 @@ index 794bc95..c6e29e9 100644
/*
* The breakpoint instruction was removed right
* after we hit it. Another cpu has removed
-@@ -682,6 +689,9 @@ static void __used __kprobes kretprobe_trampoline_holder(void)
+@@ -683,6 +690,9 @@ static void __used __kprobes kretprobe_trampoline_holder(void)
" movq %rax, 152(%rsp)\n"
RESTORE_REGS_STRING
" popfq\n"
@@ -15032,7 +15701,7 @@ index 794bc95..c6e29e9 100644
#else
" pushf\n"
SAVE_REGS_STRING
-@@ -819,7 +829,7 @@ static void __kprobes resume_execution(struct kprobe *p,
+@@ -820,7 +830,7 @@ static void __kprobes resume_execution(struct kprobe *p,
struct pt_regs *regs, struct kprobe_ctlblk *kcb)
{
unsigned long *tos = stack_addr(regs);
@@ -15041,7 +15710,7 @@ index 794bc95..c6e29e9 100644
unsigned long orig_ip = (unsigned long)p->addr;
kprobe_opcode_t *insn = p->ainsn.insn;
-@@ -1001,7 +1011,7 @@ int __kprobes kprobe_exceptions_notify(struct notifier_block *self,
+@@ -1002,7 +1012,7 @@ int __kprobes kprobe_exceptions_notify(struct notifier_block *self,
struct die_args *args = data;
int ret = NOTIFY_DONE;
@@ -15050,7 +15719,7 @@ index 794bc95..c6e29e9 100644
return ret;
switch (val) {
-@@ -1383,7 +1393,7 @@ int __kprobes arch_prepare_optimized_kprobe(struct optimized_kprobe *op)
+@@ -1384,7 +1394,7 @@ int __kprobes arch_prepare_optimized_kprobe(struct optimized_kprobe *op)
* Verify if the address gap is in 2GB range, because this uses
* a relative jump.
*/
@@ -15059,7 +15728,7 @@ index 794bc95..c6e29e9 100644
if (abs(rel) > 0x7fffffff)
return -ERANGE;
-@@ -1404,11 +1414,11 @@ int __kprobes arch_prepare_optimized_kprobe(struct optimized_kprobe *op)
+@@ -1405,11 +1415,11 @@ int __kprobes arch_prepare_optimized_kprobe(struct optimized_kprobe *op)
synthesize_set_arg1(buf + TMPL_MOVE_IDX, (unsigned long)op);
/* Set probe function call */
@@ -15073,7 +15742,7 @@ index 794bc95..c6e29e9 100644
flush_icache_range((unsigned long) buf,
(unsigned long) buf + TMPL_END_IDX +
-@@ -1430,7 +1440,7 @@ static void __kprobes setup_optimize_kprobe(struct text_poke_param *tprm,
+@@ -1431,7 +1441,7 @@ static void __kprobes setup_optimize_kprobe(struct text_poke_param *tprm,
((long)op->kp.addr + RELATIVEJUMP_SIZE));
/* Backup instructions which will be replaced by jump address */
@@ -15083,10 +15752,10 @@ index 794bc95..c6e29e9 100644
insn_buf[0] = RELATIVEJUMP_OPCODE;
diff --git a/arch/x86/kernel/kvm.c b/arch/x86/kernel/kvm.c
-index 33c07b0..188cc41 100644
+index a9c2116..a52d4fc 100644
--- a/arch/x86/kernel/kvm.c
+++ b/arch/x86/kernel/kvm.c
-@@ -426,6 +426,7 @@ static void __init paravirt_ops_setup(void)
+@@ -437,6 +437,7 @@ static void __init paravirt_ops_setup(void)
pv_mmu_ops.set_pud = kvm_set_pud;
#if PAGETABLE_LEVELS == 4
pv_mmu_ops.set_pgd = kvm_set_pgd;
@@ -15194,10 +15863,10 @@ index a3fa43b..8966f4c 100644
relocate_kernel_ptr = control_page;
page_list[PA_CONTROL_PAGE] = __pa(control_page);
diff --git a/arch/x86/kernel/microcode_intel.c b/arch/x86/kernel/microcode_intel.c
-index 1a1b606..5c89b55 100644
+index 3ca42d0..7cff8cc 100644
--- a/arch/x86/kernel/microcode_intel.c
+++ b/arch/x86/kernel/microcode_intel.c
-@@ -440,13 +440,13 @@ static enum ucode_state request_microcode_fw(int cpu, struct device *device)
+@@ -436,13 +436,13 @@ static enum ucode_state request_microcode_fw(int cpu, struct device *device)
static int get_ucode_user(void *to, const void *from, size_t n)
{
@@ -15214,10 +15883,10 @@ index 1a1b606..5c89b55 100644
static void microcode_fini_cpu(int cpu)
diff --git a/arch/x86/kernel/module.c b/arch/x86/kernel/module.c
-index 52f256f..8bf1485 100644
+index 925179f..85bec6c 100644
--- a/arch/x86/kernel/module.c
+++ b/arch/x86/kernel/module.c
-@@ -36,21 +36,66 @@
+@@ -36,15 +36,60 @@
#define DEBUGP(fmt...)
#endif
@@ -15243,12 +15912,6 @@ index 52f256f..8bf1485 100644
+
+}
+
- /* Free memory returned from module_alloc */
- void module_free(struct module *mod, void *module_region)
- {
- vfree(module_region);
- }
-
+#ifdef CONFIG_PAX_KERNEXEC
+#ifdef CONFIG_X86_32
+void *module_alloc_exec(unsigned long size)
@@ -15283,10 +15946,10 @@ index 52f256f..8bf1485 100644
+#endif
+#endif
+
- /* We don't need anything special. */
- int module_frob_arch_sections(Elf_Ehdr *hdr,
- Elf_Shdr *sechdrs,
-@@ -70,14 +115,16 @@ int apply_relocate(Elf32_Shdr *sechdrs,
+ #ifdef CONFIG_X86_32
+ int apply_relocate(Elf32_Shdr *sechdrs,
+ const char *strtab,
+@@ -55,14 +100,16 @@ int apply_relocate(Elf32_Shdr *sechdrs,
unsigned int i;
Elf32_Rel *rel = (void *)sechdrs[relsec].sh_addr;
Elf32_Sym *sym;
@@ -15306,7 +15969,7 @@ index 52f256f..8bf1485 100644
/* This is the symbol it is referring to. Note that all
undefined symbols have been resolved. */
sym = (Elf32_Sym *)sechdrs[symindex].sh_addr
-@@ -86,11 +133,15 @@ int apply_relocate(Elf32_Shdr *sechdrs,
+@@ -71,11 +118,15 @@ int apply_relocate(Elf32_Shdr *sechdrs,
switch (ELF32_R_TYPE(rel[i].r_info)) {
case R_386_32:
/* We add the value into the location given */
@@ -15324,7 +15987,7 @@ index 52f256f..8bf1485 100644
break;
default:
printk(KERN_ERR "module %s: Unknown relocation: %u\n",
-@@ -146,21 +197,30 @@ int apply_relocate_add(Elf64_Shdr *sechdrs,
+@@ -120,21 +171,30 @@ int apply_relocate_add(Elf64_Shdr *sechdrs,
case R_X86_64_NONE:
break;
case R_X86_64_64:
@@ -15355,6 +16018,28 @@ index 52f256f..8bf1485 100644
#if 0
if ((s64)val != *(s32 *)loc)
goto overflow;
+diff --git a/arch/x86/kernel/nmi.c b/arch/x86/kernel/nmi.c
+index e88f37b..1353db6 100644
+--- a/arch/x86/kernel/nmi.c
++++ b/arch/x86/kernel/nmi.c
+@@ -408,6 +408,17 @@ static notrace __kprobes void default_do_nmi(struct pt_regs *regs)
+ dotraplinkage notrace __kprobes void
+ do_nmi(struct pt_regs *regs, long error_code)
+ {
++
++#if defined(CONFIG_X86_32) && defined(CONFIG_PAX_KERNEXEC)
++ if (!user_mode(regs)) {
++ unsigned long cs = regs->cs & 0xFFFF;
++ unsigned long ip = ktva_ktla(regs->ip);
++
++ if ((cs == __KERNEL_CS || cs == __KERNEXEC_KERNEL_CS) && ip <= (unsigned long)_etext)
++ regs->ip = ip;
++ }
++#endif
++
+ nmi_enter();
+
+ inc_irq_stat(__nmi_count);
diff --git a/arch/x86/kernel/paravirt-spinlocks.c b/arch/x86/kernel/paravirt-spinlocks.c
index 676b8c7..870ba04 100644
--- a/arch/x86/kernel/paravirt-spinlocks.c
@@ -15369,7 +16054,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 869e1ae..2b82740 100644
+index d90272e..6bb013b 100644
--- a/arch/x86/kernel/paravirt.c
+++ b/arch/x86/kernel/paravirt.c
@@ -53,6 +53,9 @@ u64 _paravirt_ident_64(u64 x)
@@ -15382,26 +16067,7 @@ index 869e1ae..2b82740 100644
void __init default_banner(void)
{
-@@ -122,7 +125,7 @@ unsigned paravirt_patch_jmp(void *insnbuf, const void *target,
- * corresponding structure. */
- static void *get_call_destination(u8 type)
- {
-- struct paravirt_patch_template tmpl = {
-+ const struct paravirt_patch_template tmpl = {
- .pv_init_ops = pv_init_ops,
- .pv_time_ops = pv_time_ops,
- .pv_cpu_ops = pv_cpu_ops,
-@@ -133,6 +136,9 @@ static void *get_call_destination(u8 type)
- .pv_lock_ops = pv_lock_ops,
- #endif
- };
-+
-+ pax_track_stack();
-+
- return *((void **)&tmpl + type);
- }
-
-@@ -145,15 +151,19 @@ unsigned paravirt_patch_default(u8 type, u16 clobbers, void *insnbuf,
+@@ -145,15 +148,19 @@ unsigned paravirt_patch_default(u8 type, u16 clobbers, void *insnbuf,
if (opfunc == NULL)
/* If there's no function, patch it with a ud2a (BUG) */
ret = paravirt_patch_insns(insnbuf, len, ud2a, ud2a+sizeof(ud2a));
@@ -15424,7 +16090,7 @@ index 869e1ae..2b82740 100644
else if (type == PARAVIRT_PATCH(pv_cpu_ops.iret) ||
type == PARAVIRT_PATCH(pv_cpu_ops.irq_enable_sysexit) ||
-@@ -178,7 +188,7 @@ unsigned paravirt_patch_insns(void *insnbuf, unsigned len,
+@@ -178,7 +185,7 @@ unsigned paravirt_patch_insns(void *insnbuf, unsigned len,
if (insn_len > len || start == NULL)
insn_len = len;
else
@@ -15433,7 +16099,7 @@ index 869e1ae..2b82740 100644
return insn_len;
}
-@@ -294,22 +304,22 @@ void arch_flush_lazy_mmu_mode(void)
+@@ -302,7 +309,7 @@ void arch_flush_lazy_mmu_mode(void)
preempt_enable();
}
@@ -15442,7 +16108,8 @@ index 869e1ae..2b82740 100644
.name = "bare hardware",
.paravirt_enabled = 0,
.kernel_rpl = 0,
- .shared_kernel_pmd = 1, /* Only used when CONFIG_X86_PAE is set */
+@@ -313,16 +320,16 @@ struct pv_info pv_info = {
+ #endif
};
-struct pv_init_ops pv_init_ops = {
@@ -15453,6 +16120,7 @@ index 869e1ae..2b82740 100644
-struct pv_time_ops pv_time_ops = {
+struct pv_time_ops pv_time_ops __read_only = {
.sched_clock = native_sched_clock,
+ .steal_clock = native_steal_clock,
};
-struct pv_irq_ops pv_irq_ops = {
@@ -15460,7 +16128,7 @@ index 869e1ae..2b82740 100644
.save_fl = __PV_IS_CALLEE_SAVE(native_save_fl),
.restore_fl = __PV_IS_CALLEE_SAVE(native_restore_fl),
.irq_disable = __PV_IS_CALLEE_SAVE(native_irq_disable),
-@@ -321,7 +331,7 @@ struct pv_irq_ops pv_irq_ops = {
+@@ -334,7 +341,7 @@ struct pv_irq_ops pv_irq_ops = {
#endif
};
@@ -15469,7 +16137,7 @@ index 869e1ae..2b82740 100644
.cpuid = native_cpuid,
.get_debugreg = native_get_debugreg,
.set_debugreg = native_set_debugreg,
-@@ -382,21 +392,26 @@ struct pv_cpu_ops pv_cpu_ops = {
+@@ -395,21 +402,26 @@ struct pv_cpu_ops pv_cpu_ops = {
.end_context_switch = paravirt_nop,
};
@@ -15499,7 +16167,7 @@ index 869e1ae..2b82740 100644
.read_cr2 = native_read_cr2,
.write_cr2 = native_write_cr2,
-@@ -446,6 +461,7 @@ struct pv_mmu_ops pv_mmu_ops = {
+@@ -459,6 +471,7 @@ struct pv_mmu_ops pv_mmu_ops = {
.make_pud = PTE_IDENT,
.set_pgd = native_set_pgd,
@@ -15507,7 +16175,7 @@ index 869e1ae..2b82740 100644
#endif
#endif /* PAGETABLE_LEVELS >= 3 */
-@@ -465,6 +481,12 @@ struct pv_mmu_ops pv_mmu_ops = {
+@@ -478,6 +491,12 @@ struct pv_mmu_ops pv_mmu_ops = {
},
.set_fixmap = native_set_fixmap,
@@ -15521,7 +16189,7 @@ index 869e1ae..2b82740 100644
EXPORT_SYMBOL_GPL(pv_time_ops);
diff --git a/arch/x86/kernel/pci-iommu_table.c b/arch/x86/kernel/pci-iommu_table.c
-index 35ccf75..67e7d4d 100644
+index 35ccf75..7a15747 100644
--- a/arch/x86/kernel/pci-iommu_table.c
+++ b/arch/x86/kernel/pci-iommu_table.c
@@ -2,7 +2,7 @@
@@ -15533,17 +16201,8 @@ index 35ccf75..67e7d4d 100644
#define DEBUG 1
-@@ -51,6 +51,8 @@ void __init check_iommu_entries(struct iommu_table_entry *start,
- {
- struct iommu_table_entry *p, *q, *x;
-
-+ pax_track_stack();
-+
- /* Simple cyclic dependency checker. */
- for (p = start; p < finish; p++) {
- q = find_dependents_of(start, finish, p);
diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c
-index e1ba8cb..70a03a0 100644
+index ee5d4fb..426649b 100644
--- a/arch/x86/kernel/process.c
+++ b/arch/x86/kernel/process.c
@@ -48,16 +48,33 @@ void free_thread_xstate(struct task_struct *tsk)
@@ -15551,7 +16210,7 @@ index e1ba8cb..70a03a0 100644
void free_thread_info(struct thread_info *ti)
{
- free_thread_xstate(ti->task);
- free_pages((unsigned long)ti, get_order(THREAD_SIZE));
+ free_pages((unsigned long)ti, THREAD_ORDER);
}
+static struct kmem_cache *task_struct_cachep;
@@ -15626,16 +16285,16 @@ index e1ba8cb..70a03a0 100644
#else
regs.ss = __KERNEL_DS;
#endif
-@@ -403,7 +423,7 @@ void default_idle(void)
- EXPORT_SYMBOL(default_idle);
- #endif
+@@ -411,7 +431,7 @@ bool set_pm_idle_to_default(void)
+ return ret;
+ }
-void stop_this_cpu(void *dummy)
+__noreturn void stop_this_cpu(void *dummy)
{
local_irq_disable();
/*
-@@ -668,16 +688,37 @@ static int __init idle_setup(char *str)
+@@ -653,16 +673,37 @@ static int __init idle_setup(char *str)
}
early_param("idle", idle_setup);
@@ -15684,10 +16343,10 @@ index e1ba8cb..70a03a0 100644
+}
+#endif
diff --git a/arch/x86/kernel/process_32.c b/arch/x86/kernel/process_32.c
-index a3d0dc5..6a414ba 100644
+index 795b79f..063767a 100644
--- a/arch/x86/kernel/process_32.c
+++ b/arch/x86/kernel/process_32.c
-@@ -65,6 +65,7 @@ asmlinkage void ret_from_fork(void) __asm__("ret_from_fork");
+@@ -67,6 +67,7 @@ asmlinkage void ret_from_fork(void) __asm__("ret_from_fork");
unsigned long thread_saved_pc(struct task_struct *tsk)
{
return ((unsigned long *)tsk->thread.sp)[3];
@@ -15695,7 +16354,7 @@ index a3d0dc5..6a414ba 100644
}
#ifndef CONFIG_SMP
-@@ -126,15 +127,14 @@ void __show_regs(struct pt_regs *regs, int all)
+@@ -130,15 +131,14 @@ void __show_regs(struct pt_regs *regs, int all)
unsigned long sp;
unsigned short ss, gs;
@@ -15713,7 +16372,7 @@ index a3d0dc5..6a414ba 100644
show_regs_common();
-@@ -196,13 +196,14 @@ int copy_thread(unsigned long clone_flags, unsigned long sp,
+@@ -200,13 +200,14 @@ int copy_thread(unsigned long clone_flags, unsigned long sp,
struct task_struct *tsk;
int err;
@@ -15729,7 +16388,7 @@ index a3d0dc5..6a414ba 100644
p->thread.ip = (unsigned long) ret_from_fork;
-@@ -292,7 +293,7 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p)
+@@ -296,7 +297,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();
@@ -15738,7 +16397,7 @@ index a3d0dc5..6a414ba 100644
bool preload_fpu;
/* never put a printk in __switch_to... printk() calls wake_up*() indirectly */
-@@ -327,6 +328,10 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p)
+@@ -331,6 +332,10 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p)
*/
lazy_save_gs(prev->gs);
@@ -15749,7 +16408,7 @@ index a3d0dc5..6a414ba 100644
/*
* Load the per-thread Thread-Local Storage descriptor.
*/
-@@ -362,6 +367,9 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p)
+@@ -366,6 +371,9 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p)
*/
arch_end_context_switch(next_p);
@@ -15759,7 +16418,7 @@ index a3d0dc5..6a414ba 100644
if (preload_fpu)
__math_state_restore();
-@@ -371,8 +379,6 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p)
+@@ -375,8 +383,6 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p)
if (prev->gs | next->gs)
lazy_load_gs(next->gs);
@@ -15768,16 +16427,16 @@ index a3d0dc5..6a414ba 100644
return prev_p;
}
-@@ -402,4 +408,3 @@ unsigned long get_wchan(struct task_struct *p)
+@@ -406,4 +412,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 ca6f7ab..5d3f0e1 100644
+index 3bd7e6e..90b2bcf 100644
--- a/arch/x86/kernel/process_64.c
+++ b/arch/x86/kernel/process_64.c
-@@ -87,7 +87,7 @@ static void __exit_idle(void)
+@@ -89,7 +89,7 @@ static void __exit_idle(void)
void exit_idle(void)
{
/* idle loop has pid 0 */
@@ -15786,7 +16445,7 @@ index ca6f7ab..5d3f0e1 100644
return;
__exit_idle();
}
-@@ -260,8 +260,7 @@ int copy_thread(unsigned long clone_flags, unsigned long sp,
+@@ -264,8 +264,7 @@ int copy_thread(unsigned long clone_flags, unsigned long sp,
struct pt_regs *childregs;
struct task_struct *me = current;
@@ -15796,7 +16455,7 @@ index ca6f7ab..5d3f0e1 100644
*childregs = *regs;
childregs->ax = 0;
-@@ -273,6 +272,7 @@ int copy_thread(unsigned long clone_flags, unsigned long sp,
+@@ -277,6 +276,7 @@ int copy_thread(unsigned long clone_flags, unsigned long sp,
p->thread.sp = (unsigned long) childregs;
p->thread.sp0 = (unsigned long) (childregs+1);
p->thread.usersp = me->thread.usersp;
@@ -15804,7 +16463,7 @@ index ca6f7ab..5d3f0e1 100644
set_tsk_thread_flag(p, TIF_FORK);
-@@ -375,7 +375,7 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p)
+@@ -379,7 +379,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();
@@ -15813,7 +16472,7 @@ index ca6f7ab..5d3f0e1 100644
unsigned fsindex, gsindex;
bool preload_fpu;
-@@ -471,10 +471,9 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p)
+@@ -475,10 +475,9 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p)
prev->usersp = percpu_read(old_rsp);
percpu_write(old_rsp, next->usersp);
percpu_write(current_task, next_p);
@@ -15826,7 +16485,7 @@ index ca6f7ab..5d3f0e1 100644
/*
* Now maybe reload the debug registers and handle I/O bitmaps
-@@ -536,12 +535,11 @@ unsigned long get_wchan(struct task_struct *p)
+@@ -540,12 +539,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);
@@ -15842,10 +16501,10 @@ index ca6f7ab..5d3f0e1 100644
ip = *(u64 *)(fp+8);
if (!in_sched_functions(ip))
diff --git a/arch/x86/kernel/ptrace.c b/arch/x86/kernel/ptrace.c
-index 807c2a2..6350c3e 100644
+index 8252879..d3219e0 100644
--- a/arch/x86/kernel/ptrace.c
+++ b/arch/x86/kernel/ptrace.c
-@@ -821,7 +821,7 @@ long arch_ptrace(struct task_struct *child, long request,
+@@ -822,7 +822,7 @@ long arch_ptrace(struct task_struct *child, long request,
unsigned long addr, unsigned long data)
{
int ret;
@@ -15854,7 +16513,7 @@ index 807c2a2..6350c3e 100644
switch (request) {
/* read the word at location addr in the USER area. */
-@@ -906,14 +906,14 @@ long arch_ptrace(struct task_struct *child, long request,
+@@ -907,14 +907,14 @@ long arch_ptrace(struct task_struct *child, long request,
if ((int) addr < 0)
return -EIO;
ret = do_get_thread_area(child, addr,
@@ -15871,7 +16530,7 @@ index 807c2a2..6350c3e 100644
break;
#endif
-@@ -1330,7 +1330,7 @@ static void fill_sigtrap_info(struct task_struct *tsk,
+@@ -1331,7 +1331,7 @@ static void fill_sigtrap_info(struct task_struct *tsk,
memset(info, 0, sizeof(*info));
info->si_signo = SIGTRAP;
info->si_code = si_code;
@@ -15913,7 +16572,7 @@ index 42eb330..139955c 100644
return ret;
diff --git a/arch/x86/kernel/reboot.c b/arch/x86/kernel/reboot.c
-index d4a705f..ef8f1a9 100644
+index 37a458b..e63d183 100644
--- a/arch/x86/kernel/reboot.c
+++ b/arch/x86/kernel/reboot.c
@@ -35,7 +35,7 @@ void (*pm_power_off)(void);
@@ -15996,7 +16655,7 @@ index d4a705f..ef8f1a9 100644
}
#ifdef CONFIG_APM_MODULE
EXPORT_SYMBOL(machine_real_restart);
-@@ -532,7 +562,7 @@ void __attribute__((weak)) mach_reboot_fixups(void)
+@@ -540,7 +570,7 @@ void __attribute__((weak)) mach_reboot_fixups(void)
* try to force a triple fault and then cycle between hitting the keyboard
* controller and doing that
*/
@@ -16005,7 +16664,7 @@ index d4a705f..ef8f1a9 100644
{
int i;
int attempt = 0;
-@@ -656,13 +686,13 @@ void native_machine_shutdown(void)
+@@ -664,13 +694,13 @@ void native_machine_shutdown(void)
#endif
}
@@ -16021,7 +16680,7 @@ index d4a705f..ef8f1a9 100644
{
printk("machine restart\n");
-@@ -671,7 +701,7 @@ static void native_machine_restart(char *__unused)
+@@ -679,7 +709,7 @@ static void native_machine_restart(char *__unused)
__machine_emergency_restart(0);
}
@@ -16030,7 +16689,7 @@ index d4a705f..ef8f1a9 100644
{
/* stop other cpus and apics */
machine_shutdown();
-@@ -682,7 +712,7 @@ static void native_machine_halt(void)
+@@ -690,7 +720,7 @@ static void native_machine_halt(void)
stop_this_cpu(NULL);
}
@@ -16039,7 +16698,7 @@ index d4a705f..ef8f1a9 100644
{
if (pm_power_off) {
if (!reboot_force)
-@@ -691,6 +721,7 @@ static void native_machine_power_off(void)
+@@ -699,6 +729,7 @@ static void native_machine_power_off(void)
}
/* a fallback in case there is no PM info available */
tboot_shutdown(TB_SHUTDOWN_HALT);
@@ -16047,8 +16706,36 @@ index d4a705f..ef8f1a9 100644
}
struct machine_ops machine_ops = {
+diff --git a/arch/x86/kernel/relocate_kernel_64.S b/arch/x86/kernel/relocate_kernel_64.S
+index 7a6f3b3..bed145d7 100644
+--- a/arch/x86/kernel/relocate_kernel_64.S
++++ b/arch/x86/kernel/relocate_kernel_64.S
+@@ -11,6 +11,7 @@
+ #include <asm/kexec.h>
+ #include <asm/processor-flags.h>
+ #include <asm/pgtable_types.h>
++#include <asm/alternative-asm.h>
+
+ /*
+ * Must be relocatable PIC code callable as a C function
+@@ -160,13 +161,14 @@ identity_mapped:
+ xorq %rbp, %rbp
+ xorq %r8, %r8
+ xorq %r9, %r9
+- xorq %r10, %r9
++ xorq %r10, %r10
+ xorq %r11, %r11
+ xorq %r12, %r12
+ xorq %r13, %r13
+ xorq %r14, %r14
+ xorq %r15, %r15
+
++ pax_force_retaddr 0, 1
+ ret
+
+ 1:
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
-index afaf384..1a101fe 100644
+index cf0ef98..e3f780b 100644
--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@ -447,7 +447,7 @@ static void __init parse_setup_data(void)
@@ -16157,7 +16844,7 @@ index 71f4727..16dc9f7 100644
* Up to this point, the boot CPU has been using .init.data
* area. Reload any changed state for the boot CPU.
diff --git a/arch/x86/kernel/signal.c b/arch/x86/kernel/signal.c
-index 40a2493..2348ff2 100644
+index 54ddaeb2..22c3bdc 100644
--- a/arch/x86/kernel/signal.c
+++ b/arch/x86/kernel/signal.c
@@ -198,7 +198,7 @@ static unsigned long align_sigframe(unsigned long sp)
@@ -16225,16 +16912,7 @@ index 40a2493..2348ff2 100644
} put_user_catch(err);
if (err)
-@@ -769,6 +772,8 @@ static void do_signal(struct pt_regs *regs)
- int signr;
- sigset_t *oldset;
-
-+ pax_track_stack();
-+
- /*
- * We want the common case to go fast, which is why we may in certain
- * cases get here from kernel mode. Just return without doing anything
-@@ -776,7 +781,7 @@ static void do_signal(struct pt_regs *regs)
+@@ -769,7 +772,7 @@ static void do_signal(struct pt_regs *regs)
* X86_32: vm86 regs switched out by assembly code before reaching
* here, so testing against kernel CS suffices.
*/
@@ -16242,9 +16920,9 @@ index 40a2493..2348ff2 100644
+ if (!user_mode_novm(regs))
return;
- if (current_thread_info()->status & TS_RESTORE_SIGMASK)
+ signr = get_signal_to_deliver(&info, &ka, regs, NULL);
diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c
-index 9fd3137..290be8c 100644
+index 9f548cb..caf76f7 100644
--- a/arch/x86/kernel/smpboot.c
+++ b/arch/x86/kernel/smpboot.c
@@ -709,17 +709,20 @@ static int __cpuinit do_boot_cpu(int apicid, int cpu)
@@ -16285,7 +16963,7 @@ index 9fd3137..290be8c 100644
if (err) {
pr_debug("do_boot_cpu failed %d\n", err);
diff --git a/arch/x86/kernel/step.c b/arch/x86/kernel/step.c
-index 7977f0c..6b8651b 100644
+index c346d11..d43b163 100644
--- a/arch/x86/kernel/step.c
+++ b/arch/x86/kernel/step.c
@@ -27,10 +27,10 @@ unsigned long convert_ip_to_linear(struct task_struct *child, struct pt_regs *re
@@ -16321,15 +16999,6 @@ index 7977f0c..6b8651b 100644
copied = access_process_vm(child, addr, opcode, sizeof(opcode), 0);
for (i = 0; i < copied; i++) {
switch (opcode[i]) {
-@@ -74,7 +78,7 @@ static int is_setting_trap_flag(struct task_struct *child, struct pt_regs *regs)
-
- #ifdef CONFIG_X86_64
- case 0x40 ... 0x4f:
-- if (regs->cs != __USER_CS)
-+ if ((regs->cs & 0xffff) != __USER_CS)
- /* 32-bit mode: register increment */
- return 0;
- /* 64-bit mode: REX prefix */
diff --git a/arch/x86/kernel/sys_i386_32.c b/arch/x86/kernel/sys_i386_32.c
index 0b0cb5f..db6b9ed 100644
--- a/arch/x86/kernel/sys_i386_32.c
@@ -16346,7 +17015,12 @@ index 0b0cb5f..db6b9ed 100644
- const char *const argv[],
- const char *const envp[])
+int i386_mmap_check(unsigned long addr, unsigned long len, unsigned long flags)
-+{
+ {
+- long __res;
+- asm volatile ("int $0x80"
+- : "=a" (__res)
+- : "0" (__NR_execve), "b" (filename), "c" (argv), "d" (envp) : "memory");
+- return __res;
+ unsigned long pax_task_size = TASK_SIZE;
+
+#ifdef CONFIG_PAX_SEGMEXEC
@@ -16454,12 +17128,7 @@ index 0b0cb5f..db6b9ed 100644
+arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0,
+ const unsigned long len, const unsigned long pgoff,
+ const unsigned long flags)
- {
-- long __res;
-- asm volatile ("int $0x80"
-- : "=a" (__res)
-- : "0" (__NR_execve), "b" (filename), "c" (argv), "d" (envp) : "memory");
-- return __res;
++{
+ struct vm_area_struct *vma;
+ struct mm_struct *mm = current->mm;
+ unsigned long base = mm->mmap_base, addr = addr0, pax_task_size = TASK_SIZE;
@@ -16572,10 +17241,10 @@ index 0b0cb5f..db6b9ed 100644
+ return addr;
}
diff --git a/arch/x86/kernel/sys_x86_64.c b/arch/x86/kernel/sys_x86_64.c
-index ff14a50..35626c3 100644
+index 0514890..3dbebce 100644
--- a/arch/x86/kernel/sys_x86_64.c
+++ b/arch/x86/kernel/sys_x86_64.c
-@@ -32,8 +32,8 @@ out:
+@@ -95,8 +95,8 @@ out:
return error;
}
@@ -16586,7 +17255,7 @@ index ff14a50..35626c3 100644
{
if (!test_thread_flag(TIF_IA32) && (flags & MAP_32BIT)) {
unsigned long new_begin;
-@@ -52,7 +52,7 @@ static void find_start_end(unsigned long flags, unsigned long *begin,
+@@ -115,7 +115,7 @@ static void find_start_end(unsigned long flags, unsigned long *begin,
*begin = new_begin;
}
} else {
@@ -16595,7 +17264,7 @@ index ff14a50..35626c3 100644
*end = TASK_SIZE;
}
}
-@@ -69,16 +69,19 @@ arch_get_unmapped_area(struct file *filp, unsigned long addr,
+@@ -132,16 +132,19 @@ arch_get_unmapped_area(struct file *filp, unsigned long addr,
if (flags & MAP_FIXED)
return addr;
@@ -16618,7 +17287,7 @@ index ff14a50..35626c3 100644
return addr;
}
if (((flags & MAP_32BIT) || test_thread_flag(TIF_IA32))
-@@ -106,7 +109,7 @@ full_search:
+@@ -172,7 +175,7 @@ full_search:
}
return -ENOMEM;
}
@@ -16627,7 +17296,7 @@ index ff14a50..35626c3 100644
/*
* Remember the place where we stopped the search:
*/
-@@ -128,7 +131,7 @@ arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0,
+@@ -195,7 +198,7 @@ arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0,
{
struct vm_area_struct *vma;
struct mm_struct *mm = current->mm;
@@ -16636,7 +17305,7 @@ index ff14a50..35626c3 100644
/* requested length too big for entire address space */
if (len > TASK_SIZE)
-@@ -141,13 +144,18 @@ arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0,
+@@ -208,13 +211,18 @@ arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0,
if (!test_thread_flag(TIF_IA32) && (flags & MAP_32BIT))
goto bottomup;
@@ -16659,16 +17328,16 @@ index ff14a50..35626c3 100644
}
/* check if free_area_cache is useful for us */
-@@ -162,7 +170,7 @@ arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0,
- /* make sure it can fit in the remaining address space */
- if (addr > len) {
- vma = find_vma(mm, addr-len);
-- if (!vma || addr <= vma->vm_start)
-+ if (check_heap_stack_gap(vma, addr - len, len))
+@@ -232,7 +240,7 @@ arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0,
+ ALIGN_TOPDOWN);
+
+ vma = find_vma(mm, tmp_addr);
+- if (!vma || tmp_addr + len <= vma->vm_start)
++ if (check_heap_stack_gap(vma, tmp_addr, len))
/* remember the address as a hint for next time */
- return mm->free_area_cache = addr-len;
+ return mm->free_area_cache = tmp_addr;
}
-@@ -179,7 +187,7 @@ arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0,
+@@ -251,7 +259,7 @@ arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0,
* return with success:
*/
vma = find_vma(mm, addr);
@@ -16677,7 +17346,7 @@ index ff14a50..35626c3 100644
/* remember the address as a hint for next time */
return mm->free_area_cache = addr;
-@@ -188,8 +196,8 @@ arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0,
+@@ -260,8 +268,8 @@ arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0,
mm->cached_hole_size = vma->vm_start - addr;
/* try just below the current vma->vm_start */
@@ -16688,7 +17357,7 @@ index ff14a50..35626c3 100644
bottomup:
/*
-@@ -198,13 +206,21 @@ bottomup:
+@@ -270,13 +278,21 @@ bottomup:
* can happen with large stack limits and large mmap()
* allocations.
*/
@@ -16713,7 +17382,7 @@ index ff14a50..35626c3 100644
return addr;
diff --git a/arch/x86/kernel/syscall_table_32.S b/arch/x86/kernel/syscall_table_32.S
-index fbb0a04..357e192 100644
+index 9a0e312..e6f66f2 100644
--- a/arch/x86/kernel/syscall_table_32.S
+++ b/arch/x86/kernel/syscall_table_32.S
@@ -1,3 +1,4 @@
@@ -16722,10 +17391,10 @@ index fbb0a04..357e192 100644
.long sys_restart_syscall /* 0 - old "setup()" system call, used for restarting */
.long sys_exit
diff --git a/arch/x86/kernel/tboot.c b/arch/x86/kernel/tboot.c
-index 30ac65d..0ace0a1 100644
+index e2410e2..4fe3fbc 100644
--- a/arch/x86/kernel/tboot.c
+++ b/arch/x86/kernel/tboot.c
-@@ -217,7 +217,7 @@ static int tboot_setup_sleep(void)
+@@ -219,7 +219,7 @@ static int tboot_setup_sleep(void)
void tboot_shutdown(u32 shutdown_type)
{
@@ -16734,7 +17403,7 @@ index 30ac65d..0ace0a1 100644
if (!tboot_enabled())
return;
-@@ -239,7 +239,7 @@ void tboot_shutdown(u32 shutdown_type)
+@@ -241,7 +241,7 @@ void tboot_shutdown(u32 shutdown_type)
switch_to_tboot_pt();
@@ -16743,7 +17412,7 @@ index 30ac65d..0ace0a1 100644
shutdown();
/* should not reach here */
-@@ -296,7 +296,7 @@ void tboot_sleep(u8 sleep_state, u32 pm1a_control, u32 pm1b_control)
+@@ -298,7 +298,7 @@ void tboot_sleep(u8 sleep_state, u32 pm1a_control, u32 pm1b_control)
tboot_shutdown(acpi_shutdown_map[sleep_state]);
}
@@ -16752,7 +17421,7 @@ index 30ac65d..0ace0a1 100644
static int tboot_wait_for_aps(int num_aps)
{
-@@ -320,9 +320,9 @@ static int __cpuinit tboot_cpu_callback(struct notifier_block *nfb,
+@@ -322,9 +322,9 @@ static int __cpuinit tboot_cpu_callback(struct notifier_block *nfb,
{
switch (action) {
case CPU_DYING:
@@ -16764,7 +17433,7 @@ index 30ac65d..0ace0a1 100644
return NOTIFY_BAD;
break;
}
-@@ -341,7 +341,7 @@ static __init int tboot_late_init(void)
+@@ -343,7 +343,7 @@ static __init int tboot_late_init(void)
tboot_create_trampoline();
@@ -16774,10 +17443,10 @@ index 30ac65d..0ace0a1 100644
return 0;
}
diff --git a/arch/x86/kernel/time.c b/arch/x86/kernel/time.c
-index 00cbb27..472a348 100644
+index dd5fbf4..b7f2232 100644
--- a/arch/x86/kernel/time.c
+++ b/arch/x86/kernel/time.c
-@@ -30,9 +30,9 @@ unsigned long profile_pc(struct pt_regs *regs)
+@@ -31,9 +31,9 @@ unsigned long profile_pc(struct pt_regs *regs)
{
unsigned long pc = instruction_pointer(regs);
@@ -16789,7 +17458,7 @@ index 00cbb27..472a348 100644
#else
unsigned long *sp =
(unsigned long *)kernel_stack_pointer(regs);
-@@ -41,11 +41,17 @@ unsigned long profile_pc(struct pt_regs *regs)
+@@ -42,11 +42,17 @@ unsigned long profile_pc(struct pt_regs *regs)
* or above a saved flags. Eflags has bits 22-31 zero,
* kernel addresses don't.
*/
@@ -16872,7 +17541,7 @@ index 09ff517..df19fbff 100644
.short 0
.quad 0x00cf9b000000ffff # __KERNEL32_CS
diff --git a/arch/x86/kernel/traps.c b/arch/x86/kernel/traps.c
-index b9b6716..98109ef 100644
+index a8e3eb8..c9dbd7d 100644
--- a/arch/x86/kernel/traps.c
+++ b/arch/x86/kernel/traps.c
@@ -70,12 +70,6 @@ asmlinkage int system_call(void);
@@ -16888,7 +17557,7 @@ index b9b6716..98109ef 100644
#endif
DECLARE_BITMAP(used_vectors, NR_VECTORS);
-@@ -117,13 +111,13 @@ static inline void preempt_conditional_cli(struct pt_regs *regs)
+@@ -108,13 +102,13 @@ static inline void preempt_conditional_cli(struct pt_regs *regs)
}
static void __kprobes
@@ -16904,7 +17573,7 @@ index b9b6716..98109ef 100644
/*
* traps 0, 1, 3, 4, and 5 should be forwarded to vm86.
* On nmi (interrupt 2), do_trap should not be called.
-@@ -134,7 +128,7 @@ do_trap(int trapnr, int signr, char *str, struct pt_regs *regs,
+@@ -125,7 +119,7 @@ do_trap(int trapnr, int signr, char *str, struct pt_regs *regs,
}
#endif
@@ -16913,7 +17582,7 @@ index b9b6716..98109ef 100644
goto kernel_trap;
#ifdef CONFIG_X86_32
-@@ -157,7 +151,7 @@ trap_signal:
+@@ -148,7 +142,7 @@ trap_signal:
printk_ratelimit()) {
printk(KERN_INFO
"%s[%d] trap %s ip:%lx sp:%lx error:%lx",
@@ -16922,7 +17591,7 @@ index b9b6716..98109ef 100644
regs->ip, regs->sp, error_code);
print_vma_addr(" in ", regs->ip);
printk("\n");
-@@ -174,8 +168,20 @@ kernel_trap:
+@@ -165,8 +159,20 @@ kernel_trap:
if (!fixup_exception(regs)) {
tsk->thread.error_code = error_code;
tsk->thread.trap_no = trapnr;
@@ -16943,7 +17612,7 @@ index b9b6716..98109ef 100644
return;
#ifdef CONFIG_X86_32
-@@ -264,14 +270,30 @@ do_general_protection(struct pt_regs *regs, long error_code)
+@@ -255,14 +261,30 @@ do_general_protection(struct pt_regs *regs, long error_code)
conditional_sti(regs);
#ifdef CONFIG_X86_32
@@ -16976,7 +17645,7 @@ index b9b6716..98109ef 100644
tsk->thread.error_code = error_code;
tsk->thread.trap_no = 13;
-@@ -304,6 +326,13 @@ gp_in_kernel:
+@@ -295,6 +317,13 @@ gp_in_kernel:
if (notify_die(DIE_GPF, "general protection fault", regs,
error_code, 13, SIGSEGV) == NOTIFY_STOP)
return;
@@ -16990,25 +17659,7 @@ index b9b6716..98109ef 100644
die("general protection fault", regs, error_code);
}
-@@ -433,6 +462,17 @@ static notrace __kprobes void default_do_nmi(struct pt_regs *regs)
- dotraplinkage notrace __kprobes void
- do_nmi(struct pt_regs *regs, long error_code)
- {
-+
-+#if defined(CONFIG_X86_32) && defined(CONFIG_PAX_KERNEXEC)
-+ if (!user_mode(regs)) {
-+ unsigned long cs = regs->cs & 0xFFFF;
-+ unsigned long ip = ktva_ktla(regs->ip);
-+
-+ if ((cs == __KERNEL_CS || cs == __KERNEXEC_KERNEL_CS) && ip <= (unsigned long)_etext)
-+ regs->ip = ip;
-+ }
-+#endif
-+
- nmi_enter();
-
- inc_irq_stat(__nmi_count);
-@@ -569,7 +609,7 @@ dotraplinkage void __kprobes do_debug(struct pt_regs *regs, long error_code)
+@@ -414,7 +443,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);
@@ -17017,7 +17668,7 @@ index b9b6716..98109ef 100644
handle_vm86_trap((struct kernel_vm86_regs *) regs,
error_code, 1);
preempt_conditional_cli(regs);
-@@ -583,7 +623,7 @@ dotraplinkage void __kprobes do_debug(struct pt_regs *regs, long error_code)
+@@ -428,7 +457,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.
*/
@@ -17026,7 +17677,7 @@ index b9b6716..98109ef 100644
tsk->thread.debugreg6 &= ~DR_STEP;
set_tsk_thread_flag(tsk, TIF_SINGLESTEP);
regs->flags &= ~X86_EFLAGS_TF;
-@@ -612,7 +652,7 @@ void math_error(struct pt_regs *regs, int error_code, int trapnr)
+@@ -457,7 +486,7 @@ void math_error(struct pt_regs *regs, int error_code, int trapnr)
return;
conditional_sti(regs);
@@ -17035,7 +17686,7 @@ index b9b6716..98109ef 100644
{
if (!fixup_exception(regs)) {
task->thread.error_code = error_code;
-@@ -723,7 +763,7 @@ asmlinkage void __attribute__((weak)) smp_threshold_interrupt(void)
+@@ -568,7 +597,7 @@ asmlinkage void __attribute__((weak)) smp_threshold_interrupt(void)
void __math_state_restore(void)
{
struct thread_info *thread = current_thread_info();
@@ -17044,7 +17695,7 @@ index b9b6716..98109ef 100644
/*
* Paranoid restore. send a SIGSEGV if we fail to restore the state.
-@@ -750,8 +790,7 @@ void __math_state_restore(void)
+@@ -595,8 +624,7 @@ void __math_state_restore(void)
*/
asmlinkage void math_state_restore(void)
{
@@ -17135,7 +17786,7 @@ index 863f875..4307295 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 89aed99..597976c 100644
+index 0f703f1..9e15f64 100644
--- a/arch/x86/kernel/vmlinux.lds.S
+++ b/arch/x86/kernel/vmlinux.lds.S
@@ -26,6 +26,13 @@
@@ -17152,7 +17803,7 @@ index 89aed99..597976c 100644
#undef i386 /* in case the preprocessor is a 32bit one */
-@@ -69,31 +76,46 @@ jiffies_64 = jiffies;
+@@ -69,30 +76,43 @@ jiffies_64 = jiffies;
PHDRS {
text PT_LOAD FLAGS(5); /* R_E */
@@ -17165,9 +17816,7 @@ index 89aed99..597976c 100644
+ rodata PT_LOAD FLAGS(4); /* R__ */
+#endif
data PT_LOAD FLAGS(6); /* RW_ */
- #ifdef CONFIG_X86_64
- user PT_LOAD FLAGS(5); /* R_E */
-+#endif
+-#ifdef CONFIG_X86_64
+ init.begin PT_LOAD FLAGS(6); /* RW_ */
#ifdef CONFIG_SMP
percpu PT_LOAD FLAGS(6); /* RW_ */
@@ -17206,7 +17855,7 @@ index 89aed99..597976c 100644
HEAD_TEXT
#ifdef CONFIG_X86_32
. = ALIGN(PAGE_SIZE);
-@@ -109,13 +131,47 @@ SECTIONS
+@@ -108,13 +128,47 @@ SECTIONS
IRQENTRY_TEXT
*(.fixup)
*(.gnu.warning)
@@ -17258,7 +17907,7 @@ index 89aed99..597976c 100644
#if defined(CONFIG_DEBUG_RODATA)
/* .text should occupy whole number of pages */
-@@ -127,16 +183,20 @@ SECTIONS
+@@ -126,16 +180,20 @@ SECTIONS
/* Data */
.data : AT(ADDR(.data) - LOAD_OFFSET) {
@@ -17282,7 +17931,7 @@ index 89aed99..597976c 100644
PAGE_ALIGNED_DATA(PAGE_SIZE)
-@@ -208,12 +268,19 @@ SECTIONS
+@@ -176,12 +234,19 @@ SECTIONS
#endif /* CONFIG_X86_64 */
/* Init code and data - will be freed after init */
@@ -17305,7 +17954,7 @@ index 89aed99..597976c 100644
/*
* percpu offsets are zero-based on SMP. PERCPU_VADDR() changes the
* output PHDR, so the next output section - .init.text - should
-@@ -222,12 +289,27 @@ SECTIONS
+@@ -190,12 +255,27 @@ SECTIONS
PERCPU_VADDR(INTERNODE_CACHE_BYTES, 0, :percpu)
#endif
@@ -17338,7 +17987,7 @@ index 89aed99..597976c 100644
/*
* Code and data for a variety of lowlevel trampolines, to be
-@@ -301,19 +383,12 @@ SECTIONS
+@@ -269,19 +349,12 @@ SECTIONS
}
. = ALIGN(8);
@@ -17359,7 +18008,7 @@ index 89aed99..597976c 100644
PERCPU_SECTION(INTERNODE_CACHE_BYTES)
#endif
-@@ -332,16 +407,10 @@ SECTIONS
+@@ -300,16 +373,10 @@ SECTIONS
.smp_locks : AT(ADDR(.smp_locks) - LOAD_OFFSET) {
__smp_locks = .;
*(.smp_locks)
@@ -17377,7 +18026,7 @@ index 89aed99..597976c 100644
/* BSS */
. = ALIGN(PAGE_SIZE);
.bss : AT(ADDR(.bss) - LOAD_OFFSET) {
-@@ -357,6 +426,7 @@ SECTIONS
+@@ -325,6 +392,7 @@ SECTIONS
__brk_base = .;
. += 64 * 1024; /* 64k alignment slop space */
*(.brk_reservation) /* areas brk users have reserved */
@@ -17385,7 +18034,7 @@ index 89aed99..597976c 100644
__brk_limit = .;
}
-@@ -383,13 +453,12 @@ SECTIONS
+@@ -351,13 +419,12 @@ SECTIONS
* for the boot processor.
*/
#define INIT_PER_CPU(x) init_per_cpu__##x = x + __per_cpu_load
@@ -17401,27 +18050,57 @@ index 89aed99..597976c 100644
#ifdef CONFIG_SMP
diff --git a/arch/x86/kernel/vsyscall_64.c b/arch/x86/kernel/vsyscall_64.c
-index 3e68218..d34500c 100644
+index e4d4a22..47ee71f 100644
--- a/arch/x86/kernel/vsyscall_64.c
+++ b/arch/x86/kernel/vsyscall_64.c
-@@ -53,7 +53,7 @@ DEFINE_VVAR(int, vgetcpu_mode);
- DEFINE_VVAR(struct vsyscall_gtod_data, vsyscall_gtod_data) =
- {
+@@ -57,15 +57,13 @@ DEFINE_VVAR(struct vsyscall_gtod_data, vsyscall_gtod_data) =
.lock = __SEQLOCK_UNLOCKED(__vsyscall_gtod_data.lock),
-- .sysctl_enabled = 1,
-+ .sysctl_enabled = 0,
};
- void update_vsyscall_tz(void)
-@@ -231,7 +231,7 @@ static long __vsyscall(3) venosys_1(void)
- static ctl_table kernel_table2[] = {
- { .procname = "vsyscall64",
- .data = &vsyscall_gtod_data.sysctl_enabled, .maxlen = sizeof(int),
-- .mode = 0644,
-+ .mode = 0444,
- .proc_handler = proc_dointvec },
- {}
- };
+-static enum { EMULATE, NATIVE, NONE } vsyscall_mode = NATIVE;
++static enum { EMULATE, NONE } vsyscall_mode = EMULATE;
+
+ static int __init vsyscall_setup(char *str)
+ {
+ if (str) {
+ if (!strcmp("emulate", str))
+ vsyscall_mode = EMULATE;
+- else if (!strcmp("native", str))
+- vsyscall_mode = NATIVE;
+ else if (!strcmp("none", str))
+ vsyscall_mode = NONE;
+ else
+@@ -178,7 +176,7 @@ bool emulate_vsyscall(struct pt_regs *regs, unsigned long address)
+
+ tsk = current;
+ if (seccomp_mode(&tsk->seccomp))
+- do_exit(SIGKILL);
++ do_group_exit(SIGKILL);
+
+ switch (vsyscall_nr) {
+ case 0:
+@@ -220,8 +218,7 @@ bool emulate_vsyscall(struct pt_regs *regs, unsigned long address)
+ return true;
+
+ sigsegv:
+- force_sig(SIGSEGV, current);
+- return true;
++ do_group_exit(SIGKILL);
+ }
+
+ /*
+@@ -274,10 +271,7 @@ void __init map_vsyscall(void)
+ extern char __vvar_page;
+ unsigned long physaddr_vvar_page = __pa_symbol(&__vvar_page);
+
+- __set_fixmap(VSYSCALL_FIRST_PAGE, physaddr_vsyscall,
+- vsyscall_mode == NATIVE
+- ? PAGE_KERNEL_VSYSCALL
+- : PAGE_KERNEL_VVAR);
++ __set_fixmap(VSYSCALL_FIRST_PAGE, physaddr_vsyscall, PAGE_KERNEL_VVAR);
+ BUILD_BUG_ON((unsigned long)__fix_to_virt(VSYSCALL_FIRST_PAGE) !=
+ (unsigned long)VSYSCALL_START);
+
diff --git a/arch/x86/kernel/x8664_ksyms_64.c b/arch/x86/kernel/x8664_ksyms_64.c
index 9796c2f..f686fbf 100644
--- a/arch/x86/kernel/x8664_ksyms_64.c
@@ -17467,45 +18146,36 @@ index a391134..d0b63b6e 100644
if (unlikely(err)) {
/*
diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c
-index adc9867..eb4ab62 100644
+index f1e3be1..588efc8 100644
--- a/arch/x86/kvm/emulate.c
+++ b/arch/x86/kvm/emulate.c
-@@ -96,7 +96,7 @@
- #define Src2ImmByte (2<<29)
- #define Src2One (3<<29)
- #define Src2Imm (4<<29)
--#define Src2Mask (7<<29)
-+#define Src2Mask (7U<<29)
-
- #define X2(x...) x, x
- #define X3(x...) X2(x), x
-@@ -207,6 +207,7 @@ struct gprefix {
-
- #define ____emulate_2op(_op, _src, _dst, _eflags, _x, _y, _suffix, _dsttype) \
+@@ -249,6 +249,7 @@ struct gprefix {
+
+ #define ____emulate_2op(ctxt, _op, _x, _y, _suffix, _dsttype) \
do { \
+ unsigned long _tmp; \
__asm__ __volatile__ ( \
_PRE_EFLAGS("0", "4", "2") \
_op _suffix " %"_x"3,%1; " \
-@@ -220,8 +221,6 @@ struct gprefix {
+@@ -263,8 +264,6 @@ struct gprefix {
/* Raw emulation: instruction has two explicit operands. */
- #define __emulate_2op_nobyte(_op,_src,_dst,_eflags,_wx,_wy,_lx,_ly,_qx,_qy) \
+ #define __emulate_2op_nobyte(ctxt,_op,_wx,_wy,_lx,_ly,_qx,_qy) \
do { \
- unsigned long _tmp; \
- \
- switch ((_dst).bytes) { \
+ switch ((ctxt)->dst.bytes) { \
case 2: \
- ____emulate_2op(_op,_src,_dst,_eflags,_wx,_wy,"w",u16);\
-@@ -237,7 +236,6 @@ struct gprefix {
+ ____emulate_2op(ctxt,_op,_wx,_wy,"w",u16); \
+@@ -280,7 +279,6 @@ struct gprefix {
- #define __emulate_2op(_op,_src,_dst,_eflags,_bx,_by,_wx,_wy,_lx,_ly,_qx,_qy) \
+ #define __emulate_2op(ctxt,_op,_bx,_by,_wx,_wy,_lx,_ly,_qx,_qy) \
do { \
- unsigned long _tmp; \
- switch ((_dst).bytes) { \
+ switch ((ctxt)->dst.bytes) { \
case 1: \
- ____emulate_2op(_op,_src,_dst,_eflags,_bx,_by,"b",u8); \
+ ____emulate_2op(ctxt,_op,_bx,_by,"b",u8); \
diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c
-index 2b2255b..38f6b7f 100644
+index 54abb40..a192606 100644
--- a/arch/x86/kvm/lapic.c
+++ b/arch/x86/kvm/lapic.c
@@ -53,7 +53,7 @@
@@ -17518,10 +18188,10 @@ index 2b2255b..38f6b7f 100644
#define APIC_LVT_NUM 6
/* 14 is the version for Xeon and Pentium 8.4.8*/
diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
-index aee3862..fcf787e 100644
+index f1b36cf..af8a124 100644
--- a/arch/x86/kvm/mmu.c
+++ b/arch/x86/kvm/mmu.c
-@@ -3238,7 +3238,7 @@ void kvm_mmu_pte_write(struct kvm_vcpu *vcpu, gpa_t gpa,
+@@ -3555,7 +3555,7 @@ void kvm_mmu_pte_write(struct kvm_vcpu *vcpu, gpa_t gpa,
pgprintk("%s: gpa %llx bytes %d\n", __func__, gpa, bytes);
@@ -17530,7 +18200,7 @@ index aee3862..fcf787e 100644
/*
* Assume that the pte write on a page table of the same type
-@@ -3270,7 +3270,7 @@ void kvm_mmu_pte_write(struct kvm_vcpu *vcpu, gpa_t gpa,
+@@ -3587,7 +3587,7 @@ void kvm_mmu_pte_write(struct kvm_vcpu *vcpu, gpa_t gpa,
}
spin_lock(&vcpu->kvm->mmu_lock);
@@ -17540,28 +18210,19 @@ index aee3862..fcf787e 100644
kvm_mmu_free_some_pages(vcpu);
++vcpu->kvm->stat.mmu_pte_write;
diff --git a/arch/x86/kvm/paging_tmpl.h b/arch/x86/kvm/paging_tmpl.h
-index 9d03ad4..e9ee87c 100644
+index 9299410..ade2f9b 100644
--- a/arch/x86/kvm/paging_tmpl.h
+++ b/arch/x86/kvm/paging_tmpl.h
-@@ -182,7 +182,7 @@ walk:
- break;
- }
+@@ -197,7 +197,7 @@ retry_walk:
+ if (unlikely(kvm_is_error_hva(host_addr)))
+ goto error;
- ptep_user = (pt_element_t __user *)((void *)host_addr + offset);
+ ptep_user = (pt_element_t __force_user *)((void *)host_addr + offset);
- if (unlikely(__copy_from_user(&pte, ptep_user, sizeof(pte)))) {
- present = false;
- break;
-@@ -583,6 +583,8 @@ static int FNAME(page_fault)(struct kvm_vcpu *vcpu, gva_t addr, u32 error_code,
- unsigned long mmu_seq;
- bool map_writable;
-
-+ pax_track_stack();
-+
- pgprintk("%s: addr %lx err %x\n", __func__, addr, error_code);
+ if (unlikely(__copy_from_user(&pte, ptep_user, sizeof(pte))))
+ goto error;
- r = mmu_topup_memory_caches(vcpu);
-@@ -703,7 +705,7 @@ static void FNAME(invlpg)(struct kvm_vcpu *vcpu, gva_t gva)
+@@ -705,7 +705,7 @@ static void FNAME(invlpg)(struct kvm_vcpu *vcpu, gva_t gva)
if (need_flush)
kvm_flush_remote_tlbs(vcpu->kvm);
@@ -17571,10 +18232,10 @@ index 9d03ad4..e9ee87c 100644
spin_unlock(&vcpu->kvm->mmu_lock);
diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
-index 506e4fe..e947b49 100644
+index e32243e..a6e6172 100644
--- a/arch/x86/kvm/svm.c
+++ b/arch/x86/kvm/svm.c
-@@ -3377,7 +3377,11 @@ static void reload_tss(struct kvm_vcpu *vcpu)
+@@ -3400,7 +3400,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);
@@ -17586,7 +18247,7 @@ index 506e4fe..e947b49 100644
load_TR_desc();
}
-@@ -3755,6 +3759,10 @@ static void svm_vcpu_run(struct kvm_vcpu *vcpu)
+@@ -3778,6 +3782,10 @@ static void svm_vcpu_run(struct kvm_vcpu *vcpu)
#endif
#endif
@@ -17598,10 +18259,10 @@ index 506e4fe..e947b49 100644
local_irq_disable();
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
-index d48ec60..21f490a 100644
+index 579a0b5..ed7bbf9 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
-@@ -797,7 +797,11 @@ static void reload_tss(void)
+@@ -1305,7 +1305,11 @@ static void reload_tss(void)
struct desc_struct *descs;
descs = (void *)gdt->address;
@@ -17613,7 +18274,7 @@ index d48ec60..21f490a 100644
load_TR_desc();
}
-@@ -1747,8 +1751,11 @@ static __init int hardware_setup(void)
+@@ -2633,8 +2637,11 @@ static __init int hardware_setup(void)
if (!cpu_has_vmx_flexpriority())
flexpriority_enabled = 0;
@@ -17627,16 +18288,16 @@ index d48ec60..21f490a 100644
if (enable_ept && !cpu_has_vmx_ept_2m_page())
kvm_disable_largepages();
-@@ -2814,7 +2821,7 @@ static int vmx_vcpu_setup(struct vcpu_vmx *vmx)
+@@ -3648,7 +3655,7 @@ static void vmx_set_constant_host_state(void)
vmcs_writel(HOST_IDTR_BASE, dt.address); /* 22.2.4 */
- asm("mov $.Lkvm_vmx_return, %0" : "=r"(kvm_vmx_return));
-- vmcs_writel(HOST_RIP, kvm_vmx_return); /* 22.2.5 */
-+ vmcs_writel(HOST_RIP, ktla_ktva(kvm_vmx_return)); /* 22.2.5 */
- vmcs_write32(VM_EXIT_MSR_STORE_COUNT, 0);
- vmcs_write32(VM_EXIT_MSR_LOAD_COUNT, 0);
- vmcs_write64(VM_EXIT_MSR_LOAD_ADDR, __pa(vmx->msr_autoload.host));
-@@ -4211,6 +4218,12 @@ static void __noclone vmx_vcpu_run(struct kvm_vcpu *vcpu)
+ asm("mov $.Lkvm_vmx_return, %0" : "=r"(tmpl));
+- vmcs_writel(HOST_RIP, tmpl); /* 22.2.5 */
++ vmcs_writel(HOST_RIP, ktla_ktva(tmpl)); /* 22.2.5 */
+
+ rdmsr(MSR_IA32_SYSENTER_CS, low32, high32);
+ vmcs_write32(HOST_IA32_SYSENTER_CS, low32);
+@@ -6169,6 +6176,12 @@ static void __noclone vmx_vcpu_run(struct kvm_vcpu *vcpu)
"jmp .Lkvm_vmx_return \n\t"
".Llaunched: " __ex(ASM_VMX_VMRESUME) "\n\t"
".Lkvm_vmx_return: "
@@ -17649,7 +18310,7 @@ index d48ec60..21f490a 100644
/* Save guest registers, load host registers, keep flags */
"mov %0, %c[wordsize](%%"R"sp) \n\t"
"pop %0 \n\t"
-@@ -4259,6 +4272,11 @@ static void __noclone vmx_vcpu_run(struct kvm_vcpu *vcpu)
+@@ -6217,6 +6230,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))
@@ -17661,9 +18322,9 @@ index d48ec60..21f490a 100644
: "cc", "memory"
, R"ax", R"bx", R"di", R"si"
#ifdef CONFIG_X86_64
-@@ -4276,7 +4294,16 @@ static void __noclone vmx_vcpu_run(struct kvm_vcpu *vcpu)
-
- vmx->idt_vectoring_info = vmcs_read32(IDT_VECTORING_INFO_FIELD);
+@@ -6245,7 +6263,16 @@ static void __noclone vmx_vcpu_run(struct kvm_vcpu *vcpu)
+ }
+ }
- asm("mov %0, %%ds; mov %0, %%es" : : "r"(__USER_DS));
+ asm("mov %0, %%ds; mov %0, %%es; mov %0, %%ss" : : "r"(__KERNEL_DS));
@@ -17676,14 +18337,14 @@ index d48ec60..21f490a 100644
+ __set_fs(current_thread_info()->addr_limit);
+#endif
+
- vmx->launched = 1;
+ vmx->loaded_vmcs->launched = 1;
vmx->exit_reason = vmcs_read32(VM_EXIT_REASON);
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
-index 77c9d86..3562941 100644
+index 4c938da..4ddef65 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
-@@ -1313,8 +1313,8 @@ static int xen_hvm_config(struct kvm_vcpu *vcpu, u64 data)
+@@ -1345,8 +1345,8 @@ static int xen_hvm_config(struct kvm_vcpu *vcpu, u64 data)
{
struct kvm *kvm = vcpu->kvm;
int lm = is_long_mode(vcpu);
@@ -17694,7 +18355,7 @@ index 77c9d86..3562941 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;
-@@ -2057,6 +2057,8 @@ long kvm_arch_dev_ioctl(struct file *filp,
+@@ -2165,6 +2165,8 @@ long kvm_arch_dev_ioctl(struct file *filp,
if (n < msr_list.nmsrs)
goto out;
r = -EFAULT;
@@ -17703,7 +18364,7 @@ index 77c9d86..3562941 100644
if (copy_to_user(user_msr_list->indices, &msrs_to_save,
num_msrs_to_save * sizeof(u32)))
goto out;
-@@ -2229,15 +2231,20 @@ static int kvm_vcpu_ioctl_set_cpuid2(struct kvm_vcpu *vcpu,
+@@ -2340,15 +2342,20 @@ static int kvm_vcpu_ioctl_set_cpuid2(struct kvm_vcpu *vcpu,
struct kvm_cpuid2 *cpuid,
struct kvm_cpuid_entry2 __user *entries)
{
@@ -17727,7 +18388,7 @@ index 77c9d86..3562941 100644
vcpu->arch.cpuid_nent = cpuid->nent;
kvm_apic_set_version(vcpu);
kvm_x86_ops->cpuid_update(vcpu);
-@@ -2252,15 +2259,19 @@ static int kvm_vcpu_ioctl_get_cpuid2(struct kvm_vcpu *vcpu,
+@@ -2363,15 +2370,19 @@ static int kvm_vcpu_ioctl_get_cpuid2(struct kvm_vcpu *vcpu,
struct kvm_cpuid2 *cpuid,
struct kvm_cpuid_entry2 __user *entries)
{
@@ -17750,7 +18411,7 @@ index 77c9d86..3562941 100644
return 0;
out:
-@@ -2579,7 +2590,7 @@ static int kvm_vcpu_ioctl_set_lapic(struct kvm_vcpu *vcpu,
+@@ -2746,7 +2757,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)
{
@@ -17759,9 +18420,9 @@ index 77c9d86..3562941 100644
return -EINVAL;
if (irqchip_in_kernel(vcpu->kvm))
return -ENXIO;
-@@ -4878,7 +4889,7 @@ void kvm_after_handle_nmi(struct kvm_vcpu *vcpu)
+@@ -5162,7 +5173,7 @@ static void kvm_set_mmio_spte_mask(void)
+ kvm_mmu_set_mmio_spte_mask(mask);
}
- EXPORT_SYMBOL_GPL(kvm_after_handle_nmi);
-int kvm_arch_init(void *opaque)
+int kvm_arch_init(const void *opaque)
@@ -17769,10 +18430,10 @@ index 77c9d86..3562941 100644
int r;
struct kvm_x86_ops *ops = (struct kvm_x86_ops *)opaque;
diff --git a/arch/x86/lguest/boot.c b/arch/x86/lguest/boot.c
-index db832fd..7e9e620 100644
+index cf4603b..7cdde38 100644
--- a/arch/x86/lguest/boot.c
+++ b/arch/x86/lguest/boot.c
-@@ -1176,9 +1176,10 @@ static __init int early_put_chars(u32 vtermno, const char *buf, int count)
+@@ -1195,9 +1195,10 @@ static __init int early_put_chars(u32 vtermno, const char *buf, int count)
* Rebooting also tells the Host we're finished, but the RESTART flag tells the
* Launcher to reboot us.
*/
@@ -17785,7 +18446,7 @@ index db832fd..7e9e620 100644
/*G:050
diff --git a/arch/x86/lib/atomic64_32.c b/arch/x86/lib/atomic64_32.c
-index 540179e..e9ff0ea 100644
+index 042f682..c92afb6 100644
--- a/arch/x86/lib/atomic64_32.c
+++ b/arch/x86/lib/atomic64_32.c
@@ -8,18 +8,30 @@
@@ -18654,17 +19315,10 @@ index 1e572c5..2a162cd 100644
CFI_ENDPROC
diff --git a/arch/x86/lib/copy_page_64.S b/arch/x86/lib/copy_page_64.S
-index 6fec2d1..f162fee 100644
+index 01c805b..dccb07f 100644
--- a/arch/x86/lib/copy_page_64.S
+++ b/arch/x86/lib/copy_page_64.S
-@@ -2,12 +2,14 @@
-
- #include <linux/linkage.h>
- #include <asm/dwarf2.h>
-+#include <asm/alternative-asm.h>
-
- ALIGN
- copy_page_c:
+@@ -9,6 +9,7 @@ copy_page_c:
CFI_STARTPROC
movl $4096/8,%ecx
rep movsq
@@ -18672,7 +19326,43 @@ index 6fec2d1..f162fee 100644
ret
CFI_ENDPROC
ENDPROC(copy_page_c)
-@@ -94,6 +96,7 @@ ENTRY(copy_page)
+@@ -39,7 +40,7 @@ ENTRY(copy_page)
+ movq 16 (%rsi), %rdx
+ movq 24 (%rsi), %r8
+ movq 32 (%rsi), %r9
+- movq 40 (%rsi), %r10
++ movq 40 (%rsi), %r13
+ movq 48 (%rsi), %r11
+ movq 56 (%rsi), %r12
+
+@@ -50,7 +51,7 @@ ENTRY(copy_page)
+ movq %rdx, 16 (%rdi)
+ movq %r8, 24 (%rdi)
+ movq %r9, 32 (%rdi)
+- movq %r10, 40 (%rdi)
++ movq %r13, 40 (%rdi)
+ movq %r11, 48 (%rdi)
+ movq %r12, 56 (%rdi)
+
+@@ -69,7 +70,7 @@ ENTRY(copy_page)
+ movq 16 (%rsi), %rdx
+ movq 24 (%rsi), %r8
+ movq 32 (%rsi), %r9
+- movq 40 (%rsi), %r10
++ movq 40 (%rsi), %r13
+ movq 48 (%rsi), %r11
+ movq 56 (%rsi), %r12
+
+@@ -78,7 +79,7 @@ ENTRY(copy_page)
+ movq %rdx, 16 (%rdi)
+ movq %r8, 24 (%rdi)
+ movq %r9, 32 (%rdi)
+- movq %r10, 40 (%rdi)
++ movq %r13, 40 (%rdi)
+ movq %r11, 48 (%rdi)
+ movq %r12, 56 (%rdi)
+
+@@ -95,6 +96,7 @@ ENTRY(copy_page)
CFI_RESTORE r13
addq $3*8,%rsp
CFI_ADJUST_CFA_OFFSET -3*8
@@ -18680,7 +19370,7 @@ index 6fec2d1..f162fee 100644
ret
.Lcopy_page_end:
CFI_ENDPROC
-@@ -104,7 +107,7 @@ ENDPROC(copy_page)
+@@ -105,7 +107,7 @@ ENDPROC(copy_page)
#include <asm/cpufeature.h>
@@ -18690,7 +19380,7 @@ index 6fec2d1..f162fee 100644
.byte (copy_page_c - copy_page) - (2f - 1b) /* offset */
2:
diff --git a/arch/x86/lib/copy_user_64.S b/arch/x86/lib/copy_user_64.S
-index 0248402..416b737 100644
+index 0248402..821c786 100644
--- a/arch/x86/lib/copy_user_64.S
+++ b/arch/x86/lib/copy_user_64.S
@@ -16,6 +16,7 @@
@@ -18761,6 +19451,30 @@ index 0248402..416b737 100644
ret
CFI_ENDPROC
ENDPROC(bad_from_user)
+@@ -141,19 +115,19 @@ ENTRY(copy_user_generic_unrolled)
+ jz 17f
+ 1: movq (%rsi),%r8
+ 2: movq 1*8(%rsi),%r9
+-3: movq 2*8(%rsi),%r10
++3: movq 2*8(%rsi),%rax
+ 4: movq 3*8(%rsi),%r11
+ 5: movq %r8,(%rdi)
+ 6: movq %r9,1*8(%rdi)
+-7: movq %r10,2*8(%rdi)
++7: movq %rax,2*8(%rdi)
+ 8: movq %r11,3*8(%rdi)
+ 9: movq 4*8(%rsi),%r8
+ 10: movq 5*8(%rsi),%r9
+-11: movq 6*8(%rsi),%r10
++11: movq 6*8(%rsi),%rax
+ 12: movq 7*8(%rsi),%r11
+ 13: movq %r8,4*8(%rdi)
+ 14: movq %r9,5*8(%rdi)
+-15: movq %r10,6*8(%rdi)
++15: movq %rax,6*8(%rdi)
+ 16: movq %r11,7*8(%rdi)
+ leaq 64(%rsi),%rsi
+ leaq 64(%rdi),%rdi
@@ -179,6 +153,7 @@ ENTRY(copy_user_generic_unrolled)
decl %ecx
jnz 21b
@@ -18786,7 +19500,7 @@ index 0248402..416b737 100644
.section .fixup,"ax"
diff --git a/arch/x86/lib/copy_user_nocache_64.S b/arch/x86/lib/copy_user_nocache_64.S
-index cb0c112..8433392 100644
+index cb0c112..e3a6895 100644
--- a/arch/x86/lib/copy_user_nocache_64.S
+++ b/arch/x86/lib/copy_user_nocache_64.S
@@ -8,12 +8,14 @@
@@ -18820,6 +19534,30 @@ index cb0c112..8433392 100644
cmpl $8,%edx
jb 20f /* less then 8 bytes, go to byte copy loop */
ALIGN_DESTINATION
+@@ -59,19 +70,19 @@ ENTRY(__copy_user_nocache)
+ jz 17f
+ 1: movq (%rsi),%r8
+ 2: movq 1*8(%rsi),%r9
+-3: movq 2*8(%rsi),%r10
++3: movq 2*8(%rsi),%rax
+ 4: movq 3*8(%rsi),%r11
+ 5: movnti %r8,(%rdi)
+ 6: movnti %r9,1*8(%rdi)
+-7: movnti %r10,2*8(%rdi)
++7: movnti %rax,2*8(%rdi)
+ 8: movnti %r11,3*8(%rdi)
+ 9: movq 4*8(%rsi),%r8
+ 10: movq 5*8(%rsi),%r9
+-11: movq 6*8(%rsi),%r10
++11: movq 6*8(%rsi),%rax
+ 12: movq 7*8(%rsi),%r11
+ 13: movnti %r8,4*8(%rdi)
+ 14: movnti %r9,5*8(%rdi)
+-15: movnti %r10,6*8(%rdi)
++15: movnti %rax,6*8(%rdi)
+ 16: movnti %r11,7*8(%rdi)
+ leaq 64(%rsi),%rsi
+ leaq 64(%rdi),%rdi
@@ -98,6 +109,7 @@ ENTRY(__copy_user_nocache)
jnz 21b
23: xorl %eax,%eax
@@ -18829,7 +19567,7 @@ index cb0c112..8433392 100644
.section .fixup,"ax"
diff --git a/arch/x86/lib/csum-copy_64.S b/arch/x86/lib/csum-copy_64.S
-index fb903b7..dd8c022 100644
+index fb903b7..c92b7f7 100644
--- a/arch/x86/lib/csum-copy_64.S
+++ b/arch/x86/lib/csum-copy_64.S
@@ -8,6 +8,7 @@
@@ -18844,7 +19582,7 @@ index fb903b7..dd8c022 100644
CFI_RESTORE rbp
addq $7*8, %rsp
CFI_ADJUST_CFA_OFFSET -7*8
-+ pax_force_retaddr
++ pax_force_retaddr 0, 1
ret
CFI_RESTORE_STATE
@@ -19010,7 +19748,7 @@ index 51f1504..ddac4c1 100644
CFI_ENDPROC
END(bad_get_user)
diff --git a/arch/x86/lib/insn.c b/arch/x86/lib/insn.c
-index 9f33b98..dfc7678 100644
+index 374562e..a75830b 100644
--- a/arch/x86/lib/insn.c
+++ b/arch/x86/lib/insn.c
@@ -21,6 +21,11 @@
@@ -19023,9 +19761,9 @@ index 9f33b98..dfc7678 100644
+#define ktla_ktva(addr) addr
+#endif
- #define get_next(t, insn) \
- ({t r; r = *(t*)insn->next_byte; insn->next_byte += sizeof(t); r; })
-@@ -40,8 +45,8 @@
+ /* Verify next sizeof(t) bytes can be on the same instruction */
+ #define validate_next(t, insn, n) \
+@@ -49,8 +54,8 @@
void insn_init(struct insn *insn, const void *kaddr, int x86_64)
{
memset(insn, 0, sizeof(*insn));
@@ -19057,7 +19795,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 efbf2a0..8090894 100644
+index efbf2a0..8893637 100644
--- a/arch/x86/lib/memcpy_64.S
+++ b/arch/x86/lib/memcpy_64.S
@@ -34,6 +34,7 @@
@@ -19076,9 +19814,48 @@ index efbf2a0..8090894 100644
ret
.Lmemcpy_e_e:
.previous
-@@ -141,6 +143,7 @@ ENTRY(memcpy)
+@@ -81,13 +83,13 @@ ENTRY(memcpy)
+ */
+ movq 0*8(%rsi), %r8
+ movq 1*8(%rsi), %r9
+- movq 2*8(%rsi), %r10
++ movq 2*8(%rsi), %rcx
+ movq 3*8(%rsi), %r11
+ leaq 4*8(%rsi), %rsi
+
+ movq %r8, 0*8(%rdi)
+ movq %r9, 1*8(%rdi)
+- movq %r10, 2*8(%rdi)
++ movq %rcx, 2*8(%rdi)
+ movq %r11, 3*8(%rdi)
+ leaq 4*8(%rdi), %rdi
+ jae .Lcopy_forward_loop
+@@ -110,12 +112,12 @@ ENTRY(memcpy)
+ subq $0x20, %rdx
+ movq -1*8(%rsi), %r8
+ movq -2*8(%rsi), %r9
+- movq -3*8(%rsi), %r10
++ movq -3*8(%rsi), %rcx
+ movq -4*8(%rsi), %r11
+ leaq -4*8(%rsi), %rsi
+ movq %r8, -1*8(%rdi)
+ movq %r9, -2*8(%rdi)
+- movq %r10, -3*8(%rdi)
++ movq %rcx, -3*8(%rdi)
+ movq %r11, -4*8(%rdi)
+ leaq -4*8(%rdi), %rdi
+ jae .Lcopy_backward_loop
+@@ -135,12 +137,13 @@ ENTRY(memcpy)
+ */
+ movq 0*8(%rsi), %r8
+ movq 1*8(%rsi), %r9
+- movq -2*8(%rsi, %rdx), %r10
++ movq -2*8(%rsi, %rdx), %rcx
+ movq -1*8(%rsi, %rdx), %r11
+ movq %r8, 0*8(%rdi)
movq %r9, 1*8(%rdi)
- movq %r10, -2*8(%rdi, %rdx)
+- movq %r10, -2*8(%rdi, %rdx)
++ movq %rcx, -2*8(%rdi, %rdx)
movq %r11, -1*8(%rdi, %rdx)
+ pax_force_retaddr
retq
@@ -19109,18 +19886,122 @@ index efbf2a0..8090894 100644
CFI_ENDPROC
ENDPROC(memcpy)
diff --git a/arch/x86/lib/memmove_64.S b/arch/x86/lib/memmove_64.S
-index d0ec9c2..e5d0a9f 100644
+index ee16461..c39c199 100644
--- a/arch/x86/lib/memmove_64.S
+++ b/arch/x86/lib/memmove_64.S
-@@ -9,6 +9,7 @@
- #include <linux/linkage.h>
- #include <asm/dwarf2.h>
- #include <asm/cpufeature.h>
-+#include <asm/alternative-asm.h>
+@@ -61,13 +61,13 @@ ENTRY(memmove)
+ 5:
+ sub $0x20, %rdx
+ movq 0*8(%rsi), %r11
+- movq 1*8(%rsi), %r10
++ movq 1*8(%rsi), %rcx
+ movq 2*8(%rsi), %r9
+ movq 3*8(%rsi), %r8
+ leaq 4*8(%rsi), %rsi
+
+ movq %r11, 0*8(%rdi)
+- movq %r10, 1*8(%rdi)
++ movq %rcx, 1*8(%rdi)
+ movq %r9, 2*8(%rdi)
+ movq %r8, 3*8(%rdi)
+ leaq 4*8(%rdi), %rdi
+@@ -81,10 +81,10 @@ ENTRY(memmove)
+ 4:
+ movq %rdx, %rcx
+ movq -8(%rsi, %rdx), %r11
+- lea -8(%rdi, %rdx), %r10
++ lea -8(%rdi, %rdx), %r9
+ shrq $3, %rcx
+ rep movsq
+- movq %r11, (%r10)
++ movq %r11, (%r9)
+ jmp 13f
+ .Lmemmove_end_forward:
- #undef memmove
+@@ -95,14 +95,14 @@ ENTRY(memmove)
+ 7:
+ movq %rdx, %rcx
+ movq (%rsi), %r11
+- movq %rdi, %r10
++ movq %rdi, %r9
+ leaq -8(%rsi, %rdx), %rsi
+ leaq -8(%rdi, %rdx), %rdi
+ shrq $3, %rcx
+ std
+ rep movsq
+ cld
+- movq %r11, (%r10)
++ movq %r11, (%r9)
+ jmp 13f
-@@ -201,6 +202,7 @@ ENTRY(memmove)
+ /*
+@@ -127,13 +127,13 @@ ENTRY(memmove)
+ 8:
+ subq $0x20, %rdx
+ movq -1*8(%rsi), %r11
+- movq -2*8(%rsi), %r10
++ movq -2*8(%rsi), %rcx
+ movq -3*8(%rsi), %r9
+ movq -4*8(%rsi), %r8
+ leaq -4*8(%rsi), %rsi
+
+ movq %r11, -1*8(%rdi)
+- movq %r10, -2*8(%rdi)
++ movq %rcx, -2*8(%rdi)
+ movq %r9, -3*8(%rdi)
+ movq %r8, -4*8(%rdi)
+ leaq -4*8(%rdi), %rdi
+@@ -151,11 +151,11 @@ ENTRY(memmove)
+ * Move data from 16 bytes to 31 bytes.
+ */
+ movq 0*8(%rsi), %r11
+- movq 1*8(%rsi), %r10
++ movq 1*8(%rsi), %rcx
+ movq -2*8(%rsi, %rdx), %r9
+ movq -1*8(%rsi, %rdx), %r8
+ movq %r11, 0*8(%rdi)
+- movq %r10, 1*8(%rdi)
++ movq %rcx, 1*8(%rdi)
+ movq %r9, -2*8(%rdi, %rdx)
+ movq %r8, -1*8(%rdi, %rdx)
+ jmp 13f
+@@ -167,9 +167,9 @@ ENTRY(memmove)
+ * Move data from 8 bytes to 15 bytes.
+ */
+ movq 0*8(%rsi), %r11
+- movq -1*8(%rsi, %rdx), %r10
++ movq -1*8(%rsi, %rdx), %r9
+ movq %r11, 0*8(%rdi)
+- movq %r10, -1*8(%rdi, %rdx)
++ movq %r9, -1*8(%rdi, %rdx)
+ jmp 13f
+ 10:
+ cmpq $4, %rdx
+@@ -178,9 +178,9 @@ ENTRY(memmove)
+ * Move data from 4 bytes to 7 bytes.
+ */
+ movl (%rsi), %r11d
+- movl -4(%rsi, %rdx), %r10d
++ movl -4(%rsi, %rdx), %r9d
+ movl %r11d, (%rdi)
+- movl %r10d, -4(%rdi, %rdx)
++ movl %r9d, -4(%rdi, %rdx)
+ jmp 13f
+ 11:
+ cmp $2, %rdx
+@@ -189,9 +189,9 @@ ENTRY(memmove)
+ * Move data from 2 bytes to 3 bytes.
+ */
+ movw (%rsi), %r11w
+- movw -2(%rsi, %rdx), %r10w
++ movw -2(%rsi, %rdx), %r9w
+ movw %r11w, (%rdi)
+- movw %r10w, -2(%rdi, %rdx)
++ movw %r9w, -2(%rdi, %rdx)
+ jmp 13f
+ 12:
+ cmp $1, %rdx
+@@ -202,6 +202,7 @@ ENTRY(memmove)
movb (%rsi), %r11b
movb %r11b, (%rdi)
13:
@@ -19128,7 +20009,7 @@ index d0ec9c2..e5d0a9f 100644
retq
CFI_ENDPROC
-@@ -209,6 +211,7 @@ ENTRY(memmove)
+@@ -210,6 +211,7 @@ ENTRY(memmove)
/* Forward moving data. */
movq %rdx, %rcx
rep movsb
@@ -19137,7 +20018,7 @@ index d0ec9c2..e5d0a9f 100644
.Lmemmove_end_forward_efs:
.previous
diff --git a/arch/x86/lib/memset_64.S b/arch/x86/lib/memset_64.S
-index 79bd454..24b3780 100644
+index 79bd454..dff325a 100644
--- a/arch/x86/lib/memset_64.S
+++ b/arch/x86/lib/memset_64.S
@@ -31,6 +31,7 @@
@@ -19156,10 +20037,27 @@ index 79bd454..24b3780 100644
ret
.Lmemset_e_e:
.previous
-@@ -121,6 +123,7 @@ ENTRY(__memset)
+@@ -60,13 +62,13 @@
+ ENTRY(memset)
+ ENTRY(__memset)
+ CFI_STARTPROC
+- movq %rdi,%r10
+ movq %rdx,%r11
+
+ /* expand byte value */
+ movzbl %sil,%ecx
+ movabs $0x0101010101010101,%rax
+ mul %rcx /* with rax, clobbers rdx */
++ movq %rdi,%rdx
+
+ /* align dst */
+ movl %edi,%r9d
+@@ -120,7 +122,8 @@ ENTRY(__memset)
+ jnz .Lloop_1
.Lende:
- movq %r10,%rax
+- movq %r10,%rax
++ movq %rdx,%rax
+ pax_force_retaddr
ret
@@ -19484,7 +20382,7 @@ index c9f2d9b..e7fd2c0 100644
from += 64;
to += 64;
diff --git a/arch/x86/lib/msr-reg.S b/arch/x86/lib/msr-reg.S
-index 69fa106..234ac7f 100644
+index 69fa106..adda88b 100644
--- a/arch/x86/lib/msr-reg.S
+++ b/arch/x86/lib/msr-reg.S
@@ -3,6 +3,7 @@
@@ -19495,8 +20393,34 @@ index 69fa106..234ac7f 100644
#ifdef CONFIG_X86_64
/*
-@@ -37,6 +38,7 @@ ENTRY(native_\op\()_safe_regs)
- movl %edi, 28(%r10)
+@@ -16,7 +17,7 @@ ENTRY(native_\op\()_safe_regs)
+ CFI_STARTPROC
+ pushq_cfi %rbx
+ pushq_cfi %rbp
+- movq %rdi, %r10 /* Save pointer */
++ movq %rdi, %r9 /* Save pointer */
+ xorl %r11d, %r11d /* Return value */
+ movl (%rdi), %eax
+ movl 4(%rdi), %ecx
+@@ -27,16 +28,17 @@ ENTRY(native_\op\()_safe_regs)
+ movl 28(%rdi), %edi
+ CFI_REMEMBER_STATE
+ 1: \op
+-2: movl %eax, (%r10)
++2: movl %eax, (%r9)
+ movl %r11d, %eax /* Return value */
+- movl %ecx, 4(%r10)
+- movl %edx, 8(%r10)
+- movl %ebx, 12(%r10)
+- movl %ebp, 20(%r10)
+- movl %esi, 24(%r10)
+- movl %edi, 28(%r10)
++ movl %ecx, 4(%r9)
++ movl %edx, 8(%r9)
++ movl %ebx, 12(%r9)
++ movl %ebp, 20(%r9)
++ movl %esi, 24(%r9)
++ movl %edi, 28(%r9)
popq_cfi %rbp
popq_cfi %rbx
+ pax_force_retaddr
@@ -19646,39 +20570,93 @@ index 36b0d15..d381858 100644
#endif
xor %eax,%eax
EXIT
-diff --git a/arch/x86/lib/rwlock_64.S b/arch/x86/lib/rwlock_64.S
-index 05ea55f..f81311a 100644
---- a/arch/x86/lib/rwlock_64.S
-+++ b/arch/x86/lib/rwlock_64.S
-@@ -17,6 +17,7 @@ ENTRY(__write_lock_failed)
+diff --git a/arch/x86/lib/rwlock.S b/arch/x86/lib/rwlock.S
+index 1cad221..de671ee 100644
+--- a/arch/x86/lib/rwlock.S
++++ b/arch/x86/lib/rwlock.S
+@@ -16,13 +16,34 @@ ENTRY(__write_lock_failed)
+ FRAME
+ 0: LOCK_PREFIX
+ WRITE_LOCK_ADD($RW_LOCK_BIAS) (%__lock_ptr)
++
++#ifdef CONFIG_PAX_REFCOUNT
++ jno 1234f
++ LOCK_PREFIX
++ WRITE_LOCK_SUB($RW_LOCK_BIAS) (%__lock_ptr)
++ int $4
++1234:
++ _ASM_EXTABLE(1234b, 1234b)
++#endif
++
+ 1: rep; nop
+ cmpl $WRITE_LOCK_CMP, (%__lock_ptr)
+ jne 1b
LOCK_PREFIX
- subl $RW_LOCK_BIAS,(%rdi)
- jnz __write_lock_failed
+ WRITE_LOCK_SUB($RW_LOCK_BIAS) (%__lock_ptr)
++
++#ifdef CONFIG_PAX_REFCOUNT
++ jno 1234f
++ LOCK_PREFIX
++ WRITE_LOCK_ADD($RW_LOCK_BIAS) (%__lock_ptr)
++ int $4
++1234:
++ _ASM_EXTABLE(1234b, 1234b)
++#endif
++
+ jnz 0b
+ ENDFRAME
+ pax_force_retaddr
ret
CFI_ENDPROC
END(__write_lock_failed)
-@@ -33,6 +34,7 @@ ENTRY(__read_lock_failed)
+@@ -32,13 +53,34 @@ ENTRY(__read_lock_failed)
+ FRAME
+ 0: LOCK_PREFIX
+ READ_LOCK_SIZE(inc) (%__lock_ptr)
++
++#ifdef CONFIG_PAX_REFCOUNT
++ jno 1234f
++ LOCK_PREFIX
++ READ_LOCK_SIZE(dec) (%__lock_ptr)
++ int $4
++1234:
++ _ASM_EXTABLE(1234b, 1234b)
++#endif
++
+ 1: rep; nop
+ READ_LOCK_SIZE(cmp) $1, (%__lock_ptr)
+ js 1b
LOCK_PREFIX
- decl (%rdi)
- js __read_lock_failed
+ READ_LOCK_SIZE(dec) (%__lock_ptr)
++
++#ifdef CONFIG_PAX_REFCOUNT
++ jno 1234f
++ LOCK_PREFIX
++ READ_LOCK_SIZE(inc) (%__lock_ptr)
++ int $4
++1234:
++ _ASM_EXTABLE(1234b, 1234b)
++#endif
++
+ js 0b
+ ENDFRAME
+ pax_force_retaddr
ret
CFI_ENDPROC
END(__read_lock_failed)
-diff --git a/arch/x86/lib/rwsem_64.S b/arch/x86/lib/rwsem_64.S
-index 6774397..79f43de 100644
---- a/arch/x86/lib/rwsem_64.S
-+++ b/arch/x86/lib/rwsem_64.S
-@@ -51,6 +51,7 @@ ENTRY(call_rwsem_down_read_failed)
- popq_cfi %rdx
- CFI_RESTORE rdx
+diff --git a/arch/x86/lib/rwsem.S b/arch/x86/lib/rwsem.S
+index 5dff5f0..cadebf4 100644
+--- a/arch/x86/lib/rwsem.S
++++ b/arch/x86/lib/rwsem.S
+@@ -94,6 +94,7 @@ ENTRY(call_rwsem_down_read_failed)
+ __ASM_SIZE(pop,_cfi) %__ASM_REG(dx)
+ CFI_RESTORE __ASM_REG(dx)
restore_common_regs
+ pax_force_retaddr
ret
CFI_ENDPROC
ENDPROC(call_rwsem_down_read_failed)
-@@ -61,6 +62,7 @@ ENTRY(call_rwsem_down_write_failed)
+@@ -104,6 +105,7 @@ ENTRY(call_rwsem_down_write_failed)
movq %rax,%rdi
call rwsem_down_write_failed
restore_common_regs
@@ -19686,7 +20664,7 @@ index 6774397..79f43de 100644
ret
CFI_ENDPROC
ENDPROC(call_rwsem_down_write_failed)
-@@ -73,7 +75,8 @@ ENTRY(call_rwsem_wake)
+@@ -117,7 +119,8 @@ ENTRY(call_rwsem_wake)
movq %rax,%rdi
call rwsem_wake
restore_common_regs
@@ -19696,35 +20674,32 @@ index 6774397..79f43de 100644
CFI_ENDPROC
ENDPROC(call_rwsem_wake)
-@@ -88,6 +91,7 @@ ENTRY(call_rwsem_downgrade_wake)
- popq_cfi %rdx
- CFI_RESTORE rdx
+@@ -131,6 +134,7 @@ ENTRY(call_rwsem_downgrade_wake)
+ __ASM_SIZE(pop,_cfi) %__ASM_REG(dx)
+ CFI_RESTORE __ASM_REG(dx)
restore_common_regs
+ pax_force_retaddr
ret
CFI_ENDPROC
ENDPROC(call_rwsem_downgrade_wake)
diff --git a/arch/x86/lib/thunk_64.S b/arch/x86/lib/thunk_64.S
-index 782b082..d3b6318 100644
+index a63efd6..ccecad8 100644
--- a/arch/x86/lib/thunk_64.S
+++ b/arch/x86/lib/thunk_64.S
-@@ -10,7 +10,8 @@
- #include <asm/dwarf2.h>
- #include <asm/calling.h>
- #include <asm/rwlock.h>
--
-+ #include <asm/alternative-asm.h>
-+
- /* rdi: arg1 ... normal C conventions. rax is saved/restored. */
- .macro thunk name,func
- .globl \name
-@@ -50,5 +51,6 @@
+@@ -8,6 +8,7 @@
+ #include <linux/linkage.h>
+ #include <asm/dwarf2.h>
+ #include <asm/calling.h>
++#include <asm/alternative-asm.h>
+
+ /* rdi: arg1 ... normal C conventions. rax is saved/restored. */
+ .macro THUNK name, func, put_ret_addr_in_rdi=0
+@@ -41,5 +42,6 @@
SAVE_ARGS
restore:
RESTORE_ARGS
-- ret
+ pax_force_retaddr
-+ ret
+ ret
CFI_ENDPROC
diff --git a/arch/x86/lib/usercopy_32.c b/arch/x86/lib/usercopy_32.c
index e218d5d..35679b4 100644
@@ -20280,16 +21255,13 @@ index e218d5d..35679b4 100644
- */
-unsigned long
-copy_to_user(void __user *to, const void *from, unsigned long n)
-+void copy_from_user_overflow(void)
- {
+-{
- if (access_ok(VERIFY_WRITE, to, n))
- n = __copy_to_user(to, from, n);
- return n;
-+ WARN(1, "Buffer overflow detected!\n");
- }
+-}
-EXPORT_SYMBOL(copy_to_user);
-+EXPORT_SYMBOL(copy_from_user_overflow);
-
+-
-/**
- * copy_from_user: - Copy a block of data from user space.
- * @to: Destination address, in kernel space.
@@ -20308,23 +21280,30 @@ index e218d5d..35679b4 100644
- */
-unsigned long
-_copy_from_user(void *to, const void __user *from, unsigned long n)
-+void copy_to_user_overflow(void)
- {
+-{
- 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);
+-
+ 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);
-
--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);
@@ -20339,8 +21318,7 @@ index e218d5d..35679b4 100644
+ BUG();
+ }
+ return;
- }
--EXPORT_SYMBOL(copy_from_user_overflow);
++}
+EXPORT_SYMBOL(__set_fs);
+
+void set_fs(mm_segment_t x)
@@ -20351,7 +21329,7 @@ index e218d5d..35679b4 100644
+EXPORT_SYMBOL(set_fs);
+#endif
diff --git a/arch/x86/lib/usercopy_64.c b/arch/x86/lib/usercopy_64.c
-index b7c2849..5ef0f95 100644
+index b7c2849..8633ad8 100644
--- a/arch/x86/lib/usercopy_64.c
+++ b/arch/x86/lib/usercopy_64.c
@@ -42,6 +42,12 @@ long
@@ -20380,9 +21358,12 @@ index b7c2849..5ef0f95 100644
/* no memory constraint because it doesn't change any memory gcc knows
about */
asm volatile(
-@@ -151,10 +163,18 @@ EXPORT_SYMBOL(strlen_user);
+@@ -149,12 +161,20 @@ long strlen_user(const char __user *s)
+ }
+ EXPORT_SYMBOL(strlen_user);
- unsigned long copy_in_user(void __user *to, const void __user *from, unsigned len)
+-unsigned long copy_in_user(void __user *to, const void __user *from, unsigned len)
++unsigned long copy_in_user(void __user *to, const void __user *from, unsigned long len)
{
- if (access_ok(VERIFY_WRITE, to, len) && access_ok(VERIFY_READ, from, len)) {
- return copy_user_generic((__force void *)to, (__force void *)from, len);
@@ -20408,7 +21389,7 @@ index b7c2849..5ef0f95 100644
*/
unsigned long
-copy_user_handle_tail(char *to, char *from, unsigned len, unsigned zerorest)
-+copy_user_handle_tail(char __user *to, char __user *from, unsigned len, unsigned zerorest)
++copy_user_handle_tail(char __user *to, char __user *from, unsigned long len, unsigned zerorest)
{
char c;
unsigned zero_len;
@@ -20426,10 +21407,10 @@ index d0474ad..36e9257 100644
extern u32 pnp_bios_is_utter_crap;
pnp_bios_is_utter_crap = 1;
diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c
-index 2dbf6bf..4a744ee 100644
+index 5db0490..13bd09c 100644
--- a/arch/x86/mm/fault.c
+++ b/arch/x86/mm/fault.c
-@@ -13,10 +13,18 @@
+@@ -13,11 +13,18 @@
#include <linux/perf_event.h> /* perf_sw_event */
#include <linux/hugetlb.h> /* hstate_index_to_shift */
#include <linux/prefetch.h> /* prefetchw */
@@ -20439,7 +21420,7 @@ index 2dbf6bf..4a744ee 100644
#include <asm/traps.h> /* dotraplinkage, ... */
#include <asm/pgalloc.h> /* pgd_*(), ... */
#include <asm/kmemcheck.h> /* kmemcheck_*(), ... */
-+#include <asm/vsyscall.h>
+ #include <asm/fixmap.h> /* VSYSCALL_START */
+#include <asm/tlbflush.h>
+
+#if defined(CONFIG_X86_64) && defined(CONFIG_PAX_MEMORY_UDEREF)
@@ -20448,7 +21429,7 @@ index 2dbf6bf..4a744ee 100644
/*
* Page fault error code bits:
-@@ -54,7 +62,7 @@ static inline int __kprobes notify_page_fault(struct pt_regs *regs)
+@@ -55,7 +62,7 @@ static inline int __kprobes notify_page_fault(struct pt_regs *regs)
int ret = 0;
/* kprobe_running() needs smp_processor_id() */
@@ -20457,7 +21438,7 @@ index 2dbf6bf..4a744ee 100644
preempt_disable();
if (kprobe_running() && kprobe_fault_handler(regs, 14))
ret = 1;
-@@ -115,7 +123,10 @@ check_prefetch_opcode(struct pt_regs *regs, unsigned char *instr,
+@@ -116,7 +123,10 @@ check_prefetch_opcode(struct pt_regs *regs, unsigned char *instr,
return !instr_lo || (instr_lo>>1) == 1;
case 0x00:
/* Prefetch instruction is 0x0F0D or 0x0F18 */
@@ -20469,7 +21450,7 @@ index 2dbf6bf..4a744ee 100644
return 0;
*prefetch = (instr_lo == 0xF) &&
-@@ -149,7 +160,10 @@ is_prefetch(struct pt_regs *regs, unsigned long error_code, unsigned long addr)
+@@ -150,7 +160,10 @@ is_prefetch(struct pt_regs *regs, unsigned long error_code, unsigned long addr)
while (instr < max_instr) {
unsigned char opcode;
@@ -20481,10 +21462,14 @@ index 2dbf6bf..4a744ee 100644
break;
instr++;
-@@ -180,6 +194,30 @@ force_sig_info_fault(int si_signo, int si_code, unsigned long address,
+@@ -181,6 +194,34 @@ force_sig_info_fault(int si_signo, int si_code, unsigned long address,
force_sig_info(si_signo, &info, tsk);
}
++#if defined(CONFIG_PAX_PAGEEXEC) || defined(CONFIG_PAX_SEGMEXEC)
++static bool pax_is_fetch_fault(struct pt_regs *regs, unsigned long error_code, unsigned long address);
++#endif
++
+#ifdef CONFIG_PAX_EMUTRAMP
+static int pax_handle_fetch_fault(struct pt_regs *regs);
+#endif
@@ -20512,7 +21497,7 @@ index 2dbf6bf..4a744ee 100644
DEFINE_SPINLOCK(pgd_lock);
LIST_HEAD(pgd_list);
-@@ -230,10 +268,22 @@ void vmalloc_sync_all(void)
+@@ -231,10 +272,22 @@ void vmalloc_sync_all(void)
for (address = VMALLOC_START & PMD_MASK;
address >= TASK_SIZE && address < FIXADDR_TOP;
address += PMD_SIZE) {
@@ -20535,7 +21520,7 @@ index 2dbf6bf..4a744ee 100644
spinlock_t *pgt_lock;
pmd_t *ret;
-@@ -241,8 +291,13 @@ void vmalloc_sync_all(void)
+@@ -242,8 +295,13 @@ void vmalloc_sync_all(void)
pgt_lock = &pgd_page_get_mm(page)->page_table_lock;
spin_lock(pgt_lock);
@@ -20550,7 +21535,7 @@ index 2dbf6bf..4a744ee 100644
if (!ret)
break;
-@@ -276,6 +331,11 @@ static noinline __kprobes int vmalloc_fault(unsigned long address)
+@@ -277,6 +335,11 @@ static noinline __kprobes int vmalloc_fault(unsigned long address)
* an interrupt in the middle of a task switch..
*/
pgd_paddr = read_cr3();
@@ -20562,7 +21547,7 @@ index 2dbf6bf..4a744ee 100644
pmd_k = vmalloc_sync_one(__va(pgd_paddr), address);
if (!pmd_k)
return -1;
-@@ -371,7 +431,14 @@ static noinline __kprobes int vmalloc_fault(unsigned long address)
+@@ -372,7 +435,14 @@ static noinline __kprobes int vmalloc_fault(unsigned long address)
* happen within a race in page table update. In the later
* case just flush:
*/
@@ -20577,7 +21562,7 @@ index 2dbf6bf..4a744ee 100644
pgd_ref = pgd_offset_k(address);
if (pgd_none(*pgd_ref))
return -1;
-@@ -533,7 +600,7 @@ static int is_errata93(struct pt_regs *regs, unsigned long address)
+@@ -540,7 +610,7 @@ static int is_errata93(struct pt_regs *regs, unsigned long address)
static int is_errata100(struct pt_regs *regs, unsigned long address)
{
#ifdef CONFIG_X86_64
@@ -20586,7 +21571,7 @@ index 2dbf6bf..4a744ee 100644
return 1;
#endif
return 0;
-@@ -560,7 +627,7 @@ static int is_f00f_bug(struct pt_regs *regs, unsigned long address)
+@@ -567,7 +637,7 @@ static int is_f00f_bug(struct pt_regs *regs, unsigned long address)
}
static const char nx_warning[] = KERN_CRIT
@@ -20595,7 +21580,7 @@ index 2dbf6bf..4a744ee 100644
static void
show_fault_oops(struct pt_regs *regs, unsigned long error_code,
-@@ -569,14 +636,25 @@ show_fault_oops(struct pt_regs *regs, unsigned long error_code,
+@@ -576,15 +646,26 @@ show_fault_oops(struct pt_regs *regs, unsigned long error_code,
if (!oops_may_print())
return;
@@ -20608,8 +21593,8 @@ index 2dbf6bf..4a744ee 100644
if (pte && pte_present(*pte) && !pte_exec(*pte))
- printk(nx_warning, current_uid());
+ printk(nx_warning, current_uid(), current->comm, task_pid_nr(current));
-+ }
-+
+ }
+
+#ifdef CONFIG_PAX_KERNEXEC
+ if (init_mm.start_code <= address && address < init_mm.end_code) {
+ if (current->signal->curr_ip)
@@ -20618,45 +21603,18 @@ index 2dbf6bf..4a744ee 100644
+ else
+ printk(KERN_ERR "PAX: %s:%d, uid/euid: %u/%u, attempted to modify kernel code\n",
+ current->comm, task_pid_nr(current), current_uid(), current_euid());
- }
-+#endif
-
- printk(KERN_ALERT "BUG: unable to handle kernel ");
- if (address < PAGE_SIZE)
-@@ -702,6 +780,66 @@ __bad_area_nosemaphore(struct pt_regs *regs, unsigned long error_code,
- unsigned long address, int si_code)
- {
- struct task_struct *tsk = current;
-+#if defined(CONFIG_X86_64) || defined(CONFIG_PAX_PAGEEXEC) || defined(CONFIG_PAX_SEGMEXEC)
-+ struct mm_struct *mm = tsk->mm;
-+#endif
-+
-+#ifdef CONFIG_X86_64
-+ if (mm && (error_code & PF_INSTR) && mm->context.vdso) {
-+ if (regs->ip == VSYSCALL_ADDR(__NR_vgettimeofday) ||
-+ regs->ip == VSYSCALL_ADDR(__NR_vtime) ||
-+ regs->ip == VSYSCALL_ADDR(__NR_vgetcpu)) {
-+ regs->ip += mm->context.vdso - PAGE_SIZE - VSYSCALL_START;
-+ return;
-+ }
+ }
+#endif
+
+ printk(KERN_ALERT "BUG: unable to handle kernel ");
+ if (address < PAGE_SIZE)
+ printk(KERN_CONT "NULL pointer dereference");
+@@ -739,6 +820,21 @@ __bad_area_nosemaphore(struct pt_regs *regs, unsigned long error_code,
+ }
+ #endif
+
+#if defined(CONFIG_PAX_PAGEEXEC) || defined(CONFIG_PAX_SEGMEXEC)
-+ if (mm && (error_code & PF_USER)) {
-+ unsigned long ip = regs->ip;
-+
-+ if (v8086_mode(regs))
-+ ip = ((regs->cs & 0xffff) << 4) + (ip & 0xffff);
-+
-+ /*
-+ * It's possible to have interrupts off here:
-+ */
-+ local_irq_enable();
-+
-+#ifdef CONFIG_PAX_PAGEEXEC
-+ if ((mm->pax_flags & MF_PAX_PAGEEXEC) &&
-+ (((__supported_pte_mask & _PAGE_NX) && (error_code & PF_INSTR)) || (!(error_code & (PF_PROT | PF_WRITE)) && ip == address))) {
++ if (pax_is_fetch_fault(regs, error_code, address)) {
+
+#ifdef CONFIG_PAX_EMUTRAMP
+ switch (pax_handle_fetch_fault(regs)) {
@@ -20665,32 +21623,24 @@ index 2dbf6bf..4a744ee 100644
+ }
+#endif
+
-+ pax_report_fault(regs, (void *)ip, (void *)regs->sp);
++ pax_report_fault(regs, (void *)regs->ip, (void *)regs->sp);
+ do_group_exit(SIGKILL);
+ }
+#endif
+
-+#ifdef CONFIG_PAX_SEGMEXEC
-+ if ((mm->pax_flags & MF_PAX_SEGMEXEC) && !(error_code & (PF_PROT | PF_WRITE)) && (ip + SEGMEXEC_TASK_SIZE == address)) {
-+
-+#ifdef CONFIG_PAX_EMUTRAMP
-+ switch (pax_handle_fetch_fault(regs)) {
-+ case 2:
-+ return;
-+ }
-+#endif
-+
-+ pax_report_fault(regs, (void *)ip, (void *)regs->sp);
-+ do_group_exit(SIGKILL);
-+ }
-+#endif
-+
-+ }
-+#endif
+ if (unlikely(show_unhandled_signals))
+ show_signal_msg(regs, error_code, address, tsk);
- /* User mode accesses just cause a SIGSEGV */
- if (error_code & PF_USER) {
-@@ -871,6 +1009,99 @@ static int spurious_fault_check(unsigned long error_code, pte_t *pte)
+@@ -835,7 +931,7 @@ do_sigbus(struct pt_regs *regs, unsigned long error_code, unsigned long address,
+ if (fault & (VM_FAULT_HWPOISON|VM_FAULT_HWPOISON_LARGE)) {
+ printk(KERN_ERR
+ "MCE: Killing %s:%d due to hardware memory corruption fault at %lx\n",
+- tsk->comm, tsk->pid, address);
++ tsk->comm, task_pid_nr(tsk), address);
+ code = BUS_MCEERR_AR;
+ }
+ #endif
+@@ -890,6 +986,99 @@ static int spurious_fault_check(unsigned long error_code, pte_t *pte)
return 1;
}
@@ -20790,7 +21740,7 @@ index 2dbf6bf..4a744ee 100644
/*
* Handle a spurious fault caused by a stale TLB entry.
*
-@@ -943,6 +1174,9 @@ int show_unhandled_signals = 1;
+@@ -962,6 +1151,9 @@ int show_unhandled_signals = 1;
static inline int
access_error(unsigned long error_code, struct vm_area_struct *vma)
{
@@ -20800,7 +21750,7 @@ index 2dbf6bf..4a744ee 100644
if (error_code & PF_WRITE) {
/* write, present and write, not present: */
if (unlikely(!(vma->vm_flags & VM_WRITE)))
-@@ -976,19 +1210,33 @@ do_page_fault(struct pt_regs *regs, unsigned long error_code)
+@@ -995,18 +1187,32 @@ do_page_fault(struct pt_regs *regs, unsigned long error_code)
{
struct vm_area_struct *vma;
struct task_struct *tsk;
@@ -20811,7 +21761,11 @@ index 2dbf6bf..4a744ee 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)
@@ -20822,23 +21776,19 @@ index 2dbf6bf..4a744ee 100644
+ }
+ if (address < PAX_USER_SHADOW_BASE) {
+ printk(KERN_ERR "PAX: please report this to pageexec@freemail.hu\n");
-+ printk(KERN_ERR "PAX: faulting IP: %pA\n", (void *)regs->ip);
++ printk(KERN_ERR "PAX: faulting IP: %pS\n", (void *)regs->ip);
+ show_trace_log_lvl(NULL, NULL, (void *)regs->sp, regs->bp, KERN_ERR);
+ } else
+ address -= PAX_USER_SHADOW_BASE;
+ }
+#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.
-@@ -1048,7 +1296,7 @@ do_page_fault(struct pt_regs *regs, unsigned long error_code)
+@@ -1067,7 +1273,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:
*/
@@ -20847,7 +21797,7 @@ index 2dbf6bf..4a744ee 100644
local_irq_enable();
error_code |= PF_USER;
} else {
-@@ -1103,6 +1351,11 @@ retry:
+@@ -1122,6 +1328,11 @@ retry:
might_sleep();
}
@@ -20859,7 +21809,7 @@ index 2dbf6bf..4a744ee 100644
vma = find_vma(mm, address);
if (unlikely(!vma)) {
bad_area(regs, error_code, address);
-@@ -1114,18 +1367,24 @@ retry:
+@@ -1133,18 +1344,24 @@ retry:
bad_area(regs, error_code, address);
return;
}
@@ -20895,16 +21845,71 @@ index 2dbf6bf..4a744ee 100644
if (unlikely(expand_stack(vma, address))) {
bad_area(regs, error_code, address);
return;
-@@ -1180,3 +1439,199 @@ good_area:
+@@ -1199,3 +1416,292 @@ good_area:
up_read(&mm->mmap_sem);
}
+
++#if defined(CONFIG_PAX_PAGEEXEC) || defined(CONFIG_PAX_SEGMEXEC)
++static bool pax_is_fetch_fault(struct pt_regs *regs, unsigned long error_code, unsigned long address)
++{
++ struct mm_struct *mm = current->mm;
++ unsigned long ip = regs->ip;
++
++ if (v8086_mode(regs))
++ ip = ((regs->cs & 0xffff) << 4) + (ip & 0xffff);
++
++#ifdef CONFIG_PAX_PAGEEXEC
++ if (mm->pax_flags & MF_PAX_PAGEEXEC) {
++ if ((__supported_pte_mask & _PAGE_NX) && (error_code & PF_INSTR))
++ return true;
++ if (!(error_code & (PF_PROT | PF_WRITE)) && ip == address)
++ return true;
++ return false;
++ }
++#endif
++
++#ifdef CONFIG_PAX_SEGMEXEC
++ if (mm->pax_flags & MF_PAX_SEGMEXEC) {
++ if (!(error_code & (PF_PROT | PF_WRITE)) && (ip + SEGMEXEC_TASK_SIZE == address))
++ return true;
++ return false;
++ }
++#endif
++
++ return false;
++}
++#endif
++
+#ifdef CONFIG_PAX_EMUTRAMP
+static int pax_handle_fetch_fault_32(struct pt_regs *regs)
+{
+ int err;
+
++ do { /* PaX: libffi trampoline emulation */
++ unsigned char mov, jmp;
++ unsigned int addr1, addr2;
++
++#ifdef CONFIG_X86_64
++ if ((regs->ip + 9) >> 32)
++ break;
++#endif
++
++ err = get_user(mov, (unsigned char __user *)regs->ip);
++ err |= get_user(addr1, (unsigned int __user *)(regs->ip + 1));
++ err |= get_user(jmp, (unsigned char __user *)(regs->ip + 5));
++ err |= get_user(addr2, (unsigned int __user *)(regs->ip + 6));
++
++ if (err)
++ break;
++
++ if (mov == 0xB8 && jmp == 0xE9) {
++ regs->ax = addr1;
++ regs->ip = (unsigned int)(regs->ip + addr2 + 10);
++ return 2;
++ }
++ } while (0);
++
+ do { /* PaX: gcc trampoline emulation #1 */
+ unsigned char mov1, mov2;
+ unsigned short jmp;
@@ -20964,6 +21969,34 @@ index 2dbf6bf..4a744ee 100644
+{
+ int err;
+
++ do { /* PaX: libffi trampoline emulation */
++ unsigned short mov1, mov2, jmp1;
++ unsigned char stcclc, jmp2;
++ unsigned long addr1, addr2;
++
++ err = get_user(mov1, (unsigned short __user *)regs->ip);
++ err |= get_user(addr1, (unsigned long __user *)(regs->ip + 2));
++ err |= get_user(mov2, (unsigned short __user *)(regs->ip + 10));
++ err |= get_user(addr2, (unsigned long __user *)(regs->ip + 12));
++ err |= get_user(stcclc, (unsigned char __user *)(regs->ip + 20));
++ err |= get_user(jmp1, (unsigned short __user *)(regs->ip + 21));
++ err |= get_user(jmp2, (unsigned char __user *)(regs->ip + 23));
++
++ if (err)
++ break;
++
++ if (mov1 == 0xBB49 && mov2 == 0xBA49 && (stcclc == 0xF8 || stcclc == 0xF9) && jmp1 == 0xFF49 && jmp2 == 0xE3) {
++ regs->r11 = addr1;
++ regs->r10 = addr2;
++ if (stcclc == 0xF8)
++ regs->flags &= ~X86_EFLAGS_CF;
++ else
++ regs->flags |= X86_EFLAGS_CF;
++ regs->ip = addr1;
++ return 2;
++ }
++ } while (0);
++
+ do { /* PaX: gcc trampoline emulation #1 */
+ unsigned short mov1, mov2, jmp1;
+ unsigned char jmp2;
@@ -21041,7 +22074,7 @@ index 2dbf6bf..4a744ee 100644
+#endif
+
+#if defined(CONFIG_PAX_PAGEEXEC) || defined(CONFIG_PAX_SEGMEXEC)
-+void pax_report_insns(void *pc, void *sp)
++void pax_report_insns(struct pt_regs *regs, void *pc, void *sp)
+{
+ long i;
+
@@ -21058,14 +22091,24 @@ index 2dbf6bf..4a744ee 100644
+ printk(KERN_ERR "PAX: bytes at SP-%lu: ", (unsigned long)sizeof(long));
+ for (i = -1; i < 80 / (long)sizeof(long); i++) {
+ unsigned long c;
-+ if (get_user(c, (unsigned long __force_user *)sp+i))
++ if (get_user(c, (unsigned long __force_user *)sp+i)) {
+#ifdef CONFIG_X86_32
+ printk(KERN_CONT "???????? ");
+#else
-+ printk(KERN_CONT "???????????????? ");
++ if ((regs->cs == __USER32_CS || (regs->cs & SEGMENT_LDT)))
++ printk(KERN_CONT "???????? ???????? ");
++ else
++ printk(KERN_CONT "???????????????? ");
+#endif
-+ else
-+ printk(KERN_CONT "%0*lx ", 2 * (int)sizeof(long), c);
++ } else {
++#ifdef CONFIG_X86_64
++ if ((regs->cs == __USER32_CS || (regs->cs & SEGMENT_LDT))) {
++ printk(KERN_CONT "%08x ", (unsigned int)c);
++ printk(KERN_CONT "%08x ", (unsigned int)(c >> 32));
++ } else
++#endif
++ printk(KERN_CONT "%0*lx ", 2 * (int)sizeof(long), c);
++ }
+ }
+ printk("\n");
+}
@@ -21336,10 +22379,18 @@ index f581a18..29efd37 100644
}
if (mm->get_unmapped_area == arch_get_unmapped_area)
diff --git a/arch/x86/mm/init.c b/arch/x86/mm/init.c
-index 87488b9..9ee65f6 100644
+index 87488b9..a55509f 100644
--- a/arch/x86/mm/init.c
+++ b/arch/x86/mm/init.c
-@@ -31,7 +31,7 @@ int direct_gbpages
+@@ -15,6 +15,7 @@
+ #include <asm/tlbflush.h>
+ #include <asm/tlb.h>
+ #include <asm/proto.h>
++#include <asm/desc.h>
+
+ unsigned long __initdata pgt_buf_start;
+ unsigned long __meminitdata pgt_buf_end;
+@@ -31,7 +32,7 @@ int direct_gbpages
static void __init find_early_table_space(unsigned long end, int use_pse,
int use_gbpages)
{
@@ -21348,11 +22399,10 @@ index 87488b9..9ee65f6 100644
phys_addr_t base;
puds = (end + PUD_SIZE - 1) >> PUD_SHIFT;
-@@ -312,12 +312,34 @@ unsigned long __init_refok init_memory_mapping(unsigned long start,
+@@ -312,8 +313,29 @@ unsigned long __init_refok init_memory_mapping(unsigned long start,
*/
int devmem_is_allowed(unsigned long pagenr)
{
-- if (pagenr <= 256)
+#ifdef CONFIG_GRKERNSEC_KMEM
+ /* allow BDA */
+ if (!pagenr)
@@ -21370,20 +22420,16 @@ index 87488b9..9ee65f6 100644
+#endif
+
+ if ((ISA_START_ADDRESS >> PAGE_SHIFT) <= pagenr && pagenr < (ISA_END_ADDRESS >> PAGE_SHIFT))
- return 1;
++ return 1;
+#ifdef CONFIG_GRKERNSEC_KMEM
+ /* throw out everything else below 1MB */
-+ if (pagenr <= 256)
+ if (pagenr <= 256)
+- return 1;
+ return 0;
+#endif
if (iomem_is_exclusive(pagenr << PAGE_SHIFT))
return 0;
if (!page_is_ram(pagenr))
- return 1;
-+
- return 0;
- }
-
@@ -372,6 +394,86 @@ void free_init_pages(char *what, unsigned long begin, unsigned long end)
void free_initmem(void)
@@ -21947,19 +22993,19 @@ index d87dd6d..bf3fa66 100644
pte = kmemcheck_pte_lookup(address);
diff --git a/arch/x86/mm/mmap.c b/arch/x86/mm/mmap.c
-index 1dab519..60a7e5f 100644
+index 4b5ba85..f166ad2 100644
--- a/arch/x86/mm/mmap.c
+++ b/arch/x86/mm/mmap.c
-@@ -49,7 +49,7 @@ static unsigned int stack_maxrandom_size(void)
+@@ -52,7 +52,7 @@ static unsigned int stack_maxrandom_size(void)
* Leave an at least ~128 MB hole with possible stack randomization.
*/
#define MIN_GAP (128*1024*1024UL + stack_maxrandom_size())
-#define MAX_GAP (TASK_SIZE/6*5)
+#define MAX_GAP (pax_task_size/6*5)
- /*
- * True on X86_32 or when emulating IA32 on X86_64
-@@ -94,27 +94,40 @@ static unsigned long mmap_rnd(void)
+ static int mmap_is_legacy(void)
+ {
+@@ -82,27 +82,40 @@ static unsigned long mmap_rnd(void)
return rnd << PAGE_SHIFT;
}
@@ -22005,7 +23051,7 @@ index 1dab519..60a7e5f 100644
return TASK_UNMAPPED_BASE + mmap_rnd();
}
-@@ -125,11 +138,23 @@ static unsigned long mmap_legacy_base(void)
+@@ -113,11 +126,23 @@ static unsigned long mmap_legacy_base(void)
void arch_pick_mmap_layout(struct mm_struct *mm)
{
if (mmap_is_legacy()) {
@@ -22032,10 +23078,10 @@ index 1dab519..60a7e5f 100644
mm->unmap_area = arch_unmap_area_topdown;
}
diff --git a/arch/x86/mm/mmio-mod.c b/arch/x86/mm/mmio-mod.c
-index 3adff7d..47e9fe9 100644
+index de54b9b..799051e 100644
--- a/arch/x86/mm/mmio-mod.c
+++ b/arch/x86/mm/mmio-mod.c
-@@ -195,7 +195,7 @@ static void pre(struct kmmio_probe *p, struct pt_regs *regs,
+@@ -194,7 +194,7 @@ static void pre(struct kmmio_probe *p, struct pt_regs *regs,
break;
default:
{
@@ -22044,7 +23090,7 @@ index 3adff7d..47e9fe9 100644
my_trace->opcode = MMIO_UNKNOWN_OP;
my_trace->width = 0;
my_trace->value = (*ip) << 16 | *(ip + 1) << 8 |
-@@ -235,7 +235,7 @@ static void post(struct kmmio_probe *p, unsigned long condition,
+@@ -234,7 +234,7 @@ static void post(struct kmmio_probe *p, unsigned long condition,
static void ioremap_trace_core(resource_size_t offset, unsigned long size,
void __iomem *addr)
{
@@ -22053,7 +23099,7 @@ index 3adff7d..47e9fe9 100644
struct remap_trace *trace = kmalloc(sizeof(*trace), GFP_KERNEL);
/* These are page-unaligned. */
struct mmiotrace_map map = {
-@@ -259,7 +259,7 @@ static void ioremap_trace_core(resource_size_t offset, unsigned long size,
+@@ -258,7 +258,7 @@ static void ioremap_trace_core(resource_size_t offset, unsigned long size,
.private = trace
},
.phys = offset,
@@ -22063,7 +23109,7 @@ index 3adff7d..47e9fe9 100644
map.map_id = trace->id;
diff --git a/arch/x86/mm/pageattr-test.c b/arch/x86/mm/pageattr-test.c
-index e1d1069..2251ff3 100644
+index b008656..773eac2 100644
--- a/arch/x86/mm/pageattr-test.c
+++ b/arch/x86/mm/pageattr-test.c
@@ -36,7 +36,7 @@ enum {
@@ -22282,7 +23328,7 @@ index 8573b83..6372501 100644
+ *dst++ = __pgd((pgd_val(*src++) | (_PAGE_NX & __supported_pte_mask)) & ~_PAGE_USER);
+}
+#endif
-+
+
+#ifdef CONFIG_PAX_PER_CPU_PGD
+void __clone_user_pgds(pgd_t *dst, const pgd_t *src, int count)
+{
@@ -22314,7 +23360,7 @@ index 8573b83..6372501 100644
+#define pyd_offset(mm ,address) pud_offset((mm), (address))
+#define PYD_SIZE PUD_SIZE
+#endif
-
++
+#ifdef CONFIG_PAX_PER_CPU_PGD
+static inline void pgd_ctor(struct mm_struct *mm, pgd_t *pgd) {}
+static inline void pgd_dtor(pgd_t *pgd) {}
@@ -22661,12 +23707,40 @@ index 6687022..ceabcfa 100644
+ pax_force_retaddr
ret
diff --git a/arch/x86/net/bpf_jit_comp.c b/arch/x86/net/bpf_jit_comp.c
-index bfab3fa..e32d0f0 100644
+index 7b65f75..63097f6 100644
--- a/arch/x86/net/bpf_jit_comp.c
+++ b/arch/x86/net/bpf_jit_comp.c
-@@ -589,7 +589,9 @@ cond_branch: f_offset = addrs[i + filter[i].jf] - addrs[i];
- module_free(NULL, image);
- return;
+@@ -117,6 +117,10 @@ static inline void bpf_flush_icache(void *start, void *end)
+ set_fs(old_fs);
+ }
+
++struct bpf_jit_work {
++ struct work_struct work;
++ void *image;
++};
+
+ void bpf_jit_compile(struct sk_filter *fp)
+ {
+@@ -141,6 +145,10 @@ void bpf_jit_compile(struct sk_filter *fp)
+ if (addrs == NULL)
+ return;
+
++ fp->work = kmalloc(sizeof(*fp->work), GFP_KERNEL);
++ if (!fp->work)
++ goto out;
++
+ /* Before first pass, make a rough estimation of addrs[]
+ * each bpf instruction is translated to less than 64 bytes
+ */
+@@ -585,11 +593,12 @@ cond_branch: f_offset = addrs[i + filter[i].jf] - addrs[i];
+ if (image) {
+ if (unlikely(proglen + ilen > oldproglen)) {
+ pr_err("bpb_jit_compile fatal error\n");
+- kfree(addrs);
+- module_free(NULL, image);
+- return;
++ module_free_exec(NULL, image);
++ goto out;
}
+ pax_open_kernel();
memcpy(image + proglen, temp, ilen);
@@ -22674,7 +23748,7 @@ index bfab3fa..e32d0f0 100644
}
proglen += ilen;
addrs[i] = proglen;
-@@ -609,7 +611,7 @@ cond_branch: f_offset = addrs[i + filter[i].jf] - addrs[i];
+@@ -609,7 +618,7 @@ cond_branch: f_offset = addrs[i + filter[i].jf] - addrs[i];
break;
}
if (proglen == oldproglen) {
@@ -22683,11 +23757,42 @@ index bfab3fa..e32d0f0 100644
proglen,
sizeof(struct work_struct)));
if (!image)
+@@ -631,24 +640,27 @@ cond_branch: f_offset = addrs[i + filter[i].jf] - addrs[i];
+ fp->bpf_func = (void *)image;
+ }
+ out:
++ kfree(fp->work);
+ kfree(addrs);
+ return;
+ }
+
+ static void jit_free_defer(struct work_struct *arg)
+ {
+- module_free(NULL, arg);
++ module_free_exec(NULL, ((struct bpf_jit_work*)arg)->image);
++ kfree(arg);
+ }
+
+ /* run from softirq, we must use a work_struct to call
+- * module_free() from process context
++ * module_free_exec() from process context
+ */
+ void bpf_jit_free(struct sk_filter *fp)
+ {
+ if (fp->bpf_func != sk_run_filter) {
+- struct work_struct *work = (struct work_struct *)fp->bpf_func;
++ struct work_struct *work = &fp->work->work;
+
+ INIT_WORK(work, jit_free_defer);
++ fp->work->image = fp->bpf_func;
+ schedule_work(work);
+ }
+ }
diff --git a/arch/x86/oprofile/backtrace.c b/arch/x86/oprofile/backtrace.c
-index 32f78eb..9074017 100644
+index bff89df..377758a 100644
--- a/arch/x86/oprofile/backtrace.c
+++ b/arch/x86/oprofile/backtrace.c
-@@ -83,11 +83,11 @@ dump_user_backtrace_32(struct stack_frame_ia32 *head)
+@@ -46,11 +46,11 @@ dump_user_backtrace_32(struct stack_frame_ia32 *head)
struct stack_frame_ia32 *fp;
unsigned long bytes;
@@ -22701,7 +23806,7 @@ index 32f78eb..9074017 100644
oprofile_add_trace(bufhead[0].return_address);
-@@ -129,7 +129,7 @@ static struct stack_frame *dump_user_backtrace(struct stack_frame *head)
+@@ -92,7 +92,7 @@ static struct stack_frame *dump_user_backtrace(struct stack_frame *head)
struct stack_frame bufhead[2];
unsigned long bytes;
@@ -22710,7 +23815,7 @@ index 32f78eb..9074017 100644
if (bytes != sizeof(bufhead))
return NULL;
-@@ -148,7 +148,7 @@ x86_backtrace(struct pt_regs * const regs, unsigned int depth)
+@@ -111,7 +111,7 @@ x86_backtrace(struct pt_regs * const regs, unsigned int depth)
{
struct stack_frame *head = (struct stack_frame *)frame_pointer(regs);
@@ -22735,7 +23840,7 @@ index cb29191..036766d 100644
return 1;
}
diff --git a/arch/x86/pci/pcbios.c b/arch/x86/pci/pcbios.c
-index a5f7d0d..f7a8a1b 100644
+index db0e9a5..8844dea 100644
--- a/arch/x86/pci/pcbios.c
+++ b/arch/x86/pci/pcbios.c
@@ -79,50 +79,93 @@ union bios32 {
@@ -22873,7 +23978,7 @@ index a5f7d0d..f7a8a1b 100644
: "memory");
local_irq_restore(flags);
-@@ -188,7 +234,10 @@ static int pci_bios_read(unsigned int seg, unsigned int bus,
+@@ -189,7 +235,10 @@ static int pci_bios_read(unsigned int seg, unsigned int bus,
switch (len) {
case 1:
@@ -22885,7 +23990,7 @@ index a5f7d0d..f7a8a1b 100644
"jc 1f\n\t"
"xor %%ah, %%ah\n"
"1:"
-@@ -197,7 +246,8 @@ static int pci_bios_read(unsigned int seg, unsigned int bus,
+@@ -198,7 +247,8 @@ static int pci_bios_read(unsigned int seg, unsigned int bus,
: "1" (PCIBIOS_READ_CONFIG_BYTE),
"b" (bx),
"D" ((long)reg),
@@ -22895,7 +24000,7 @@ index a5f7d0d..f7a8a1b 100644
/*
* Zero-extend the result beyond 8 bits, do not trust the
* BIOS having done it:
-@@ -205,7 +255,10 @@ static int pci_bios_read(unsigned int seg, unsigned int bus,
+@@ -206,7 +256,10 @@ static int pci_bios_read(unsigned int seg, unsigned int bus,
*value &= 0xff;
break;
case 2:
@@ -22907,7 +24012,7 @@ index a5f7d0d..f7a8a1b 100644
"jc 1f\n\t"
"xor %%ah, %%ah\n"
"1:"
-@@ -214,7 +267,8 @@ static int pci_bios_read(unsigned int seg, unsigned int bus,
+@@ -215,7 +268,8 @@ static int pci_bios_read(unsigned int seg, unsigned int bus,
: "1" (PCIBIOS_READ_CONFIG_WORD),
"b" (bx),
"D" ((long)reg),
@@ -22917,7 +24022,7 @@ index a5f7d0d..f7a8a1b 100644
/*
* Zero-extend the result beyond 16 bits, do not trust the
* BIOS having done it:
-@@ -222,7 +276,10 @@ static int pci_bios_read(unsigned int seg, unsigned int bus,
+@@ -223,7 +277,10 @@ static int pci_bios_read(unsigned int seg, unsigned int bus,
*value &= 0xffff;
break;
case 4:
@@ -22929,7 +24034,7 @@ index a5f7d0d..f7a8a1b 100644
"jc 1f\n\t"
"xor %%ah, %%ah\n"
"1:"
-@@ -231,7 +288,8 @@ static int pci_bios_read(unsigned int seg, unsigned int bus,
+@@ -232,7 +289,8 @@ static int pci_bios_read(unsigned int seg, unsigned int bus,
: "1" (PCIBIOS_READ_CONFIG_DWORD),
"b" (bx),
"D" ((long)reg),
@@ -22939,7 +24044,7 @@ index a5f7d0d..f7a8a1b 100644
break;
}
-@@ -254,7 +312,10 @@ static int pci_bios_write(unsigned int seg, unsigned int bus,
+@@ -256,7 +314,10 @@ static int pci_bios_write(unsigned int seg, unsigned int bus,
switch (len) {
case 1:
@@ -22951,7 +24056,7 @@ index a5f7d0d..f7a8a1b 100644
"jc 1f\n\t"
"xor %%ah, %%ah\n"
"1:"
-@@ -263,10 +324,14 @@ static int pci_bios_write(unsigned int seg, unsigned int bus,
+@@ -265,10 +326,14 @@ static int pci_bios_write(unsigned int seg, unsigned int bus,
"c" (value),
"b" (bx),
"D" ((long)reg),
@@ -22968,7 +24073,7 @@ index a5f7d0d..f7a8a1b 100644
"jc 1f\n\t"
"xor %%ah, %%ah\n"
"1:"
-@@ -275,10 +340,14 @@ static int pci_bios_write(unsigned int seg, unsigned int bus,
+@@ -277,10 +342,14 @@ static int pci_bios_write(unsigned int seg, unsigned int bus,
"c" (value),
"b" (bx),
"D" ((long)reg),
@@ -22985,7 +24090,7 @@ index a5f7d0d..f7a8a1b 100644
"jc 1f\n\t"
"xor %%ah, %%ah\n"
"1:"
-@@ -287,7 +356,8 @@ static int pci_bios_write(unsigned int seg, unsigned int bus,
+@@ -289,7 +358,8 @@ static int pci_bios_write(unsigned int seg, unsigned int bus,
"c" (value),
"b" (bx),
"D" ((long)reg),
@@ -22995,7 +24100,7 @@ index a5f7d0d..f7a8a1b 100644
break;
}
-@@ -392,10 +462,13 @@ struct irq_routing_table * pcibios_get_irq_routing_table(void)
+@@ -394,10 +464,13 @@ struct irq_routing_table * pcibios_get_irq_routing_table(void)
DBG("PCI: Fetching IRQ routing table... ");
__asm__("push %%es\n\t"
@@ -23010,7 +24115,7 @@ index a5f7d0d..f7a8a1b 100644
"jc 1f\n\t"
"xor %%ah, %%ah\n"
"1:"
-@@ -406,7 +479,8 @@ struct irq_routing_table * pcibios_get_irq_routing_table(void)
+@@ -408,7 +481,8 @@ struct irq_routing_table * pcibios_get_irq_routing_table(void)
"1" (0),
"D" ((long) &opt),
"S" (&pci_indirect),
@@ -23020,7 +24125,7 @@ index a5f7d0d..f7a8a1b 100644
: "memory");
DBG("OK ret=%d, size=%d, map=%x\n", ret, opt.size, map);
if (ret & 0xff00)
-@@ -430,7 +504,10 @@ int pcibios_set_irq_routing(struct pci_dev *dev, int pin, int irq)
+@@ -432,7 +506,10 @@ int pcibios_set_irq_routing(struct pci_dev *dev, int pin, int irq)
{
int ret;
@@ -23032,7 +24137,7 @@ index a5f7d0d..f7a8a1b 100644
"jc 1f\n\t"
"xor %%ah, %%ah\n"
"1:"
-@@ -438,7 +515,8 @@ int pcibios_set_irq_routing(struct pci_dev *dev, int pin, int irq)
+@@ -440,7 +517,8 @@ int pcibios_set_irq_routing(struct pci_dev *dev, int pin, int irq)
: "0" (PCIBIOS_SET_PCI_HW_INT),
"b" ((dev->bus->number << 8) | dev->devfn),
"c" ((irq << 8) | (pin + 10)),
@@ -23043,21 +24148,11 @@ index a5f7d0d..f7a8a1b 100644
}
EXPORT_SYMBOL(pcibios_set_irq_routing);
diff --git a/arch/x86/platform/efi/efi_32.c b/arch/x86/platform/efi/efi_32.c
-index 5cab48e..b025f9b 100644
+index 40e4469..1ab536e 100644
--- a/arch/x86/platform/efi/efi_32.c
+++ b/arch/x86/platform/efi/efi_32.c
-@@ -38,70 +38,56 @@
- */
-
- static unsigned long efi_rt_eflags;
--static pgd_t efi_bak_pg_dir_pointer[2];
-+static pgd_t __initdata efi_bak_pg_dir_pointer[KERNEL_PGD_PTRS];
-
--void efi_call_phys_prelog(void)
-+void __init efi_call_phys_prelog(void)
+@@ -44,11 +44,22 @@ void efi_call_phys_prelog(void)
{
-- unsigned long cr4;
-- unsigned long temp;
struct desc_ptr gdt_descr;
+#ifdef CONFIG_PAX_KERNEXEC
@@ -23066,36 +24161,7 @@ index 5cab48e..b025f9b 100644
+
local_irq_save(efi_rt_eflags);
-- /*
-- * If I don't have PAE, I should just duplicate two entries in page
-- * directory. If I have PAE, I just need to duplicate one entry in
-- * page directory.
-- */
-- cr4 = read_cr4_safe();
--
-- if (cr4 & X86_CR4_PAE) {
-- efi_bak_pg_dir_pointer[0].pgd =
-- swapper_pg_dir[pgd_index(0)].pgd;
-- swapper_pg_dir[0].pgd =
-- swapper_pg_dir[pgd_index(PAGE_OFFSET)].pgd;
-- } else {
-- efi_bak_pg_dir_pointer[0].pgd =
-- swapper_pg_dir[pgd_index(0)].pgd;
-- efi_bak_pg_dir_pointer[1].pgd =
-- swapper_pg_dir[pgd_index(0x400000)].pgd;
-- swapper_pg_dir[pgd_index(0)].pgd =
-- swapper_pg_dir[pgd_index(PAGE_OFFSET)].pgd;
-- temp = PAGE_OFFSET + 0x400000;
-- swapper_pg_dir[pgd_index(0x400000)].pgd =
-- swapper_pg_dir[pgd_index(temp)].pgd;
-- }
-+ clone_pgd_range(efi_bak_pg_dir_pointer, swapper_pg_dir, KERNEL_PGD_PTRS);
-+ clone_pgd_range(swapper_pg_dir, swapper_pg_dir + KERNEL_PGD_BOUNDARY,
-+ min_t(unsigned long, KERNEL_PGD_PTRS, KERNEL_PGD_BOUNDARY));
-
- /*
- * After the lock is released, the original page table is restored.
- */
+ load_cr3(initial_page_table);
__flush_tlb_all();
+#ifdef CONFIG_PAX_KERNEXEC
@@ -23108,12 +24174,8 @@ index 5cab48e..b025f9b 100644
gdt_descr.address = __pa(get_cpu_gdt_table(0));
gdt_descr.size = GDT_SIZE - 1;
load_gdt(&gdt_descr);
- }
-
--void efi_call_phys_epilog(void)
-+void __init efi_call_phys_epilog(void)
+@@ -58,6 +69,14 @@ void efi_call_phys_epilog(void)
{
-- unsigned long cr4;
struct desc_ptr gdt_descr;
+#ifdef CONFIG_PAX_KERNEXEC
@@ -23127,22 +24189,6 @@ index 5cab48e..b025f9b 100644
gdt_descr.address = (unsigned long)get_cpu_gdt_table(0);
gdt_descr.size = GDT_SIZE - 1;
load_gdt(&gdt_descr);
-
-- cr4 = read_cr4_safe();
--
-- if (cr4 & X86_CR4_PAE) {
-- swapper_pg_dir[pgd_index(0)].pgd =
-- efi_bak_pg_dir_pointer[0].pgd;
-- } else {
-- swapper_pg_dir[pgd_index(0)].pgd =
-- efi_bak_pg_dir_pointer[0].pgd;
-- swapper_pg_dir[pgd_index(0x400000)].pgd =
-- efi_bak_pg_dir_pointer[1].pgd;
-- }
-+ clone_pgd_range(swapper_pg_dir, efi_bak_pg_dir_pointer, KERNEL_PGD_PTRS);
-
- /*
- * After the lock is released, the original page table is restored.
diff --git a/arch/x86/platform/efi/efi_stub_32.S b/arch/x86/platform/efi/efi_stub_32.S
index fbe66e6..c5c0dd2 100644
--- a/arch/x86/platform/efi/efi_stub_32.S
@@ -23256,7 +24302,7 @@ index fbe66e6..c5c0dd2 100644
.long 0
efi_rt_function_ptr:
diff --git a/arch/x86/platform/efi/efi_stub_64.S b/arch/x86/platform/efi/efi_stub_64.S
-index 4c07cca..3092c81 100644
+index 4c07cca..2c8427d 100644
--- a/arch/x86/platform/efi/efi_stub_64.S
+++ b/arch/x86/platform/efi/efi_stub_64.S
@@ -7,6 +7,7 @@
@@ -23271,7 +24317,7 @@ index 4c07cca..3092c81 100644
call *%rdi
addq $32, %rsp
RESTORE_XMM
-+ pax_force_retaddr
++ pax_force_retaddr 0, 1
ret
ENDPROC(efi_call0)
@@ -23279,7 +24325,7 @@ index 4c07cca..3092c81 100644
call *%rdi
addq $32, %rsp
RESTORE_XMM
-+ pax_force_retaddr
++ pax_force_retaddr 0, 1
ret
ENDPROC(efi_call1)
@@ -23287,7 +24333,7 @@ index 4c07cca..3092c81 100644
call *%rdi
addq $32, %rsp
RESTORE_XMM
-+ pax_force_retaddr
++ pax_force_retaddr 0, 1
ret
ENDPROC(efi_call2)
@@ -23295,7 +24341,7 @@ index 4c07cca..3092c81 100644
call *%rdi
addq $32, %rsp
RESTORE_XMM
-+ pax_force_retaddr
++ pax_force_retaddr 0, 1
ret
ENDPROC(efi_call3)
@@ -23303,7 +24349,7 @@ index 4c07cca..3092c81 100644
call *%rdi
addq $32, %rsp
RESTORE_XMM
-+ pax_force_retaddr
++ pax_force_retaddr 0, 1
ret
ENDPROC(efi_call4)
@@ -23311,7 +24357,7 @@ index 4c07cca..3092c81 100644
call *%rdi
addq $48, %rsp
RESTORE_XMM
-+ pax_force_retaddr
++ pax_force_retaddr 0, 1
ret
ENDPROC(efi_call5)
@@ -23319,50 +24365,41 @@ index 4c07cca..3092c81 100644
call *%rdi
addq $48, %rsp
RESTORE_XMM
-+ pax_force_retaddr
++ pax_force_retaddr 0, 1
ret
ENDPROC(efi_call6)
diff --git a/arch/x86/platform/mrst/mrst.c b/arch/x86/platform/mrst/mrst.c
-index fe73276..70fe25a 100644
+index ad4ec1c..686479e 100644
--- a/arch/x86/platform/mrst/mrst.c
+++ b/arch/x86/platform/mrst/mrst.c
-@@ -239,14 +239,16 @@ static int mrst_i8042_detect(void)
- }
+@@ -76,18 +76,20 @@ struct sfi_rtc_table_entry sfi_mrtc_array[SFI_MRTC_MAX];
+ EXPORT_SYMBOL_GPL(sfi_mrtc_array);
+ int sfi_mrtc_num;
- /* Reboot and power off are handled by the SCU on a MID device */
-static void mrst_power_off(void)
+static __noreturn void mrst_power_off(void)
{
- intel_scu_ipc_simple_command(0xf1, 1);
+ if (__mrst_cpu_chip == MRST_CPU_CHIP_LINCROFT)
+ intel_scu_ipc_simple_command(IPCMSG_COLD_RESET, 1);
+ BUG();
}
-static void mrst_reboot(void)
+static __noreturn void mrst_reboot(void)
{
- intel_scu_ipc_simple_command(0xf1, 0);
+ if (__mrst_cpu_chip == MRST_CPU_CHIP_LINCROFT)
+ intel_scu_ipc_simple_command(IPCMSG_COLD_RESET, 0);
+ else
+ intel_scu_ipc_simple_command(IPCMSG_COLD_BOOT, 0);
+ BUG();
}
- /*
-diff --git a/arch/x86/platform/uv/tlb_uv.c b/arch/x86/platform/uv/tlb_uv.c
-index 82cff4a..ceceb7c 100644
---- a/arch/x86/platform/uv/tlb_uv.c
-+++ b/arch/x86/platform/uv/tlb_uv.c
-@@ -370,6 +370,8 @@ static void reset_with_ipi(struct bau_targ_hubmask *distribution, int sender)
- cpumask_t mask;
- struct reset_args reset_args;
-
-+ pax_track_stack();
-+
- reset_args.sender = sender;
- cpus_clear(mask);
- /* find a single cpu for each uvhub in this distribution mask */
+ /* parse all the mtimer info to a static mtimer array */
diff --git a/arch/x86/power/cpu.c b/arch/x86/power/cpu.c
-index 87bb35e..eff2da8 100644
+index f10c0af..3ec1f95 100644
--- a/arch/x86/power/cpu.c
+++ b/arch/x86/power/cpu.c
-@@ -130,7 +130,7 @@ static void do_fpu_end(void)
+@@ -131,7 +131,7 @@ static void do_fpu_end(void)
static void fix_processor_context(void)
{
int cpu = smp_processor_id();
@@ -23371,7 +24408,7 @@ index 87bb35e..eff2da8 100644
set_tss_desc(cpu, t); /*
* This just modifies memory; should not be
-@@ -140,7 +140,9 @@ static void fix_processor_context(void)
+@@ -141,7 +141,9 @@ static void fix_processor_context(void)
*/
#ifdef CONFIG_X86_64
@@ -23382,10 +24419,10 @@ index 87bb35e..eff2da8 100644
syscall_init(); /* This sets MSR_*STAR and related */
#endif
diff --git a/arch/x86/vdso/Makefile b/arch/x86/vdso/Makefile
-index bef0bc9..8495be8 100644
+index 5d17950..2253fc9 100644
--- a/arch/x86/vdso/Makefile
+++ b/arch/x86/vdso/Makefile
-@@ -136,7 +136,7 @@ quiet_cmd_vdso = VDSO $@
+@@ -137,7 +137,7 @@ quiet_cmd_vdso = VDSO $@
-Wl,-T,$(filter %.lds,$^) $(filter %.o,$^) && \
sh $(srctree)/$(src)/checkundef.sh '$(NM)' '$@'
@@ -23481,100 +24518,67 @@ index 468d591..8e80a0a 100644
return NULL;
}
diff --git a/arch/x86/vdso/vma.c b/arch/x86/vdso/vma.c
-index 7abd2be..32c057d 100644
+index 153407c..611cba9 100644
--- a/arch/x86/vdso/vma.c
+++ b/arch/x86/vdso/vma.c
-@@ -15,18 +15,19 @@
- #include <asm/proto.h>
+@@ -16,8 +16,6 @@
#include <asm/vdso.h>
+ #include <asm/page.h>
-unsigned int __read_mostly vdso_enabled = 1;
-
extern char vdso_start[], vdso_end[];
extern unsigned short vdso_sync_cpuid;
-+extern char __vsyscall_0;
-
- static struct page **vdso_pages;
-+static struct page *vsyscall_page;
- static unsigned vdso_size;
-
- static int __init init_vdso_vars(void)
- {
-- int npages = (vdso_end - vdso_start + PAGE_SIZE - 1) / PAGE_SIZE;
-- int i;
-+ size_t nbytes = vdso_end - vdso_start;
-+ size_t npages = (nbytes + PAGE_SIZE - 1) / PAGE_SIZE;
-+ size_t i;
-
- vdso_size = npages << PAGE_SHIFT;
- vdso_pages = kmalloc(sizeof(struct page *) * npages, GFP_KERNEL);
-@@ -34,19 +35,19 @@ static int __init init_vdso_vars(void)
- goto oom;
- for (i = 0; i < npages; i++) {
- struct page *p;
-- p = alloc_page(GFP_KERNEL);
-+ p = alloc_page(GFP_KERNEL | __GFP_ZERO);
- if (!p)
- goto oom;
- vdso_pages[i] = p;
-- copy_page(page_address(p), vdso_start + i*PAGE_SIZE);
-+ memcpy(page_address(p), vdso_start + i*PAGE_SIZE, nbytes > PAGE_SIZE ? PAGE_SIZE : nbytes);
-+ nbytes -= PAGE_SIZE;
- }
-+ vsyscall_page = pfn_to_page((__pa_symbol(&__vsyscall_0)) >> PAGE_SHIFT);
- return 0;
+@@ -96,7 +94,6 @@ static unsigned long vdso_addr(unsigned long start, unsigned len)
+ * unaligned here as a result of stack start randomization.
+ */
+ addr = PAGE_ALIGN(addr);
+- addr = align_addr(addr, NULL, ALIGN_VDSO);
- oom:
-- printk("Cannot allocate vdso\n");
-- vdso_enabled = 0;
-- return -ENOMEM;
-+ panic("Cannot allocate vdso\n");
+ return addr;
}
- subsys_initcall(init_vdso_vars);
-
-@@ -80,37 +81,35 @@ int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp)
- unsigned long addr;
+@@ -106,40 +103,35 @@ static unsigned long vdso_addr(unsigned long start, unsigned len)
+ int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp)
+ {
+ struct mm_struct *mm = current->mm;
+- unsigned long addr;
++ unsigned long addr = 0;
int ret;
- if (!vdso_enabled)
- return 0;
-
down_write(&mm->mmap_sem);
-- addr = vdso_addr(mm->start_stack, vdso_size);
-- addr = get_unmapped_area(NULL, addr, vdso_size, 0, 0);
-+ addr = vdso_addr(mm->start_stack, vdso_size + PAGE_SIZE);
-+ addr = get_unmapped_area(NULL, addr, vdso_size + PAGE_SIZE, 0, 0);
++
++#ifdef CONFIG_PAX_RANDMMAP
++ if (!(mm->pax_flags & MF_PAX_RANDMMAP))
++#endif
++
+ addr = vdso_addr(mm->start_stack, vdso_size);
++ addr = align_addr(addr, NULL, ALIGN_VDSO);
+ addr = get_unmapped_area(NULL, addr, vdso_size, 0, 0);
if (IS_ERR_VALUE(addr)) {
ret = addr;
goto up_fail;
}
- current->mm->context.vdso = (void *)addr;
-+ mm->context.vdso = addr + PAGE_SIZE;
++ mm->context.vdso = addr;
-- ret = install_special_mapping(mm, addr, vdso_size,
-+ ret = install_special_mapping(mm, addr, PAGE_SIZE,
+ ret = install_special_mapping(mm, addr, vdso_size,
VM_READ|VM_EXEC|
-- VM_MAYREAD|VM_MAYWRITE|VM_MAYEXEC|
-+ VM_MAYREAD|VM_MAYEXEC|
+ VM_MAYREAD|VM_MAYWRITE|VM_MAYEXEC|
VM_ALWAYSDUMP,
-- vdso_pages);
-+ &vsyscall_page);
- if (ret) {
+ vdso_pages);
+- if (ret) {
- current->mm->context.vdso = NULL;
-+ mm->context.vdso = 0;
- goto up_fail;
- }
-
-+ ret = install_special_mapping(mm, addr + PAGE_SIZE, vdso_size,
-+ VM_READ|VM_EXEC|
-+ VM_MAYREAD|VM_MAYWRITE|VM_MAYEXEC|
-+ VM_ALWAYSDUMP,
-+ vdso_pages);
+- goto up_fail;
+- }
++
+ if (ret)
+ mm->context.vdso = 0;
-+
+
up_fail:
up_write(&mm->mmap_sem);
return ret;
@@ -23587,7 +24591,7 @@ index 7abd2be..32c057d 100644
-}
-__setup("vdso=", vdso_setup);
diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
-index 0fb662a..0033c99 100644
+index 1f92865..c843b20 100644
--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -85,8 +85,6 @@ EXPORT_SYMBOL_GPL(xen_start_info);
@@ -23599,7 +24603,7 @@ index 0fb662a..0033c99 100644
RESERVE_BRK(shared_info_page_brk, PAGE_SIZE);
__read_mostly int xen_have_vector_callback;
EXPORT_SYMBOL_GPL(xen_have_vector_callback);
-@@ -1010,7 +1008,7 @@ static const struct pv_apic_ops xen_apic_ops __initconst = {
+@@ -1029,7 +1027,7 @@ static const struct pv_apic_ops xen_apic_ops __initconst = {
#endif
};
@@ -23608,7 +24612,7 @@ index 0fb662a..0033c99 100644
{
struct sched_shutdown r = { .reason = reason };
-@@ -1018,17 +1016,17 @@ static void xen_reboot(int reason)
+@@ -1037,17 +1035,17 @@ static void xen_reboot(int reason)
BUG();
}
@@ -23629,7 +24633,7 @@ index 0fb662a..0033c99 100644
{
xen_reboot(SHUTDOWN_poweroff);
}
-@@ -1134,7 +1132,17 @@ asmlinkage void __init xen_start_kernel(void)
+@@ -1153,7 +1151,17 @@ asmlinkage void __init xen_start_kernel(void)
__userpte_alloc_gfp &= ~__GFP_HIGHMEM;
/* Work out if we support NX */
@@ -23648,7 +24652,7 @@ index 0fb662a..0033c99 100644
xen_setup_features();
-@@ -1165,13 +1173,6 @@ asmlinkage void __init xen_start_kernel(void)
+@@ -1184,13 +1192,6 @@ asmlinkage void __init xen_start_kernel(void)
machine_ops = xen_machine_ops;
@@ -23663,30 +24667,32 @@ index 0fb662a..0033c99 100644
#ifdef CONFIG_ACPI_NUMA
diff --git a/arch/x86/xen/mmu.c b/arch/x86/xen/mmu.c
-index 5f76c0a..809e8b5 100644
+index 87f6673..e2555a6 100644
--- a/arch/x86/xen/mmu.c
+++ b/arch/x86/xen/mmu.c
-@@ -1683,6 +1683,8 @@ pgd_t * __init xen_setup_kernel_pagetable(pgd_t *pgd,
+@@ -1733,6 +1733,9 @@ pgd_t * __init xen_setup_kernel_pagetable(pgd_t *pgd,
convert_pfn_mfn(init_level4_pgt);
convert_pfn_mfn(level3_ident_pgt);
convert_pfn_mfn(level3_kernel_pgt);
-+ convert_pfn_mfn(level3_vmalloc_pgt);
++ convert_pfn_mfn(level3_vmalloc_start_pgt);
++ convert_pfn_mfn(level3_vmalloc_end_pgt);
+ convert_pfn_mfn(level3_vmemmap_pgt);
l3 = m2v(pgd[pgd_index(__START_KERNEL_map)].pgd);
l2 = m2v(l3[pud_index(__START_KERNEL_map)].pud);
-@@ -1701,7 +1703,10 @@ pgd_t * __init xen_setup_kernel_pagetable(pgd_t *pgd,
+@@ -1751,7 +1754,11 @@ pgd_t * __init xen_setup_kernel_pagetable(pgd_t *pgd,
set_page_prot(init_level4_pgt, PAGE_KERNEL_RO);
set_page_prot(level3_ident_pgt, PAGE_KERNEL_RO);
set_page_prot(level3_kernel_pgt, PAGE_KERNEL_RO);
-+ set_page_prot(level3_vmalloc_pgt, PAGE_KERNEL_RO);
++ set_page_prot(level3_vmalloc_start_pgt, PAGE_KERNEL_RO);
++ set_page_prot(level3_vmalloc_end_pgt, PAGE_KERNEL_RO);
+ set_page_prot(level3_vmemmap_pgt, PAGE_KERNEL_RO);
set_page_prot(level3_user_vsyscall, PAGE_KERNEL_RO);
+ set_page_prot(level2_vmemmap_pgt, PAGE_KERNEL_RO);
set_page_prot(level2_kernel_pgt, PAGE_KERNEL_RO);
set_page_prot(level2_fixmap_pgt, PAGE_KERNEL_RO);
-@@ -1913,6 +1918,7 @@ static void __init xen_post_allocator_init(void)
+@@ -1962,6 +1969,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;
@@ -23694,7 +24700,7 @@ index 5f76c0a..809e8b5 100644
#endif
/* This will work as long as patching hasn't happened yet
-@@ -1994,6 +2000,7 @@ static const struct pv_mmu_ops xen_mmu_ops __initconst = {
+@@ -2043,6 +2051,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,
@@ -23703,7 +24709,7 @@ index 5f76c0a..809e8b5 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 d4fc6d4..117a268 100644
+index 041d4fe..7666b7e 100644
--- a/arch/x86/xen/smp.c
+++ b/arch/x86/xen/smp.c
@@ -194,11 +194,6 @@ static void __init xen_smp_prepare_boot_cpu(void)
@@ -23824,7 +24830,7 @@ index 58916af..9cb880b 100644
struct list_head *list = &__get_cpu_var(blk_cpu_iopoll);
int rearm = 0, budget = blk_iopoll_budget;
diff --git a/block/blk-map.c b/block/blk-map.c
-index 164cd00..6d96fc1 100644
+index 623e1cd..ca1e109 100644
--- a/block/blk-map.c
+++ b/block/blk-map.c
@@ -302,7 +302,7 @@ int blk_rq_map_kern(struct request_queue *q, struct request *rq, void *kbuf,
@@ -23837,7 +24843,7 @@ index 164cd00..6d96fc1 100644
bio = bio_copy_kern(q, kbuf, len, gfp_mask, reading);
else
diff --git a/block/blk-softirq.c b/block/blk-softirq.c
-index ee9c216..58d410a 100644
+index 1366a89..e17f54b 100644
--- a/block/blk-softirq.c
+++ b/block/blk-softirq.c
@@ -17,7 +17,7 @@ static DEFINE_PER_CPU(struct list_head, blk_cpu_done);
@@ -23850,7 +24856,7 @@ index ee9c216..58d410a 100644
struct list_head *cpu_list, local_list;
diff --git a/block/bsg.c b/block/bsg.c
-index 0c8b64a..0115e08 100644
+index 702f131..37808bf 100644
--- a/block/bsg.c
+++ b/block/bsg.c
@@ -176,16 +176,24 @@ static int blk_fill_sgv4_hdr_rq(struct request_queue *q, struct request *rq,
@@ -23869,7 +24875,7 @@ index 0c8b64a..0115e08 100644
+ } else
+ cmdptr = tmpcmd;
-- if (copy_from_user(rq->cmd, (void *)(unsigned long)hdr->request,
+- if (copy_from_user(rq->cmd, (void __user *)(unsigned long)hdr->request,
+ if (copy_from_user(cmdptr, (void __user *)(unsigned long)hdr->request,
hdr->request_len))
return -EFAULT;
@@ -23880,51 +24886,11 @@ index 0c8b64a..0115e08 100644
if (hdr->subprotocol == BSG_SUB_PROTOCOL_SCSI_CMD) {
if (blk_verify_command(rq->cmd, has_write_perm))
return -EPERM;
-@@ -249,7 +257,7 @@ bsg_map_hdr(struct bsg_device *bd, struct sg_io_v4 *hdr, fmode_t has_write_perm,
- struct request *rq, *next_rq = NULL;
- int ret, rw;
- unsigned int dxfer_len;
-- void *dxferp = NULL;
-+ void __user *dxferp = NULL;
- struct bsg_class_device *bcd = &q->bsg_dev;
-
- /* if the LLD has been removed then the bsg_unregister_queue will
-@@ -291,7 +299,7 @@ bsg_map_hdr(struct bsg_device *bd, struct sg_io_v4 *hdr, fmode_t has_write_perm,
- rq->next_rq = next_rq;
- next_rq->cmd_type = rq->cmd_type;
-
-- dxferp = (void*)(unsigned long)hdr->din_xferp;
-+ dxferp = (void __user *)(unsigned long)hdr->din_xferp;
- ret = blk_rq_map_user(q, next_rq, NULL, dxferp,
- hdr->din_xfer_len, GFP_KERNEL);
- if (ret)
-@@ -300,10 +308,10 @@ bsg_map_hdr(struct bsg_device *bd, struct sg_io_v4 *hdr, fmode_t has_write_perm,
-
- if (hdr->dout_xfer_len) {
- dxfer_len = hdr->dout_xfer_len;
-- dxferp = (void*)(unsigned long)hdr->dout_xferp;
-+ dxferp = (void __user *)(unsigned long)hdr->dout_xferp;
- } else if (hdr->din_xfer_len) {
- dxfer_len = hdr->din_xfer_len;
-- dxferp = (void*)(unsigned long)hdr->din_xferp;
-+ dxferp = (void __user *)(unsigned long)hdr->din_xferp;
- } else
- dxfer_len = 0;
-
-@@ -445,7 +453,7 @@ static int blk_complete_sgv4_hdr_rq(struct request *rq, struct sg_io_v4 *hdr,
- int len = min_t(unsigned int, hdr->max_response_len,
- rq->sense_len);
-
-- ret = copy_to_user((void*)(unsigned long)hdr->response,
-+ ret = copy_to_user((void __user *)(unsigned long)hdr->response,
- rq->sense, len);
- if (!ret)
- hdr->response_len = len;
diff --git a/block/compat_ioctl.c b/block/compat_ioctl.c
-index cc3eb78..2ffe28d 100644
+index 7b72502..646105c 100644
--- a/block/compat_ioctl.c
+++ b/block/compat_ioctl.c
-@@ -354,7 +354,7 @@ static int compat_fd_ioctl(struct block_device *bdev, fmode_t mode,
+@@ -340,7 +340,7 @@ static int compat_fd_ioctl(struct block_device *bdev, fmode_t mode,
err |= __get_user(f->spec1, &uf->spec1);
err |= __get_user(f->fmt_gap, &uf->fmt_gap);
err |= __get_user(name, &uf->name);
@@ -23934,10 +24900,18 @@ index cc3eb78..2ffe28d 100644
err = -EFAULT;
goto out;
diff --git a/block/scsi_ioctl.c b/block/scsi_ioctl.c
-index 4f4230b..0feae9a 100644
+index fbdf0d8..e8f3caf 100644
--- a/block/scsi_ioctl.c
+++ b/block/scsi_ioctl.c
-@@ -222,8 +222,20 @@ EXPORT_SYMBOL(blk_verify_command);
+@@ -24,6 +24,7 @@
+ #include <linux/capability.h>
+ #include <linux/completion.h>
+ #include <linux/cdrom.h>
++#include <linux/ratelimit.h>
+ #include <linux/slab.h>
+ #include <linux/times.h>
+ #include <asm/uaccess.h>
+@@ -222,8 +223,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)
{
@@ -23959,7 +24933,7 @@ index 4f4230b..0feae9a 100644
if (blk_verify_command(rq->cmd, mode & FMODE_WRITE))
return -EPERM;
-@@ -432,6 +444,8 @@ int sg_scsi_ioctl(struct request_queue *q, struct gendisk *disk, fmode_t mode,
+@@ -432,6 +445,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];
@@ -23968,7 +24942,7 @@ index 4f4230b..0feae9a 100644
if (!sic)
return -EINVAL;
-@@ -465,9 +479,18 @@ int sg_scsi_ioctl(struct request_queue *q, struct gendisk *disk, fmode_t mode,
+@@ -465,9 +480,18 @@ int sg_scsi_ioctl(struct request_queue *q, struct gendisk *disk, fmode_t mode,
*/
err = -EFAULT;
rq->cmd_len = cmdlen;
@@ -23988,6 +24962,64 @@ index 4f4230b..0feae9a 100644
if (in_len && copy_from_user(buffer, sic->data + cmdlen, in_len))
goto error;
+@@ -690,6 +714,57 @@ int scsi_cmd_ioctl(struct request_queue *q, struct gendisk *bd_disk, fmode_t mod
+ }
+ EXPORT_SYMBOL(scsi_cmd_ioctl);
+
++int scsi_verify_blk_ioctl(struct block_device *bd, unsigned int cmd)
++{
++ if (bd && bd == bd->bd_contains)
++ return 0;
++
++ /* Actually none of these is particularly useful on a partition,
++ * but they are safe.
++ */
++ switch (cmd) {
++ case SCSI_IOCTL_GET_IDLUN:
++ case SCSI_IOCTL_GET_BUS_NUMBER:
++ case SCSI_IOCTL_GET_PCI:
++ case SCSI_IOCTL_PROBE_HOST:
++ case SG_GET_VERSION_NUM:
++ case SG_SET_TIMEOUT:
++ case SG_GET_TIMEOUT:
++ case SG_GET_RESERVED_SIZE:
++ case SG_SET_RESERVED_SIZE:
++ case SG_EMULATED_HOST:
++ return 0;
++ case CDROM_GET_CAPABILITY:
++ /* Keep this until we remove the printk below. udev sends it
++ * and we do not want to spam dmesg about it. CD-ROMs do
++ * not have partitions, so we get here only for disks.
++ */
++ return -ENOIOCTLCMD;
++ default:
++ break;
++ }
++
++ /* In particular, rule out all resets and host-specific ioctls. */
++ printk_ratelimited(KERN_WARNING
++ "%s: sending ioctl %x to a partition!\n", current->comm, cmd);
++
++ return capable(CAP_SYS_RAWIO) ? 0 : -ENOIOCTLCMD;
++}
++EXPORT_SYMBOL(scsi_verify_blk_ioctl);
++
++int scsi_cmd_blk_ioctl(struct block_device *bd, fmode_t mode,
++ unsigned int cmd, void __user *arg)
++{
++ int ret;
++
++ ret = scsi_verify_blk_ioctl(bd, cmd);
++ if (ret < 0)
++ return ret;
++
++ return scsi_cmd_ioctl(bd->bd_disk->queue, bd->bd_disk, mode, cmd, arg);
++}
++EXPORT_SYMBOL(scsi_cmd_blk_ioctl);
++
+ static int __init blk_scsi_ioctl_init(void)
+ {
+ blk_set_cmd_filter_defaults(&blk_default_cmd_filter);
diff --git a/crypto/cryptd.c b/crypto/cryptd.c
index 671d4d6..5f24030 100644
--- a/crypto/cryptd.c
@@ -24010,41 +25042,6 @@ index 671d4d6..5f24030 100644
static void cryptd_queue_worker(struct work_struct *work);
-diff --git a/crypto/gf128mul.c b/crypto/gf128mul.c
-index df35e4c..5276607 100644
---- a/crypto/gf128mul.c
-+++ b/crypto/gf128mul.c
-@@ -182,7 +182,7 @@ void gf128mul_lle(be128 *r, const be128 *b)
- for (i = 0; i < 7; ++i)
- gf128mul_x_lle(&p[i + 1], &p[i]);
-
-- memset(r, 0, sizeof(r));
-+ memset(r, 0, sizeof(*r));
- for (i = 0;;) {
- u8 ch = ((u8 *)b)[15 - i];
-
-@@ -220,7 +220,7 @@ void gf128mul_bbe(be128 *r, const be128 *b)
- for (i = 0; i < 7; ++i)
- gf128mul_x_bbe(&p[i + 1], &p[i]);
-
-- memset(r, 0, sizeof(r));
-+ memset(r, 0, sizeof(*r));
- for (i = 0;;) {
- u8 ch = ((u8 *)b)[i];
-
-diff --git a/crypto/serpent.c b/crypto/serpent.c
-index b651a55..a9ddd79b 100644
---- a/crypto/serpent.c
-+++ b/crypto/serpent.c
-@@ -224,6 +224,8 @@ static int serpent_setkey(struct crypto_tfm *tfm, const u8 *key,
- u32 r0,r1,r2,r3,r4;
- int i;
-
-+ pax_track_stack();
-+
- /* Copy key, add padding */
-
- for (i = 0; i < keylen; ++i)
diff --git a/drivers/acpi/apei/cper.c b/drivers/acpi/apei/cper.c
index 5d41894..22021e4 100644
--- a/drivers/acpi/apei/cper.c
@@ -24067,18 +25064,18 @@ index 5d41894..22021e4 100644
EXPORT_SYMBOL_GPL(cper_next_record_id);
diff --git a/drivers/acpi/ec_sys.c b/drivers/acpi/ec_sys.c
-index 05b4420..f1cc3da 100644
+index 6c47ae9..8ab9132 100644
--- a/drivers/acpi/ec_sys.c
+++ b/drivers/acpi/ec_sys.c
-@@ -11,6 +11,7 @@
- #include <linux/kernel.h>
+@@ -12,6 +12,7 @@
#include <linux/acpi.h>
#include <linux/debugfs.h>
+ #include <linux/module.h>
+#include <asm/uaccess.h>
#include "internal.h"
MODULE_AUTHOR("Thomas Renninger <trenn@suse.de>");
-@@ -39,7 +40,7 @@ static ssize_t acpi_ec_read_io(struct file *f, char __user *buf,
+@@ -40,7 +41,7 @@ static ssize_t acpi_ec_read_io(struct file *f, char __user *buf,
* struct acpi_ec *ec = ((struct seq_file *)f->private_data)->private;
*/
unsigned int size = EC_SPACE_SIZE;
@@ -24087,7 +25084,7 @@ index 05b4420..f1cc3da 100644
loff_t init_off = *off;
int err = 0;
-@@ -52,9 +53,11 @@ static ssize_t acpi_ec_read_io(struct file *f, char __user *buf,
+@@ -53,9 +54,11 @@ static ssize_t acpi_ec_read_io(struct file *f, char __user *buf,
size = count;
while (size) {
@@ -24100,7 +25097,7 @@ index 05b4420..f1cc3da 100644
*off += 1;
size--;
}
-@@ -70,7 +73,6 @@ static ssize_t acpi_ec_write_io(struct file *f, const char __user *buf,
+@@ -71,7 +74,6 @@ static ssize_t acpi_ec_write_io(struct file *f, const char __user *buf,
unsigned int size = count;
loff_t init_off = *off;
@@ -24108,7 +25105,7 @@ index 05b4420..f1cc3da 100644
int err = 0;
if (*off >= EC_SPACE_SIZE)
-@@ -81,7 +83,9 @@ static ssize_t acpi_ec_write_io(struct file *f, const char __user *buf,
+@@ -82,7 +84,9 @@ static ssize_t acpi_ec_write_io(struct file *f, const char __user *buf,
}
while (size) {
@@ -24120,10 +25117,10 @@ index 05b4420..f1cc3da 100644
if (err)
return err;
diff --git a/drivers/acpi/proc.c b/drivers/acpi/proc.c
-index f5f9869..da87aeb 100644
+index 251c7b62..000462d 100644
--- a/drivers/acpi/proc.c
+++ b/drivers/acpi/proc.c
-@@ -342,19 +342,13 @@ acpi_system_write_wakeup_device(struct file *file,
+@@ -343,19 +343,13 @@ acpi_system_write_wakeup_device(struct file *file,
size_t count, loff_t * ppos)
{
struct list_head *node, *next;
@@ -24148,7 +25145,7 @@ index f5f9869..da87aeb 100644
mutex_lock(&acpi_device_lock);
list_for_each_safe(node, next, &acpi_wakeup_device_list) {
-@@ -363,7 +357,7 @@ acpi_system_write_wakeup_device(struct file *file,
+@@ -364,7 +358,7 @@ acpi_system_write_wakeup_device(struct file *file,
if (!dev->wakeup.flags.valid)
continue;
@@ -24158,7 +25155,7 @@ index f5f9869..da87aeb 100644
bool enable = !device_may_wakeup(&dev->dev);
device_set_wakeup_enable(&dev->dev, enable);
diff --git a/drivers/acpi/processor_driver.c b/drivers/acpi/processor_driver.c
-index a4e0f1b..9793b28 100644
+index 9d7bc9f..a6fc091 100644
--- a/drivers/acpi/processor_driver.c
+++ b/drivers/acpi/processor_driver.c
@@ -473,7 +473,7 @@ static int __cpuinit acpi_processor_add(struct acpi_device *device)
@@ -24171,10 +25168,10 @@ index a4e0f1b..9793b28 100644
/*
* Buggy BIOS check
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
-index 000d03a..36c5da0 100644
+index c04ad68..0b99473 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
-@@ -4753,7 +4753,7 @@ void ata_qc_free(struct ata_queued_cmd *qc)
+@@ -4733,7 +4733,7 @@ void ata_qc_free(struct ata_queued_cmd *qc)
struct ata_port *ap;
unsigned int tag;
@@ -24183,7 +25180,7 @@ index 000d03a..36c5da0 100644
ap = qc->ap;
qc->flags = 0;
-@@ -4769,7 +4769,7 @@ void __ata_qc_complete(struct ata_queued_cmd *qc)
+@@ -4749,7 +4749,7 @@ void __ata_qc_complete(struct ata_queued_cmd *qc)
struct ata_port *ap;
struct ata_link *link;
@@ -24192,7 +25189,7 @@ index 000d03a..36c5da0 100644
WARN_ON_ONCE(!(qc->flags & ATA_QCFLAG_ACTIVE));
ap = qc->ap;
link = qc->dev->link;
-@@ -5774,6 +5774,7 @@ static void ata_finalize_port_ops(struct ata_port_operations *ops)
+@@ -5754,6 +5754,7 @@ static void ata_finalize_port_ops(struct ata_port_operations *ops)
return;
spin_lock(&lock);
@@ -24200,7 +25197,7 @@ index 000d03a..36c5da0 100644
for (cur = ops->inherits; cur; cur = cur->inherits) {
void **inherit = (void **)cur;
-@@ -5787,8 +5788,9 @@ static void ata_finalize_port_ops(struct ata_port_operations *ops)
+@@ -5767,8 +5768,9 @@ static void ata_finalize_port_ops(struct ata_port_operations *ops)
if (IS_ERR(*pp))
*pp = NULL;
@@ -24211,21 +25208,8 @@ index 000d03a..36c5da0 100644
spin_unlock(&lock);
}
-diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c
-index 7f099d6..0d42651 100644
---- a/drivers/ata/libata-eh.c
-+++ b/drivers/ata/libata-eh.c
-@@ -2518,6 +2518,8 @@ void ata_eh_report(struct ata_port *ap)
- {
- struct ata_link *link;
-
-+ pax_track_stack();
-+
- ata_for_each_link(link, ap, HOST_FIRST)
- ata_eh_link_report(link);
- }
diff --git a/drivers/ata/pata_arasan_cf.c b/drivers/ata/pata_arasan_cf.c
-index 719bb73..79ce858 100644
+index e8574bb..f9f6a72 100644
--- a/drivers/ata/pata_arasan_cf.c
+++ b/drivers/ata/pata_arasan_cf.c
@@ -862,7 +862,9 @@ static int __devinit arasan_cf_probe(struct platform_device *pdev)
@@ -24253,7 +25237,7 @@ index f9b983a..887b9d8 100644
return 0;
}
diff --git a/drivers/atm/ambassador.c b/drivers/atm/ambassador.c
-index a5fcb1e..4da3c32 100644
+index f8f41e0..1f987dd 100644
--- a/drivers/atm/ambassador.c
+++ b/drivers/atm/ambassador.c
@@ -454,7 +454,7 @@ static void tx_complete (amb_dev * dev, tx_out * tx) {
@@ -24283,7 +25267,7 @@ index a5fcb1e..4da3c32 100644
}
} else {
-@@ -1342,7 +1342,7 @@ static int amb_send (struct atm_vcc * atm_vcc, struct sk_buff * skb) {
+@@ -1338,7 +1338,7 @@ static int amb_send (struct atm_vcc * atm_vcc, struct sk_buff * skb) {
}
if (check_area (skb->data, skb->len)) {
@@ -24293,7 +25277,7 @@ index a5fcb1e..4da3c32 100644
}
diff --git a/drivers/atm/atmtcp.c b/drivers/atm/atmtcp.c
-index 0b06250..9a7e2d8 100644
+index b22d71c..d6e1049 100644
--- a/drivers/atm/atmtcp.c
+++ b/drivers/atm/atmtcp.c
@@ -207,7 +207,7 @@ static int atmtcp_v_send(struct atm_vcc *vcc,struct sk_buff *skb)
@@ -24346,7 +25330,7 @@ index 0b06250..9a7e2d8 100644
if (vcc->pop) vcc->pop(vcc,skb);
else dev_kfree_skb(skb);
diff --git a/drivers/atm/eni.c b/drivers/atm/eni.c
-index 3230ea0..ffa1fa1 100644
+index 956e9ac..133516d 100644
--- a/drivers/atm/eni.c
+++ b/drivers/atm/eni.c
@@ -526,7 +526,7 @@ static int rx_aal0(struct atm_vcc *vcc)
@@ -24385,7 +25369,7 @@ index 3230ea0..ffa1fa1 100644
}
wake_up(&eni_dev->rx_wait);
}
-@@ -1228,7 +1228,7 @@ static void dequeue_tx(struct atm_dev *dev)
+@@ -1229,7 +1229,7 @@ static void dequeue_tx(struct atm_dev *dev)
PCI_DMA_TODEVICE);
if (vcc->pop) vcc->pop(vcc,skb);
else dev_kfree_skb_irq(skb);
@@ -24394,7 +25378,7 @@ index 3230ea0..ffa1fa1 100644
wake_up(&eni_dev->tx_wait);
dma_complete++;
}
-@@ -1568,7 +1568,7 @@ tx_complete++;
+@@ -1569,7 +1569,7 @@ tx_complete++;
/*--------------------------------- entries ---------------------------------*/
@@ -24404,10 +25388,10 @@ index 3230ea0..ffa1fa1 100644
"UTP", "05?", "06?", "07?", /* 4- 7 */
"TAXI","09?", "10?", "11?", /* 8-11 */
diff --git a/drivers/atm/firestream.c b/drivers/atm/firestream.c
-index ef7a658..04b6ef8 100644
+index 5072f8a..fa52520d 100644
--- a/drivers/atm/firestream.c
+++ b/drivers/atm/firestream.c
-@@ -749,7 +749,7 @@ static void process_txdone_queue (struct fs_dev *dev, struct queue *q)
+@@ -750,7 +750,7 @@ static void process_txdone_queue (struct fs_dev *dev, struct queue *q)
}
}
@@ -24416,7 +25400,7 @@ index ef7a658..04b6ef8 100644
fs_dprintk (FS_DEBUG_TXMEM, "i");
fs_dprintk (FS_DEBUG_ALLOC, "Free t-skb: %p\n", skb);
-@@ -816,7 +816,7 @@ static void process_incoming (struct fs_dev *dev, struct queue *q)
+@@ -817,7 +817,7 @@ static void process_incoming (struct fs_dev *dev, struct queue *q)
#endif
skb_put (skb, qe->p1 & 0xffff);
ATM_SKB(skb)->vcc = atm_vcc;
@@ -24425,7 +25409,7 @@ index ef7a658..04b6ef8 100644
__net_timestamp(skb);
fs_dprintk (FS_DEBUG_ALLOC, "Free rec-skb: %p (pushed)\n", skb);
atm_vcc->push (atm_vcc, skb);
-@@ -837,12 +837,12 @@ static void process_incoming (struct fs_dev *dev, struct queue *q)
+@@ -838,12 +838,12 @@ static void process_incoming (struct fs_dev *dev, struct queue *q)
kfree (pe);
}
if (atm_vcc)
@@ -24441,7 +25425,7 @@ index ef7a658..04b6ef8 100644
default: /* Hmm. Haven't written the code to handle the others yet... -- REW */
printk (KERN_WARNING "Don't know what to do with RX status %x: %s.\n",
diff --git a/drivers/atm/fore200e.c b/drivers/atm/fore200e.c
-index bc9e702..ce4742a 100644
+index 361f5ae..7fc552d 100644
--- a/drivers/atm/fore200e.c
+++ b/drivers/atm/fore200e.c
@@ -933,9 +933,9 @@ fore200e_tx_irq(struct fore200e* fore200e)
@@ -24586,10 +25570,10 @@ index 9a51df4..f3bb5f8 100644
return 0;
}
diff --git a/drivers/atm/horizon.c b/drivers/atm/horizon.c
-index d58e3fc..92b6e00 100644
+index b812103..e391a49 100644
--- a/drivers/atm/horizon.c
+++ b/drivers/atm/horizon.c
-@@ -1034,7 +1034,7 @@ static void rx_schedule (hrz_dev * dev, int irq) {
+@@ -1035,7 +1035,7 @@ static void rx_schedule (hrz_dev * dev, int irq) {
{
struct atm_vcc * vcc = ATM_SKB(skb)->vcc;
// VC layer stats
@@ -24598,7 +25582,7 @@ index d58e3fc..92b6e00 100644
__net_timestamp(skb);
// end of our responsibility
vcc->push (vcc, skb);
-@@ -1186,7 +1186,7 @@ static void tx_schedule (hrz_dev * const dev, int irq) {
+@@ -1187,7 +1187,7 @@ static void tx_schedule (hrz_dev * const dev, int irq) {
dev->tx_iovec = NULL;
// VC layer stats
@@ -24608,10 +25592,10 @@ index d58e3fc..92b6e00 100644
// free the skb
hrz_kfree_skb (skb);
diff --git a/drivers/atm/idt77252.c b/drivers/atm/idt77252.c
-index 1f8d724..aa37fff 100644
+index 1c05212..c28e200 100644
--- a/drivers/atm/idt77252.c
+++ b/drivers/atm/idt77252.c
-@@ -811,7 +811,7 @@ drain_scq(struct idt77252_dev *card, struct vc_map *vc)
+@@ -812,7 +812,7 @@ drain_scq(struct idt77252_dev *card, struct vc_map *vc)
else
dev_kfree_skb(skb);
@@ -24620,7 +25604,7 @@ index 1f8d724..aa37fff 100644
}
atomic_dec(&scq->used);
-@@ -1074,13 +1074,13 @@ dequeue_rx(struct idt77252_dev *card, struct rsq_entry *rsqe)
+@@ -1075,13 +1075,13 @@ dequeue_rx(struct idt77252_dev *card, struct rsq_entry *rsqe)
if ((sb = dev_alloc_skb(64)) == NULL) {
printk("%s: Can't allocate buffers for aal0.\n",
card->name);
@@ -24636,7 +25620,7 @@ index 1f8d724..aa37fff 100644
dev_kfree_skb(sb);
break;
}
-@@ -1097,7 +1097,7 @@ dequeue_rx(struct idt77252_dev *card, struct rsq_entry *rsqe)
+@@ -1098,7 +1098,7 @@ dequeue_rx(struct idt77252_dev *card, struct rsq_entry *rsqe)
ATM_SKB(sb)->vcc = vcc;
__net_timestamp(sb);
vcc->push(vcc, sb);
@@ -24645,7 +25629,7 @@ index 1f8d724..aa37fff 100644
cell += ATM_CELL_PAYLOAD;
}
-@@ -1134,13 +1134,13 @@ dequeue_rx(struct idt77252_dev *card, struct rsq_entry *rsqe)
+@@ -1135,13 +1135,13 @@ dequeue_rx(struct idt77252_dev *card, struct rsq_entry *rsqe)
"(CDC: %08x)\n",
card->name, len, rpp->len, readl(SAR_REG_CDC));
recycle_rx_pool_skb(card, rpp);
@@ -24661,7 +25645,7 @@ index 1f8d724..aa37fff 100644
return;
}
if (skb_queue_len(&rpp->queue) > 1) {
-@@ -1151,7 +1151,7 @@ dequeue_rx(struct idt77252_dev *card, struct rsq_entry *rsqe)
+@@ -1152,7 +1152,7 @@ dequeue_rx(struct idt77252_dev *card, struct rsq_entry *rsqe)
RXPRINTK("%s: Can't alloc RX skb.\n",
card->name);
recycle_rx_pool_skb(card, rpp);
@@ -24670,7 +25654,7 @@ index 1f8d724..aa37fff 100644
return;
}
if (!atm_charge(vcc, skb->truesize)) {
-@@ -1170,7 +1170,7 @@ dequeue_rx(struct idt77252_dev *card, struct rsq_entry *rsqe)
+@@ -1171,7 +1171,7 @@ dequeue_rx(struct idt77252_dev *card, struct rsq_entry *rsqe)
__net_timestamp(skb);
vcc->push(vcc, skb);
@@ -24679,7 +25663,7 @@ index 1f8d724..aa37fff 100644
return;
}
-@@ -1192,7 +1192,7 @@ dequeue_rx(struct idt77252_dev *card, struct rsq_entry *rsqe)
+@@ -1193,7 +1193,7 @@ dequeue_rx(struct idt77252_dev *card, struct rsq_entry *rsqe)
__net_timestamp(skb);
vcc->push(vcc, skb);
@@ -24688,7 +25672,7 @@ index 1f8d724..aa37fff 100644
if (skb->truesize > SAR_FB_SIZE_3)
add_rx_skb(card, 3, SAR_FB_SIZE_3, 1);
-@@ -1303,14 +1303,14 @@ idt77252_rx_raw(struct idt77252_dev *card)
+@@ -1304,14 +1304,14 @@ idt77252_rx_raw(struct idt77252_dev *card)
if (vcc->qos.aal != ATM_AAL0) {
RPRINTK("%s: raw cell for non AAL0 vc %u.%u\n",
card->name, vpi, vci);
@@ -24705,7 +25689,7 @@ index 1f8d724..aa37fff 100644
goto drop;
}
-@@ -1329,7 +1329,7 @@ idt77252_rx_raw(struct idt77252_dev *card)
+@@ -1330,7 +1330,7 @@ idt77252_rx_raw(struct idt77252_dev *card)
ATM_SKB(sb)->vcc = vcc;
__net_timestamp(sb);
vcc->push(vcc, sb);
@@ -24714,7 +25698,7 @@ index 1f8d724..aa37fff 100644
drop:
skb_pull(queue, 64);
-@@ -1954,13 +1954,13 @@ idt77252_send_skb(struct atm_vcc *vcc, struct sk_buff *skb, int oam)
+@@ -1955,13 +1955,13 @@ idt77252_send_skb(struct atm_vcc *vcc, struct sk_buff *skb, int oam)
if (vc == NULL) {
printk("%s: NULL connection in send().\n", card->name);
@@ -24730,7 +25714,7 @@ index 1f8d724..aa37fff 100644
dev_kfree_skb(skb);
return -EINVAL;
}
-@@ -1972,14 +1972,14 @@ idt77252_send_skb(struct atm_vcc *vcc, struct sk_buff *skb, int oam)
+@@ -1973,14 +1973,14 @@ idt77252_send_skb(struct atm_vcc *vcc, struct sk_buff *skb, int oam)
break;
default:
printk("%s: Unsupported AAL: %d\n", card->name, vcc->qos.aal);
@@ -24747,7 +25731,7 @@ index 1f8d724..aa37fff 100644
dev_kfree_skb(skb);
return -EINVAL;
}
-@@ -1987,7 +1987,7 @@ idt77252_send_skb(struct atm_vcc *vcc, struct sk_buff *skb, int oam)
+@@ -1988,7 +1988,7 @@ idt77252_send_skb(struct atm_vcc *vcc, struct sk_buff *skb, int oam)
err = queue_skb(card, vc, skb, oam);
if (err) {
@@ -24756,7 +25740,7 @@ index 1f8d724..aa37fff 100644
dev_kfree_skb(skb);
return err;
}
-@@ -2010,7 +2010,7 @@ idt77252_send_oam(struct atm_vcc *vcc, void *cell, int flags)
+@@ -2011,7 +2011,7 @@ idt77252_send_oam(struct atm_vcc *vcc, void *cell, int flags)
skb = dev_alloc_skb(64);
if (!skb) {
printk("%s: Out of memory in send_oam().\n", card->name);
@@ -24766,10 +25750,10 @@ index 1f8d724..aa37fff 100644
}
atomic_add(skb->truesize, &sk_atm(vcc)->sk_wmem_alloc);
diff --git a/drivers/atm/iphase.c b/drivers/atm/iphase.c
-index dee4f01..bec4c50 100644
+index 3d0c2b0..45441fa 100644
--- a/drivers/atm/iphase.c
+++ b/drivers/atm/iphase.c
-@@ -1120,7 +1120,7 @@ static int rx_pkt(struct atm_dev *dev)
+@@ -1146,7 +1146,7 @@ static int rx_pkt(struct atm_dev *dev)
status = (u_short) (buf_desc_ptr->desc_mode);
if (status & (RX_CER | RX_PTE | RX_OFL))
{
@@ -24778,7 +25762,7 @@ index dee4f01..bec4c50 100644
IF_ERR(printk("IA: bad packet, dropping it");)
if (status & RX_CER) {
IF_ERR(printk(" cause: packet CRC error\n");)
-@@ -1143,7 +1143,7 @@ static int rx_pkt(struct atm_dev *dev)
+@@ -1169,7 +1169,7 @@ static int rx_pkt(struct atm_dev *dev)
len = dma_addr - buf_addr;
if (len > iadev->rx_buf_sz) {
printk("Over %d bytes sdu received, dropped!!!\n", iadev->rx_buf_sz);
@@ -24787,7 +25771,7 @@ index dee4f01..bec4c50 100644
goto out_free_desc;
}
-@@ -1293,7 +1293,7 @@ static void rx_dle_intr(struct atm_dev *dev)
+@@ -1319,7 +1319,7 @@ static void rx_dle_intr(struct atm_dev *dev)
ia_vcc = INPH_IA_VCC(vcc);
if (ia_vcc == NULL)
{
@@ -24796,7 +25780,7 @@ index dee4f01..bec4c50 100644
dev_kfree_skb_any(skb);
atm_return(vcc, atm_guess_pdu2truesize(len));
goto INCR_DLE;
-@@ -1305,7 +1305,7 @@ static void rx_dle_intr(struct atm_dev *dev)
+@@ -1331,7 +1331,7 @@ static void rx_dle_intr(struct atm_dev *dev)
if ((length > iadev->rx_buf_sz) || (length >
(skb->len - sizeof(struct cpcs_trailer))))
{
@@ -24805,7 +25789,7 @@ index dee4f01..bec4c50 100644
IF_ERR(printk("rx_dle_intr: Bad AAL5 trailer %d (skb len %d)",
length, skb->len);)
dev_kfree_skb_any(skb);
-@@ -1321,7 +1321,7 @@ static void rx_dle_intr(struct atm_dev *dev)
+@@ -1347,7 +1347,7 @@ static void rx_dle_intr(struct atm_dev *dev)
IF_RX(printk("rx_dle_intr: skb push");)
vcc->push(vcc,skb);
@@ -24814,7 +25798,7 @@ index dee4f01..bec4c50 100644
iadev->rx_pkt_cnt++;
}
INCR_DLE:
-@@ -2801,15 +2801,15 @@ static int ia_ioctl(struct atm_dev *dev, unsigned int cmd, void __user *arg)
+@@ -2827,15 +2827,15 @@ static int ia_ioctl(struct atm_dev *dev, unsigned int cmd, void __user *arg)
{
struct k_sonet_stats *stats;
stats = &PRIV(_ia_dev[board])->sonet_stats;
@@ -24839,7 +25823,7 @@ index dee4f01..bec4c50 100644
}
ia_cmds.status = 0;
break;
-@@ -2914,7 +2914,7 @@ static int ia_pkt_tx (struct atm_vcc *vcc, struct sk_buff *skb) {
+@@ -2940,7 +2940,7 @@ static int ia_pkt_tx (struct atm_vcc *vcc, struct sk_buff *skb) {
if ((desc == 0) || (desc > iadev->num_tx_desc))
{
IF_ERR(printk(DEV_LABEL "invalid desc for send: %d\n", desc);)
@@ -24848,7 +25832,7 @@ index dee4f01..bec4c50 100644
if (vcc->pop)
vcc->pop(vcc, skb);
else
-@@ -3019,14 +3019,14 @@ static int ia_pkt_tx (struct atm_vcc *vcc, struct sk_buff *skb) {
+@@ -3045,14 +3045,14 @@ static int ia_pkt_tx (struct atm_vcc *vcc, struct sk_buff *skb) {
ATM_DESC(skb) = vcc->vci;
skb_queue_tail(&iadev->tx_dma_q, skb);
@@ -24866,7 +25850,7 @@ index dee4f01..bec4c50 100644
vcc->tx_quota = vcc->tx_quota * 3 / 4;
printk("Tx1: vcc->tx_quota = %d \n", (u32)vcc->tx_quota );
diff --git a/drivers/atm/lanai.c b/drivers/atm/lanai.c
-index 4e8ba56..900a2ab 100644
+index f556969..0da15eb 100644
--- a/drivers/atm/lanai.c
+++ b/drivers/atm/lanai.c
@@ -1303,7 +1303,7 @@ static void lanai_send_one_aal5(struct lanai_dev *lanai,
@@ -24887,7 +25871,7 @@ index 4e8ba56..900a2ab 100644
out:
lvcc->rx.buf.ptr = end;
cardvcc_write(lvcc, endptr, vcc_rxreadptr);
-@@ -1668,7 +1668,7 @@ static int handle_service(struct lanai_dev *lanai, u32 s)
+@@ -1667,7 +1667,7 @@ static int handle_service(struct lanai_dev *lanai, u32 s)
DPRINTK("(itf %d) got RX service entry 0x%X for non-AAL5 "
"vcc %d\n", lanai->number, (unsigned int) s, vci);
lanai->stats.service_rxnotaal5++;
@@ -24896,7 +25880,7 @@ index 4e8ba56..900a2ab 100644
return 0;
}
if (likely(!(s & (SERVICE_TRASH | SERVICE_STREAM | SERVICE_CRCERR)))) {
-@@ -1680,7 +1680,7 @@ static int handle_service(struct lanai_dev *lanai, u32 s)
+@@ -1679,7 +1679,7 @@ static int handle_service(struct lanai_dev *lanai, u32 s)
int bytes;
read_unlock(&vcc_sklist_lock);
DPRINTK("got trashed rx pdu on vci %d\n", vci);
@@ -24905,7 +25889,7 @@ index 4e8ba56..900a2ab 100644
lvcc->stats.x.aal5.service_trash++;
bytes = (SERVICE_GET_END(s) * 16) -
(((unsigned long) lvcc->rx.buf.ptr) -
-@@ -1692,7 +1692,7 @@ static int handle_service(struct lanai_dev *lanai, u32 s)
+@@ -1691,7 +1691,7 @@ static int handle_service(struct lanai_dev *lanai, u32 s)
}
if (s & SERVICE_STREAM) {
read_unlock(&vcc_sklist_lock);
@@ -24914,7 +25898,7 @@ index 4e8ba56..900a2ab 100644
lvcc->stats.x.aal5.service_stream++;
printk(KERN_ERR DEV_LABEL "(itf %d): Got AAL5 stream "
"PDU on VCI %d!\n", lanai->number, vci);
-@@ -1700,7 +1700,7 @@ static int handle_service(struct lanai_dev *lanai, u32 s)
+@@ -1699,7 +1699,7 @@ static int handle_service(struct lanai_dev *lanai, u32 s)
return 0;
}
DPRINTK("got rx crc error on vci %d\n", vci);
@@ -24924,7 +25908,7 @@ index 4e8ba56..900a2ab 100644
lvcc->rx.buf.ptr = &lvcc->rx.buf.start[SERVICE_GET_END(s) * 4];
cardvcc_write(lvcc, SERVICE_GET_END(s), vcc_rxreadptr);
diff --git a/drivers/atm/nicstar.c b/drivers/atm/nicstar.c
-index 6b313ee..3891287 100644
+index 1c70c45..300718d 100644
--- a/drivers/atm/nicstar.c
+++ b/drivers/atm/nicstar.c
@@ -1654,7 +1654,7 @@ static int ns_send(struct atm_vcc *vcc, struct sk_buff *skb)
@@ -25129,7 +26113,7 @@ index 6b313ee..3891287 100644
}
diff --git a/drivers/atm/solos-pci.c b/drivers/atm/solos-pci.c
-index 5d1d076..4f31f42 100644
+index 5d1d076..12fbca4 100644
--- a/drivers/atm/solos-pci.c
+++ b/drivers/atm/solos-pci.c
@@ -714,7 +714,7 @@ void solos_bh(unsigned long card_arg)
@@ -25141,16 +26125,7 @@ index 5d1d076..4f31f42 100644
break;
case PKT_STATUS:
-@@ -899,6 +899,8 @@ static int print_buffer(struct sk_buff *buf)
- char msg[500];
- char item[10];
-
-+ pax_track_stack();
-+
- len = buf->len;
- for (i = 0; i < len; i++){
- if(i % 8 == 0)
-@@ -1008,7 +1010,7 @@ static uint32_t fpga_tx(struct solos_card *card)
+@@ -1008,7 +1008,7 @@ static uint32_t fpga_tx(struct solos_card *card)
vcc = SKB_CB(oldskb)->vcc;
if (vcc) {
@@ -25160,7 +26135,7 @@ index 5d1d076..4f31f42 100644
} else
dev_kfree_skb_irq(oldskb);
diff --git a/drivers/atm/suni.c b/drivers/atm/suni.c
-index 41c56ea..83df600 100644
+index 90f1ccc..04c4a1e 100644
--- a/drivers/atm/suni.c
+++ b/drivers/atm/suni.c
@@ -50,8 +50,8 @@ static DEFINE_SPINLOCK(sunis_lock);
@@ -25175,7 +26150,7 @@ index 41c56ea..83df600 100644
static void suni_hz(unsigned long from_timer)
diff --git a/drivers/atm/uPD98402.c b/drivers/atm/uPD98402.c
-index c45ae05..ed6f0c4 100644
+index 5120a96..e2572bd 100644
--- a/drivers/atm/uPD98402.c
+++ b/drivers/atm/uPD98402.c
@@ -42,7 +42,7 @@ static int fetch_stats(struct atm_dev *dev,struct sonet_stats __user *arg,int ze
@@ -25223,10 +26198,10 @@ index c45ae05..ed6f0c4 100644
}
diff --git a/drivers/atm/zatm.c b/drivers/atm/zatm.c
-index 6249179..b062f45 100644
+index d889f56..17eb71e 100644
--- a/drivers/atm/zatm.c
+++ b/drivers/atm/zatm.c
-@@ -459,7 +459,7 @@ printk("dummy: 0x%08lx, 0x%08lx\n",dummy[0],dummy[1]);
+@@ -460,7 +460,7 @@ printk("dummy: 0x%08lx, 0x%08lx\n",dummy[0],dummy[1]);
}
if (!size) {
dev_kfree_skb_irq(skb);
@@ -25235,7 +26210,7 @@ index 6249179..b062f45 100644
continue;
}
if (!atm_charge(vcc,skb->truesize)) {
-@@ -469,7 +469,7 @@ printk("dummy: 0x%08lx, 0x%08lx\n",dummy[0],dummy[1]);
+@@ -470,7 +470,7 @@ printk("dummy: 0x%08lx, 0x%08lx\n",dummy[0],dummy[1]);
skb->len = size;
ATM_SKB(skb)->vcc = vcc;
vcc->push(vcc,skb);
@@ -25244,7 +26219,7 @@ index 6249179..b062f45 100644
}
zout(pos & 0xffff,MTA(mbx));
#if 0 /* probably a stupid idea */
-@@ -733,7 +733,7 @@ if (*ZATM_PRV_DSC(skb) != (uPD98401_TXPD_V | uPD98401_TXPD_DP |
+@@ -734,7 +734,7 @@ if (*ZATM_PRV_DSC(skb) != (uPD98401_TXPD_V | uPD98401_TXPD_DP |
skb_queue_head(&zatm_vcc->backlog,skb);
break;
}
@@ -25254,11 +26229,11 @@ index 6249179..b062f45 100644
}
diff --git a/drivers/base/devtmpfs.c b/drivers/base/devtmpfs.c
-index 82bbb59..f9af954 100644
+index a4760e0..51283cf 100644
--- a/drivers/base/devtmpfs.c
+++ b/drivers/base/devtmpfs.c
-@@ -357,7 +357,7 @@ int devtmpfs_mount(const char *mntdir)
- if (!dev_mnt)
+@@ -368,7 +368,7 @@ int devtmpfs_mount(const char *mntdir)
+ if (!thread)
return 0;
- err = sys_mount("devtmpfs", (char *)mntdir, "devtmpfs", MS_SILENT, NULL);
@@ -25267,10 +26242,10 @@ index 82bbb59..f9af954 100644
printk(KERN_INFO "devtmpfs: error mounting %i\n", err);
else
diff --git a/drivers/base/power/wakeup.c b/drivers/base/power/wakeup.c
-index 84f7c7d..37cfd87 100644
+index caf995f..6f76697 100644
--- a/drivers/base/power/wakeup.c
+++ b/drivers/base/power/wakeup.c
-@@ -29,14 +29,14 @@ bool events_check_enabled;
+@@ -30,14 +30,14 @@ bool events_check_enabled;
* They need to be modified together atomically, so it's better to use one
* atomic variable to hold them both.
*/
@@ -25287,7 +26262,7 @@ index 84f7c7d..37cfd87 100644
*cnt = (comb >> IN_PROGRESS_BITS);
*inpr = comb & MAX_IN_PROGRESS;
-@@ -350,7 +350,7 @@ static void wakeup_source_activate(struct wakeup_source *ws)
+@@ -353,7 +353,7 @@ static void wakeup_source_activate(struct wakeup_source *ws)
ws->last_time = ktime_get();
/* Increment the counter of events in progress. */
@@ -25296,7 +26271,7 @@ index 84f7c7d..37cfd87 100644
}
/**
-@@ -440,7 +440,7 @@ static void wakeup_source_deactivate(struct wakeup_source *ws)
+@@ -443,7 +443,7 @@ static void wakeup_source_deactivate(struct wakeup_source *ws)
* Increment the counter of registered wakeup events and decrement the
* couter of wakeup events in progress simultaneously.
*/
@@ -25305,24 +26280,11 @@ index 84f7c7d..37cfd87 100644
}
/**
-diff --git a/drivers/block/DAC960.c b/drivers/block/DAC960.c
-index e086fbb..398e1fe 100644
---- a/drivers/block/DAC960.c
-+++ b/drivers/block/DAC960.c
-@@ -1980,6 +1980,8 @@ static bool DAC960_V1_ReadDeviceConfiguration(DAC960_Controller_T
- unsigned long flags;
- int Channel, TargetID;
-
-+ pax_track_stack();
-+
- if (!init_dma_loaf(Controller->PCIDevice, &local_dma,
- DAC960_V1_MaxChannels*(sizeof(DAC960_V1_DCDB_T) +
- sizeof(DAC960_SCSI_Inquiry_T) +
diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c
-index c2f9b3e..5911988 100644
+index 587cce5..77b928b 100644
--- a/drivers/block/cciss.c
+++ b/drivers/block/cciss.c
-@@ -1179,6 +1179,8 @@ static int cciss_ioctl32_passthru(struct block_device *bdev, fmode_t mode,
+@@ -1198,6 +1198,8 @@ static int cciss_ioctl32_passthru(struct block_device *bdev, fmode_t mode,
int err;
u32 cp;
@@ -25331,7 +26293,28 @@ index c2f9b3e..5911988 100644
err = 0;
err |=
copy_from_user(&arg64.LUN_info, &arg32->LUN_info,
-@@ -2986,7 +2988,7 @@ static void start_io(ctlr_info_t *h)
+@@ -1735,7 +1737,7 @@ static int cciss_ioctl(struct block_device *bdev, fmode_t mode,
+ case CCISS_BIG_PASSTHRU:
+ return cciss_bigpassthru(h, argp);
+
+- /* scsi_cmd_ioctl handles these, below, though some are not */
++ /* scsi_cmd_blk_ioctl handles these, below, though some are not */
+ /* very meaningful for cciss. SG_IO is the main one people want. */
+
+ case SG_GET_VERSION_NUM:
+@@ -1746,9 +1748,9 @@ static int cciss_ioctl(struct block_device *bdev, fmode_t mode,
+ case SG_EMULATED_HOST:
+ case SG_IO:
+ case SCSI_IOCTL_SEND_COMMAND:
+- return scsi_cmd_ioctl(disk->queue, disk, mode, cmd, argp);
++ return scsi_cmd_blk_ioctl(bdev, mode, cmd, argp);
+
+- /* scsi_cmd_ioctl would normally handle these, below, but */
++ /* scsi_cmd_blk_ioctl would normally handle these, below, but */
+ /* they aren't a good fit for cciss, as CD-ROMs are */
+ /* not supported, and we don't have any bus/target/lun */
+ /* which we present to the kernel. */
+@@ -3007,7 +3009,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 */
@@ -25340,7 +26323,7 @@ index c2f9b3e..5911988 100644
dev_warn(&h->pdev->dev, "fifo full\n");
break;
}
-@@ -2996,7 +2998,7 @@ static void start_io(ctlr_info_t *h)
+@@ -3017,7 +3019,7 @@ static void start_io(ctlr_info_t *h)
h->Qdepth--;
/* Tell the controller execute command */
@@ -25349,7 +26332,7 @@ index c2f9b3e..5911988 100644
/* Put job onto the completed Q */
addQ(&h->cmpQ, c);
-@@ -3422,17 +3424,17 @@ startio:
+@@ -3443,17 +3445,17 @@ startio:
static inline unsigned long get_next_completion(ctlr_info_t *h)
{
@@ -25370,7 +26353,7 @@ index c2f9b3e..5911988 100644
(h->interrupts_enabled == 0));
}
-@@ -3465,7 +3467,7 @@ static inline u32 next_command(ctlr_info_t *h)
+@@ -3486,7 +3488,7 @@ static inline u32 next_command(ctlr_info_t *h)
u32 a;
if (unlikely(!(h->transMethod & CFGTBL_Trans_Performant)))
@@ -25379,7 +26362,7 @@ index c2f9b3e..5911988 100644
if ((*(h->reply_pool_head) & 1) == (h->reply_pool_wraparound)) {
a = *(h->reply_pool_head); /* Next cmd in ring buffer */
-@@ -4020,7 +4022,7 @@ static void __devinit cciss_put_controller_into_performant_mode(ctlr_info_t *h)
+@@ -4044,7 +4046,7 @@ static void __devinit 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 */
@@ -25388,7 +26371,7 @@ index c2f9b3e..5911988 100644
h->transMethod = CFGTBL_Trans_Performant;
return;
-@@ -4292,7 +4294,7 @@ static int __devinit cciss_pci_init(ctlr_info_t *h)
+@@ -4316,7 +4318,7 @@ static int __devinit cciss_pci_init(ctlr_info_t *h)
if (prod_index < 0)
return -ENODEV;
h->product_name = products[prod_index].product_name;
@@ -25397,7 +26380,7 @@ index c2f9b3e..5911988 100644
if (cciss_board_disabled(h)) {
dev_warn(&h->pdev->dev, "controller appears to be disabled\n");
-@@ -5009,7 +5011,7 @@ reinit_after_soft_reset:
+@@ -5041,7 +5043,7 @@ reinit_after_soft_reset:
}
/* make sure the board interrupts are off */
@@ -25406,16 +26389,16 @@ index c2f9b3e..5911988 100644
rc = cciss_request_irq(h, do_cciss_msix_intr, do_cciss_intx);
if (rc)
goto clean2;
-@@ -5061,7 +5063,7 @@ reinit_after_soft_reset:
+@@ -5093,7 +5095,7 @@ reinit_after_soft_reset:
* fake ones to scoop up any residual completions.
*/
spin_lock_irqsave(&h->lock, flags);
- h->access.set_intr_mask(h, CCISS_INTR_OFF);
+ h->access->set_intr_mask(h, CCISS_INTR_OFF);
spin_unlock_irqrestore(&h->lock, flags);
- free_irq(h->intr[PERF_MODE_INT], h);
+ free_irq(h->intr[h->intr_mode], h);
rc = cciss_request_irq(h, cciss_msix_discard_completions,
-@@ -5081,9 +5083,9 @@ reinit_after_soft_reset:
+@@ -5113,9 +5115,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");
@@ -25427,7 +26410,7 @@ index c2f9b3e..5911988 100644
rc = controller_reset_failed(h->cfgtable);
if (rc)
-@@ -5106,7 +5108,7 @@ reinit_after_soft_reset:
+@@ -5138,7 +5140,7 @@ reinit_after_soft_reset:
cciss_scsi_setup(h);
/* Turn the interrupts on so we can service requests */
@@ -25436,20 +26419,20 @@ index c2f9b3e..5911988 100644
/* Get the firmware version */
inq_buff = kzalloc(sizeof(InquiryData_struct), GFP_KERNEL);
-@@ -5178,7 +5180,7 @@ static void cciss_shutdown(struct pci_dev *pdev)
+@@ -5211,7 +5213,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");
- h->access.set_intr_mask(h, CCISS_INTR_OFF);
+ h->access->set_intr_mask(h, CCISS_INTR_OFF);
- free_irq(h->intr[PERF_MODE_INT], h);
+ free_irq(h->intr[h->intr_mode], h);
}
diff --git a/drivers/block/cciss.h b/drivers/block/cciss.h
-index c049548..a09cb6e 100644
+index 7fda30e..eb5dfe0 100644
--- a/drivers/block/cciss.h
+++ b/drivers/block/cciss.h
-@@ -100,7 +100,7 @@ struct ctlr_info
+@@ -101,7 +101,7 @@ struct ctlr_info
/* information about each logical volume */
drive_info_struct *drv[CISS_MAX_LUN];
@@ -25459,7 +26442,7 @@ index c049548..a09cb6e 100644
/* queue and queue Info */
struct list_head reqQ;
diff --git a/drivers/block/cpqarray.c b/drivers/block/cpqarray.c
-index b2fceb5..87fec83 100644
+index 9125bbe..eede5c8 100644
--- a/drivers/block/cpqarray.c
+++ b/drivers/block/cpqarray.c
@@ -404,7 +404,7 @@ static int __devinit cpqarray_register_ctlr( int i, struct pci_dev *pdev)
@@ -25498,16 +26481,7 @@ index b2fceb5..87fec83 100644
hba[ctlr]->ctlr = ctlr;
hba[ctlr]->board_id = board_id;
hba[ctlr]->pci_dev = NULL; /* not PCI */
-@@ -911,6 +911,8 @@ static void do_ida_request(struct request_queue *q)
- struct scatterlist tmp_sg[SG_MAX];
- int i, dir, seg;
-
-+ pax_track_stack();
-+
- queue_next:
- creq = blk_peek_request(q);
- if (!creq)
-@@ -980,7 +982,7 @@ static void start_io(ctlr_info_t *h)
+@@ -980,7 +980,7 @@ static void start_io(ctlr_info_t *h)
while((c = h->reqQ) != NULL) {
/* Can't do anything if we're busy */
@@ -25516,7 +26490,7 @@ index b2fceb5..87fec83 100644
return;
/* Get the first entry from the request Q */
-@@ -988,7 +990,7 @@ static void start_io(ctlr_info_t *h)
+@@ -988,7 +988,7 @@ static void start_io(ctlr_info_t *h)
h->Qdepth--;
/* Tell the controller to do our bidding */
@@ -25525,7 +26499,7 @@ index b2fceb5..87fec83 100644
/* Get onto the completion Q */
addQ(&h->cmpQ, c);
-@@ -1050,7 +1052,7 @@ static irqreturn_t do_ida_intr(int irq, void *dev_id)
+@@ -1050,7 +1050,7 @@ static irqreturn_t do_ida_intr(int irq, void *dev_id)
unsigned long flags;
__u32 a,a1;
@@ -25534,7 +26508,7 @@ index b2fceb5..87fec83 100644
/* Is this interrupt for us? */
if (istat == 0)
return IRQ_NONE;
-@@ -1061,7 +1063,7 @@ static irqreturn_t do_ida_intr(int irq, void *dev_id)
+@@ -1061,7 +1061,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) {
@@ -25543,7 +26517,7 @@ index b2fceb5..87fec83 100644
a1 = a; a &= ~3;
if ((c = h->cmpQ) == NULL)
{
-@@ -1449,11 +1451,11 @@ static int sendcmd(
+@@ -1449,11 +1449,11 @@ static int sendcmd(
/*
* Disable interrupt
*/
@@ -25557,7 +26531,7 @@ index b2fceb5..87fec83 100644
if (temp != 0) {
break;
}
-@@ -1466,7 +1468,7 @@ DBG(
+@@ -1466,7 +1466,7 @@ DBG(
/*
* Send the cmd
*/
@@ -25566,7 +26540,7 @@ index b2fceb5..87fec83 100644
complete = pollcomplete(ctlr);
pci_unmap_single(info_p->pci_dev, (dma_addr_t) c->req.sg[0].addr,
-@@ -1549,9 +1551,9 @@ static int revalidate_allvol(ctlr_info_t *host)
+@@ -1549,9 +1549,9 @@ static int revalidate_allvol(ctlr_info_t *host)
* we check the new geometry. Then turn interrupts back on when
* we're done.
*/
@@ -25578,7 +26552,7 @@ index b2fceb5..87fec83 100644
for(i=0; i<NWD; i++) {
struct gendisk *disk = ida_gendisk[ctlr][i];
-@@ -1591,7 +1593,7 @@ static int pollcomplete(int ctlr)
+@@ -1591,7 +1591,7 @@ static int pollcomplete(int ctlr)
/* Wait (up to 2 seconds) for a command to complete */
for (i = 200000; i > 0; i--) {
@@ -25601,10 +26575,10 @@ 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 ef2ceed..c9cb18e 100644
+index 9cf2035..bffca95 100644
--- a/drivers/block/drbd/drbd_int.h
+++ b/drivers/block/drbd/drbd_int.h
-@@ -737,7 +737,7 @@ struct drbd_request;
+@@ -736,7 +736,7 @@ struct drbd_request;
struct drbd_epoch {
struct list_head list;
unsigned int barrier_nr;
@@ -25613,7 +26587,7 @@ index ef2ceed..c9cb18e 100644
atomic_t active; /* increased on every req. added, and dec on every finished. */
unsigned long flags;
};
-@@ -1109,7 +1109,7 @@ struct drbd_conf {
+@@ -1108,7 +1108,7 @@ struct drbd_conf {
void *int_dig_in;
void *int_dig_vv;
wait_queue_head_t seq_wait;
@@ -25622,7 +26596,7 @@ index ef2ceed..c9cb18e 100644
unsigned int peer_seq;
spinlock_t peer_seq_lock;
unsigned int minor;
-@@ -1618,30 +1618,30 @@ static inline int drbd_setsockopt(struct socket *sock, int level, int optname,
+@@ -1617,30 +1617,30 @@ static inline int drbd_setsockopt(struct socket *sock, int level, int optname,
static inline void drbd_tcp_cork(struct socket *sock)
{
@@ -25704,7 +26678,7 @@ index 0358e55..bc33689 100644
mdev->bm_writ_cnt =
mdev->read_cnt =
diff --git a/drivers/block/drbd/drbd_nl.c b/drivers/block/drbd/drbd_nl.c
-index 515bcd9..7ff5ae0 100644
+index af2a250..219c74b 100644
--- a/drivers/block/drbd/drbd_nl.c
+++ b/drivers/block/drbd/drbd_nl.c
@@ -2359,7 +2359,7 @@ static void drbd_connector_callback(struct cn_msg *req, struct netlink_skb_parms
@@ -25842,10 +26816,10 @@ index 43beaca..4a5b1dd 100644
}
diff --git a/drivers/block/loop.c b/drivers/block/loop.c
-index 2ebacf0..9d79297 100644
+index 1e888c9..05cf1b0 100644
--- a/drivers/block/loop.c
+++ b/drivers/block/loop.c
-@@ -283,7 +283,7 @@ static int __do_lo_send_write(struct file *file,
+@@ -227,7 +227,7 @@ static int __do_lo_send_write(struct file *file,
mm_segment_t old_fs = get_fs();
set_fs(get_ds());
@@ -25854,30 +26828,59 @@ index 2ebacf0..9d79297 100644
set_fs(old_fs);
if (likely(bw == len))
return 0;
-diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
-index f533f33..6177bcb 100644
---- a/drivers/block/nbd.c
-+++ b/drivers/block/nbd.c
-@@ -157,6 +157,8 @@ static int sock_xmit(struct nbd_device *lo, int send, void *buf, int size,
- struct kvec iov;
- sigset_t blocked, oldset;
+diff --git a/drivers/block/ub.c b/drivers/block/ub.c
+index 0e376d4..7333b9e 100644
+--- a/drivers/block/ub.c
++++ b/drivers/block/ub.c
+@@ -1744,12 +1744,11 @@ static int ub_bd_release(struct gendisk *disk, fmode_t mode)
+ static int ub_bd_ioctl(struct block_device *bdev, fmode_t mode,
+ unsigned int cmd, unsigned long arg)
+ {
+- struct gendisk *disk = bdev->bd_disk;
+ void __user *usermem = (void __user *) arg;
+ int ret;
-+ pax_track_stack();
-+
- if (unlikely(!sock)) {
- printk(KERN_ERR "%s: Attempted %s on closed socket in sock_xmit\n",
- lo->disk->disk_name, (send ? "send" : "recv"));
-@@ -572,6 +574,8 @@ static void do_nbd_request(struct request_queue *q)
- static int __nbd_ioctl(struct block_device *bdev, struct nbd_device *lo,
- unsigned int cmd, unsigned long arg)
+ mutex_lock(&ub_mutex);
+- ret = scsi_cmd_ioctl(disk->queue, disk, mode, cmd, usermem);
++ ret = scsi_cmd_blk_ioctl(bdev, mode, cmd, usermem);
+ mutex_unlock(&ub_mutex);
+
+ return ret;
+diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c
+index 4d0b70a..e46f2f7 100644
+--- a/drivers/block/virtio_blk.c
++++ b/drivers/block/virtio_blk.c
+@@ -243,8 +243,8 @@ static int virtblk_ioctl(struct block_device *bdev, fmode_t mode,
+ if (!virtio_has_feature(vblk->vdev, VIRTIO_BLK_F_SCSI))
+ return -ENOTTY;
+
+- return scsi_cmd_ioctl(disk->queue, disk, mode, cmd,
+- (void __user *)data);
++ return scsi_cmd_blk_ioctl(bdev, mode, cmd,
++ (void __user *)data);
+ }
+
+ /* We provide getgeo only to please some old bootloader/partitioning tools */
+diff --git a/drivers/cdrom/cdrom.c b/drivers/cdrom/cdrom.c
+index f997c27..cedb231 100644
+--- a/drivers/cdrom/cdrom.c
++++ b/drivers/cdrom/cdrom.c
+@@ -2747,12 +2747,11 @@ int cdrom_ioctl(struct cdrom_device_info *cdi, struct block_device *bdev,
{
-+ pax_track_stack();
-+
- switch (cmd) {
- case NBD_DISCONNECT: {
- struct request sreq;
+ void __user *argp = (void __user *)arg;
+ int ret;
+- struct gendisk *disk = bdev->bd_disk;
+
+ /*
+ * Try the generic SCSI command ioctl's first.
+ */
+- ret = scsi_cmd_ioctl(disk->queue, disk, mode, cmd, argp);
++ ret = scsi_cmd_blk_ioctl(bdev, mode, cmd, argp);
+ if (ret != -ENOTTY)
+ return ret;
+
diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig
-index 49502bc..7b818aa 100644
+index 4364303..9adf4ee 100644
--- a/drivers/char/Kconfig
+++ b/drivers/char/Kconfig
@@ -8,7 +8,8 @@ source "drivers/tty/Kconfig"
@@ -25969,7 +26972,7 @@ index f773a9d..65cd683 100644
return -EINVAL;
else
diff --git a/drivers/char/hpet.c b/drivers/char/hpet.c
-index 34d6a1c..7b38c5b 100644
+index 0833896..cccce52 100644
--- a/drivers/char/hpet.c
+++ b/drivers/char/hpet.c
@@ -572,7 +572,7 @@ static inline unsigned long hpet_time_div(struct hpets *hpets,
@@ -25982,7 +26985,7 @@ index 34d6a1c..7b38c5b 100644
{
struct hpet_timer __iomem *timer;
diff --git a/drivers/char/ipmi/ipmi_msghandler.c b/drivers/char/ipmi/ipmi_msghandler.c
-index 58c0e63..25aed94 100644
+index 58c0e63..46c16bf 100644
--- a/drivers/char/ipmi/ipmi_msghandler.c
+++ b/drivers/char/ipmi/ipmi_msghandler.c
@@ -415,7 +415,7 @@ struct ipmi_smi {
@@ -26015,15 +27018,6 @@ index 58c0e63..25aed94 100644
intf->proc_dir = NULL;
-@@ -4220,6 +4220,8 @@ static void send_panic_events(char *str)
- struct ipmi_smi_msg smi_msg;
- struct ipmi_recv_msg recv_msg;
-
-+ pax_track_stack();
-+
- si = (struct ipmi_system_interface_addr *) &addr;
- si->addr_type = IPMI_SYSTEM_INTERFACE_ADDR_TYPE;
- si->channel = IPMI_BMC_CHANNEL;
diff --git a/drivers/char/ipmi/ipmi_si_intf.c b/drivers/char/ipmi/ipmi_si_intf.c
index 9397ab4..d01bee1 100644
--- a/drivers/char/ipmi/ipmi_si_intf.c
@@ -26072,7 +27066,7 @@ index 1aeaaba..e018570 100644
.part_num = MBCS_PART_NUM,
.mfg_num = MBCS_MFG_NUM,
diff --git a/drivers/char/mem.c b/drivers/char/mem.c
-index 8fc04b4..f1a9ee2 100644
+index 1451790..f705c30 100644
--- a/drivers/char/mem.c
+++ b/drivers/char/mem.c
@@ -18,6 +18,7 @@
@@ -26083,18 +27077,18 @@ index 8fc04b4..f1a9ee2 100644
#include <linux/ptrace.h>
#include <linux/device.h>
#include <linux/highmem.h>
-@@ -34,6 +35,10 @@
+@@ -35,6 +36,10 @@
# include <linux/efi.h>
#endif
+#if defined(CONFIG_GRKERNSEC) && !defined(CONFIG_GRKERNSEC_NO_RBAC)
-+extern struct file_operations grsec_fops;
++extern const struct file_operations grsec_fops;
+#endif
+
static inline unsigned long size_inside_page(unsigned long start,
unsigned long size)
{
-@@ -65,9 +70,13 @@ static inline int range_is_allowed(unsigned long pfn, unsigned long size)
+@@ -66,9 +71,13 @@ static inline int range_is_allowed(unsigned long pfn, unsigned long size)
while (cursor < to) {
if (!devmem_is_allowed(pfn)) {
@@ -26108,7 +27102,7 @@ index 8fc04b4..f1a9ee2 100644
return 0;
}
cursor += PAGE_SIZE;
-@@ -75,6 +84,11 @@ static inline int range_is_allowed(unsigned long pfn, unsigned long size)
+@@ -76,6 +85,11 @@ static inline int range_is_allowed(unsigned long pfn, unsigned long size)
}
return 1;
}
@@ -26120,7 +27114,7 @@ index 8fc04b4..f1a9ee2 100644
#else
static inline int range_is_allowed(unsigned long pfn, unsigned long size)
{
-@@ -117,6 +131,7 @@ static ssize_t read_mem(struct file *file, char __user *buf,
+@@ -118,6 +132,7 @@ static ssize_t read_mem(struct file *file, char __user *buf,
while (count > 0) {
unsigned long remaining;
@@ -26128,7 +27122,7 @@ index 8fc04b4..f1a9ee2 100644
sz = size_inside_page(p, count);
-@@ -132,7 +147,23 @@ static ssize_t read_mem(struct file *file, char __user *buf,
+@@ -133,7 +148,23 @@ static ssize_t read_mem(struct file *file, char __user *buf,
if (!ptr)
return -EFAULT;
@@ -26153,7 +27147,7 @@ index 8fc04b4..f1a9ee2 100644
unxlate_dev_mem_ptr(p, ptr);
if (remaining)
return -EFAULT;
-@@ -395,9 +426,8 @@ static ssize_t read_kmem(struct file *file, char __user *buf,
+@@ -396,9 +427,8 @@ static ssize_t read_kmem(struct file *file, char __user *buf,
size_t count, loff_t *ppos)
{
unsigned long p = *ppos;
@@ -26164,7 +27158,7 @@ index 8fc04b4..f1a9ee2 100644
read = 0;
if (p < (unsigned long) high_memory) {
-@@ -419,6 +449,8 @@ static ssize_t read_kmem(struct file *file, char __user *buf,
+@@ -420,6 +450,8 @@ static ssize_t read_kmem(struct file *file, char __user *buf,
}
#endif
while (low_count > 0) {
@@ -26173,7 +27167,7 @@ index 8fc04b4..f1a9ee2 100644
sz = size_inside_page(p, low_count);
/*
-@@ -428,7 +460,22 @@ static ssize_t read_kmem(struct file *file, char __user *buf,
+@@ -429,7 +461,22 @@ static ssize_t read_kmem(struct file *file, char __user *buf,
*/
kbuf = xlate_dev_kmem_ptr((char *)p);
@@ -26197,7 +27191,7 @@ index 8fc04b4..f1a9ee2 100644
return -EFAULT;
buf += sz;
p += sz;
-@@ -866,6 +913,9 @@ static const struct memdev {
+@@ -867,6 +914,9 @@ static const struct memdev {
#ifdef CONFIG_CRASH_DUMP
[12] = { "oldmem", 0, &oldmem_fops, NULL },
#endif
@@ -26208,10 +27202,10 @@ index 8fc04b4..f1a9ee2 100644
static int memory_open(struct inode *inode, struct file *filp)
diff --git a/drivers/char/nvram.c b/drivers/char/nvram.c
-index 166f1e7..c579d46 100644
+index da3cfee..a5a6606 100644
--- a/drivers/char/nvram.c
+++ b/drivers/char/nvram.c
-@@ -246,7 +246,7 @@ static ssize_t nvram_read(struct file *file, char __user *buf,
+@@ -248,7 +248,7 @@ static ssize_t nvram_read(struct file *file, char __user *buf,
spin_unlock_irq(&rtc_lock);
@@ -26221,7 +27215,7 @@ index 166f1e7..c579d46 100644
*ppos = i;
diff --git a/drivers/char/random.c b/drivers/char/random.c
-index c35a785..6d82202 100644
+index 6035ab8..bdfe4fd 100644
--- a/drivers/char/random.c
+++ b/drivers/char/random.c
@@ -261,8 +261,13 @@
@@ -26265,7 +27259,7 @@ index c35a785..6d82202 100644
ret = -EFAULT;
break;
}
-@@ -1214,7 +1226,7 @@ EXPORT_SYMBOL(generate_random_uuid);
+@@ -1228,7 +1240,7 @@ EXPORT_SYMBOL(generate_random_uuid);
#include <linux/sysctl.h>
static int min_read_thresh = 8, min_write_thresh;
@@ -26317,7 +27311,7 @@ index 1ee8ce7..b778bef 100644
return 0;
diff --git a/drivers/char/tpm/tpm.c b/drivers/char/tpm/tpm.c
-index b85ee76..4d81778 100644
+index 361a1df..2471eee 100644
--- a/drivers/char/tpm/tpm.c
+++ b/drivers/char/tpm/tpm.c
@@ -414,7 +414,7 @@ static ssize_t tpm_transmit(struct tpm_chip *chip, const char *buf,
@@ -26329,15 +27323,6 @@ index b85ee76..4d81778 100644
dev_err(chip->dev, "Operation Canceled\n");
rc = -ECANCELED;
goto out;
-@@ -847,6 +847,8 @@ ssize_t tpm_show_pubek(struct device *dev, struct device_attribute *attr,
-
- struct tpm_chip *chip = dev_get_drvdata(dev);
-
-+ pax_track_stack();
-+
- tpm_cmd.header.in = tpm_readpubek_header;
- err = transmit_cmd(chip, &tpm_cmd, READ_PUBEK_RESULT_SIZE,
- "attempting to read the PUBEK");
diff --git a/drivers/char/tpm/tpm_bios.c b/drivers/char/tpm/tpm_bios.c
index 0636520..169c1d0 100644
--- a/drivers/char/tpm/tpm_bios.c
@@ -26386,10 +27371,10 @@ index 0636520..169c1d0 100644
acpi_os_unmap_memory(virt, len);
return 0;
diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c
-index fb68b12..0f6c6ca 100644
+index 8e3c46d..c139b99 100644
--- a/drivers/char/virtio_console.c
+++ b/drivers/char/virtio_console.c
-@@ -555,7 +555,7 @@ static ssize_t fill_readbuf(struct port *port, char *out_buf, size_t out_count,
+@@ -563,7 +563,7 @@ static ssize_t fill_readbuf(struct port *port, char *out_buf, size_t out_count,
if (to_user) {
ssize_t ret;
@@ -26398,7 +27383,7 @@ index fb68b12..0f6c6ca 100644
if (ret)
return -EFAULT;
} else {
-@@ -654,7 +654,7 @@ static ssize_t port_fops_read(struct file *filp, char __user *ubuf,
+@@ -662,7 +662,7 @@ static ssize_t port_fops_read(struct file *filp, char __user *ubuf,
if (!port_has_data(port) && !port->host_connected)
return 0;
@@ -26407,56 +27392,24 @@ index fb68b12..0f6c6ca 100644
}
static ssize_t port_fops_write(struct file *filp, const char __user *ubuf,
-diff --git a/drivers/crypto/hifn_795x.c b/drivers/crypto/hifn_795x.c
-index a84250a..68c725e 100644
---- a/drivers/crypto/hifn_795x.c
-+++ b/drivers/crypto/hifn_795x.c
-@@ -1655,6 +1655,8 @@ static int hifn_test(struct hifn_device *dev, int encdec, u8 snum)
- 0xCA, 0x34, 0x2B, 0x2E};
- struct scatterlist sg;
-
-+ pax_track_stack();
-+
- memset(src, 0, sizeof(src));
- memset(ctx.key, 0, sizeof(ctx.key));
-
-diff --git a/drivers/crypto/padlock-aes.c b/drivers/crypto/padlock-aes.c
-index db33d30..7823369 100644
---- a/drivers/crypto/padlock-aes.c
-+++ b/drivers/crypto/padlock-aes.c
-@@ -109,6 +109,8 @@ static int aes_set_key(struct crypto_tfm *tfm, const u8 *in_key,
- struct crypto_aes_ctx gen_aes;
- int cpu;
-
-+ pax_track_stack();
-+
- if (key_len % 8) {
- *flags |= CRYPTO_TFM_RES_BAD_KEY_LEN;
- return -EINVAL;
-diff --git a/drivers/dma/ioat/dma_v3.c b/drivers/dma/ioat/dma_v3.c
-index d845dc4..fec8664 100644
---- a/drivers/dma/ioat/dma_v3.c
-+++ b/drivers/dma/ioat/dma_v3.c
-@@ -73,10 +73,10 @@
- /* provide a lookup table for setting the source address in the base or
- * extended descriptor of an xor or pq descriptor
- */
--static const u8 xor_idx_to_desc __read_mostly = 0xd0;
--static const u8 xor_idx_to_field[] __read_mostly = { 1, 4, 5, 6, 7, 0, 1, 2 };
--static const u8 pq_idx_to_desc __read_mostly = 0xf8;
--static const u8 pq_idx_to_field[] __read_mostly = { 1, 4, 5, 0, 1, 2, 4, 5 };
-+static const u8 xor_idx_to_desc = 0xd0;
-+static const u8 xor_idx_to_field[] = { 1, 4, 5, 6, 7, 0, 1, 2 };
-+static const u8 pq_idx_to_desc = 0xf8;
-+static const u8 pq_idx_to_field[] = { 1, 4, 5, 0, 1, 2, 4, 5 };
+diff --git a/drivers/dma/dmatest.c b/drivers/dma/dmatest.c
+index eb1d864..39ee5a7 100644
+--- a/drivers/dma/dmatest.c
++++ b/drivers/dma/dmatest.c
+@@ -591,7 +591,7 @@ static int dmatest_add_channel(struct dma_chan *chan)
+ }
+ if (dma_has_cap(DMA_PQ, dma_dev->cap_mask)) {
+ cnt = dmatest_add_threads(dtc, DMA_PQ);
+- thread_count += cnt > 0 ?: 0;
++ thread_count += cnt > 0 ? cnt : 0;
+ }
- static dma_addr_t xor_get_src(struct ioat_raw_descriptor *descs[2], int idx)
- {
+ pr_info("dmatest: Started %u threads using %s\n",
diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c
-index 9a8bebc..b1e4989 100644
+index c9eee6d..f9d5280 100644
--- a/drivers/edac/amd64_edac.c
+++ b/drivers/edac/amd64_edac.c
-@@ -2670,7 +2670,7 @@ static void __devexit amd64_remove_one_instance(struct pci_dev *pdev)
+@@ -2685,7 +2685,7 @@ static void __devexit amd64_remove_one_instance(struct pci_dev *pdev)
* PCI core identifies what devices are on a system during boot, and then
* inquiry this table to see if this driver is for a given device found.
*/
@@ -26657,10 +27610,10 @@ index 74d6ec34..baff517 100644
{0,} /* 0 terminated list. */
};
diff --git a/drivers/edac/i7300_edac.c b/drivers/edac/i7300_edac.c
-index a76fe83..15479e6 100644
+index 6104dba..e7ea8e1 100644
--- a/drivers/edac/i7300_edac.c
+++ b/drivers/edac/i7300_edac.c
-@@ -1191,7 +1191,7 @@ static void __devexit i7300_remove_one(struct pci_dev *pdev)
+@@ -1192,7 +1192,7 @@ static void __devexit i7300_remove_one(struct pci_dev *pdev)
*
* Has only 8086:360c PCI ID
*/
@@ -26670,10 +27623,10 @@ index a76fe83..15479e6 100644
{0,} /* 0 terminated list. */
};
diff --git a/drivers/edac/i7core_edac.c b/drivers/edac/i7core_edac.c
-index f6cf448..3f612e9 100644
+index 70ad892..178943c 100644
--- a/drivers/edac/i7core_edac.c
+++ b/drivers/edac/i7core_edac.c
-@@ -359,7 +359,7 @@ static const struct pci_id_table pci_dev_table[] = {
+@@ -391,7 +391,7 @@ static const struct pci_id_table pci_dev_table[] = {
/*
* pci_device_id table for which devices we are looking for
*/
@@ -26735,7 +27688,7 @@ index a5da732..983363b 100644
PCI_VEND_DEV(INTEL, 82975_0), PCI_ANY_ID, PCI_ANY_ID, 0, 0,
I82975X
diff --git a/drivers/edac/mce_amd.h b/drivers/edac/mce_amd.h
-index 795a320..3bbc3d3 100644
+index 0106747..0b40417 100644
--- a/drivers/edac/mce_amd.h
+++ b/drivers/edac/mce_amd.h
@@ -83,7 +83,7 @@ struct amd_decoder_ops {
@@ -26746,7 +27699,7 @@ index 795a320..3bbc3d3 100644
+} __no_const;
void amd_report_gart_errors(bool);
- void amd_register_ecc_decoder(void (*f)(int, struct mce *, u32));
+ void amd_register_ecc_decoder(void (*f)(int, struct mce *));
diff --git a/drivers/edac/r82600_edac.c b/drivers/edac/r82600_edac.c
index b153674..ad2ba9b 100644
--- a/drivers/edac/r82600_edac.c
@@ -26774,7 +27727,7 @@ index b6f47de..c5acf3a 100644
PCI_VEND_DEV(INTEL, X38_HB), PCI_ANY_ID, PCI_ANY_ID, 0, 0,
X38},
diff --git a/drivers/firewire/core-card.c b/drivers/firewire/core-card.c
-index 29d2423..6c48b3a 100644
+index 85661b0..c784559a 100644
--- a/drivers/firewire/core-card.c
+++ b/drivers/firewire/core-card.c
@@ -657,7 +657,7 @@ void fw_card_release(struct kref *kref)
@@ -26787,10 +27740,10 @@ index 29d2423..6c48b3a 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 e6ad3bb..2f89ef8 100644
+index 4799393..37bd3ab 100644
--- a/drivers/firewire/core-cdev.c
+++ b/drivers/firewire/core-cdev.c
-@@ -1313,8 +1313,7 @@ static int init_iso_resource(struct client *client,
+@@ -1331,8 +1331,7 @@ static int init_iso_resource(struct client *client,
int ret;
if ((request->channels == 0 && request->bandwidth == 0) ||
@@ -26801,7 +27754,7 @@ index e6ad3bb..2f89ef8 100644
r = kmalloc(sizeof(*r), GFP_KERNEL);
diff --git a/drivers/firewire/core-transaction.c b/drivers/firewire/core-transaction.c
-index 334b82a..ea5261d 100644
+index 855ab3f..11f4bbd 100644
--- a/drivers/firewire/core-transaction.c
+++ b/drivers/firewire/core-transaction.c
@@ -37,6 +37,7 @@
@@ -26812,17 +27765,8 @@ index 334b82a..ea5261d 100644
#include <asm/byteorder.h>
-@@ -422,6 +423,8 @@ int fw_run_transaction(struct fw_card *card, int tcode, int destination_id,
- struct transaction_callback_data d;
- struct fw_transaction t;
-
-+ pax_track_stack();
-+
- init_timer_on_stack(&t.split_timeout_timer);
- init_completion(&d.done);
- d.payload = payload;
diff --git a/drivers/firewire/core.h b/drivers/firewire/core.h
-index 0fe4e4e..1edf73c 100644
+index b45be57..5fad18b 100644
--- a/drivers/firewire/core.h
+++ b/drivers/firewire/core.h
@@ -101,6 +101,7 @@ struct fw_card_driver {
@@ -26834,7 +27778,7 @@ index 0fe4e4e..1edf73c 100644
void fw_card_initialize(struct fw_card *card,
const struct fw_card_driver *driver, struct device *device);
diff --git a/drivers/firmware/dmi_scan.c b/drivers/firmware/dmi_scan.c
-index bcb1126..2cc2121 100644
+index 153980b..4b4d046 100644
--- a/drivers/firmware/dmi_scan.c
+++ b/drivers/firmware/dmi_scan.c
@@ -449,11 +449,6 @@ void __init dmi_scan_machine(void)
@@ -26849,7 +27793,7 @@ index bcb1126..2cc2121 100644
p = dmi_ioremap(0xF0000, 0x10000);
if (p == NULL)
goto error;
-@@ -725,7 +720,7 @@ int dmi_walk(void (*decode)(const struct dmi_header *, void *),
+@@ -723,7 +718,7 @@ int dmi_walk(void (*decode)(const struct dmi_header *, void *),
if (buf == NULL)
return -1;
@@ -26858,10 +27802,10 @@ index bcb1126..2cc2121 100644
iounmap(buf);
return 0;
-diff --git a/drivers/gpio/vr41xx_giu.c b/drivers/gpio/vr41xx_giu.c
-index a365be0..a629755 100644
---- a/drivers/gpio/vr41xx_giu.c
-+++ b/drivers/gpio/vr41xx_giu.c
+diff --git a/drivers/gpio/gpio-vr41xx.c b/drivers/gpio/gpio-vr41xx.c
+index 98723cb..10ca85b 100644
+--- a/drivers/gpio/gpio-vr41xx.c
++++ b/drivers/gpio/gpio-vr41xx.c
@@ -204,7 +204,7 @@ static int giu_get_irq(unsigned int irq)
printk(KERN_ERR "spurious GIU interrupt: %04x(%04x),%04x(%04x)\n",
maskl, pendl, maskh, pendh);
@@ -26872,10 +27816,10 @@ index a365be0..a629755 100644
return -EINVAL;
}
diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
-index 1367ced..f2ec98d 100644
+index 8323fc3..5c1d755 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
-@@ -1372,7 +1372,7 @@ int drm_mode_getconnector(struct drm_device *dev, void *data,
+@@ -1379,7 +1379,7 @@ int drm_mode_getconnector(struct drm_device *dev, void *data,
*/
if ((out_resp->count_modes >= mode_count) && mode_count) {
copied = 0;
@@ -26884,7 +27828,7 @@ index 1367ced..f2ec98d 100644
list_for_each_entry(mode, &connector->modes, head) {
drm_crtc_convert_to_umode(&u_mode, mode);
if (copy_to_user(mode_ptr + copied,
-@@ -1387,8 +1387,8 @@ int drm_mode_getconnector(struct drm_device *dev, void *data,
+@@ -1394,8 +1394,8 @@ int drm_mode_getconnector(struct drm_device *dev, void *data,
if ((out_resp->count_props >= props_count) && props_count) {
copied = 0;
@@ -26895,7 +27839,7 @@ index 1367ced..f2ec98d 100644
for (i = 0; i < DRM_CONNECTOR_MAX_PROPERTY; i++) {
if (connector->property_ids[i] != 0) {
if (put_user(connector->property_ids[i],
-@@ -1410,7 +1410,7 @@ int drm_mode_getconnector(struct drm_device *dev, void *data,
+@@ -1417,7 +1417,7 @@ int drm_mode_getconnector(struct drm_device *dev, void *data,
if ((out_resp->count_encoders >= encoders_count) && encoders_count) {
copied = 0;
@@ -26904,7 +27848,7 @@ index 1367ced..f2ec98d 100644
for (i = 0; i < DRM_CONNECTOR_MAX_ENCODER; i++) {
if (connector->encoder_ids[i] != 0) {
if (put_user(connector->encoder_ids[i],
-@@ -1569,7 +1569,7 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data,
+@@ -1576,7 +1576,7 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data,
}
for (i = 0; i < crtc_req->count_connectors; i++) {
@@ -26913,7 +27857,7 @@ index 1367ced..f2ec98d 100644
if (get_user(out_id, &set_connectors_ptr[i])) {
ret = -EFAULT;
goto out;
-@@ -1850,7 +1850,7 @@ int drm_mode_dirtyfb_ioctl(struct drm_device *dev,
+@@ -1857,7 +1857,7 @@ int drm_mode_dirtyfb_ioctl(struct drm_device *dev,
fb = obj_to_fb(obj);
num_clips = r->num_clips;
@@ -26922,7 +27866,7 @@ index 1367ced..f2ec98d 100644
if (!num_clips != !clips_ptr) {
ret = -EINVAL;
-@@ -2274,7 +2274,7 @@ int drm_mode_getproperty_ioctl(struct drm_device *dev,
+@@ -2283,7 +2283,7 @@ int drm_mode_getproperty_ioctl(struct drm_device *dev,
out_resp->flags = property->flags;
if ((out_resp->count_values >= value_count) && value_count) {
@@ -26931,7 +27875,7 @@ index 1367ced..f2ec98d 100644
for (i = 0; i < value_count; i++) {
if (copy_to_user(values_ptr + i, &property->values[i], sizeof(uint64_t))) {
ret = -EFAULT;
-@@ -2287,7 +2287,7 @@ int drm_mode_getproperty_ioctl(struct drm_device *dev,
+@@ -2296,7 +2296,7 @@ int drm_mode_getproperty_ioctl(struct drm_device *dev,
if (property->flags & DRM_MODE_PROP_ENUM) {
if ((out_resp->count_enum_blobs >= enum_count) && enum_count) {
copied = 0;
@@ -26940,7 +27884,7 @@ index 1367ced..f2ec98d 100644
list_for_each_entry(prop_enum, &property->enum_blob_list, head) {
if (copy_to_user(&enum_ptr[copied].value, &prop_enum->value, sizeof(uint64_t))) {
-@@ -2310,7 +2310,7 @@ int drm_mode_getproperty_ioctl(struct drm_device *dev,
+@@ -2319,7 +2319,7 @@ int drm_mode_getproperty_ioctl(struct drm_device *dev,
if ((out_resp->count_enum_blobs >= blob_count) && blob_count) {
copied = 0;
blob_id_ptr = (uint32_t *)(unsigned long)out_resp->enum_blob_ptr;
@@ -26949,7 +27893,7 @@ index 1367ced..f2ec98d 100644
list_for_each_entry(prop_blob, &property->enum_blob_list, head) {
if (put_user(prop_blob->base.id, blob_id_ptr + copied)) {
-@@ -2371,7 +2371,7 @@ int drm_mode_getblob_ioctl(struct drm_device *dev,
+@@ -2380,7 +2380,7 @@ int drm_mode_getblob_ioctl(struct drm_device *dev,
struct drm_mode_get_blob *out_resp = data;
struct drm_property_blob *blob;
int ret = 0;
@@ -26958,7 +27902,7 @@ index 1367ced..f2ec98d 100644
if (!drm_core_check_feature(dev, DRIVER_MODESET))
return -EINVAL;
-@@ -2385,7 +2385,7 @@ int drm_mode_getblob_ioctl(struct drm_device *dev,
+@@ -2394,7 +2394,7 @@ int drm_mode_getblob_ioctl(struct drm_device *dev,
blob = obj_to_blob(obj);
if (out_resp->length == blob->length) {
@@ -26968,10 +27912,10 @@ index 1367ced..f2ec98d 100644
ret = -EFAULT;
goto done;
diff --git a/drivers/gpu/drm/drm_crtc_helper.c b/drivers/gpu/drm/drm_crtc_helper.c
-index 9236965..f9ea6cd 100644
+index d2619d7..bd6bd00 100644
--- a/drivers/gpu/drm/drm_crtc_helper.c
+++ b/drivers/gpu/drm/drm_crtc_helper.c
-@@ -276,7 +276,7 @@ static bool drm_encoder_crtc_ok(struct drm_encoder *encoder,
+@@ -279,7 +279,7 @@ static bool drm_encoder_crtc_ok(struct drm_encoder *encoder,
struct drm_crtc *tmp;
int crtc_mask = 1;
@@ -26980,20 +27924,11 @@ index 9236965..f9ea6cd 100644
dev = crtc->dev;
-@@ -343,6 +343,8 @@ bool drm_crtc_helper_set_mode(struct drm_crtc *crtc,
- struct drm_encoder *encoder;
- bool ret = true;
-
-+ pax_track_stack();
-+
- crtc->enabled = drm_helper_crtc_in_use(crtc);
- if (!crtc->enabled)
- return true;
diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
-index 93a112d..c8b065d 100644
+index 40c187c..5746164 100644
--- a/drivers/gpu/drm/drm_drv.c
+++ b/drivers/gpu/drm/drm_drv.c
-@@ -307,7 +307,7 @@ module_exit(drm_core_exit);
+@@ -308,7 +308,7 @@ module_exit(drm_core_exit);
/**
* Copy and IOCTL return string to user space
*/
@@ -27002,7 +27937,7 @@ index 93a112d..c8b065d 100644
{
int len;
-@@ -386,7 +386,7 @@ long drm_ioctl(struct file *filp,
+@@ -387,7 +387,7 @@ long drm_ioctl(struct file *filp,
dev = file_priv->minor->dev;
atomic_inc(&dev->ioctl_count);
@@ -27012,10 +27947,10 @@ index 93a112d..c8b065d 100644
DRM_DEBUG("pid=%d, cmd=0x%02x, nr=0x%02x, dev 0x%lx, auth=%d\n",
diff --git a/drivers/gpu/drm/drm_fops.c b/drivers/gpu/drm/drm_fops.c
-index 2ec7d48..be14bb1 100644
+index 4911e1d..484c8a3 100644
--- a/drivers/gpu/drm/drm_fops.c
+++ b/drivers/gpu/drm/drm_fops.c
-@@ -70,7 +70,7 @@ static int drm_setup(struct drm_device * dev)
+@@ -71,7 +71,7 @@ static int drm_setup(struct drm_device * dev)
}
for (i = 0; i < ARRAY_SIZE(dev->counts); i++)
@@ -27024,7 +27959,7 @@ index 2ec7d48..be14bb1 100644
dev->sigdata.lock = NULL;
-@@ -134,8 +134,8 @@ int drm_open(struct inode *inode, struct file *filp)
+@@ -135,8 +135,8 @@ int drm_open(struct inode *inode, struct file *filp)
retcode = drm_open_helper(inode, filp, dev);
if (!retcode) {
@@ -27035,7 +27970,7 @@ index 2ec7d48..be14bb1 100644
retcode = drm_setup(dev);
}
if (!retcode) {
-@@ -472,7 +472,7 @@ int drm_release(struct inode *inode, struct file *filp)
+@@ -473,7 +473,7 @@ int drm_release(struct inode *inode, struct file *filp)
mutex_lock(&drm_global_mutex);
@@ -27044,7 +27979,7 @@ index 2ec7d48..be14bb1 100644
if (dev->driver->preclose)
dev->driver->preclose(dev, file_priv);
-@@ -484,7 +484,7 @@ int drm_release(struct inode *inode, struct file *filp)
+@@ -485,7 +485,7 @@ int drm_release(struct inode *inode, struct file *filp)
DRM_DEBUG("pid = %d, device = 0x%lx, open_count = %d\n",
task_pid_nr(current),
(long)old_encode_dev(file_priv->minor->device),
@@ -27053,7 +27988,7 @@ index 2ec7d48..be14bb1 100644
/* if the master has gone away we can't do anything with the lock */
if (file_priv->minor->master)
-@@ -565,8 +565,8 @@ int drm_release(struct inode *inode, struct file *filp)
+@@ -566,8 +566,8 @@ int drm_release(struct inode *inode, struct file *filp)
* End inline drm_release
*/
@@ -27170,10 +28105,10 @@ index ab1162d..42587b2 100644
#if defined(__i386__)
pgprot = pgprot_val(vma->vm_page_prot);
diff --git a/drivers/gpu/drm/drm_ioc32.c b/drivers/gpu/drm/drm_ioc32.c
-index 4a058c7..b42cd92 100644
+index ddd70db..40321e6 100644
--- a/drivers/gpu/drm/drm_ioc32.c
+++ b/drivers/gpu/drm/drm_ioc32.c
-@@ -455,7 +455,7 @@ static int compat_drm_infobufs(struct file *file, unsigned int cmd,
+@@ -456,7 +456,7 @@ static int compat_drm_infobufs(struct file *file, unsigned int cmd,
request = compat_alloc_user_space(nbytes);
if (!access_ok(VERIFY_WRITE, request, nbytes))
return -EFAULT;
@@ -27182,7 +28117,7 @@ index 4a058c7..b42cd92 100644
if (__put_user(count, &request->count)
|| __put_user(list, &request->list))
-@@ -516,7 +516,7 @@ static int compat_drm_mapbufs(struct file *file, unsigned int cmd,
+@@ -517,7 +517,7 @@ static int compat_drm_mapbufs(struct file *file, unsigned int cmd,
request = compat_alloc_user_space(nbytes);
if (!access_ok(VERIFY_WRITE, request, nbytes))
return -EFAULT;
@@ -27268,19 +28203,19 @@ index c9339f4..f5e1b9d 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 e36efdc..e917798 100644
+index 004b048..7588eba 100644
--- a/drivers/gpu/drm/i915/i915_debugfs.c
+++ b/drivers/gpu/drm/i915/i915_debugfs.c
-@@ -497,7 +497,7 @@ static int i915_interrupt_info(struct seq_file *m, void *data)
+@@ -499,7 +499,7 @@ static int i915_interrupt_info(struct seq_file *m, void *data)
I915_READ(GTIMR));
}
seq_printf(m, "Interrupts received: %d\n",
- atomic_read(&dev_priv->irq_received));
+ atomic_read_unchecked(&dev_priv->irq_received));
for (i = 0; i < I915_NUM_RINGS; i++) {
- if (IS_GEN6(dev)) {
+ if (IS_GEN6(dev) || IS_GEN7(dev)) {
seq_printf(m, "Graphics Interrupt mask (%s): %08x\n",
-@@ -1147,7 +1147,7 @@ static int i915_opregion(struct seq_file *m, void *unused)
+@@ -1232,7 +1232,7 @@ static int i915_opregion(struct seq_file *m, void *unused)
return ret;
if (opregion->header)
@@ -27290,10 +28225,10 @@ index e36efdc..e917798 100644
mutex_unlock(&dev->struct_mutex);
diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c
-index 7eef6e1..f8b411e 100644
+index a9ae374..43c1e9e 100644
--- a/drivers/gpu/drm/i915/i915_dma.c
+++ b/drivers/gpu/drm/i915/i915_dma.c
-@@ -1169,7 +1169,7 @@ static bool i915_switcheroo_can_switch(struct pci_dev *pdev)
+@@ -1172,7 +1172,7 @@ static bool i915_switcheroo_can_switch(struct pci_dev *pdev)
bool can_switch;
spin_lock(&dev->count_lock);
@@ -27303,10 +28238,10 @@ index 7eef6e1..f8b411e 100644
return can_switch;
}
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
-index e0d0e27..f48e37e 100644
+index 554bef7..d24791c 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
-@@ -219,7 +219,7 @@ struct drm_i915_display_funcs {
+@@ -229,7 +229,7 @@ struct drm_i915_display_funcs {
/* render clock increase/decrease */
/* display clock increase/decrease */
/* pll clock increase/decrease */
@@ -27315,7 +28250,7 @@ index e0d0e27..f48e37e 100644
struct intel_device_info {
u8 gen;
-@@ -300,7 +300,7 @@ typedef struct drm_i915_private {
+@@ -312,7 +312,7 @@ typedef struct drm_i915_private {
int current_page;
int page_flipping;
@@ -27324,7 +28259,7 @@ index e0d0e27..f48e37e 100644
/* protects the irq masks */
spinlock_t irq_lock;
-@@ -875,7 +875,7 @@ struct drm_i915_gem_object {
+@@ -887,7 +887,7 @@ struct drm_i915_gem_object {
* will be page flipped away on the next vblank. When it
* reaches 0, dev_priv->pending_flip_queue will be woken up.
*/
@@ -27333,7 +28268,7 @@ index e0d0e27..f48e37e 100644
};
#define to_intel_bo(x) container_of(x, struct drm_i915_gem_object, base)
-@@ -1248,7 +1248,7 @@ extern int intel_setup_gmbus(struct drm_device *dev);
+@@ -1267,7 +1267,7 @@ extern int intel_setup_gmbus(struct drm_device *dev);
extern void intel_teardown_gmbus(struct drm_device *dev);
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);
@@ -27343,10 +28278,10 @@ index e0d0e27..f48e37e 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 4934cf8..52e8e83 100644
+index b9da890..cad1d98 100644
--- a/drivers/gpu/drm/i915/i915_gem_execbuffer.c
+++ b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
-@@ -188,7 +188,7 @@ i915_gem_object_set_to_gpu_domain(struct drm_i915_gem_object *obj,
+@@ -189,7 +189,7 @@ i915_gem_object_set_to_gpu_domain(struct drm_i915_gem_object *obj,
i915_gem_clflush_object(obj);
if (obj->base.pending_write_domain)
@@ -27355,11 +28290,23 @@ index 4934cf8..52e8e83 100644
/* The actual obj->write_domain will be updated with
* pending_write_domain after we emit the accumulated flush for all
+@@ -882,9 +882,9 @@ i915_gem_check_execbuffer(struct drm_i915_gem_execbuffer2 *exec)
+
+ static int
+ validate_exec_list(struct drm_i915_gem_exec_object2 *exec,
+- int count)
++ unsigned int count)
+ {
+- int i;
++ unsigned int i;
+
+ for (i = 0; i < count; i++) {
+ char __user *ptr = (char __user *)(uintptr_t)exec[i].relocs_ptr;
diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
-index 3635647..1ad5700 100644
+index b40004b..7c53a75 100644
--- a/drivers/gpu/drm/i915/i915_irq.c
+++ b/drivers/gpu/drm/i915/i915_irq.c
-@@ -473,7 +473,7 @@ static irqreturn_t ivybridge_irq_handler(DRM_IRQ_ARGS)
+@@ -475,7 +475,7 @@ static irqreturn_t ivybridge_irq_handler(DRM_IRQ_ARGS)
u32 de_iir, gt_iir, de_ier, pch_iir, pm_iir;
struct drm_i915_master_private *master_priv;
@@ -27368,7 +28315,7 @@ index 3635647..1ad5700 100644
/* disable master interrupt before clearing iir */
de_ier = I915_READ(DEIER);
-@@ -563,7 +563,7 @@ static irqreturn_t ironlake_irq_handler(DRM_IRQ_ARGS)
+@@ -566,7 +566,7 @@ static irqreturn_t ironlake_irq_handler(DRM_IRQ_ARGS)
struct drm_i915_master_private *master_priv;
u32 bsd_usr_interrupt = GT_BSD_USER_INTERRUPT;
@@ -27377,7 +28324,7 @@ index 3635647..1ad5700 100644
if (IS_GEN6(dev))
bsd_usr_interrupt = GT_GEN6_BSD_USER_INTERRUPT;
-@@ -1227,7 +1227,7 @@ static irqreturn_t i915_driver_irq_handler(DRM_IRQ_ARGS)
+@@ -1231,7 +1231,7 @@ static irqreturn_t i915_driver_irq_handler(DRM_IRQ_ARGS)
int ret = IRQ_NONE, pipe;
bool blc_event = false;
@@ -27386,7 +28333,7 @@ index 3635647..1ad5700 100644
iir = I915_READ(IIR);
-@@ -1736,7 +1736,7 @@ static void ironlake_irq_preinstall(struct drm_device *dev)
+@@ -1743,7 +1743,7 @@ static void ironlake_irq_preinstall(struct drm_device *dev)
{
drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private;
@@ -27395,7 +28342,7 @@ index 3635647..1ad5700 100644
INIT_WORK(&dev_priv->hotplug_work, i915_hotplug_work_func);
INIT_WORK(&dev_priv->error_work, i915_error_work_func);
-@@ -1900,7 +1900,7 @@ static void i915_driver_irq_preinstall(struct drm_device * dev)
+@@ -1931,7 +1931,7 @@ static void i915_driver_irq_preinstall(struct drm_device * dev)
drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private;
int pipe;
@@ -27405,10 +28352,10 @@ index 3635647..1ad5700 100644
INIT_WORK(&dev_priv->hotplug_work, i915_hotplug_work_func);
INIT_WORK(&dev_priv->error_work, i915_error_work_func);
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
-index fed87d6..f594763 100644
+index daa5743..c0757a9 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
-@@ -1961,7 +1961,7 @@ intel_pipe_set_base(struct drm_crtc *crtc, int x, int y,
+@@ -2230,7 +2230,7 @@ intel_pipe_set_base(struct drm_crtc *crtc, int x, int y,
wait_event(dev_priv->pending_flip_queue,
atomic_read(&dev_priv->mm.wedged) ||
@@ -27417,7 +28364,7 @@ index fed87d6..f594763 100644
/* Big Hammer, we also need to ensure that any pending
* MI_WAIT_FOR_EVENT inside a user batch buffer on the
-@@ -2550,7 +2550,7 @@ static void intel_crtc_wait_for_pending_flips(struct drm_crtc *crtc)
+@@ -2851,7 +2851,7 @@ static void intel_crtc_wait_for_pending_flips(struct drm_crtc *crtc)
obj = to_intel_framebuffer(crtc->fb)->obj;
dev_priv = crtc->dev->dev_private;
wait_event(dev_priv->pending_flip_queue,
@@ -27426,7 +28373,7 @@ index fed87d6..f594763 100644
}
static bool intel_crtc_driving_pch(struct drm_crtc *crtc)
-@@ -6257,7 +6257,7 @@ static void do_intel_finish_page_flip(struct drm_device *dev,
+@@ -6952,7 +6952,7 @@ static void do_intel_finish_page_flip(struct drm_device *dev,
atomic_clear_mask(1 << intel_crtc->plane,
&obj->pending_flip.counter);
@@ -27435,7 +28382,7 @@ index fed87d6..f594763 100644
wake_up(&dev_priv->pending_flip_queue);
schedule_work(&work->work);
-@@ -6546,7 +6546,7 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc,
+@@ -7242,7 +7242,7 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc,
/* Block clients from rendering to the new back buffer until
* the flip occurs and the object is no longer visible.
*/
@@ -27444,15 +28391,15 @@ index fed87d6..f594763 100644
ret = dev_priv->display.queue_flip(dev, crtc, fb, obj);
if (ret)
-@@ -6559,7 +6559,7 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc,
+@@ -7256,7 +7256,7 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc,
return 0;
cleanup_pending:
- atomic_sub(1 << intel_crtc->plane, &work->old_fb_obj->pending_flip);
+ atomic_sub_unchecked(1 << intel_crtc->plane, &work->old_fb_obj->pending_flip);
- cleanup_objs:
drm_gem_object_unreference(&work->old_fb_obj->base);
drm_gem_object_unreference(&obj->base);
+ mutex_unlock(&dev->struct_mutex);
diff --git a/drivers/gpu/drm/mga/mga_drv.h b/drivers/gpu/drm/mga/mga_drv.h
index 54558a0..2d97005 100644
--- a/drivers/gpu/drm/mga/mga_drv.h
@@ -27510,10 +28457,10 @@ index 2581202..f230a8d9 100644
*sequence = cur_fence;
diff --git a/drivers/gpu/drm/nouveau/nouveau_bios.c b/drivers/gpu/drm/nouveau/nouveau_bios.c
-index 729d5fd..2d52506 100644
+index 5fc201b..7b032b9 100644
--- a/drivers/gpu/drm/nouveau/nouveau_bios.c
+++ b/drivers/gpu/drm/nouveau/nouveau_bios.c
-@@ -200,7 +200,7 @@ struct methods {
+@@ -201,7 +201,7 @@ struct methods {
const char desc[8];
void (*loadbios)(struct drm_device *, uint8_t *);
const bool rw;
@@ -27522,7 +28469,7 @@ index 729d5fd..2d52506 100644
static struct methods shadow_methods[] = {
{ "PRAMIN", load_vbios_pramin, true },
-@@ -5488,7 +5488,7 @@ parse_bit_displayport_tbl_entry(struct drm_device *dev, struct nvbios *bios,
+@@ -5474,7 +5474,7 @@ parse_bit_U_tbl_entry(struct drm_device *dev, struct nvbios *bios,
struct bit_table {
const char id;
int (* const parse_fn)(struct drm_device *, struct nvbios *, struct bit_entry *);
@@ -27532,19 +28479,19 @@ index 729d5fd..2d52506 100644
#define BIT_TABLE(id, funcid) ((struct bit_table){ id, parse_bit_##funcid##_tbl_entry })
diff --git a/drivers/gpu/drm/nouveau/nouveau_drv.h b/drivers/gpu/drm/nouveau/nouveau_drv.h
-index 9c56331..3809ea8 100644
+index 4c0be3a..5757582 100644
--- a/drivers/gpu/drm/nouveau/nouveau_drv.h
+++ b/drivers/gpu/drm/nouveau/nouveau_drv.h
-@@ -227,7 +227,7 @@ struct nouveau_channel {
+@@ -238,7 +238,7 @@ struct nouveau_channel {
struct list_head pending;
uint32_t sequence;
uint32_t sequence_ack;
- atomic_t last_sequence_irq;
+ atomic_unchecked_t last_sequence_irq;
+ struct nouveau_vma vma;
} fence;
- /* DMA push buffer */
-@@ -304,7 +304,7 @@ struct nouveau_exec_engine {
+@@ -319,7 +319,7 @@ struct nouveau_exec_engine {
u32 handle, u16 class);
void (*set_tile_region)(struct drm_device *dev, int i);
void (*tlb_flush)(struct drm_device *, int engine);
@@ -27553,7 +28500,7 @@ index 9c56331..3809ea8 100644
struct nouveau_instmem_engine {
void *priv;
-@@ -325,13 +325,13 @@ struct nouveau_instmem_engine {
+@@ -341,13 +341,13 @@ struct nouveau_instmem_engine {
struct nouveau_mc_engine {
int (*init)(struct drm_device *dev);
void (*takedown)(struct drm_device *dev);
@@ -27569,7 +28516,7 @@ index 9c56331..3809ea8 100644
struct nouveau_fb_engine {
int num_tiles;
-@@ -494,7 +494,7 @@ struct nouveau_vram_engine {
+@@ -558,7 +558,7 @@ struct nouveau_vram_engine {
void (*put)(struct drm_device *, struct nouveau_mem **);
bool (*flags_valid)(struct drm_device *, u32 tile_flags);
@@ -27578,7 +28525,7 @@ index 9c56331..3809ea8 100644
struct nouveau_engine {
struct nouveau_instmem_engine instmem;
-@@ -640,7 +640,7 @@ struct drm_nouveau_private {
+@@ -706,7 +706,7 @@ struct drm_nouveau_private {
struct drm_global_reference mem_global_ref;
struct ttm_bo_global_ref bo_global_ref;
struct ttm_bo_device bdev;
@@ -27588,7 +28535,7 @@ index 9c56331..3809ea8 100644
struct {
diff --git a/drivers/gpu/drm/nouveau/nouveau_fence.c b/drivers/gpu/drm/nouveau/nouveau_fence.c
-index 56f06b0..3d0f7dd 100644
+index 2f6daae..c9d7b9e 100644
--- a/drivers/gpu/drm/nouveau/nouveau_fence.c
+++ b/drivers/gpu/drm/nouveau/nouveau_fence.c
@@ -85,7 +85,7 @@ nouveau_fence_update(struct nouveau_channel *chan)
@@ -27600,7 +28547,7 @@ index 56f06b0..3d0f7dd 100644
if (chan->fence.sequence_ack == sequence)
goto out;
-@@ -542,7 +542,7 @@ nouveau_fence_channel_init(struct nouveau_channel *chan)
+@@ -539,7 +539,7 @@ nouveau_fence_channel_init(struct nouveau_channel *chan)
return ret;
}
@@ -27610,10 +28557,10 @@ index 56f06b0..3d0f7dd 100644
}
diff --git a/drivers/gpu/drm/nouveau/nouveau_gem.c b/drivers/gpu/drm/nouveau/nouveau_gem.c
-index b52e460..bb5bb3c 100644
+index 5f0bc57..eb9fac8 100644
--- a/drivers/gpu/drm/nouveau/nouveau_gem.c
+++ b/drivers/gpu/drm/nouveau/nouveau_gem.c
-@@ -249,7 +249,7 @@ validate_init(struct nouveau_channel *chan, struct drm_file *file_priv,
+@@ -314,7 +314,7 @@ validate_init(struct nouveau_channel *chan, struct drm_file *file_priv,
int trycnt = 0;
int ret, i;
@@ -27623,10 +28570,10 @@ index b52e460..bb5bb3c 100644
if (++trycnt > 100000) {
NV_ERROR(dev, "%s failed and gave up.\n", __func__);
diff --git a/drivers/gpu/drm/nouveau/nouveau_state.c b/drivers/gpu/drm/nouveau/nouveau_state.c
-index 731acea..1b3c064 100644
+index d8831ab..0ba8356 100644
--- a/drivers/gpu/drm/nouveau/nouveau_state.c
+++ b/drivers/gpu/drm/nouveau/nouveau_state.c
-@@ -488,7 +488,7 @@ static bool nouveau_switcheroo_can_switch(struct pci_dev *pdev)
+@@ -542,7 +542,7 @@ static bool nouveau_switcheroo_can_switch(struct pci_dev *pdev)
bool can_switch;
spin_lock(&dev->count_lock);
@@ -27636,10 +28583,10 @@ index 731acea..1b3c064 100644
return can_switch;
}
diff --git a/drivers/gpu/drm/nouveau/nv04_graph.c b/drivers/gpu/drm/nouveau/nv04_graph.c
-index 3626ee7..c60f0db 100644
+index dbdea8e..cd6eeeb 100644
--- a/drivers/gpu/drm/nouveau/nv04_graph.c
+++ b/drivers/gpu/drm/nouveau/nv04_graph.c
-@@ -560,7 +560,7 @@ static int
+@@ -554,7 +554,7 @@ static int
nv04_graph_mthd_set_ref(struct nouveau_channel *chan,
u32 class, u32 mthd, u32 data)
{
@@ -27649,10 +28596,10 @@ index 3626ee7..c60f0db 100644
}
diff --git a/drivers/gpu/drm/r128/r128_cce.c b/drivers/gpu/drm/r128/r128_cce.c
-index 570e190..084a31a 100644
+index bcac90b..53bfc76 100644
--- a/drivers/gpu/drm/r128/r128_cce.c
+++ b/drivers/gpu/drm/r128/r128_cce.c
-@@ -377,7 +377,7 @@ static int r128_do_init_cce(struct drm_device *dev, drm_r128_init_t *init)
+@@ -378,7 +378,7 @@ static int r128_do_init_cce(struct drm_device *dev, drm_r128_init_t *init)
/* GH: Simple idle check.
*/
@@ -27721,19 +28668,6 @@ index a9e33ce..09edd4b 100644
}
#endif
-diff --git a/drivers/gpu/drm/radeon/atom.c b/drivers/gpu/drm/radeon/atom.c
-index 9a0aee2..4e5010c 100644
---- a/drivers/gpu/drm/radeon/atom.c
-+++ b/drivers/gpu/drm/radeon/atom.c
-@@ -1254,6 +1254,8 @@ struct atom_context *atom_parse(struct card_info *card, void *bios)
- char name[512];
- int i;
-
-+ pax_track_stack();
-+
- ctx->card = card;
- ctx->bios = bios;
-
diff --git a/drivers/gpu/drm/radeon/mkregtable.c b/drivers/gpu/drm/radeon/mkregtable.c
index 5a82b6b..9e69c73 100644
--- a/drivers/gpu/drm/radeon/mkregtable.c
@@ -27756,7 +28690,7 @@ 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.h b/drivers/gpu/drm/radeon/radeon.h
-index 59d72d0..3621b94 100644
+index 8227e76..ce0b195 100644
--- a/drivers/gpu/drm/radeon/radeon.h
+++ b/drivers/gpu/drm/radeon/radeon.h
@@ -192,7 +192,7 @@ extern int sumo_get_temp(struct radeon_device *rdev);
@@ -27768,7 +28702,16 @@ index 59d72d0..3621b94 100644
uint32_t last_seq;
unsigned long last_jiffies;
unsigned long last_timeout;
-@@ -962,7 +962,7 @@ struct radeon_asic {
+@@ -530,7 +530,7 @@ struct r600_blit_cp_primitives {
+ int x2, int y2);
+ void (*draw_auto)(struct radeon_device *rdev);
+ void (*set_default_state)(struct radeon_device *rdev);
+-};
++} __no_const;
+
+ struct r600_blit {
+ struct mutex mutex;
+@@ -954,7 +954,7 @@ struct radeon_asic {
void (*pre_page_flip)(struct radeon_device *rdev, int crtc);
u32 (*page_flip)(struct radeon_device *rdev, int crtc, u64 crtc_base);
void (*post_page_flip)(struct radeon_device *rdev, int crtc);
@@ -27777,24 +28720,11 @@ index 59d72d0..3621b94 100644
/*
* Asic structures
-diff --git a/drivers/gpu/drm/radeon/radeon_atombios.c b/drivers/gpu/drm/radeon/radeon_atombios.c
-index 285acc4..f4d909f 100644
---- a/drivers/gpu/drm/radeon/radeon_atombios.c
-+++ b/drivers/gpu/drm/radeon/radeon_atombios.c
-@@ -569,6 +569,8 @@ bool radeon_get_atom_connector_info_from_object_table(struct drm_device *dev)
- struct radeon_gpio_rec gpio;
- struct radeon_hpd hpd;
-
-+ pax_track_stack();
-+
- if (!atom_parse_data_header(ctx, index, &size, &frev, &crev, &data_offset))
- return false;
-
diff --git a/drivers/gpu/drm/radeon/radeon_device.c b/drivers/gpu/drm/radeon/radeon_device.c
-index 440e6ec..8f7f68b 100644
+index c4d00a1..f0fdc90 100644
--- a/drivers/gpu/drm/radeon/radeon_device.c
+++ b/drivers/gpu/drm/radeon/radeon_device.c
-@@ -678,7 +678,7 @@ static bool radeon_switcheroo_can_switch(struct pci_dev *pdev)
+@@ -684,7 +684,7 @@ static bool radeon_switcheroo_can_switch(struct pci_dev *pdev)
bool can_switch;
spin_lock(&dev->count_lock);
@@ -27803,19 +28733,6 @@ index 440e6ec..8f7f68b 100644
spin_unlock(&dev->count_lock);
return can_switch;
}
-diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c
-index ed085ce..dabdad7 100644
---- a/drivers/gpu/drm/radeon/radeon_display.c
-+++ b/drivers/gpu/drm/radeon/radeon_display.c
-@@ -946,6 +946,8 @@ void radeon_compute_pll_legacy(struct radeon_pll *pll,
- uint32_t post_div;
- u32 pll_out_min, pll_out_max;
-
-+ pax_track_stack();
-+
- DRM_DEBUG_KMS("PLL freq %llu %u %u\n", freq, pll->min_ref_div, pll->max_ref_div);
- freq = freq * 1000;
-
diff --git a/drivers/gpu/drm/radeon/radeon_drv.h b/drivers/gpu/drm/radeon/radeon_drv.h
index a1b59ca..86f2d44 100644
--- a/drivers/gpu/drm/radeon/radeon_drv.h
@@ -27830,7 +28747,7 @@ index a1b59ca..86f2d44 100644
uint32_t irq_enable_reg;
uint32_t r500_disp_irq_reg;
diff --git a/drivers/gpu/drm/radeon/radeon_fence.c b/drivers/gpu/drm/radeon/radeon_fence.c
-index 021d2b6..7969575 100644
+index 76ec0e9..6feb1a3 100644
--- a/drivers/gpu/drm/radeon/radeon_fence.c
+++ b/drivers/gpu/drm/radeon/radeon_fence.c
@@ -78,7 +78,7 @@ int radeon_fence_emit(struct radeon_device *rdev, struct radeon_fence *fence)
@@ -27865,7 +28782,7 @@ index 48b7cea..342236f 100644
return -EFAULT;
diff --git a/drivers/gpu/drm/radeon/radeon_irq.c b/drivers/gpu/drm/radeon/radeon_irq.c
-index 465746b..cb2b055 100644
+index 00da384..32f972d 100644
--- a/drivers/gpu/drm/radeon/radeon_irq.c
+++ b/drivers/gpu/drm/radeon/radeon_irq.c
@@ -225,8 +225,8 @@ static int radeon_emit_irq(struct drm_device * dev)
@@ -27889,7 +28806,7 @@ index 465746b..cb2b055 100644
dev->max_vblank_count = 0x001fffff;
diff --git a/drivers/gpu/drm/radeon/radeon_state.c b/drivers/gpu/drm/radeon/radeon_state.c
-index 92e7ea7..147ffad 100644
+index e8422ae..d22d4a8 100644
--- a/drivers/gpu/drm/radeon/radeon_state.c
+++ b/drivers/gpu/drm/radeon/radeon_state.c
@@ -2168,7 +2168,7 @@ static int radeon_cp_clear(struct drm_device *dev, void *data, struct drm_file *
@@ -27911,10 +28828,10 @@ index 92e7ea7..147ffad 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 3e9b41b..8619b10 100644
+index 0b5468b..9c4b308 100644
--- a/drivers/gpu/drm/radeon/radeon_ttm.c
+++ b/drivers/gpu/drm/radeon/radeon_ttm.c
-@@ -649,8 +649,10 @@ int radeon_mmap(struct file *filp, struct vm_area_struct *vma)
+@@ -672,8 +672,10 @@ int radeon_mmap(struct file *filp, struct vm_area_struct *vma)
}
if (unlikely(ttm_vm_ops == NULL)) {
ttm_vm_ops = vma->vm_ops;
@@ -27945,7 +28862,7 @@ index a9049ed..501f284 100644
if (rdev->pm.max_bandwidth.full > rdev->pm.k8_bandwidth.full &&
rdev->pm.k8_bandwidth.full)
diff --git a/drivers/gpu/drm/ttm/ttm_page_alloc.c b/drivers/gpu/drm/ttm/ttm_page_alloc.c
-index d948575..059a928 100644
+index 727e93d..1565650 100644
--- a/drivers/gpu/drm/ttm/ttm_page_alloc.c
+++ b/drivers/gpu/drm/ttm/ttm_page_alloc.c
@@ -398,9 +398,9 @@ static int ttm_pool_get_num_unused_pages(void)
@@ -28057,58 +28974,32 @@ index d391f48..10c8ca3 100644
case VIA_IRQ_ABSOLUTE:
break;
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h
-index 10fc01f..b4e9822 100644
+index dc27970..f18b008 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h
-@@ -240,7 +240,7 @@ struct vmw_private {
+@@ -260,7 +260,7 @@ struct vmw_private {
* Fencing and IRQs.
*/
-- atomic_t fence_seq;
-+ atomic_unchecked_t fence_seq;
+- atomic_t marker_seq;
++ atomic_unchecked_t marker_seq;
wait_queue_head_t fence_queue;
wait_queue_head_t fifo_queue;
- atomic_t fence_queue_waiters;
-diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c b/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c
-index 41b95ed..69ea504 100644
---- a/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c
-+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c
-@@ -610,7 +610,7 @@ int vmw_execbuf_ioctl(struct drm_device *dev, void *data,
- struct drm_vmw_fence_rep fence_rep;
- struct drm_vmw_fence_rep __user *user_fence_rep;
- int ret;
-- void *user_cmd;
-+ void __user *user_cmd;
- void *cmd;
- uint32_t sequence;
- struct vmw_sw_context *sw_context = &dev_priv->ctx;
-diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_fence.c b/drivers/gpu/drm/vmwgfx/vmwgfx_fence.c
-index 61eacc1..ee38ce8 100644
---- a/drivers/gpu/drm/vmwgfx/vmwgfx_fence.c
-+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_fence.c
-@@ -151,7 +151,7 @@ int vmw_wait_lag(struct vmw_private *dev_priv,
- while (!vmw_lag_lt(queue, us)) {
- spin_lock(&queue->lock);
- if (list_empty(&queue->head))
-- sequence = atomic_read(&dev_priv->fence_seq);
-+ sequence = atomic_read_unchecked(&dev_priv->fence_seq);
- else {
- fence = list_first_entry(&queue->head,
- struct vmw_fence, head);
+ int fence_queue_waiters; /* Protected by hw_mutex */
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c b/drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c
-index 635c0ff..2641bbb 100644
+index a0c2f12..68ae6cb 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c
@@ -137,7 +137,7 @@ int vmw_fifo_init(struct vmw_private *dev_priv, struct vmw_fifo_state *fifo)
(unsigned int) min,
(unsigned int) fifo->capabilities);
-- atomic_set(&dev_priv->fence_seq, dev_priv->last_read_sequence);
-+ atomic_set_unchecked(&dev_priv->fence_seq, dev_priv->last_read_sequence);
- iowrite32(dev_priv->last_read_sequence, fifo_mem + SVGA_FIFO_FENCE);
- vmw_fence_queue_init(&fifo->fence_queue);
+- atomic_set(&dev_priv->marker_seq, dev_priv->last_read_seqno);
++ atomic_set_unchecked(&dev_priv->marker_seq, dev_priv->last_read_seqno);
+ iowrite32(dev_priv->last_read_seqno, fifo_mem + SVGA_FIFO_FENCE);
+ vmw_marker_queue_init(&fifo->marker_queue);
return vmw_fifo_send_fence(dev_priv, &dummy);
-@@ -356,7 +356,7 @@ void *vmw_fifo_reserve(struct vmw_private *dev_priv, uint32_t bytes)
+@@ -355,7 +355,7 @@ void *vmw_fifo_reserve(struct vmw_private *dev_priv, uint32_t bytes)
if (reserveable)
iowrite32(bytes, fifo_mem +
SVGA_FIFO_RESERVED);
@@ -28117,51 +29008,64 @@ index 635c0ff..2641bbb 100644
} else {
need_bounce = true;
}
-@@ -476,7 +476,7 @@ int vmw_fifo_send_fence(struct vmw_private *dev_priv, uint32_t *sequence)
+@@ -475,7 +475,7 @@ int vmw_fifo_send_fence(struct vmw_private *dev_priv, uint32_t *seqno)
fm = vmw_fifo_reserve(dev_priv, bytes);
if (unlikely(fm == NULL)) {
-- *sequence = atomic_read(&dev_priv->fence_seq);
-+ *sequence = atomic_read_unchecked(&dev_priv->fence_seq);
+- *seqno = atomic_read(&dev_priv->marker_seq);
++ *seqno = atomic_read_unchecked(&dev_priv->marker_seq);
ret = -ENOMEM;
- (void)vmw_fallback_wait(dev_priv, false, true, *sequence,
+ (void)vmw_fallback_wait(dev_priv, false, true, *seqno,
false, 3*HZ);
-@@ -484,7 +484,7 @@ int vmw_fifo_send_fence(struct vmw_private *dev_priv, uint32_t *sequence)
+@@ -483,7 +483,7 @@ int vmw_fifo_send_fence(struct vmw_private *dev_priv, uint32_t *seqno)
}
do {
-- *sequence = atomic_add_return(1, &dev_priv->fence_seq);
-+ *sequence = atomic_add_return_unchecked(1, &dev_priv->fence_seq);
- } while (*sequence == 0);
+- *seqno = atomic_add_return(1, &dev_priv->marker_seq);
++ *seqno = atomic_add_return_unchecked(1, &dev_priv->marker_seq);
+ } while (*seqno == 0);
if (!(fifo_state->capabilities & SVGA_FIFO_CAP_FENCE)) {
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_irq.c b/drivers/gpu/drm/vmwgfx/vmwgfx_irq.c
-index e92298a..f68f2d6 100644
+index cabc95f..14b3d77 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_irq.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_irq.c
-@@ -100,7 +100,7 @@ bool vmw_fence_signaled(struct vmw_private *dev_priv,
+@@ -107,7 +107,7 @@ bool vmw_seqno_passed(struct vmw_private *dev_priv,
* emitted. Then the fence is stale and signaled.
*/
-- ret = ((atomic_read(&dev_priv->fence_seq) - sequence)
-+ ret = ((atomic_read_unchecked(&dev_priv->fence_seq) - sequence)
+- ret = ((atomic_read(&dev_priv->marker_seq) - seqno)
++ ret = ((atomic_read_unchecked(&dev_priv->marker_seq) - seqno)
> VMW_FENCE_WRAP);
return ret;
-@@ -131,7 +131,7 @@ int vmw_fallback_wait(struct vmw_private *dev_priv,
+@@ -138,7 +138,7 @@ int vmw_fallback_wait(struct vmw_private *dev_priv,
if (fifo_idle)
down_read(&fifo_state->rwsem);
-- signal_seq = atomic_read(&dev_priv->fence_seq);
-+ signal_seq = atomic_read_unchecked(&dev_priv->fence_seq);
+- signal_seq = atomic_read(&dev_priv->marker_seq);
++ signal_seq = atomic_read_unchecked(&dev_priv->marker_seq);
ret = 0;
for (;;) {
+diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_marker.c b/drivers/gpu/drm/vmwgfx/vmwgfx_marker.c
+index 8a8725c..afed796 100644
+--- a/drivers/gpu/drm/vmwgfx/vmwgfx_marker.c
++++ b/drivers/gpu/drm/vmwgfx/vmwgfx_marker.c
+@@ -151,7 +151,7 @@ int vmw_wait_lag(struct vmw_private *dev_priv,
+ while (!vmw_lag_lt(queue, us)) {
+ spin_lock(&queue->lock);
+ if (list_empty(&queue->head))
+- seqno = atomic_read(&dev_priv->marker_seq);
++ seqno = atomic_read_unchecked(&dev_priv->marker_seq);
+ else {
+ marker = list_first_entry(&queue->head,
+ struct vmw_marker, head);
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
-index 763797d..67a9f78 100644
+index af35384..5ab3c36 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
-@@ -1940,7 +1940,7 @@ static bool hid_ignore(struct hid_device *hdev)
+@@ -2000,7 +2000,7 @@ static bool hid_ignore(struct hid_device *hdev)
int hid_add_device(struct hid_device *hdev)
{
@@ -28170,7 +29074,7 @@ index 763797d..67a9f78 100644
int ret;
if (WARN_ON(hdev->status & HID_STAT_ADDED))
-@@ -1955,7 +1955,7 @@ int hid_add_device(struct hid_device *hdev)
+@@ -2015,7 +2015,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,
@@ -28180,7 +29084,7 @@ index 763797d..67a9f78 100644
hid_debug_register(hdev, dev_name(&hdev->dev));
ret = device_add(&hdev->dev);
diff --git a/drivers/hid/usbhid/hiddev.c b/drivers/hid/usbhid/hiddev.c
-index 7c1188b..5a64357 100644
+index 4ef02b2..8a96831 100644
--- a/drivers/hid/usbhid/hiddev.c
+++ b/drivers/hid/usbhid/hiddev.c
@@ -624,7 +624,7 @@ static long hiddev_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
@@ -28192,6 +29096,64 @@ index 7c1188b..5a64357 100644
break;
for (i = 0; i < hid->maxcollection; i++)
+diff --git a/drivers/hv/channel.c b/drivers/hv/channel.c
+index 4065374..10ed7dc 100644
+--- a/drivers/hv/channel.c
++++ b/drivers/hv/channel.c
+@@ -400,8 +400,8 @@ int vmbus_establish_gpadl(struct vmbus_channel *channel, void *kbuffer,
+ int ret = 0;
+ int t;
+
+- next_gpadl_handle = atomic_read(&vmbus_connection.next_gpadl_handle);
+- atomic_inc(&vmbus_connection.next_gpadl_handle);
++ next_gpadl_handle = atomic_read_unchecked(&vmbus_connection.next_gpadl_handle);
++ atomic_inc_unchecked(&vmbus_connection.next_gpadl_handle);
+
+ ret = create_gpadl_header(kbuffer, size, &msginfo, &msgcount);
+ if (ret)
+diff --git a/drivers/hv/hv.c b/drivers/hv/hv.c
+index 0fb100e..baf87e5 100644
+--- a/drivers/hv/hv.c
++++ b/drivers/hv/hv.c
+@@ -132,7 +132,7 @@ static u64 do_hypercall(u64 control, void *input, void *output)
+ u64 output_address = (output) ? virt_to_phys(output) : 0;
+ u32 output_address_hi = output_address >> 32;
+ u32 output_address_lo = output_address & 0xFFFFFFFF;
+- void *hypercall_page = hv_context.hypercall_page;
++ void *hypercall_page = ktva_ktla(hv_context.hypercall_page);
+
+ __asm__ __volatile__ ("call *%8" : "=d"(hv_status_hi),
+ "=a"(hv_status_lo) : "d" (control_hi),
+diff --git a/drivers/hv/hyperv_vmbus.h b/drivers/hv/hyperv_vmbus.h
+index 0aee112..b72d21f 100644
+--- a/drivers/hv/hyperv_vmbus.h
++++ b/drivers/hv/hyperv_vmbus.h
+@@ -556,7 +556,7 @@ enum vmbus_connect_state {
+ struct vmbus_connection {
+ enum vmbus_connect_state conn_state;
+
+- atomic_t next_gpadl_handle;
++ atomic_unchecked_t next_gpadl_handle;
+
+ /*
+ * Represents channel interrupts. Each bit position represents a
+diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c
+index d2d0a2a..90b8f4d 100644
+--- a/drivers/hv/vmbus_drv.c
++++ b/drivers/hv/vmbus_drv.c
+@@ -663,10 +663,10 @@ int vmbus_device_register(struct hv_device *child_device_obj)
+ {
+ int ret = 0;
+
+- static atomic_t device_num = ATOMIC_INIT(0);
++ static atomic_unchecked_t device_num = ATOMIC_INIT(0);
+
+ dev_set_name(&child_device_obj->device, "vmbus_0_%d",
+- atomic_inc_return(&device_num));
++ atomic_inc_return_unchecked(&device_num));
+
+ child_device_obj->device.bus = &hv_bus;
+ child_device_obj->device.parent = &hv_acpi_dev->dev;
diff --git a/drivers/hwmon/acpi_power_meter.c b/drivers/hwmon/acpi_power_meter.c
index 66f6729..2d6de0a 100644
--- a/drivers/hwmon/acpi_power_meter.c
@@ -28206,7 +29168,7 @@ index 66f6729..2d6de0a 100644
mutex_lock(&resource->lock);
resource->trip[attr->index - 7] = temp;
diff --git a/drivers/hwmon/sht15.c b/drivers/hwmon/sht15.c
-index cf4330b..8ea6aeb 100644
+index fe4104c..346febb 100644
--- a/drivers/hwmon/sht15.c
+++ b/drivers/hwmon/sht15.c
@@ -166,7 +166,7 @@ struct sht15_data {
@@ -28257,21 +29219,6 @@ index cf4330b..8ea6aeb 100644
return;
}
-diff --git a/drivers/hwmon/w83791d.c b/drivers/hwmon/w83791d.c
-index 17cf1ab..8c2844e 100644
---- a/drivers/hwmon/w83791d.c
-+++ b/drivers/hwmon/w83791d.c
-@@ -329,8 +329,8 @@ static int w83791d_detect(struct i2c_client *client,
- struct i2c_board_info *info);
- static int w83791d_remove(struct i2c_client *client);
-
--static int w83791d_read(struct i2c_client *client, u8 register);
--static int w83791d_write(struct i2c_client *client, u8 register, u8 value);
-+static int w83791d_read(struct i2c_client *client, u8 reg);
-+static int w83791d_write(struct i2c_client *client, u8 reg, u8 value);
- static struct w83791d_data *w83791d_update_device(struct device *dev);
-
- #ifdef DEBUG
diff --git a/drivers/i2c/busses/i2c-amd756-s4882.c b/drivers/i2c/busses/i2c-amd756-s4882.c
index 378fcb5..5e91fa8 100644
--- a/drivers/i2c/busses/i2c-amd756-s4882.c
@@ -28416,10 +29363,10 @@ index 5059faf..18d4c85 100644
.port_ops = &cs5535_port_ops,
.host_flags = IDE_HFLAG_SINGLE | IDE_HFLAG_POST_SET_MODE,
diff --git a/drivers/ide/cy82c693.c b/drivers/ide/cy82c693.c
-index 3be60da..93c1104 100644
+index 847553f..3ffb49d 100644
--- a/drivers/ide/cy82c693.c
+++ b/drivers/ide/cy82c693.c
-@@ -161,7 +161,7 @@ static const struct ide_port_ops cy82c693_port_ops = {
+@@ -163,7 +163,7 @@ static const struct ide_port_ops cy82c693_port_ops = {
.set_dma_mode = cy82c693_set_dma_mode,
};
@@ -28541,10 +29488,10 @@ index 58c51cd..4aec3b8 100644
.name = DRV_NAME,
.init_chipset = init_chipset_hpt366,
diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
-index 04b0956..f5b47dc 100644
+index 8126824..55a2798 100644
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
-@@ -769,7 +769,7 @@ static void cdrom_do_block_pc(ide_drive_t *drive, struct request *rq)
+@@ -768,7 +768,7 @@ static void cdrom_do_block_pc(ide_drive_t *drive, struct request *rq)
alignment = queue_dma_alignment(q) | q->dma_pad_mask;
if ((unsigned long)buf & alignment
|| blk_rq_bytes(rq) & q->dma_pad_mask
@@ -28553,19 +29500,20 @@ index 04b0956..f5b47dc 100644
drive->dma = 0;
}
}
-diff --git a/drivers/ide/ide-floppy.c b/drivers/ide/ide-floppy.c
-index 61fdf54..2834ea6 100644
---- a/drivers/ide/ide-floppy.c
-+++ b/drivers/ide/ide-floppy.c
-@@ -379,6 +379,8 @@ static int ide_floppy_get_capacity(ide_drive_t *drive)
- u8 pc_buf[256], header_len, desc_cnt;
- int i, rc = 1, blocks, length;
-
-+ pax_track_stack();
-+
- ide_debug_log(IDE_DBG_FUNC, "enter");
+diff --git a/drivers/ide/ide-floppy_ioctl.c b/drivers/ide/ide-floppy_ioctl.c
+index d267b7a..a22ca84 100644
+--- a/drivers/ide/ide-floppy_ioctl.c
++++ b/drivers/ide/ide-floppy_ioctl.c
+@@ -292,8 +292,7 @@ int ide_floppy_ioctl(ide_drive_t *drive, struct block_device *bdev,
+ * and CDROM_SEND_PACKET (legacy) ioctls
+ */
+ if (cmd != CDROM_SEND_PACKET && cmd != SCSI_IOCTL_SEND_COMMAND)
+- err = scsi_cmd_ioctl(bdev->bd_disk->queue, bdev->bd_disk,
+- mode, cmd, argp);
++ err = scsi_cmd_blk_ioctl(bdev, mode, cmd, argp);
- drive->bios_cyl = 0;
+ if (err == -ENOTTY)
+ err = generic_ide_ioctl(drive, bdev, cmd, arg);
diff --git a/drivers/ide/ide-pci-generic.c b/drivers/ide/ide-pci-generic.c
index a743e68..1cfd674 100644
--- a/drivers/ide/ide-pci-generic.c
@@ -28684,7 +29632,7 @@ index 3a35ec6..5634510 100644
.name = DRV_NAME,
.init_chipset = init_chipset_pdc202xx,
diff --git a/drivers/ide/piix.c b/drivers/ide/piix.c
-index b59d04c..368c2a7 100644
+index 1892e81..fe0fd60 100644
--- a/drivers/ide/piix.c
+++ b/drivers/ide/piix.c
@@ -344,7 +344,7 @@ static const struct ide_port_ops ich_port_ops = {
@@ -28748,19 +29696,6 @@ index 35fb8da..24d72ef 100644
{ /* 0: OSB4 */
.name = DRV_NAME,
.init_chipset = init_chipset_svwks,
-diff --git a/drivers/ide/setup-pci.c b/drivers/ide/setup-pci.c
-index ab3db61..afed580 100644
---- a/drivers/ide/setup-pci.c
-+++ b/drivers/ide/setup-pci.c
-@@ -542,6 +542,8 @@ int ide_pci_init_two(struct pci_dev *dev1, struct pci_dev *dev2,
- int ret, i, n_ports = dev2 ? 4 : 2;
- struct ide_hw hw[4], *hws[] = { NULL, NULL, NULL, NULL };
-
-+ pax_track_stack();
-+
- for (i = 0; i < n_ports / 2; i++) {
- ret = ide_setup_pci_controller(pdev[i], d, !i);
- if (ret < 0)
diff --git a/drivers/ide/siimage.c b/drivers/ide/siimage.c
index ddeda44..46f7e30 100644
--- a/drivers/ide/siimage.c
@@ -28814,10 +29749,10 @@ index 864ffe0..863a5e9 100644
.enablebits = { {0x41, 0x80, 0x80}, {0x43, 0x80, 0x80} },
.port_ops = &slc90e66_port_ops,
diff --git a/drivers/ide/tc86c001.c b/drivers/ide/tc86c001.c
-index e444d24..ba577de 100644
+index 4799d5c..1794678 100644
--- a/drivers/ide/tc86c001.c
+++ b/drivers/ide/tc86c001.c
-@@ -191,7 +191,7 @@ static const struct ide_dma_ops tc86c001_dma_ops = {
+@@ -192,7 +192,7 @@ static const struct ide_dma_ops tc86c001_dma_ops = {
.dma_sff_read_status = ide_dma_sff_read_status,
};
@@ -28827,7 +29762,7 @@ index e444d24..ba577de 100644
.init_hwif = init_hwif_tc86c001,
.port_ops = &tc86c001_port_ops,
diff --git a/drivers/ide/triflex.c b/drivers/ide/triflex.c
-index e53a1b7..d11aff7 100644
+index 281c914..55ce1b8 100644
--- a/drivers/ide/triflex.c
+++ b/drivers/ide/triflex.c
@@ -92,7 +92,7 @@ static const struct ide_port_ops triflex_port_ops = {
@@ -28865,11 +29800,24 @@ index f46f49c..eb77678 100644
.name = DRV_NAME,
.init_chipset = init_chipset_via82cxxx,
.enablebits = { { 0x40, 0x02, 0x02 }, { 0x40, 0x01, 0x01 } },
+diff --git a/drivers/ieee802154/fakehard.c b/drivers/ieee802154/fakehard.c
+index eb0e2cc..14241c7 100644
+--- a/drivers/ieee802154/fakehard.c
++++ b/drivers/ieee802154/fakehard.c
+@@ -386,7 +386,7 @@ static int __devinit ieee802154fake_probe(struct platform_device *pdev)
+ phy->transmit_power = 0xbf;
+
+ dev->netdev_ops = &fake_ops;
+- dev->ml_priv = &fake_mlme;
++ dev->ml_priv = (void *)&fake_mlme;
+
+ priv = netdev_priv(dev);
+ priv->phy = phy;
diff --git a/drivers/infiniband/core/cm.c b/drivers/infiniband/core/cm.c
-index fc0f2bd..ac2f8a5 100644
+index 8b72f39..55df4c8 100644
--- a/drivers/infiniband/core/cm.c
+++ b/drivers/infiniband/core/cm.c
-@@ -113,7 +113,7 @@ static char const counter_group_names[CM_COUNTER_GROUPS]
+@@ -114,7 +114,7 @@ static char const counter_group_names[CM_COUNTER_GROUPS]
struct cm_counter_group {
struct kobject obj;
@@ -28878,7 +29826,7 @@ index fc0f2bd..ac2f8a5 100644
};
struct cm_counter_attribute {
-@@ -1387,7 +1387,7 @@ static void cm_dup_req_handler(struct cm_work *work,
+@@ -1394,7 +1394,7 @@ static void cm_dup_req_handler(struct cm_work *work,
struct ib_mad_send_buf *msg = NULL;
int ret;
@@ -28887,7 +29835,7 @@ index fc0f2bd..ac2f8a5 100644
counter[CM_REQ_COUNTER]);
/* Quick state check to discard duplicate REQs. */
-@@ -1765,7 +1765,7 @@ static void cm_dup_rep_handler(struct cm_work *work)
+@@ -1778,7 +1778,7 @@ static void cm_dup_rep_handler(struct cm_work *work)
if (!cm_id_priv)
return;
@@ -28896,7 +29844,7 @@ index fc0f2bd..ac2f8a5 100644
counter[CM_REP_COUNTER]);
ret = cm_alloc_response_msg(work->port, work->mad_recv_wc, &msg);
if (ret)
-@@ -1932,7 +1932,7 @@ static int cm_rtu_handler(struct cm_work *work)
+@@ -1945,7 +1945,7 @@ static int cm_rtu_handler(struct cm_work *work)
if (cm_id_priv->id.state != IB_CM_REP_SENT &&
cm_id_priv->id.state != IB_CM_MRA_REP_RCVD) {
spin_unlock_irq(&cm_id_priv->lock);
@@ -28905,7 +29853,7 @@ index fc0f2bd..ac2f8a5 100644
counter[CM_RTU_COUNTER]);
goto out;
}
-@@ -2115,7 +2115,7 @@ static int cm_dreq_handler(struct cm_work *work)
+@@ -2128,7 +2128,7 @@ static int cm_dreq_handler(struct cm_work *work)
cm_id_priv = cm_acquire_id(dreq_msg->remote_comm_id,
dreq_msg->local_comm_id);
if (!cm_id_priv) {
@@ -28914,7 +29862,7 @@ index fc0f2bd..ac2f8a5 100644
counter[CM_DREQ_COUNTER]);
cm_issue_drep(work->port, work->mad_recv_wc);
return -EINVAL;
-@@ -2140,7 +2140,7 @@ static int cm_dreq_handler(struct cm_work *work)
+@@ -2153,7 +2153,7 @@ static int cm_dreq_handler(struct cm_work *work)
case IB_CM_MRA_REP_RCVD:
break;
case IB_CM_TIMEWAIT:
@@ -28923,7 +29871,7 @@ index fc0f2bd..ac2f8a5 100644
counter[CM_DREQ_COUNTER]);
if (cm_alloc_response_msg(work->port, work->mad_recv_wc, &msg))
goto unlock;
-@@ -2154,7 +2154,7 @@ static int cm_dreq_handler(struct cm_work *work)
+@@ -2167,7 +2167,7 @@ static int cm_dreq_handler(struct cm_work *work)
cm_free_msg(msg);
goto deref;
case IB_CM_DREQ_RCVD:
@@ -28932,7 +29880,7 @@ index fc0f2bd..ac2f8a5 100644
counter[CM_DREQ_COUNTER]);
goto unlock;
default:
-@@ -2521,7 +2521,7 @@ static int cm_mra_handler(struct cm_work *work)
+@@ -2534,7 +2534,7 @@ static int cm_mra_handler(struct cm_work *work)
ib_modify_mad(cm_id_priv->av.port->mad_agent,
cm_id_priv->msg, timeout)) {
if (cm_id_priv->id.lap_state == IB_CM_MRA_LAP_RCVD)
@@ -28941,7 +29889,7 @@ index fc0f2bd..ac2f8a5 100644
counter_group[CM_RECV_DUPLICATES].
counter[CM_MRA_COUNTER]);
goto out;
-@@ -2530,7 +2530,7 @@ static int cm_mra_handler(struct cm_work *work)
+@@ -2543,7 +2543,7 @@ static int cm_mra_handler(struct cm_work *work)
break;
case IB_CM_MRA_REQ_RCVD:
case IB_CM_MRA_REP_RCVD:
@@ -28950,7 +29898,7 @@ index fc0f2bd..ac2f8a5 100644
counter[CM_MRA_COUNTER]);
/* fall through */
default:
-@@ -2692,7 +2692,7 @@ static int cm_lap_handler(struct cm_work *work)
+@@ -2705,7 +2705,7 @@ static int cm_lap_handler(struct cm_work *work)
case IB_CM_LAP_IDLE:
break;
case IB_CM_MRA_LAP_SENT:
@@ -28959,7 +29907,7 @@ index fc0f2bd..ac2f8a5 100644
counter[CM_LAP_COUNTER]);
if (cm_alloc_response_msg(work->port, work->mad_recv_wc, &msg))
goto unlock;
-@@ -2708,7 +2708,7 @@ static int cm_lap_handler(struct cm_work *work)
+@@ -2721,7 +2721,7 @@ static int cm_lap_handler(struct cm_work *work)
cm_free_msg(msg);
goto deref;
case IB_CM_LAP_RCVD:
@@ -28968,7 +29916,7 @@ index fc0f2bd..ac2f8a5 100644
counter[CM_LAP_COUNTER]);
goto unlock;
default:
-@@ -2992,7 +2992,7 @@ static int cm_sidr_req_handler(struct cm_work *work)
+@@ -3005,7 +3005,7 @@ static int cm_sidr_req_handler(struct cm_work *work)
cur_cm_id_priv = cm_insert_remote_sidr(cm_id_priv);
if (cur_cm_id_priv) {
spin_unlock_irq(&cm.lock);
@@ -28977,7 +29925,7 @@ index fc0f2bd..ac2f8a5 100644
counter[CM_SIDR_REQ_COUNTER]);
goto out; /* Duplicate message. */
}
-@@ -3204,10 +3204,10 @@ static void cm_send_handler(struct ib_mad_agent *mad_agent,
+@@ -3217,10 +3217,10 @@ static void cm_send_handler(struct ib_mad_agent *mad_agent,
if (!msg->context[0] && (attr_index != CM_REJ_COUNTER))
msg->retries = 1;
@@ -28990,7 +29938,7 @@ index fc0f2bd..ac2f8a5 100644
&port->counter_group[CM_XMIT_RETRIES].
counter[attr_index]);
-@@ -3417,7 +3417,7 @@ static void cm_recv_handler(struct ib_mad_agent *mad_agent,
+@@ -3430,7 +3430,7 @@ static void cm_recv_handler(struct ib_mad_agent *mad_agent,
}
attr_id = be16_to_cpu(mad_recv_wc->recv_buf.mad->mad_hdr.attr_id);
@@ -28999,7 +29947,7 @@ index fc0f2bd..ac2f8a5 100644
counter[attr_id - CM_ATTR_ID_OFFSET]);
work = kmalloc(sizeof *work + sizeof(struct ib_sa_path_rec) * paths,
-@@ -3615,7 +3615,7 @@ static ssize_t cm_show_counter(struct kobject *obj, struct attribute *attr,
+@@ -3635,7 +3635,7 @@ static ssize_t cm_show_counter(struct kobject *obj, struct attribute *attr,
cm_attr = container_of(attr, struct cm_counter_attribute, attr);
return sprintf(buf, "%ld\n",
@@ -29009,10 +29957,10 @@ index fc0f2bd..ac2f8a5 100644
static const struct sysfs_ops cm_counter_ops = {
diff --git a/drivers/infiniband/core/fmr_pool.c b/drivers/infiniband/core/fmr_pool.c
-index 4507043..14ad522 100644
+index 176c8f9..2627b62 100644
--- a/drivers/infiniband/core/fmr_pool.c
+++ b/drivers/infiniband/core/fmr_pool.c
-@@ -97,8 +97,8 @@ struct ib_fmr_pool {
+@@ -98,8 +98,8 @@ struct ib_fmr_pool {
struct task_struct *thread;
@@ -29023,7 +29971,7 @@ index 4507043..14ad522 100644
wait_queue_head_t force_wait;
};
-@@ -179,10 +179,10 @@ static int ib_fmr_cleanup_thread(void *pool_ptr)
+@@ -180,10 +180,10 @@ static int ib_fmr_cleanup_thread(void *pool_ptr)
struct ib_fmr_pool *pool = pool_ptr;
do {
@@ -29036,7 +29984,7 @@ index 4507043..14ad522 100644
wake_up_interruptible(&pool->force_wait);
if (pool->flush_function)
-@@ -190,7 +190,7 @@ static int ib_fmr_cleanup_thread(void *pool_ptr)
+@@ -191,7 +191,7 @@ static int ib_fmr_cleanup_thread(void *pool_ptr)
}
set_current_state(TASK_INTERRUPTIBLE);
@@ -29045,7 +29993,7 @@ index 4507043..14ad522 100644
!kthread_should_stop())
schedule();
__set_current_state(TASK_RUNNING);
-@@ -282,8 +282,8 @@ struct ib_fmr_pool *ib_create_fmr_pool(struct ib_pd *pd,
+@@ -283,8 +283,8 @@ struct ib_fmr_pool *ib_create_fmr_pool(struct ib_pd *pd,
pool->dirty_watermark = params->dirty_watermark;
pool->dirty_len = 0;
spin_lock_init(&pool->pool_lock);
@@ -29056,7 +30004,7 @@ index 4507043..14ad522 100644
init_waitqueue_head(&pool->force_wait);
pool->thread = kthread_run(ib_fmr_cleanup_thread,
-@@ -411,11 +411,11 @@ int ib_flush_fmr_pool(struct ib_fmr_pool *pool)
+@@ -412,11 +412,11 @@ int ib_flush_fmr_pool(struct ib_fmr_pool *pool)
}
spin_unlock_irq(&pool->pool_lock);
@@ -29070,7 +30018,7 @@ index 4507043..14ad522 100644
return -EINTR;
return 0;
-@@ -525,7 +525,7 @@ int ib_fmr_pool_unmap(struct ib_pool_fmr *fmr)
+@@ -526,7 +526,7 @@ int ib_fmr_pool_unmap(struct ib_pool_fmr *fmr)
} else {
list_add_tail(&fmr->list, &pool->dirty_list);
if (++pool->dirty_len >= pool->dirty_watermark) {
@@ -29080,7 +30028,7 @@ index 4507043..14ad522 100644
}
}
diff --git a/drivers/infiniband/hw/cxgb4/mem.c b/drivers/infiniband/hw/cxgb4/mem.c
-index 0347eed..0f0e4b1 100644
+index 40c8353..946b0e4 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,
@@ -29101,19 +30049,6 @@ index 0347eed..0f0e4b1 100644
}
PDBG("%s stag_state 0x%0x type 0x%0x pdid 0x%0x, stag_idx 0x%x\n",
__func__, stag_state, type, pdid, stag_idx);
-diff --git a/drivers/infiniband/hw/ipath/ipath_fs.c b/drivers/infiniband/hw/ipath/ipath_fs.c
-index 31ae1b1..2f5b038 100644
---- a/drivers/infiniband/hw/ipath/ipath_fs.c
-+++ b/drivers/infiniband/hw/ipath/ipath_fs.c
-@@ -113,6 +113,8 @@ static ssize_t atomic_counters_read(struct file *file, char __user *buf,
- struct infinipath_counters counters;
- struct ipath_devdata *dd;
-
-+ pax_track_stack();
-+
- dd = file->f_path.dentry->d_inode->i_private;
- dd->ipath_f_read_counters(dd, &counters);
-
diff --git a/drivers/infiniband/hw/ipath/ipath_rc.c b/drivers/infiniband/hw/ipath/ipath_rc.c
index 79b3dbc..96e5fcc 100644
--- a/drivers/infiniband/hw/ipath/ipath_rc.c
@@ -29169,7 +30104,7 @@ index 1f95bba..9530f87 100644
sdata, wqe->wr.wr.atomic.swap);
goto send_comp;
diff --git a/drivers/infiniband/hw/nes/nes.c b/drivers/infiniband/hw/nes/nes.c
-index 2d668c6..3312bb7 100644
+index 5965b3d..16817fb 100644
--- a/drivers/infiniband/hw/nes/nes.c
+++ b/drivers/infiniband/hw/nes/nes.c
@@ -103,7 +103,7 @@ MODULE_PARM_DESC(limit_maxrdreqsz, "Limit max read request size to 256 Bytes");
@@ -29181,7 +30116,7 @@ index 2d668c6..3312bb7 100644
static unsigned int ee_flsh_adapter;
static unsigned int sysfs_nonidx_addr;
-@@ -275,7 +275,7 @@ static void nes_cqp_rem_ref_callback(struct nes_device *nesdev, struct nes_cqp_r
+@@ -272,7 +272,7 @@ static void nes_cqp_rem_ref_callback(struct nes_device *nesdev, struct nes_cqp_r
struct nes_qp *nesqp = cqp_request->cqp_callback_pointer;
struct nes_adapter *nesadapter = nesdev->nesadapter;
@@ -29191,10 +30126,10 @@ index 2d668c6..3312bb7 100644
/* Free the control structures */
diff --git a/drivers/infiniband/hw/nes/nes.h b/drivers/infiniband/hw/nes/nes.h
-index 6fe7987..68637b5 100644
+index 568b4f1..5ea3eff 100644
--- a/drivers/infiniband/hw/nes/nes.h
+++ b/drivers/infiniband/hw/nes/nes.h
-@@ -175,17 +175,17 @@ extern unsigned int nes_debug_level;
+@@ -178,17 +178,17 @@ extern unsigned int nes_debug_level;
extern unsigned int wqm_quanta;
extern struct list_head nes_adapter_list;
@@ -29223,7 +30158,7 @@ index 6fe7987..68637b5 100644
extern u32 mh_detected;
extern u32 mh_pauses_sent;
extern u32 cm_packets_sent;
-@@ -194,14 +194,14 @@ extern u32 cm_packets_created;
+@@ -197,16 +197,16 @@ extern u32 cm_packets_created;
extern u32 cm_packets_received;
extern u32 cm_packets_dropped;
extern u32 cm_packets_retrans;
@@ -29237,16 +30172,20 @@ index 6fe7987..68637b5 100644
-extern atomic_t cm_nodes_destroyed;
-extern atomic_t cm_accel_dropped_pkts;
-extern atomic_t cm_resets_recvd;
+-extern atomic_t pau_qps_created;
+-extern atomic_t pau_qps_destroyed;
+extern atomic_unchecked_t cm_loopbacks;
+extern atomic_unchecked_t cm_nodes_created;
+extern atomic_unchecked_t cm_nodes_destroyed;
+extern atomic_unchecked_t cm_accel_dropped_pkts;
+extern atomic_unchecked_t cm_resets_recvd;
++extern atomic_unchecked_t pau_qps_created;
++extern atomic_unchecked_t pau_qps_destroyed;
extern u32 int_mod_timer_init;
extern u32 int_mod_cq_depth_256;
diff --git a/drivers/infiniband/hw/nes/nes_cm.c b/drivers/infiniband/hw/nes/nes_cm.c
-index e74cdf9..4b5ca90 100644
+index 0a52d72..0642f36 100644
--- a/drivers/infiniband/hw/nes/nes_cm.c
+++ b/drivers/infiniband/hw/nes/nes_cm.c
@@ -68,14 +68,14 @@ u32 cm_packets_dropped;
@@ -29269,9 +30208,9 @@ index e74cdf9..4b5ca90 100644
+atomic_unchecked_t cm_accel_dropped_pkts;
+atomic_unchecked_t cm_resets_recvd;
- static inline int mini_cm_accelerated(struct nes_cm_core *,
- struct nes_cm_node *);
-@@ -151,13 +151,13 @@ static struct nes_cm_ops nes_cm_api = {
+ static inline int mini_cm_accelerated(struct nes_cm_core *, struct nes_cm_node *);
+ static struct nes_cm_listener *mini_cm_listen(struct nes_cm_core *, struct nes_vnic *, struct nes_cm_info *);
+@@ -148,13 +148,13 @@ static struct nes_cm_ops nes_cm_api = {
static struct nes_cm_core *g_cm_core;
@@ -29290,9 +30229,9 @@ index e74cdf9..4b5ca90 100644
+atomic_unchecked_t cm_connect_reqs;
+atomic_unchecked_t cm_rejects;
-
- /**
-@@ -1045,7 +1045,7 @@ static int mini_cm_dec_refcnt_listen(struct nes_cm_core *cm_core,
+ int nes_add_ref_cm_node(struct nes_cm_node *cm_node)
+ {
+@@ -1271,7 +1271,7 @@ static int mini_cm_dec_refcnt_listen(struct nes_cm_core *cm_core,
kfree(listener);
listener = NULL;
ret = 0;
@@ -29301,7 +30240,7 @@ index e74cdf9..4b5ca90 100644
} else {
spin_unlock_irqrestore(&cm_core->listen_list_lock, flags);
}
-@@ -1240,7 +1240,7 @@ static struct nes_cm_node *make_cm_node(struct nes_cm_core *cm_core,
+@@ -1473,7 +1473,7 @@ static struct nes_cm_node *make_cm_node(struct nes_cm_core *cm_core,
cm_node->rem_mac);
add_hte_node(cm_core, cm_node);
@@ -29310,7 +30249,7 @@ index e74cdf9..4b5ca90 100644
return cm_node;
}
-@@ -1298,7 +1298,7 @@ static int rem_ref_cm_node(struct nes_cm_core *cm_core,
+@@ -1531,7 +1531,7 @@ static int rem_ref_cm_node(struct nes_cm_core *cm_core,
}
atomic_dec(&cm_core->node_cnt);
@@ -29319,7 +30258,7 @@ index e74cdf9..4b5ca90 100644
nesqp = cm_node->nesqp;
if (nesqp) {
nesqp->cm_node = NULL;
-@@ -1365,7 +1365,7 @@ static int process_options(struct nes_cm_node *cm_node, u8 *optionsloc,
+@@ -1595,7 +1595,7 @@ static int process_options(struct nes_cm_node *cm_node, u8 *optionsloc,
static void drop_packet(struct sk_buff *skb)
{
@@ -29328,7 +30267,7 @@ index e74cdf9..4b5ca90 100644
dev_kfree_skb_any(skb);
}
-@@ -1428,7 +1428,7 @@ static void handle_rst_pkt(struct nes_cm_node *cm_node, struct sk_buff *skb,
+@@ -1658,7 +1658,7 @@ static void handle_rst_pkt(struct nes_cm_node *cm_node, struct sk_buff *skb,
{
int reset = 0; /* whether to send reset in case of err.. */
@@ -29337,7 +30276,7 @@ index e74cdf9..4b5ca90 100644
nes_debug(NES_DBG_CM, "Received Reset, cm_node = %p, state = %u."
" refcnt=%d\n", cm_node, cm_node->state,
atomic_read(&cm_node->ref_count));
-@@ -2057,7 +2057,7 @@ static struct nes_cm_node *mini_cm_connect(struct nes_cm_core *cm_core,
+@@ -2299,7 +2299,7 @@ static struct nes_cm_node *mini_cm_connect(struct nes_cm_core *cm_core,
rem_ref_cm_node(cm_node->cm_core, cm_node);
return NULL;
}
@@ -29346,16 +30285,16 @@ index e74cdf9..4b5ca90 100644
loopbackremotenode->loopbackpartner = cm_node;
loopbackremotenode->tcp_cntxt.rcv_wscale =
NES_CM_DEFAULT_RCV_WND_SCALE;
-@@ -2332,7 +2332,7 @@ static int mini_cm_recv_pkt(struct nes_cm_core *cm_core,
- add_ref_cm_node(cm_node);
- } else if (cm_node->state == NES_CM_STATE_TSA) {
- rem_ref_cm_node(cm_core, cm_node);
-- atomic_inc(&cm_accel_dropped_pkts);
-+ atomic_inc_unchecked(&cm_accel_dropped_pkts);
- dev_kfree_skb_any(skb);
+@@ -2574,7 +2574,7 @@ static int mini_cm_recv_pkt(struct nes_cm_core *cm_core,
+ nes_queue_mgt_skbs(skb, nesvnic, cm_node->nesqp);
+ else {
+ rem_ref_cm_node(cm_core, cm_node);
+- atomic_inc(&cm_accel_dropped_pkts);
++ atomic_inc_unchecked(&cm_accel_dropped_pkts);
+ dev_kfree_skb_any(skb);
+ }
break;
- }
-@@ -2638,7 +2638,7 @@ static int nes_cm_disconn_true(struct nes_qp *nesqp)
+@@ -2880,7 +2880,7 @@ static int nes_cm_disconn_true(struct nes_qp *nesqp)
if ((cm_id) && (cm_id->event_handler)) {
if (issue_disconn) {
@@ -29364,7 +30303,7 @@ index e74cdf9..4b5ca90 100644
cm_event.event = IW_CM_EVENT_DISCONNECT;
cm_event.status = disconn_status;
cm_event.local_addr = cm_id->local_addr;
-@@ -2660,7 +2660,7 @@ static int nes_cm_disconn_true(struct nes_qp *nesqp)
+@@ -2902,7 +2902,7 @@ static int nes_cm_disconn_true(struct nes_qp *nesqp)
}
if (issue_close) {
@@ -29373,7 +30312,7 @@ index e74cdf9..4b5ca90 100644
nes_disconnect(nesqp, 1);
cm_id->provider_data = nesqp;
-@@ -2791,7 +2791,7 @@ int nes_accept(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param)
+@@ -3038,7 +3038,7 @@ int nes_accept(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param)
nes_debug(NES_DBG_CM, "QP%u, cm_node=%p, jiffies = %lu listener = %p\n",
nesqp->hwqp.qp_id, cm_node, jiffies, cm_node->listener);
@@ -29382,25 +30321,25 @@ index e74cdf9..4b5ca90 100644
nes_debug(NES_DBG_CM, "netdev refcnt = %u.\n",
netdev_refcnt_read(nesvnic->netdev));
-@@ -3001,7 +3001,7 @@ int nes_reject(struct iw_cm_id *cm_id, const void *pdata, u8 pdata_len)
-
+@@ -3240,7 +3240,7 @@ int nes_reject(struct iw_cm_id *cm_id, const void *pdata, u8 pdata_len)
struct nes_cm_core *cm_core;
+ u8 *start_buff;
- atomic_inc(&cm_rejects);
+ atomic_inc_unchecked(&cm_rejects);
- cm_node = (struct nes_cm_node *) cm_id->provider_data;
+ cm_node = (struct nes_cm_node *)cm_id->provider_data;
loopback = cm_node->loopbackpartner;
cm_core = cm_node->cm_core;
-@@ -3067,7 +3067,7 @@ int nes_connect(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param)
- ntohl(cm_id->local_addr.sin_addr.s_addr),
- ntohs(cm_id->local_addr.sin_port));
+@@ -3300,7 +3300,7 @@ int nes_connect(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param)
+ ntohl(cm_id->local_addr.sin_addr.s_addr),
+ ntohs(cm_id->local_addr.sin_port));
- atomic_inc(&cm_connects);
+ atomic_inc_unchecked(&cm_connects);
nesqp->active_conn = 1;
/* cache the cm_id in the qp */
-@@ -3173,7 +3173,7 @@ int nes_create_listen(struct iw_cm_id *cm_id, int backlog)
+@@ -3406,7 +3406,7 @@ int nes_create_listen(struct iw_cm_id *cm_id, int backlog)
g_cm_core->api->stop_listener(g_cm_core, (void *)cm_node);
return err;
}
@@ -29409,16 +30348,16 @@ index e74cdf9..4b5ca90 100644
}
cm_id->add_ref(cm_id);
-@@ -3278,7 +3278,7 @@ static void cm_event_connected(struct nes_cm_event *event)
- if (nesqp->destroyed) {
+@@ -3507,7 +3507,7 @@ static void cm_event_connected(struct nes_cm_event *event)
+
+ if (nesqp->destroyed)
return;
- }
- atomic_inc(&cm_connecteds);
+ atomic_inc_unchecked(&cm_connecteds);
nes_debug(NES_DBG_CM, "QP%u attempting to connect to 0x%08X:0x%04X on"
- " local port 0x%04X. jiffies = %lu.\n",
- nesqp->hwqp.qp_id,
-@@ -3493,7 +3493,7 @@ static void cm_event_reset(struct nes_cm_event *event)
+ " local port 0x%04X. jiffies = %lu.\n",
+ nesqp->hwqp.qp_id,
+@@ -3694,7 +3694,7 @@ static void cm_event_reset(struct nes_cm_event *event)
cm_id->add_ref(cm_id);
ret = cm_id->event_handler(cm_id, &cm_event);
@@ -29427,29 +30366,62 @@ index e74cdf9..4b5ca90 100644
cm_event.event = IW_CM_EVENT_CLOSE;
cm_event.status = 0;
cm_event.provider_data = cm_id->provider_data;
-@@ -3529,7 +3529,7 @@ static void cm_event_mpa_req(struct nes_cm_event *event)
+@@ -3730,7 +3730,7 @@ static void cm_event_mpa_req(struct nes_cm_event *event)
return;
cm_id = cm_node->cm_id;
- atomic_inc(&cm_connect_reqs);
+ atomic_inc_unchecked(&cm_connect_reqs);
nes_debug(NES_DBG_CM, "cm_node = %p - cm_id = %p, jiffies = %lu\n",
- cm_node, cm_id, jiffies);
+ cm_node, cm_id, jiffies);
-@@ -3567,7 +3567,7 @@ static void cm_event_mpa_reject(struct nes_cm_event *event)
+@@ -3770,7 +3770,7 @@ static void cm_event_mpa_reject(struct nes_cm_event *event)
return;
cm_id = cm_node->cm_id;
- atomic_inc(&cm_connect_reqs);
+ atomic_inc_unchecked(&cm_connect_reqs);
nes_debug(NES_DBG_CM, "cm_node = %p - cm_id = %p, jiffies = %lu\n",
- cm_node, cm_id, jiffies);
+ cm_node, cm_id, jiffies);
+
+diff --git a/drivers/infiniband/hw/nes/nes_mgt.c b/drivers/infiniband/hw/nes/nes_mgt.c
+index b3b2a24..7bfaf1e 100644
+--- a/drivers/infiniband/hw/nes/nes_mgt.c
++++ b/drivers/infiniband/hw/nes/nes_mgt.c
+@@ -40,8 +40,8 @@
+ #include "nes.h"
+ #include "nes_mgt.h"
+
+-atomic_t pau_qps_created;
+-atomic_t pau_qps_destroyed;
++atomic_unchecked_t pau_qps_created;
++atomic_unchecked_t pau_qps_destroyed;
+
+ static void nes_replenish_mgt_rq(struct nes_vnic_mgt *mgtvnic)
+ {
+@@ -621,7 +621,7 @@ void nes_destroy_pau_qp(struct nes_device *nesdev, struct nes_qp *nesqp)
+ {
+ struct sk_buff *skb;
+ unsigned long flags;
+- atomic_inc(&pau_qps_destroyed);
++ atomic_inc_unchecked(&pau_qps_destroyed);
+
+ /* Free packets that have not yet been forwarded */
+ /* Lock is acquired by skb_dequeue when removing the skb */
+@@ -812,7 +812,7 @@ static void nes_mgt_ce_handler(struct nes_device *nesdev, struct nes_hw_nic_cq *
+ cq->cq_vbase[head].cqe_words[NES_NIC_CQE_HASH_RCVNXT]);
+ skb_queue_head_init(&nesqp->pau_list);
+ spin_lock_init(&nesqp->pau_lock);
+- atomic_inc(&pau_qps_created);
++ atomic_inc_unchecked(&pau_qps_created);
+ nes_change_quad_hash(nesdev, mgtvnic->nesvnic, nesqp);
+ }
diff --git a/drivers/infiniband/hw/nes/nes_nic.c b/drivers/infiniband/hw/nes/nes_nic.c
-index d3a1c41..2356add 100644
+index c00d2f3..8834298 100644
--- a/drivers/infiniband/hw/nes/nes_nic.c
+++ b/drivers/infiniband/hw/nes/nes_nic.c
-@@ -1274,31 +1274,31 @@ static void nes_netdev_get_ethtool_stats(struct net_device *netdev,
+@@ -1277,39 +1277,39 @@ static void nes_netdev_get_ethtool_stats(struct net_device *netdev,
target_stat_values[++index] = mh_detected;
target_stat_values[++index] = mh_pauses_sent;
target_stat_values[++index] = nesvnic->endnode_ipv4_tcp_retransmits;
@@ -29499,8 +30471,18 @@ index d3a1c41..2356add 100644
target_stat_values[++index] = nesadapter->free_4kpbl;
target_stat_values[++index] = nesadapter->free_256pbl;
target_stat_values[++index] = int_mod_timer_init;
+ target_stat_values[++index] = nesvnic->lro_mgr.stats.aggregated;
+ target_stat_values[++index] = nesvnic->lro_mgr.stats.flushed;
+ target_stat_values[++index] = nesvnic->lro_mgr.stats.no_desc;
+- target_stat_values[++index] = atomic_read(&pau_qps_created);
+- target_stat_values[++index] = atomic_read(&pau_qps_destroyed);
++ target_stat_values[++index] = atomic_read_unchecked(&pau_qps_created);
++ target_stat_values[++index] = atomic_read_unchecked(&pau_qps_destroyed);
+ }
+
+ /**
diff --git a/drivers/infiniband/hw/nes/nes_verbs.c b/drivers/infiniband/hw/nes/nes_verbs.c
-index 95ca93c..c992848 100644
+index 5095bc4..41e8fff 100644
--- a/drivers/infiniband/hw/nes/nes_verbs.c
+++ b/drivers/infiniband/hw/nes/nes_verbs.c
@@ -46,9 +46,9 @@
@@ -29516,7 +30498,7 @@ index 95ca93c..c992848 100644
static void nes_unregister_ofa_device(struct nes_ib_device *nesibdev);
-@@ -1141,7 +1141,7 @@ static struct ib_qp *nes_create_qp(struct ib_pd *ibpd,
+@@ -1131,7 +1131,7 @@ static struct ib_qp *nes_create_qp(struct ib_pd *ibpd,
if (init_attr->create_flags)
return ERR_PTR(-EINVAL);
@@ -29525,9 +30507,9 @@ index 95ca93c..c992848 100644
switch (init_attr->qp_type) {
case IB_QPT_RC:
if (nes_drv_opt & NES_DRV_OPT_NO_INLINE_DATA) {
-@@ -1470,7 +1470,7 @@ static int nes_destroy_qp(struct ib_qp *ibqp)
+@@ -1460,7 +1460,7 @@ static int nes_destroy_qp(struct ib_qp *ibqp)
struct iw_cm_event cm_event;
- int ret;
+ int ret = 0;
- atomic_inc(&sw_qps_destroyed);
+ atomic_inc_unchecked(&sw_qps_destroyed);
@@ -29535,7 +30517,7 @@ index 95ca93c..c992848 100644
/* Blow away the connection if it exists. */
diff --git a/drivers/infiniband/hw/qib/qib.h b/drivers/infiniband/hw/qib/qib.h
-index 769a1d9..7807648 100644
+index b881bdc..c2e360c 100644
--- a/drivers/infiniband/hw/qib/qib.h
+++ b/drivers/infiniband/hw/qib/qib.h
@@ -51,6 +51,7 @@
@@ -29547,7 +30529,7 @@ index 769a1d9..7807648 100644
#include "qib_common.h"
#include "qib_verbs.h"
diff --git a/drivers/input/gameport/gameport.c b/drivers/input/gameport/gameport.c
-index 5b8f59d..7f36886 100644
+index c351aa4..e6967c2 100644
--- a/drivers/input/gameport/gameport.c
+++ b/drivers/input/gameport/gameport.c
@@ -488,14 +488,14 @@ EXPORT_SYMBOL(gameport_set_phys);
@@ -29590,7 +30572,7 @@ index da38d97..2aa0b79 100644
error = device_add(&dev->dev);
if (error)
diff --git a/drivers/input/joystick/sidewinder.c b/drivers/input/joystick/sidewinder.c
-index b8d8611..15f8d2c 100644
+index b8d8611..7a4a04b 100644
--- a/drivers/input/joystick/sidewinder.c
+++ b/drivers/input/joystick/sidewinder.c
@@ -30,6 +30,7 @@
@@ -29601,20 +30583,11 @@ index b8d8611..15f8d2c 100644
#include <linux/init.h>
#include <linux/input.h>
#include <linux/gameport.h>
-@@ -428,6 +429,8 @@ static int sw_read(struct sw *sw)
- unsigned char buf[SW_LENGTH];
- int i;
-
-+ pax_track_stack();
-+
- i = sw_read_packet(sw->gameport, buf, sw->length, 0);
-
- if (sw->type == SW_ID_3DP && sw->length == 66 && i != 66) { /* Broken packet, try to fix */
diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c
-index 56abf3d..d8dd85d 100644
+index d728875..844c89b 100644
--- a/drivers/input/joystick/xpad.c
+++ b/drivers/input/joystick/xpad.c
-@@ -689,7 +689,7 @@ static void xpad_led_set(struct led_classdev *led_cdev,
+@@ -710,7 +710,7 @@ static void xpad_led_set(struct led_classdev *led_cdev,
static int xpad_led_probe(struct usb_xpad *xpad)
{
@@ -29623,7 +30596,7 @@ index 56abf3d..d8dd85d 100644
long led_no;
struct xpad_led *led;
struct led_classdev *led_cdev;
-@@ -702,7 +702,7 @@ static int xpad_led_probe(struct usb_xpad *xpad)
+@@ -723,7 +723,7 @@ static int xpad_led_probe(struct usb_xpad *xpad)
if (!led)
return -ENOMEM;
@@ -29722,13 +30695,13 @@ index db621db..825ea1a 100644
cs->tty = NULL;
cs->tty_dev = NULL;
diff --git a/drivers/isdn/gigaset/gigaset.h b/drivers/isdn/gigaset/gigaset.h
-index 6dd3607..b66e23e 100644
+index 212efaf..f187c6b 100644
--- a/drivers/isdn/gigaset/gigaset.h
+++ b/drivers/isdn/gigaset/gigaset.h
@@ -35,6 +35,7 @@
#include <linux/tty_driver.h>
#include <linux/list.h>
- #include <asm/atomic.h>
+ #include <linux/atomic.h>
+#include <asm/local.h>
#define GIG_VERSION {0, 5, 0, 0}
@@ -29743,10 +30716,10 @@ index 6dd3607..b66e23e 100644
struct tasklet_struct if_wake_tasklet;
unsigned control_state;
diff --git a/drivers/isdn/gigaset/interface.c b/drivers/isdn/gigaset/interface.c
-index e35058b..5898a8b 100644
+index ee0a549..a7c9798 100644
--- a/drivers/isdn/gigaset/interface.c
+++ b/drivers/isdn/gigaset/interface.c
-@@ -162,9 +162,7 @@ static int if_open(struct tty_struct *tty, struct file *filp)
+@@ -163,9 +163,7 @@ static int if_open(struct tty_struct *tty, struct file *filp)
}
tty->driver_data = cs;
@@ -29757,7 +30730,7 @@ index e35058b..5898a8b 100644
spin_lock_irqsave(&cs->lock, flags);
cs->tty = tty;
spin_unlock_irqrestore(&cs->lock, flags);
-@@ -192,10 +190,10 @@ static void if_close(struct tty_struct *tty, struct file *filp)
+@@ -193,10 +191,10 @@ static void if_close(struct tty_struct *tty, struct file *filp)
if (!cs->connected)
gig_dbg(DEBUG_IF, "not connected"); /* nothing to do */
@@ -29770,7 +30743,7 @@ index e35058b..5898a8b 100644
spin_lock_irqsave(&cs->lock, flags);
cs->tty = NULL;
spin_unlock_irqrestore(&cs->lock, flags);
-@@ -230,7 +228,7 @@ static int if_ioctl(struct tty_struct *tty,
+@@ -231,7 +229,7 @@ static int if_ioctl(struct tty_struct *tty,
if (!cs->connected) {
gig_dbg(DEBUG_IF, "not connected");
retval = -ENODEV;
@@ -29779,7 +30752,7 @@ index e35058b..5898a8b 100644
dev_warn(cs->dev, "%s: device not opened\n", __func__);
else {
retval = 0;
-@@ -360,7 +358,7 @@ static int if_write(struct tty_struct *tty, const unsigned char *buf, int count)
+@@ -361,7 +359,7 @@ static int if_write(struct tty_struct *tty, const unsigned char *buf, int count)
retval = -ENODEV;
goto done;
}
@@ -29788,7 +30761,7 @@ index e35058b..5898a8b 100644
dev_warn(cs->dev, "%s: device not opened\n", __func__);
retval = -ENODEV;
goto done;
-@@ -413,7 +411,7 @@ static int if_write_room(struct tty_struct *tty)
+@@ -414,7 +412,7 @@ static int if_write_room(struct tty_struct *tty)
if (!cs->connected) {
gig_dbg(DEBUG_IF, "not connected");
retval = -ENODEV;
@@ -29797,7 +30770,7 @@ index e35058b..5898a8b 100644
dev_warn(cs->dev, "%s: device not opened\n", __func__);
else if (cs->mstate != MS_LOCKED) {
dev_warn(cs->dev, "can't write to unlocked device\n");
-@@ -443,7 +441,7 @@ static int if_chars_in_buffer(struct tty_struct *tty)
+@@ -444,7 +442,7 @@ static int if_chars_in_buffer(struct tty_struct *tty)
if (!cs->connected)
gig_dbg(DEBUG_IF, "not connected");
@@ -29806,7 +30779,7 @@ index e35058b..5898a8b 100644
dev_warn(cs->dev, "%s: device not opened\n", __func__);
else if (cs->mstate != MS_LOCKED)
dev_warn(cs->dev, "can't write to unlocked device\n");
-@@ -471,7 +469,7 @@ static void if_throttle(struct tty_struct *tty)
+@@ -472,7 +470,7 @@ static void if_throttle(struct tty_struct *tty)
if (!cs->connected)
gig_dbg(DEBUG_IF, "not connected"); /* nothing to do */
@@ -29815,7 +30788,7 @@ index e35058b..5898a8b 100644
dev_warn(cs->dev, "%s: device not opened\n", __func__);
else
gig_dbg(DEBUG_IF, "%s: not implemented\n", __func__);
-@@ -495,7 +493,7 @@ static void if_unthrottle(struct tty_struct *tty)
+@@ -496,7 +494,7 @@ static void if_unthrottle(struct tty_struct *tty)
if (!cs->connected)
gig_dbg(DEBUG_IF, "not connected"); /* nothing to do */
@@ -29824,7 +30797,7 @@ index e35058b..5898a8b 100644
dev_warn(cs->dev, "%s: device not opened\n", __func__);
else
gig_dbg(DEBUG_IF, "%s: not implemented\n", __func__);
-@@ -526,7 +524,7 @@ static void if_set_termios(struct tty_struct *tty, struct ktermios *old)
+@@ -527,7 +525,7 @@ static void if_set_termios(struct tty_struct *tty, struct ktermios *old)
goto out;
}
@@ -29855,57 +30828,6 @@ index 2a57da59..e7a12ed 100644
return -EFAULT;
} else {
memcpy(buf, dp, left);
-diff --git a/drivers/isdn/hardware/eicon/capidtmf.c b/drivers/isdn/hardware/eicon/capidtmf.c
-index f130724..c373c68 100644
---- a/drivers/isdn/hardware/eicon/capidtmf.c
-+++ b/drivers/isdn/hardware/eicon/capidtmf.c
-@@ -498,6 +498,7 @@ void capidtmf_recv_block (t_capidtmf_state *p_state, byte *buffer, word leng
- byte goertzel_result_buffer[CAPIDTMF_RECV_TOTAL_FREQUENCY_COUNT];
- short windowed_sample_buffer[CAPIDTMF_RECV_WINDOWED_SAMPLES];
-
-+ pax_track_stack();
-
- if (p_state->recv.state & CAPIDTMF_RECV_STATE_DTMF_ACTIVE)
- {
-diff --git a/drivers/isdn/hardware/eicon/capifunc.c b/drivers/isdn/hardware/eicon/capifunc.c
-index 4d425c6..a9be6c4 100644
---- a/drivers/isdn/hardware/eicon/capifunc.c
-+++ b/drivers/isdn/hardware/eicon/capifunc.c
-@@ -1055,6 +1055,8 @@ static int divacapi_connect_didd(void)
- IDI_SYNC_REQ req;
- DESCRIPTOR DIDD_Table[MAX_DESCRIPTORS];
-
-+ pax_track_stack();
-+
- DIVA_DIDD_Read(DIDD_Table, sizeof(DIDD_Table));
-
- for (x = 0; x < MAX_DESCRIPTORS; x++) {
-diff --git a/drivers/isdn/hardware/eicon/diddfunc.c b/drivers/isdn/hardware/eicon/diddfunc.c
-index 3029234..ef0d9e2 100644
---- a/drivers/isdn/hardware/eicon/diddfunc.c
-+++ b/drivers/isdn/hardware/eicon/diddfunc.c
-@@ -54,6 +54,8 @@ static int DIVA_INIT_FUNCTION connect_didd(void)
- IDI_SYNC_REQ req;
- DESCRIPTOR DIDD_Table[MAX_DESCRIPTORS];
-
-+ pax_track_stack();
-+
- DIVA_DIDD_Read(DIDD_Table, sizeof(DIDD_Table));
-
- for (x = 0; x < MAX_DESCRIPTORS; x++) {
-diff --git a/drivers/isdn/hardware/eicon/divasfunc.c b/drivers/isdn/hardware/eicon/divasfunc.c
-index 0bbee78..a0d0a01 100644
---- a/drivers/isdn/hardware/eicon/divasfunc.c
-+++ b/drivers/isdn/hardware/eicon/divasfunc.c
-@@ -160,6 +160,8 @@ static int DIVA_INIT_FUNCTION connect_didd(void)
- IDI_SYNC_REQ req;
- DESCRIPTOR DIDD_Table[MAX_DESCRIPTORS];
-
-+ pax_track_stack();
-+
- DIVA_DIDD_Read(DIDD_Table, sizeof(DIDD_Table));
-
- for (x = 0; x < MAX_DESCRIPTORS; x++) {
diff --git a/drivers/isdn/hardware/eicon/divasync.h b/drivers/isdn/hardware/eicon/divasync.h
index 85784a7..a19ca98 100644
--- a/drivers/isdn/hardware/eicon/divasync.h
@@ -29919,72 +30841,6 @@ index 85784a7..a19ca98 100644
typedef struct _diva_didd_read_adapter_array {
void * buffer;
dword length;
-diff --git a/drivers/isdn/hardware/eicon/idifunc.c b/drivers/isdn/hardware/eicon/idifunc.c
-index db87d51..7d09acf 100644
---- a/drivers/isdn/hardware/eicon/idifunc.c
-+++ b/drivers/isdn/hardware/eicon/idifunc.c
-@@ -188,6 +188,8 @@ static int DIVA_INIT_FUNCTION connect_didd(void)
- IDI_SYNC_REQ req;
- DESCRIPTOR DIDD_Table[MAX_DESCRIPTORS];
-
-+ pax_track_stack();
-+
- DIVA_DIDD_Read(DIDD_Table, sizeof(DIDD_Table));
-
- for (x = 0; x < MAX_DESCRIPTORS; x++) {
-diff --git a/drivers/isdn/hardware/eicon/message.c b/drivers/isdn/hardware/eicon/message.c
-index a339598..b6a8bfc 100644
---- a/drivers/isdn/hardware/eicon/message.c
-+++ b/drivers/isdn/hardware/eicon/message.c
-@@ -4886,6 +4886,8 @@ static void sig_ind(PLCI *plci)
- dword d;
- word w;
-
-+ pax_track_stack();
-+
- a = plci->adapter;
- Id = ((word)plci->Id<<8)|a->Id;
- PUT_WORD(&SS_Ind[4],0x0000);
-@@ -7480,6 +7482,8 @@ static word add_b1(PLCI *plci, API_PARSE *bp, word b_channel_info,
- word j, n, w;
- dword d;
-
-+ pax_track_stack();
-+
-
- for(i=0;i<8;i++) bp_parms[i].length = 0;
- for(i=0;i<2;i++) global_config[i].length = 0;
-@@ -7954,6 +7958,8 @@ static word add_b23(PLCI *plci, API_PARSE *bp)
- const byte llc3[] = {4,3,2,2,6,6,0};
- const byte header[] = {0,2,3,3,0,0,0};
-
-+ pax_track_stack();
-+
- for(i=0;i<8;i++) bp_parms[i].length = 0;
- for(i=0;i<6;i++) b2_config_parms[i].length = 0;
- for(i=0;i<5;i++) b3_config_parms[i].length = 0;
-@@ -14741,6 +14747,8 @@ static void group_optimization(DIVA_CAPI_ADAPTER * a, PLCI * plci)
- word appl_number_group_type[MAX_APPL];
- PLCI *auxplci;
-
-+ pax_track_stack();
-+
- set_group_ind_mask (plci); /* all APPLs within this inc. call are allowed to dial in */
-
- if(!a->group_optimization_enabled)
-diff --git a/drivers/isdn/hardware/eicon/mntfunc.c b/drivers/isdn/hardware/eicon/mntfunc.c
-index a564b75..f3cf8b5 100644
---- a/drivers/isdn/hardware/eicon/mntfunc.c
-+++ b/drivers/isdn/hardware/eicon/mntfunc.c
-@@ -79,6 +79,8 @@ static int DIVA_INIT_FUNCTION connect_didd(void)
- IDI_SYNC_REQ req;
- DESCRIPTOR DIDD_Table[MAX_DESCRIPTORS];
-
-+ pax_track_stack();
-+
- DIVA_DIDD_Read(DIDD_Table, sizeof(DIDD_Table));
-
- for (x = 0; x < MAX_DESCRIPTORS; x++) {
diff --git a/drivers/isdn/hardware/eicon/xdi_adapter.h b/drivers/isdn/hardware/eicon/xdi_adapter.h
index a3bd163..8956575 100644
--- a/drivers/isdn/hardware/eicon/xdi_adapter.h
@@ -29998,19 +30854,6 @@ index a3bd163..8956575 100644
typedef struct _diva_os_xdi_adapter {
struct list_head link;
-diff --git a/drivers/isdn/i4l/isdn_common.c b/drivers/isdn/i4l/isdn_common.c
-index 6ed82ad..b05ac05 100644
---- a/drivers/isdn/i4l/isdn_common.c
-+++ b/drivers/isdn/i4l/isdn_common.c
-@@ -1286,6 +1286,8 @@ isdn_ioctl(struct file *file, uint cmd, ulong arg)
- } iocpar;
- void __user *argp = (void __user *)arg;
-
-+ pax_track_stack();
-+
- #define name iocpar.name
- #define bname iocpar.bname
- #define iocts iocpar.iocts
diff --git a/drivers/isdn/icn/icn.c b/drivers/isdn/icn/icn.c
index 1f355bb..43f1fea 100644
--- a/drivers/isdn/icn/icn.c
@@ -30025,7 +30868,7 @@ index 1f355bb..43f1fea 100644
} else
memcpy(msg, buf, count);
diff --git a/drivers/lguest/core.c b/drivers/lguest/core.c
-index efa2024..2e18d14 100644
+index b5fdcb7..5b6c59f 100644
--- a/drivers/lguest/core.c
+++ b/drivers/lguest/core.c
@@ -92,9 +92,17 @@ static __init int map_switcher(void)
@@ -30048,7 +30891,7 @@ index efa2024..2e18d14 100644
printk("lguest: could not map switcher pages high\n");
@@ -119,7 +127,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 <arch>_switcher.S).
+ * Copy in the compiled-in Switcher code (from x86/switcher_32.S).
*/
- memcpy(switcher_vma->addr, start_switcher_text,
+ memcpy(switcher_vma->addr, ktla_ktva(start_switcher_text),
@@ -30056,7 +30899,7 @@ index efa2024..2e18d14 100644
printk(KERN_INFO "lguest: mapped switcher at %p\n",
diff --git a/drivers/lguest/x86/core.c b/drivers/lguest/x86/core.c
-index 9f1659c..5352032 100644
+index 65af42f..530c87a 100644
--- a/drivers/lguest/x86/core.c
+++ b/drivers/lguest/x86/core.c
@@ -59,7 +59,7 @@ static struct {
@@ -30082,7 +30925,7 @@ index 9f1659c..5352032 100644
/*
* Set up the Guest's page tables to see this CPU's pages (and no
* other CPU's pages).
-@@ -547,7 +553,7 @@ void __init lguest_arch_host_init(void)
+@@ -472,7 +478,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++)
@@ -30091,7 +30934,7 @@ index 9f1659c..5352032 100644
/*
* Set up the Switcher's per-cpu areas.
-@@ -630,7 +636,7 @@ void __init lguest_arch_host_init(void)
+@@ -555,7 +561,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.
*/
@@ -30176,10 +31019,10 @@ index 4daf9e5..b8d1d0f 100644
.device = PCI_ANY_ID,
.subvendor = PCI_ANY_ID,
diff --git a/drivers/md/dm-ioctl.c b/drivers/md/dm-ioctl.c
-index 4cacdad..9b5929d 100644
+index 31c2dc2..a2de7a6 100644
--- a/drivers/md/dm-ioctl.c
+++ b/drivers/md/dm-ioctl.c
-@@ -1551,7 +1551,7 @@ static int validate_params(uint cmd, struct dm_ioctl *param)
+@@ -1589,7 +1589,7 @@ static int validate_params(uint cmd, struct dm_ioctl *param)
cmd == DM_LIST_VERSIONS_CMD)
return 0;
@@ -30307,10 +31150,10 @@ index 3d80cf0..b77cc47 100644
schedule_work(&sc->trigger_event);
}
diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c
-index ebdae6e..cc57e52 100644
+index 8e91321..fd17aef 100644
--- a/drivers/md/dm-table.c
+++ b/drivers/md/dm-table.c
-@@ -390,7 +390,7 @@ static int device_area_is_invalid(struct dm_target *ti, struct dm_dev *dev,
+@@ -391,7 +391,7 @@ static int device_area_is_invalid(struct dm_target *ti, struct dm_dev *dev,
if (!dev_size)
return 0;
@@ -30319,11 +31162,33 @@ index ebdae6e..cc57e52 100644
DMWARN("%s: %s too small for target: "
"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 59c4f04..4c7b661 100644
+--- a/drivers/md/dm-thin-metadata.c
++++ b/drivers/md/dm-thin-metadata.c
+@@ -431,7 +431,7 @@ static int init_pmd(struct dm_pool_metadata *pmd,
+
+ pmd->info.tm = tm;
+ pmd->info.levels = 2;
+- pmd->info.value_type.context = pmd->data_sm;
++ pmd->info.value_type.context = (dm_space_map_no_const *)pmd->data_sm;
+ pmd->info.value_type.size = sizeof(__le64);
+ pmd->info.value_type.inc = data_block_inc;
+ pmd->info.value_type.dec = data_block_dec;
+@@ -450,7 +450,7 @@ static int init_pmd(struct dm_pool_metadata *pmd,
+
+ pmd->bl_info.tm = tm;
+ pmd->bl_info.levels = 1;
+- pmd->bl_info.value_type.context = pmd->data_sm;
++ pmd->bl_info.value_type.context = (dm_space_map_no_const *)pmd->data_sm;
+ pmd->bl_info.value_type.size = sizeof(__le64);
+ 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 41abc6d..1c6194f 100644
+index 4720f68..78d1df7 100644
--- a/drivers/md/dm.c
+++ b/drivers/md/dm.c
-@@ -164,9 +164,9 @@ struct mapped_device {
+@@ -177,9 +177,9 @@ struct mapped_device {
/*
* Event handling.
*/
@@ -30335,7 +31200,7 @@ index 41abc6d..1c6194f 100644
struct list_head uevent_list;
spinlock_t uevent_lock; /* Protect access to uevent_list */
-@@ -1842,8 +1842,8 @@ static struct mapped_device *alloc_dev(int minor)
+@@ -1845,8 +1845,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);
@@ -30346,7 +31211,7 @@ index 41abc6d..1c6194f 100644
INIT_LIST_HEAD(&md->uevent_list);
spin_lock_init(&md->uevent_lock);
-@@ -1977,7 +1977,7 @@ static void event_callback(void *context)
+@@ -1980,7 +1980,7 @@ static void event_callback(void *context)
dm_send_uevents(&uevents, &disk_to_dev(md->disk)->kobj);
@@ -30355,7 +31220,7 @@ index 41abc6d..1c6194f 100644
wake_up(&md->eventq);
}
-@@ -2553,18 +2553,18 @@ int dm_kobject_uevent(struct mapped_device *md, enum kobject_action action,
+@@ -2622,18 +2622,18 @@ int dm_kobject_uevent(struct mapped_device *md, enum kobject_action action,
uint32_t dm_next_uevent_seq(struct mapped_device *md)
{
@@ -30378,32 +31243,32 @@ index 41abc6d..1c6194f 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 bc83428..f605840 100644
+index f47f1f8..b7f559e 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
-@@ -231,10 +231,10 @@ EXPORT_SYMBOL_GPL(bio_clone_mddev);
+@@ -278,10 +278,10 @@ EXPORT_SYMBOL_GPL(md_trim_bio);
* start build, activate spare
*/
static DECLARE_WAIT_QUEUE_HEAD(md_event_waiters);
-static atomic_t md_event_count;
+static atomic_unchecked_t md_event_count;
- void md_new_event(mddev_t *mddev)
+ void md_new_event(struct mddev *mddev)
{
- atomic_inc(&md_event_count);
+ atomic_inc_unchecked(&md_event_count);
wake_up(&md_event_waiters);
}
EXPORT_SYMBOL_GPL(md_new_event);
-@@ -244,7 +244,7 @@ EXPORT_SYMBOL_GPL(md_new_event);
+@@ -291,7 +291,7 @@ EXPORT_SYMBOL_GPL(md_new_event);
*/
- static void md_new_event_inintr(mddev_t *mddev)
+ static void md_new_event_inintr(struct mddev *mddev)
{
- atomic_inc(&md_event_count);
+ atomic_inc_unchecked(&md_event_count);
wake_up(&md_event_waiters);
}
-@@ -1475,7 +1475,7 @@ static int super_1_load(mdk_rdev_t *rdev, mdk_rdev_t *refdev, int minor_version)
+@@ -1525,7 +1525,7 @@ static int super_1_load(struct md_rdev *rdev, struct md_rdev *refdev, int minor_
rdev->preferred_minor = 0xffff;
rdev->data_offset = le64_to_cpu(sb->data_offset);
@@ -30412,7 +31277,7 @@ index bc83428..f605840 100644
rdev->sb_size = le32_to_cpu(sb->max_dev) * 2 + 256;
bmask = queue_logical_block_size(rdev->bdev->bd_disk->queue)-1;
-@@ -1653,7 +1653,7 @@ static void super_1_sync(mddev_t *mddev, mdk_rdev_t *rdev)
+@@ -1742,7 +1742,7 @@ static void super_1_sync(struct mddev *mddev, struct md_rdev *rdev)
else
sb->resync_offset = cpu_to_le64(0);
@@ -30421,16 +31286,16 @@ index bc83428..f605840 100644
sb->raid_disks = cpu_to_le32(mddev->raid_disks);
sb->size = cpu_to_le64(mddev->dev_sectors);
-@@ -2446,7 +2446,7 @@ __ATTR(state, S_IRUGO|S_IWUSR, state_show, state_store);
+@@ -2639,7 +2639,7 @@ __ATTR(state, S_IRUGO|S_IWUSR, state_show, state_store);
static ssize_t
- errors_show(mdk_rdev_t *rdev, char *page)
+ errors_show(struct md_rdev *rdev, char *page)
{
- return sprintf(page, "%d\n", atomic_read(&rdev->corrected_errors));
+ return sprintf(page, "%d\n", atomic_read_unchecked(&rdev->corrected_errors));
}
static ssize_t
-@@ -2455,7 +2455,7 @@ errors_store(mdk_rdev_t *rdev, const char *buf, size_t len)
+@@ -2648,7 +2648,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')) {
@@ -30439,9 +31304,9 @@ index bc83428..f605840 100644
return len;
}
return -EINVAL;
-@@ -2811,8 +2811,8 @@ void md_rdev_init(mdk_rdev_t *rdev)
- rdev->last_read_error.tv_sec = 0;
- rdev->last_read_error.tv_nsec = 0;
+@@ -3039,8 +3039,8 @@ int md_rdev_init(struct md_rdev *rdev)
+ rdev->sb_loaded = 0;
+ rdev->bb_page = NULL;
atomic_set(&rdev->nr_pending, 0);
- atomic_set(&rdev->read_errors, 0);
- atomic_set(&rdev->corrected_errors, 0);
@@ -30450,16 +31315,16 @@ index bc83428..f605840 100644
INIT_LIST_HEAD(&rdev->same_set);
init_waitqueue_head(&rdev->blocked_wait);
-@@ -6440,7 +6440,7 @@ static int md_seq_show(struct seq_file *seq, void *v)
+@@ -6683,7 +6683,7 @@ static int md_seq_show(struct seq_file *seq, void *v)
spin_unlock(&pers_lock);
seq_printf(seq, "\n");
-- mi->event = atomic_read(&md_event_count);
-+ mi->event = atomic_read_unchecked(&md_event_count);
+- seq->poll_event = atomic_read(&md_event_count);
++ seq->poll_event = atomic_read_unchecked(&md_event_count);
return 0;
}
if (v == (void*)2) {
-@@ -6529,7 +6529,7 @@ static int md_seq_show(struct seq_file *seq, void *v)
+@@ -6772,7 +6772,7 @@ static int md_seq_show(struct seq_file *seq, void *v)
chunk_kb ? "KB" : "B");
if (bitmap->file) {
seq_printf(seq, ", file: ");
@@ -30468,25 +31333,25 @@ index bc83428..f605840 100644
}
seq_printf(seq, "\n");
-@@ -6563,7 +6563,7 @@ static int md_seq_open(struct inode *inode, struct file *file)
- else {
- struct seq_file *p = file->private_data;
- p->private = mi;
-- mi->event = atomic_read(&md_event_count);
-+ mi->event = atomic_read_unchecked(&md_event_count);
- }
+@@ -6803,7 +6803,7 @@ static int md_seq_open(struct inode *inode, struct file *file)
+ return error;
+
+ seq = file->private_data;
+- seq->poll_event = atomic_read(&md_event_count);
++ seq->poll_event = atomic_read_unchecked(&md_event_count);
return error;
}
-@@ -6579,7 +6579,7 @@ static unsigned int mdstat_poll(struct file *filp, poll_table *wait)
+
+@@ -6817,7 +6817,7 @@ static unsigned int mdstat_poll(struct file *filp, poll_table *wait)
/* always allow read */
mask = POLLIN | POLLRDNORM;
-- if (mi->event != atomic_read(&md_event_count))
-+ if (mi->event != atomic_read_unchecked(&md_event_count))
+- if (seq->poll_event != atomic_read(&md_event_count))
++ if (seq->poll_event != atomic_read_unchecked(&md_event_count))
mask |= POLLERR | POLLPRI;
return mask;
}
-@@ -6623,7 +6623,7 @@ static int is_mddev_idle(mddev_t *mddev, int init)
+@@ -6861,7 +6861,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]) -
@@ -30496,10 +31361,10 @@ index bc83428..f605840 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 ce4e328..93770e9 100644
+index cf742d9..7c7c745 100644
--- a/drivers/md/md.h
+++ b/drivers/md/md.h
-@@ -97,13 +97,13 @@ struct mdk_rdev_s
+@@ -120,13 +120,13 @@ struct md_rdev {
* only maintained for arrays that
* support hot removal
*/
@@ -30515,7 +31380,7 @@ index ce4e328..93770e9 100644
* for reporting to userspace and storing
* in superblock.
*/
-@@ -344,7 +344,7 @@ static inline void rdev_dec_pending(mdk_rdev_t *rdev, mddev_t *mddev)
+@@ -410,7 +410,7 @@ static inline void rdev_dec_pending(struct md_rdev *rdev, struct mddev *mddev)
static inline void md_sync_acct(struct block_device *bdev, unsigned long nr_sectors)
{
@@ -30523,43 +31388,94 @@ index ce4e328..93770e9 100644
+ atomic_add_unchecked(nr_sectors, &bdev->bd_contains->bd_disk->sync_io);
}
- struct mdk_personality
+ struct md_personality
+diff --git a/drivers/md/persistent-data/dm-space-map-checker.c b/drivers/md/persistent-data/dm-space-map-checker.c
+index 50ed53b..4f29d7d 100644
+--- a/drivers/md/persistent-data/dm-space-map-checker.c
++++ b/drivers/md/persistent-data/dm-space-map-checker.c
+@@ -159,7 +159,7 @@ static void ca_destroy(struct count_array *ca)
+ /*----------------------------------------------------------------*/
+
+ struct sm_checker {
+- struct dm_space_map sm;
++ dm_space_map_no_const sm;
+
+ struct count_array old_counts;
+ struct count_array counts;
+diff --git a/drivers/md/persistent-data/dm-space-map-disk.c b/drivers/md/persistent-data/dm-space-map-disk.c
+index fc469ba..2d91555 100644
+--- a/drivers/md/persistent-data/dm-space-map-disk.c
++++ b/drivers/md/persistent-data/dm-space-map-disk.c
+@@ -23,7 +23,7 @@
+ * Space map interface.
+ */
+ struct sm_disk {
+- struct dm_space_map sm;
++ dm_space_map_no_const sm;
+
+ struct ll_disk ll;
+ struct ll_disk old_ll;
+diff --git a/drivers/md/persistent-data/dm-space-map-metadata.c b/drivers/md/persistent-data/dm-space-map-metadata.c
+index e89ae5e..062e4c2 100644
+--- a/drivers/md/persistent-data/dm-space-map-metadata.c
++++ b/drivers/md/persistent-data/dm-space-map-metadata.c
+@@ -43,7 +43,7 @@ struct block_op {
+ };
+
+ struct sm_metadata {
+- struct dm_space_map sm;
++ dm_space_map_no_const sm;
+
+ struct ll_disk ll;
+ struct ll_disk old_ll;
+diff --git a/drivers/md/persistent-data/dm-space-map.h b/drivers/md/persistent-data/dm-space-map.h
+index 1cbfc6b..56e1dbb 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);
+ };
++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 3a9e59f..6ffbdd3 100644
+index ede2461..9c4c691 100644
--- a/drivers/md/raid1.c
+++ b/drivers/md/raid1.c
-@@ -1263,7 +1263,7 @@ static int fix_sync_read_error(r1bio_t *r1_bio)
- rdev_dec_pending(rdev, mddev);
- md_error(mddev, rdev);
- } else
+@@ -1559,7 +1559,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)
- atomic_add(s, &rdev->corrected_errors);
+ atomic_add_unchecked(s, &rdev->corrected_errors);
}
- d = start;
- while (d != r1_bio->read_disk) {
-@@ -1492,7 +1492,7 @@ static void fix_read_error(conf_t *conf, int read_disk,
- /* Well, this device is dead */
- md_error(mddev, rdev);
- else {
+ sectors -= s;
+ sect += s;
+@@ -1772,7 +1772,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)) {
- atomic_add(s, &rdev->corrected_errors);
+ atomic_add_unchecked(s, &rdev->corrected_errors);
printk(KERN_INFO
"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 17cb6ab..f448b35 100644
+index 685ddf3..955b087 100644
--- a/drivers/md/raid10.c
+++ b/drivers/md/raid10.c
-@@ -1186,7 +1186,7 @@ static void end_sync_read(struct bio *bio, int error)
- if (test_bit(BIO_UPTODATE, &bio->bi_flags))
- set_bit(R10BIO_Uptodate, &r10_bio->state);
- else {
+@@ -1440,7 +1440,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
+ */
- atomic_add(r10_bio->sectors,
+ atomic_add_unchecked(r10_bio->sectors,
&conf->mirrors[d].rdev->corrected_errors);
- if (!test_bit(MD_RECOVERY_SYNC, &conf->mddev->recovery))
- md_error(r10_bio->mddev,
-@@ -1394,7 +1394,7 @@ static void check_decay_read_errors(mddev_t *mddev, mdk_rdev_t *rdev)
+
+ /* for reconstruct, we always reschedule after a read.
+@@ -1740,7 +1740,7 @@ static void check_decay_read_errors(struct mddev *mddev, struct md_rdev *rdev)
{
struct timespec cur_time_mon;
unsigned long hours_since_last;
@@ -30568,7 +31484,7 @@ index 17cb6ab..f448b35 100644
ktime_get_ts(&cur_time_mon);
-@@ -1416,9 +1416,9 @@ static void check_decay_read_errors(mddev_t *mddev, mdk_rdev_t *rdev)
+@@ -1762,9 +1762,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))
@@ -30579,8 +31495,8 @@ index 17cb6ab..f448b35 100644
+ atomic_set_unchecked(&rdev->read_errors, read_errors >> hours_since_last);
}
- /*
-@@ -1448,8 +1448,8 @@ static void fix_read_error(conf_t *conf, mddev_t *mddev, r10bio_t *r10_bio)
+ static int r10_sync_page_io(struct md_rdev *rdev, sector_t sector,
+@@ -1814,8 +1814,8 @@ static void fix_read_error(struct r10conf *conf, struct mddev *mddev, struct r10
return;
check_decay_read_errors(mddev, rdev);
@@ -30591,7 +31507,7 @@ index 17cb6ab..f448b35 100644
char b[BDEVNAME_SIZE];
bdevname(rdev->bdev, b);
-@@ -1457,7 +1457,7 @@ static void fix_read_error(conf_t *conf, mddev_t *mddev, r10bio_t *r10_bio)
+@@ -1823,7 +1823,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,
@@ -30600,29 +31516,25 @@ index 17cb6ab..f448b35 100644
printk(KERN_NOTICE
"md/raid10:%s: %s: Failing raid device\n",
mdname(mddev), b);
-@@ -1520,7 +1520,7 @@ static void fix_read_error(conf_t *conf, mddev_t *mddev, r10bio_t *r10_bio)
- test_bit(In_sync, &rdev->flags)) {
- atomic_inc(&rdev->nr_pending);
- rcu_read_unlock();
+@@ -1968,7 +1968,7 @@ static void fix_read_error(struct r10conf *conf, struct mddev *mddev, struct r10
+ (unsigned long long)(
+ sect + rdev->data_offset),
+ bdevname(rdev->bdev, b));
- atomic_add(s, &rdev->corrected_errors);
+ atomic_add_unchecked(s, &rdev->corrected_errors);
- if (sync_page_io(rdev,
- r10_bio->devs[sl].addr +
- sect,
+ }
+
+ rdev_dec_pending(rdev, mddev);
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
-index 1f6c68d..c384765 100644
+index 858fdbb..b2dac95 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
-@@ -550,7 +550,7 @@ static void ops_run_io(struct stripe_head *sh, struct stripe_head_state *s)
- bi->bi_next = NULL;
- if ((rw & WRITE) &&
- test_bit(R5_ReWrite, &sh->dev[i].flags))
-- atomic_add(STRIPE_SECTORS,
-+ atomic_add_unchecked(STRIPE_SECTORS,
- &rdev->corrected_errors);
- generic_make_request(bi);
- } else {
-@@ -1596,15 +1596,15 @@ static void raid5_end_read_request(struct bio * bi, int error)
+@@ -1610,19 +1610,19 @@ static void raid5_end_read_request(struct bio * bi, int error)
+ (unsigned long long)(sh->sector
+ + rdev->data_offset),
+ bdevname(rdev->bdev, b));
+- atomic_add(STRIPE_SECTORS, &rdev->corrected_errors);
++ atomic_add_unchecked(STRIPE_SECTORS, &rdev->corrected_errors);
clear_bit(R5_ReadError, &sh->dev[i].flags);
clear_bit(R5_ReWrite, &sh->dev[i].flags);
}
@@ -30639,71 +31551,35 @@ index 1f6c68d..c384765 100644
- atomic_inc(&rdev->read_errors);
+ atomic_inc_unchecked(&rdev->read_errors);
if (conf->mddev->degraded >= conf->max_degraded)
- printk_rl(KERN_WARNING
- "md/raid:%s: read error not correctable "
-@@ -1622,7 +1622,7 @@ static void raid5_end_read_request(struct bio * bi, int error)
- (unsigned long long)(sh->sector
- + rdev->data_offset),
- bdn);
+ printk_ratelimited(
+ KERN_WARNING
+@@ -1642,7 +1642,7 @@ static void raid5_end_read_request(struct bio * bi, int error)
+ (unsigned long long)(sh->sector
+ + rdev->data_offset),
+ bdn);
- else if (atomic_read(&rdev->read_errors)
+ else if (atomic_read_unchecked(&rdev->read_errors)
> conf->max_nr_stripes)
printk(KERN_WARNING
"md/raid:%s: Too many read errors, failing device %s.\n",
-@@ -1945,6 +1945,7 @@ static sector_t compute_blocknr(struct stripe_head *sh, int i, int previous)
- sector_t r_sector;
- struct stripe_head sh2;
-
-+ pax_track_stack();
-
- chunk_offset = sector_div(new_sector, sectors_per_chunk);
- stripe = new_sector;
-diff --git a/drivers/media/common/saa7146_hlp.c b/drivers/media/common/saa7146_hlp.c
-index 1d1d8d2..6c6837a 100644
---- a/drivers/media/common/saa7146_hlp.c
-+++ b/drivers/media/common/saa7146_hlp.c
-@@ -353,6 +353,8 @@ static void calculate_clipping_registers_rect(struct saa7146_dev *dev, struct sa
-
- int x[32], y[32], w[32], h[32];
-
-+ pax_track_stack();
-+
- /* clear out memory */
- memset(&line_list[0], 0x00, sizeof(u32)*32);
- memset(&pixel_list[0], 0x00, sizeof(u32)*32);
-diff --git a/drivers/media/dvb/dvb-core/dvb_ca_en50221.c b/drivers/media/dvb/dvb-core/dvb_ca_en50221.c
-index 7ea517b..252fe54 100644
---- a/drivers/media/dvb/dvb-core/dvb_ca_en50221.c
-+++ b/drivers/media/dvb/dvb-core/dvb_ca_en50221.c
-@@ -590,6 +590,8 @@ static int dvb_ca_en50221_read_data(struct dvb_ca_private *ca, int slot, u8 * eb
- u8 buf[HOST_LINK_BUF_SIZE];
- int i;
-
-+ pax_track_stack();
-+
- dprintk("%s\n", __func__);
-
- /* check if we have space for a link buf in the rx_buffer */
-@@ -1285,6 +1287,8 @@ static ssize_t dvb_ca_en50221_io_write(struct file *file,
- unsigned long timeout;
- int written;
-
-+ pax_track_stack();
-+
- dprintk("%s\n", __func__);
-
- /* Incoming packet has a 2 byte header. hdr[0] = slot_id, hdr[1] = connection_id */
+diff --git a/drivers/media/dvb/ddbridge/ddbridge-core.c b/drivers/media/dvb/ddbridge/ddbridge-core.c
+index ba9a643..e474ab5 100644
+--- a/drivers/media/dvb/ddbridge/ddbridge-core.c
++++ b/drivers/media/dvb/ddbridge/ddbridge-core.c
+@@ -1678,7 +1678,7 @@ static struct ddb_info ddb_v6 = {
+ .subvendor = _subvend, .subdevice = _subdev, \
+ .driver_data = (unsigned long)&_driverdata }
+
+-static const struct pci_device_id ddb_id_tbl[] __devinitdata = {
++static const struct pci_device_id ddb_id_tbl[] __devinitconst = {
+ DDB_ID(DDVID, 0x0002, DDVID, 0x0001, ddb_octopus),
+ DDB_ID(DDVID, 0x0003, DDVID, 0x0001, ddb_octopus),
+ DDB_ID(DDVID, 0x0003, DDVID, 0x0002, ddb_octopus_le),
diff --git a/drivers/media/dvb/dvb-core/dvb_demux.h b/drivers/media/dvb/dvb-core/dvb_demux.h
-index a7d876f..8fee34d 100644
+index a7d876f..8c21b61 100644
--- a/drivers/media/dvb/dvb-core/dvb_demux.h
+++ b/drivers/media/dvb/dvb-core/dvb_demux.h
-@@ -68,12 +68,12 @@ struct dvb_demux_feed {
- union {
- struct dmx_ts_feed ts;
- struct dmx_section_feed sec;
-- } feed;
-+ } __no_const feed;
-
+@@ -73,7 +73,7 @@ struct dvb_demux_feed {
union {
dmx_ts_cb ts;
dmx_section_cb sec;
@@ -30726,10 +31602,10 @@ index f732877..d38c35a 100644
int minor;
int id;
diff --git a/drivers/media/dvb/dvb-usb/cxusb.c b/drivers/media/dvb/dvb-usb/cxusb.c
-index acb5fb2..2413f1d 100644
+index 9f2a02c..5920f88 100644
--- a/drivers/media/dvb/dvb-usb/cxusb.c
+++ b/drivers/media/dvb/dvb-usb/cxusb.c
-@@ -1059,7 +1059,7 @@ static struct dib0070_config dib7070p_dib0070_config = {
+@@ -1069,7 +1069,7 @@ static struct dib0070_config dib7070p_dib0070_config = {
struct dib0700_adapter_state {
int (*set_param_save) (struct dvb_frontend *,
struct dvb_frontend_parameters *);
@@ -30738,34 +31614,8 @@ index acb5fb2..2413f1d 100644
static int dib7070_set_param_override(struct dvb_frontend *fe,
struct dvb_frontend_parameters *fep)
-diff --git a/drivers/media/dvb/dvb-usb/dib0700_core.c b/drivers/media/dvb/dvb-usb/dib0700_core.c
-index a224e94..503b76a 100644
---- a/drivers/media/dvb/dvb-usb/dib0700_core.c
-+++ b/drivers/media/dvb/dvb-usb/dib0700_core.c
-@@ -478,6 +478,8 @@ int dib0700_download_firmware(struct usb_device *udev, const struct firmware *fw
- if (!buf)
- return -ENOMEM;
-
-+ pax_track_stack();
-+
- while ((ret = dvb_usb_get_hexline(fw, &hx, &pos)) > 0) {
- deb_fwdata("writing to address 0x%08x (buffer: 0x%02x %02x)\n",
- hx.addr, hx.len, hx.chk);
-diff --git a/drivers/media/dvb/dvb-usb/dibusb.h b/drivers/media/dvb/dvb-usb/dibusb.h
-index e47c321..b18237b 100644
---- a/drivers/media/dvb/dvb-usb/dibusb.h
-+++ b/drivers/media/dvb/dvb-usb/dibusb.h
-@@ -97,7 +97,7 @@
- #define DIBUSB_IOCTL_CMD_DISABLE_STREAM 0x02
-
- struct dibusb_state {
-- struct dib_fe_xfer_ops ops;
-+ dib_fe_xfer_ops_no_const ops;
- int mt2060_present;
- u8 tuner_addr;
- };
diff --git a/drivers/media/dvb/dvb-usb/dw2102.c b/drivers/media/dvb/dvb-usb/dw2102.c
-index 058b231..183d2b3 100644
+index f103ec1..5e8968b 100644
--- a/drivers/media/dvb/dvb-usb/dw2102.c
+++ b/drivers/media/dvb/dvb-usb/dw2102.c
@@ -95,7 +95,7 @@ struct su3000_state {
@@ -30777,88 +31627,37 @@ index 058b231..183d2b3 100644
/* debug */
static int dvb_usb_dw2102_debug;
-diff --git a/drivers/media/dvb/dvb-usb/lmedm04.c b/drivers/media/dvb/dvb-usb/lmedm04.c
-index 37b1469..28a6f6f 100644
---- a/drivers/media/dvb/dvb-usb/lmedm04.c
-+++ b/drivers/media/dvb/dvb-usb/lmedm04.c
-@@ -742,6 +742,7 @@ static int lme2510_download_firmware(struct usb_device *dev,
- usb_control_msg(dev, usb_rcvctrlpipe(dev, 0),
- 0x06, 0x80, 0x0200, 0x00, data, 0x0109, 1000);
-
-+ pax_track_stack();
-
- data[0] = 0x8a;
- len_in = 1;
-@@ -764,6 +765,8 @@ static void lme_coldreset(struct usb_device *dev)
- int ret = 0, len_in;
- u8 data[512] = {0};
-
-+ pax_track_stack();
-+
- data[0] = 0x0a;
- len_in = 1;
- info("FRM Firmware Cold Reset");
diff --git a/drivers/media/dvb/frontends/dib3000.h b/drivers/media/dvb/frontends/dib3000.h
-index ba91735..547ac27 100644
+index 404f63a..4796533 100644
--- a/drivers/media/dvb/frontends/dib3000.h
+++ b/drivers/media/dvb/frontends/dib3000.h
-@@ -40,10 +40,11 @@ struct dib_fe_xfer_ops
+@@ -39,7 +39,7 @@ struct dib_fe_xfer_ops
+ int (*fifo_ctrl)(struct dvb_frontend *fe, int onoff);
int (*pid_ctrl)(struct dvb_frontend *fe, int index, int pid, int onoff);
int (*tuner_pass_ctrl)(struct dvb_frontend *fe, int onoff, u8 pll_ctrl);
- };
-+typedef struct dib_fe_xfer_ops __no_const dib_fe_xfer_ops_no_const;
+-};
++} __no_const;
#if defined(CONFIG_DVB_DIB3000MB) || (defined(CONFIG_DVB_DIB3000MB_MODULE) && defined(MODULE))
extern struct dvb_frontend* dib3000mb_attach(const struct dib3000_config* config,
-- struct i2c_adapter* i2c, struct dib_fe_xfer_ops *xfer_ops);
-+ struct i2c_adapter* i2c, dib_fe_xfer_ops_no_const *xfer_ops);
- #else
- static inline struct dvb_frontend* dib3000mb_attach(const struct dib3000_config* config,
- struct i2c_adapter* i2c, struct dib_fe_xfer_ops *xfer_ops)
-diff --git a/drivers/media/dvb/frontends/dib3000mb.c b/drivers/media/dvb/frontends/dib3000mb.c
-index e80c597..0fd3f2c 100644
---- a/drivers/media/dvb/frontends/dib3000mb.c
-+++ b/drivers/media/dvb/frontends/dib3000mb.c
-@@ -756,7 +756,7 @@ static int dib3000mb_tuner_pass_ctrl(struct dvb_frontend *fe, int onoff, u8 pll_
- static struct dvb_frontend_ops dib3000mb_ops;
-
- struct dvb_frontend* dib3000mb_attach(const struct dib3000_config* config,
-- struct i2c_adapter* i2c, struct dib_fe_xfer_ops *xfer_ops)
-+ struct i2c_adapter* i2c, dib_fe_xfer_ops_no_const *xfer_ops)
- {
- struct dib3000_state* state = NULL;
-
-diff --git a/drivers/media/dvb/frontends/mb86a16.c b/drivers/media/dvb/frontends/mb86a16.c
-index c283112..7f367a7 100644
---- a/drivers/media/dvb/frontends/mb86a16.c
-+++ b/drivers/media/dvb/frontends/mb86a16.c
-@@ -1060,6 +1060,8 @@ static int mb86a16_set_fe(struct mb86a16_state *state)
- int ret = -1;
- int sync;
-
-+ pax_track_stack();
-+
- dprintk(verbose, MB86A16_INFO, 1, "freq=%d Mhz, symbrt=%d Ksps", state->frequency, state->srate);
-
- fcp = 3000;
-diff --git a/drivers/media/dvb/frontends/or51211.c b/drivers/media/dvb/frontends/or51211.c
-index c709ce6..b3fe620 100644
---- a/drivers/media/dvb/frontends/or51211.c
-+++ b/drivers/media/dvb/frontends/or51211.c
-@@ -113,6 +113,8 @@ static int or51211_load_firmware (struct dvb_frontend* fe,
- u8 tudata[585];
- int i;
-
-+ pax_track_stack();
-+
- dprintk("Firmware is %zd bytes\n",fw->size);
+diff --git a/drivers/media/dvb/frontends/ds3000.c b/drivers/media/dvb/frontends/ds3000.c
+index 90bf573..e8463da 100644
+--- a/drivers/media/dvb/frontends/ds3000.c
++++ b/drivers/media/dvb/frontends/ds3000.c
+@@ -1210,7 +1210,7 @@ static int ds3000_set_frontend(struct dvb_frontend *fe,
+
+ for (i = 0; i < 30 ; i++) {
+ ds3000_read_status(fe, &status);
+- if (status && FE_HAS_LOCK)
++ if (status & FE_HAS_LOCK)
+ break;
- /* Get eprom data */
+ msleep(10);
diff --git a/drivers/media/dvb/ngene/ngene-cards.c b/drivers/media/dvb/ngene/ngene-cards.c
-index fcf4be9..6e5393b 100644
+index 0564192..75b16f5 100644
--- a/drivers/media/dvb/ngene/ngene-cards.c
+++ b/drivers/media/dvb/ngene/ngene-cards.c
-@@ -379,7 +379,7 @@ static struct ngene_info ngene_info_m780 = {
+@@ -477,7 +477,7 @@ static struct ngene_info ngene_info_m780 = {
/****************************************************************************/
@@ -30867,37 +31666,50 @@ index fcf4be9..6e5393b 100644
NGENE_ID(0x18c3, 0xabc3, ngene_info_cineS2),
NGENE_ID(0x18c3, 0xabc4, ngene_info_cineS2),
NGENE_ID(0x18c3, 0xdb01, ngene_info_satixS2),
-diff --git a/drivers/media/video/cx18/cx18-driver.c b/drivers/media/video/cx18/cx18-driver.c
-index 9e2f870..22e3a08 100644
---- a/drivers/media/video/cx18/cx18-driver.c
-+++ b/drivers/media/video/cx18/cx18-driver.c
-@@ -327,6 +327,8 @@ void cx18_read_eeprom(struct cx18 *cx, struct tveeprom *tv)
- struct i2c_client c;
- u8 eedata[256];
-
-+ pax_track_stack();
-+
- memset(&c, 0, sizeof(c));
- strlcpy(c.name, "cx18 tveeprom tmp", sizeof(c.name));
- c.adapter = &cx->i2c_adap[0];
-diff --git a/drivers/media/video/cx23885/cx23885-input.c b/drivers/media/video/cx23885/cx23885-input.c
-index e97cafd..33db7bc 100644
---- a/drivers/media/video/cx23885/cx23885-input.c
-+++ b/drivers/media/video/cx23885/cx23885-input.c
-@@ -53,6 +53,8 @@ static void cx23885_input_process_measurements(struct cx23885_dev *dev,
- bool handle = false;
- struct ir_raw_event ir_core_event[64];
-
-+ pax_track_stack();
-+
- do {
- num = 0;
- v4l2_subdev_call(dev->sd_ir, ir, rx_read, (u8 *) ir_core_event,
+diff --git a/drivers/media/radio/radio-cadet.c b/drivers/media/radio/radio-cadet.c
+index 16a089f..ab1667d 100644
+--- a/drivers/media/radio/radio-cadet.c
++++ b/drivers/media/radio/radio-cadet.c
+@@ -326,6 +326,8 @@ static ssize_t cadet_read(struct file *file, char __user *data, size_t count, lo
+ unsigned char readbuf[RDS_BUFFER];
+ int i = 0;
+
++ if (count > RDS_BUFFER)
++ return -EFAULT;
+ mutex_lock(&dev->lock);
+ if (dev->rdsstat == 0) {
+ dev->rdsstat = 1;
+diff --git a/drivers/media/rc/redrat3.c b/drivers/media/rc/redrat3.c
+index 61287fc..8b08712 100644
+--- a/drivers/media/rc/redrat3.c
++++ b/drivers/media/rc/redrat3.c
+@@ -905,7 +905,7 @@ static int redrat3_set_tx_carrier(struct rc_dev *dev, u32 carrier)
+ return carrier;
+ }
+
+-static int redrat3_transmit_ir(struct rc_dev *rcdev, int *txbuf, u32 n)
++static int redrat3_transmit_ir(struct rc_dev *rcdev, unsigned *txbuf, u32 n)
+ {
+ struct redrat3_dev *rr3 = rcdev->priv;
+ struct device *dev = rr3->dev;
+diff --git a/drivers/media/video/au0828/au0828.h b/drivers/media/video/au0828/au0828.h
+index 9cde353..8c6a1c3 100644
+--- a/drivers/media/video/au0828/au0828.h
++++ b/drivers/media/video/au0828/au0828.h
+@@ -191,7 +191,7 @@ struct au0828_dev {
+
+ /* I2C */
+ struct i2c_adapter i2c_adap;
+- struct i2c_algorithm i2c_algo;
++ i2c_algorithm_no_const i2c_algo;
+ struct i2c_client i2c_client;
+ u32 i2c_rc;
+
diff --git a/drivers/media/video/cx88/cx88-alsa.c b/drivers/media/video/cx88/cx88-alsa.c
-index 423c1af..1070601 100644
+index 68d1240..46b32eb 100644
--- a/drivers/media/video/cx88/cx88-alsa.c
+++ b/drivers/media/video/cx88/cx88-alsa.c
-@@ -764,7 +764,7 @@ static struct snd_kcontrol_new snd_cx88_alc_switch = {
+@@ -766,7 +766,7 @@ static struct snd_kcontrol_new snd_cx88_alc_switch = {
* Only boards with eeprom and byte 1 at eeprom=1 have it
*/
@@ -30906,56 +31718,21 @@ index 423c1af..1070601 100644
{0x14f1,0x8801,PCI_ANY_ID,PCI_ANY_ID,0,0,0},
{0x14f1,0x8811,PCI_ANY_ID,PCI_ANY_ID,0,0,0},
{0, }
-diff --git a/drivers/media/video/pvrusb2/pvrusb2-eeprom.c b/drivers/media/video/pvrusb2/pvrusb2-eeprom.c
-index 9515f3a..c9ecb85 100644
---- a/drivers/media/video/pvrusb2/pvrusb2-eeprom.c
-+++ b/drivers/media/video/pvrusb2/pvrusb2-eeprom.c
-@@ -120,6 +120,8 @@ int pvr2_eeprom_analyze(struct pvr2_hdw *hdw)
- u8 *eeprom;
- struct tveeprom tvdata;
-
-+ pax_track_stack();
-+
- memset(&tvdata,0,sizeof(tvdata));
-
- eeprom = pvr2_eeprom_fetch(hdw);
-diff --git a/drivers/media/video/saa7134/saa6752hs.c b/drivers/media/video/saa7134/saa6752hs.c
-index f9f29cc..5a2e330 100644
---- a/drivers/media/video/saa7134/saa6752hs.c
-+++ b/drivers/media/video/saa7134/saa6752hs.c
-@@ -682,6 +682,8 @@ static int saa6752hs_init(struct v4l2_subdev *sd, u32 leading_null_bytes)
- unsigned char localPAT[256];
- unsigned char localPMT[256];
-
-+ pax_track_stack();
-+
- /* Set video format - must be done first as it resets other settings */
- set_reg8(client, 0x41, h->video_format);
-
-diff --git a/drivers/media/video/saa7164/saa7164-cmd.c b/drivers/media/video/saa7164/saa7164-cmd.c
-index 62fac7f..f29e0b9 100644
---- a/drivers/media/video/saa7164/saa7164-cmd.c
-+++ b/drivers/media/video/saa7164/saa7164-cmd.c
-@@ -88,6 +88,8 @@ int saa7164_irq_dequeue(struct saa7164_dev *dev)
- u8 tmp[512];
- dprintk(DBGLVL_CMD, "%s()\n", __func__);
-
-+ pax_track_stack();
-+
- /* While any outstand message on the bus exists... */
- do {
-
-@@ -141,6 +143,8 @@ int saa7164_cmd_dequeue(struct saa7164_dev *dev)
- u8 tmp[512];
- dprintk(DBGLVL_CMD, "%s()\n", __func__);
-
-+ pax_track_stack();
-+
- while (loop) {
-
- struct tmComResInfo tRsp = { 0, 0, 0, 0, 0, 0 };
+diff --git a/drivers/media/video/pvrusb2/pvrusb2-hdw-internal.h b/drivers/media/video/pvrusb2/pvrusb2-hdw-internal.h
+index 305e6aa..0143317 100644
+--- a/drivers/media/video/pvrusb2/pvrusb2-hdw-internal.h
++++ b/drivers/media/video/pvrusb2/pvrusb2-hdw-internal.h
+@@ -196,7 +196,7 @@ struct pvr2_hdw {
+
+ /* I2C stuff */
+ struct i2c_adapter i2c_adap;
+- struct i2c_algorithm i2c_algo;
++ i2c_algorithm_no_const i2c_algo;
+ pvr2_i2c_func i2c_func[PVR2_I2C_FUNC_CNT];
+ int i2c_cx25840_hack_state;
+ int i2c_linked;
diff --git a/drivers/media/video/timblogiw.c b/drivers/media/video/timblogiw.c
-index fc611eb..45ccd26 100644
+index a0895bf..b7ebb1b 100644
--- a/drivers/media/video/timblogiw.c
+++ b/drivers/media/video/timblogiw.c
@@ -745,7 +745,7 @@ static int timblogiw_mmap(struct file *file, struct vm_area_struct *vma)
@@ -30967,37 +31744,20 @@ index fc611eb..45ccd26 100644
.vidioc_querycap = timblogiw_querycap,
.vidioc_enum_fmt_vid_cap = timblogiw_enum_fmt,
.vidioc_g_fmt_vid_cap = timblogiw_g_fmt,
-diff --git a/drivers/media/video/usbvision/usbvision-core.c b/drivers/media/video/usbvision/usbvision-core.c
-index f344411..6ae9974 100644
---- a/drivers/media/video/usbvision/usbvision-core.c
-+++ b/drivers/media/video/usbvision/usbvision-core.c
-@@ -707,6 +707,8 @@ static enum parse_state usbvision_parse_compress(struct usb_usbvision *usbvision
- unsigned char rv, gv, bv;
- static unsigned char *Y, *U, *V;
-
-+ pax_track_stack();
-+
- frame = usbvision->cur_frame;
- image_size = frame->frmwidth * frame->frmheight;
- if ((frame->v4l2_format.format == V4L2_PIX_FMT_YUV422P) ||
-diff --git a/drivers/media/video/videobuf-dma-sg.c b/drivers/media/video/videobuf-dma-sg.c
-index ddb8f4b..35fce12 100644
---- a/drivers/media/video/videobuf-dma-sg.c
-+++ b/drivers/media/video/videobuf-dma-sg.c
-@@ -606,6 +606,8 @@ void *videobuf_sg_alloc(size_t size)
- {
- struct videobuf_queue q;
-
-+ pax_track_stack();
-+
- /* Required to make generic handler to call __videobuf_alloc */
- q.int_ops = &sg_ops;
+@@ -767,7 +767,7 @@ static __devinitconst struct v4l2_ioctl_ops timblogiw_ioctl_ops = {
+ .vidioc_enum_framesizes = timblogiw_enum_framesizes,
+ };
+-static __devinitconst struct v4l2_file_operations timblogiw_fops = {
++static __devinitconst v4l2_file_operations_no_const timblogiw_fops = {
+ .owner = THIS_MODULE,
+ .open = timblogiw_open,
+ .release = timblogiw_close,
diff --git a/drivers/message/fusion/mptbase.c b/drivers/message/fusion/mptbase.c
-index 7956a10..f39232f 100644
+index e9c6a60..daf6a33 100644
--- a/drivers/message/fusion/mptbase.c
+++ b/drivers/message/fusion/mptbase.c
-@@ -6681,8 +6681,13 @@ static int mpt_iocinfo_proc_show(struct seq_file *m, void *v)
+@@ -6753,8 +6753,13 @@ static int mpt_iocinfo_proc_show(struct seq_file *m, void *v)
seq_printf(m, " MaxChainDepth = 0x%02x frames\n", ioc->facts.MaxChainDepth);
seq_printf(m, " MinBlockSize = 0x%02x bytes\n", 4*ioc->facts.BlockSize);
@@ -31012,10 +31772,10 @@ index 7956a10..f39232f 100644
* Rounding UP to nearest 4-kB boundary here...
*/
diff --git a/drivers/message/fusion/mptsas.c b/drivers/message/fusion/mptsas.c
-index 7596aec..f7ae9aa 100644
+index 9d95042..b808101 100644
--- a/drivers/message/fusion/mptsas.c
+++ b/drivers/message/fusion/mptsas.c
-@@ -439,6 +439,23 @@ mptsas_is_end_device(struct mptsas_devinfo * attached)
+@@ -446,6 +446,23 @@ mptsas_is_end_device(struct mptsas_devinfo * attached)
return 0;
}
@@ -31039,7 +31799,7 @@ index 7596aec..f7ae9aa 100644
/* no mutex */
static void
mptsas_port_delete(MPT_ADAPTER *ioc, struct mptsas_portinfo_details * port_details)
-@@ -477,23 +494,6 @@ mptsas_get_rphy(struct mptsas_phyinfo *phy_info)
+@@ -484,23 +501,6 @@ mptsas_get_rphy(struct mptsas_phyinfo *phy_info)
return NULL;
}
@@ -31064,10 +31824,10 @@ index 7596aec..f7ae9aa 100644
mptsas_get_port(struct mptsas_phyinfo *phy_info)
{
diff --git a/drivers/message/fusion/mptscsih.c b/drivers/message/fusion/mptscsih.c
-index a1d4ee6..341d381 100644
+index 0c3ced7..1fe34ec 100644
--- a/drivers/message/fusion/mptscsih.c
+++ b/drivers/message/fusion/mptscsih.c
-@@ -1268,15 +1268,16 @@ mptscsih_info(struct Scsi_Host *SChost)
+@@ -1270,15 +1270,16 @@ mptscsih_info(struct Scsi_Host *SChost)
h = shost_priv(SChost);
@@ -31092,19 +31852,6 @@ index a1d4ee6..341d381 100644
return h->info_kbuf;
}
-diff --git a/drivers/message/i2o/i2o_config.c b/drivers/message/i2o/i2o_config.c
-index 098de2b..fbb922c 100644
---- a/drivers/message/i2o/i2o_config.c
-+++ b/drivers/message/i2o/i2o_config.c
-@@ -781,6 +781,8 @@ static int i2o_cfg_passthru(unsigned long arg)
- struct i2o_message *msg;
- unsigned int iop;
-
-+ pax_track_stack();
-+
- if (get_user(iop, &cmd->iop) || get_user(user_msg, &cmd->msg))
- return -EFAULT;
-
diff --git a/drivers/message/i2o/i2o_proc.c b/drivers/message/i2o/i2o_proc.c
index 07dbeaf..5533142 100644
--- a/drivers/message/i2o/i2o_proc.c
@@ -31196,7 +31943,7 @@ index 07dbeaf..5533142 100644
return 0;
}
diff --git a/drivers/message/i2o/iop.c b/drivers/message/i2o/iop.c
-index 090d2a3..5f24ef8 100644
+index a8c08f3..155fe3d 100644
--- a/drivers/message/i2o/iop.c
+++ b/drivers/message/i2o/iop.c
@@ -111,10 +111,10 @@ u32 i2o_cntxt_list_add(struct i2o_controller * c, void *ptr)
@@ -31222,24 +31969,11 @@ index 090d2a3..5f24ef8 100644
INIT_LIST_HEAD(&c->context_list);
#endif
-diff --git a/drivers/mfd/ab3100-core.c b/drivers/mfd/ab3100-core.c
-index a20e1c4..4f57255 100644
---- a/drivers/mfd/ab3100-core.c
-+++ b/drivers/mfd/ab3100-core.c
-@@ -809,7 +809,7 @@ struct ab_family_id {
- char *name;
- };
-
--static const struct ab_family_id ids[] __devinitdata = {
-+static const struct ab_family_id ids[] __devinitconst = {
- /* AB3100 */
- {
- .id = 0xc0,
diff --git a/drivers/mfd/abx500-core.c b/drivers/mfd/abx500-core.c
-index f12720d..3c251fd 100644
+index 7ce65f4..e66e9bc 100644
--- a/drivers/mfd/abx500-core.c
+++ b/drivers/mfd/abx500-core.c
-@@ -14,7 +14,7 @@ static LIST_HEAD(abx500_list);
+@@ -15,7 +15,7 @@ static LIST_HEAD(abx500_list);
struct abx500_device_entry {
struct list_head list;
@@ -31260,64 +31994,51 @@ index 5c2a06a..8fa077c 100644
#include <linux/init.h>
#include <linux/pci.h>
#include <linux/interrupt.h>
-diff --git a/drivers/mfd/wm8350-i2c.c b/drivers/mfd/wm8350-i2c.c
-index 5fe5de1..af64f53 100644
---- a/drivers/mfd/wm8350-i2c.c
-+++ b/drivers/mfd/wm8350-i2c.c
-@@ -44,6 +44,8 @@ static int wm8350_i2c_write_device(struct wm8350 *wm8350, char reg,
- u8 msg[(WM8350_MAX_REGISTER << 1) + 1];
- int ret;
-
-+ pax_track_stack();
-+
- if (bytes > ((WM8350_MAX_REGISTER << 1) + 1))
- return -EINVAL;
-
diff --git a/drivers/misc/lis3lv02d/lis3lv02d.c b/drivers/misc/lis3lv02d/lis3lv02d.c
-index 8b51cd6..f628f8d 100644
+index 29d12a7..f900ba4 100644
--- a/drivers/misc/lis3lv02d/lis3lv02d.c
+++ b/drivers/misc/lis3lv02d/lis3lv02d.c
-@@ -437,7 +437,7 @@ static irqreturn_t lis302dl_interrupt(int irq, void *dummy)
+@@ -464,7 +464,7 @@ static irqreturn_t lis302dl_interrupt(int irq, void *data)
* the lid is closed. This leads to interrupts as soon as a little move
* is done.
*/
-- atomic_inc(&lis3_dev.count);
-+ atomic_inc_unchecked(&lis3_dev.count);
+- atomic_inc(&lis3->count);
++ atomic_inc_unchecked(&lis3->count);
- wake_up_interruptible(&lis3_dev.misc_wait);
- kill_fasync(&lis3_dev.async_queue, SIGIO, POLL_IN);
-@@ -520,7 +520,7 @@ static int lis3lv02d_misc_open(struct inode *inode, struct file *file)
- if (lis3_dev.pm_dev)
- pm_runtime_get_sync(lis3_dev.pm_dev);
+ wake_up_interruptible(&lis3->misc_wait);
+ kill_fasync(&lis3->async_queue, SIGIO, POLL_IN);
+@@ -550,7 +550,7 @@ static int lis3lv02d_misc_open(struct inode *inode, struct file *file)
+ if (lis3->pm_dev)
+ pm_runtime_get_sync(lis3->pm_dev);
-- atomic_set(&lis3_dev.count, 0);
-+ atomic_set_unchecked(&lis3_dev.count, 0);
+- atomic_set(&lis3->count, 0);
++ atomic_set_unchecked(&lis3->count, 0);
return 0;
}
-@@ -547,7 +547,7 @@ static ssize_t lis3lv02d_misc_read(struct file *file, char __user *buf,
- add_wait_queue(&lis3_dev.misc_wait, &wait);
+@@ -583,7 +583,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);
-- data = atomic_xchg(&lis3_dev.count, 0);
-+ data = atomic_xchg_unchecked(&lis3_dev.count, 0);
+- data = atomic_xchg(&lis3->count, 0);
++ data = atomic_xchg_unchecked(&lis3->count, 0);
if (data)
break;
-@@ -585,7 +585,7 @@ out:
- static unsigned int lis3lv02d_misc_poll(struct file *file, poll_table *wait)
- {
- poll_wait(file, &lis3_dev.misc_wait, wait);
-- if (atomic_read(&lis3_dev.count))
-+ if (atomic_read_unchecked(&lis3_dev.count))
+@@ -624,7 +624,7 @@ static unsigned int lis3lv02d_misc_poll(struct file *file, poll_table *wait)
+ struct lis3lv02d, miscdev);
+
+ poll_wait(file, &lis3->misc_wait, wait);
+- if (atomic_read(&lis3->count))
++ if (atomic_read_unchecked(&lis3->count))
return POLLIN | POLLRDNORM;
return 0;
}
diff --git a/drivers/misc/lis3lv02d/lis3lv02d.h b/drivers/misc/lis3lv02d/lis3lv02d.h
-index a193958..4d7ecd2 100644
+index 2b1482a..5d33616 100644
--- a/drivers/misc/lis3lv02d/lis3lv02d.h
+++ b/drivers/misc/lis3lv02d/lis3lv02d.h
-@@ -265,7 +265,7 @@ struct lis3lv02d {
+@@ -266,7 +266,7 @@ struct lis3lv02d {
struct input_polled_dev *idev; /* input device */
struct platform_device *pdev; /* platform device */
struct regulator_bulk_data regulators[2];
@@ -31427,31 +32148,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;
@@ -31503,10 +32199,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;
@@ -31599,10 +32318,10 @@ index 8d082b4..aa749ae 100644
/*
* Timer function to enforce the timelimit on the partition disengage.
diff --git a/drivers/mmc/host/sdhci-pci.c b/drivers/mmc/host/sdhci-pci.c
-index 936bbca..8ade4516 100644
+index 6878a94..fe5c5f1 100644
--- a/drivers/mmc/host/sdhci-pci.c
+++ b/drivers/mmc/host/sdhci-pci.c
-@@ -524,7 +524,7 @@ static const struct sdhci_pci_fixes sdhci_via = {
+@@ -673,7 +673,7 @@ static const struct sdhci_pci_fixes sdhci_via = {
.probe = via_probe,
};
@@ -31611,91 +32330,11 @@ index 936bbca..8ade4516 100644
{
.vendor = PCI_VENDOR_ID_RICOH,
.device = PCI_DEVICE_ID_RICOH_R5C822,
-diff --git a/drivers/mtd/chips/cfi_cmdset_0001.c b/drivers/mtd/chips/cfi_cmdset_0001.c
-index e1e122f..d99a6ea 100644
---- a/drivers/mtd/chips/cfi_cmdset_0001.c
-+++ b/drivers/mtd/chips/cfi_cmdset_0001.c
-@@ -757,6 +757,8 @@ static int chip_ready (struct map_info *map, struct flchip *chip, unsigned long
- struct cfi_pri_intelext *cfip = cfi->cmdset_priv;
- unsigned long timeo = jiffies + HZ;
-
-+ pax_track_stack();
-+
- /* Prevent setting state FL_SYNCING for chip in suspended state. */
- if (mode == FL_SYNCING && chip->oldstate != FL_READY)
- goto sleep;
-@@ -1653,6 +1655,8 @@ static int __xipram do_write_buffer(struct map_info *map, struct flchip *chip,
- unsigned long initial_adr;
- int initial_len = len;
-
-+ pax_track_stack();
-+
- wbufsize = cfi_interleave(cfi) << cfi->cfiq->MaxBufWriteSize;
- adr += chip->start;
- initial_adr = adr;
-@@ -1871,6 +1875,8 @@ static int __xipram do_erase_oneblock(struct map_info *map, struct flchip *chip,
- int retries = 3;
- int ret;
-
-+ pax_track_stack();
-+
- adr += chip->start;
-
- retry:
-diff --git a/drivers/mtd/chips/cfi_cmdset_0020.c b/drivers/mtd/chips/cfi_cmdset_0020.c
-index 179814a..abe9d60 100644
---- a/drivers/mtd/chips/cfi_cmdset_0020.c
-+++ b/drivers/mtd/chips/cfi_cmdset_0020.c
-@@ -255,6 +255,8 @@ static inline int do_read_onechip(struct map_info *map, struct flchip *chip, lof
- unsigned long cmd_addr;
- struct cfi_private *cfi = map->fldrv_priv;
-
-+ pax_track_stack();
-+
- adr += chip->start;
-
- /* Ensure cmd read/writes are aligned. */
-@@ -429,6 +431,8 @@ static inline int do_write_buffer(struct map_info *map, struct flchip *chip,
- DECLARE_WAITQUEUE(wait, current);
- int wbufsize, z;
-
-+ pax_track_stack();
-+
- /* M58LW064A requires bus alignment for buffer wriets -- saw */
- if (adr & (map_bankwidth(map)-1))
- return -EINVAL;
-@@ -743,6 +747,8 @@ static inline int do_erase_oneblock(struct map_info *map, struct flchip *chip, u
- DECLARE_WAITQUEUE(wait, current);
- int ret = 0;
-
-+ pax_track_stack();
-+
- adr += chip->start;
-
- /* Let's determine this according to the interleave only once */
-@@ -1048,6 +1054,8 @@ static inline int do_lock_oneblock(struct map_info *map, struct flchip *chip, un
- unsigned long timeo = jiffies + HZ;
- DECLARE_WAITQUEUE(wait, current);
-
-+ pax_track_stack();
-+
- adr += chip->start;
-
- /* Let's determine this according to the interleave only once */
-@@ -1197,6 +1205,8 @@ static inline int do_unlock_oneblock(struct map_info *map, struct flchip *chip,
- unsigned long timeo = jiffies + HZ;
- DECLARE_WAITQUEUE(wait, current);
-
-+ pax_track_stack();
-+
- adr += chip->start;
-
- /* Let's determine this according to the interleave only once */
diff --git a/drivers/mtd/devices/doc2000.c b/drivers/mtd/devices/doc2000.c
-index f7fbf60..9866457 100644
+index e9fad91..0a7a16a 100644
--- a/drivers/mtd/devices/doc2000.c
+++ b/drivers/mtd/devices/doc2000.c
-@@ -776,7 +776,7 @@ static int doc_write(struct mtd_info *mtd, loff_t to, size_t len,
+@@ -773,7 +773,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-
@@ -31705,10 +32344,10 @@ index f7fbf60..9866457 100644
"ECC needs a full sector write (adr: %lx size %lx)\n",
(long) to, (long) len);
diff --git a/drivers/mtd/devices/doc2001.c b/drivers/mtd/devices/doc2001.c
-index 241192f..d0c35a3 100644
+index a3f7a27..234016e 100644
--- a/drivers/mtd/devices/doc2001.c
+++ b/drivers/mtd/devices/doc2001.c
-@@ -393,7 +393,7 @@ static int doc_read (struct mtd_info *mtd, loff_t from, size_t len,
+@@ -392,7 +392,7 @@ static int doc_read (struct mtd_info *mtd, loff_t from, size_t len,
struct Nand *mychip = &this->chips[from >> (this->chipshift)];
/* Don't allow read past end of device */
@@ -31717,73 +32356,8 @@ index 241192f..d0c35a3 100644
return -EINVAL;
/* Don't allow a single read to cross a 512-byte block boundary */
-diff --git a/drivers/mtd/ftl.c b/drivers/mtd/ftl.c
-index 037b399..225a71d 100644
---- a/drivers/mtd/ftl.c
-+++ b/drivers/mtd/ftl.c
-@@ -474,6 +474,8 @@ static int copy_erase_unit(partition_t *part, uint16_t srcunit,
- loff_t offset;
- uint16_t srcunitswap = cpu_to_le16(srcunit);
-
-+ pax_track_stack();
-+
- eun = &part->EUNInfo[srcunit];
- xfer = &part->XferInfo[xferunit];
- DEBUG(2, "ftl_cs: copying block 0x%x to 0x%x\n",
-diff --git a/drivers/mtd/inftlcore.c b/drivers/mtd/inftlcore.c
-index d7592e6..31c505c 100644
---- a/drivers/mtd/inftlcore.c
-+++ b/drivers/mtd/inftlcore.c
-@@ -259,6 +259,8 @@ static u16 INFTL_foldchain(struct INFTLrecord *inftl, unsigned thisVUC, unsigned
- struct inftl_oob oob;
- size_t retlen;
-
-+ pax_track_stack();
-+
- DEBUG(MTD_DEBUG_LEVEL3, "INFTL: INFTL_foldchain(inftl=%p,thisVUC=%d,"
- "pending=%d)\n", inftl, thisVUC, pendingblock);
-
-diff --git a/drivers/mtd/inftlmount.c b/drivers/mtd/inftlmount.c
-index 104052e..6232be5 100644
---- a/drivers/mtd/inftlmount.c
-+++ b/drivers/mtd/inftlmount.c
-@@ -53,6 +53,8 @@ static int find_boot_record(struct INFTLrecord *inftl)
- struct INFTLPartition *ip;
- size_t retlen;
-
-+ pax_track_stack();
-+
- DEBUG(MTD_DEBUG_LEVEL3, "INFTL: find_boot_record(inftl=%p)\n", inftl);
-
- /*
-diff --git a/drivers/mtd/lpddr/qinfo_probe.c b/drivers/mtd/lpddr/qinfo_probe.c
-index dbfe17b..c7b0918 100644
---- a/drivers/mtd/lpddr/qinfo_probe.c
-+++ b/drivers/mtd/lpddr/qinfo_probe.c
-@@ -106,6 +106,8 @@ static int lpddr_pfow_present(struct map_info *map, struct lpddr_private *lpddr)
- {
- map_word pfow_val[4];
-
-+ pax_track_stack();
-+
- /* Check identification string */
- pfow_val[0] = map_read(map, map->pfow_base + PFOW_QUERY_STRING_P);
- pfow_val[1] = map_read(map, map->pfow_base + PFOW_QUERY_STRING_F);
-diff --git a/drivers/mtd/mtdchar.c b/drivers/mtd/mtdchar.c
-index 9f8658e..caf1155 100644
---- a/drivers/mtd/mtdchar.c
-+++ b/drivers/mtd/mtdchar.c
-@@ -554,6 +554,8 @@ static int mtd_ioctl(struct file *file, u_int cmd, u_long arg)
- u_long size;
- struct mtd_info_user info;
-
-+ pax_track_stack();
-+
- DEBUG(MTD_DEBUG_LEVEL0, "MTD_ioctl\n");
-
- size = (cmd & IOCSIZE_MASK) >> IOCSIZE_SHIFT;
diff --git a/drivers/mtd/nand/denali.c b/drivers/mtd/nand/denali.c
-index d527621..2491fab 100644
+index 3984d48..28aa897 100644
--- a/drivers/mtd/nand/denali.c
+++ b/drivers/mtd/nand/denali.c
@@ -26,6 +26,7 @@
@@ -31794,21 +32368,8 @@ index d527621..2491fab 100644
#include "denali.h"
-diff --git a/drivers/mtd/nftlcore.c b/drivers/mtd/nftlcore.c
-index b155666..611b801 100644
---- a/drivers/mtd/nftlcore.c
-+++ b/drivers/mtd/nftlcore.c
-@@ -264,6 +264,8 @@ static u16 NFTL_foldchain (struct NFTLrecord *nftl, unsigned thisVUC, unsigned p
- int inplace = 1;
- size_t retlen;
-
-+ pax_track_stack();
-+
- memset(BlockMap, 0xff, sizeof(BlockMap));
- memset(BlockFreeFound, 0, sizeof(BlockFreeFound));
-
diff --git a/drivers/mtd/nftlmount.c b/drivers/mtd/nftlmount.c
-index e3cd1ff..0ea79a3 100644
+index ac40925..483b753 100644
--- a/drivers/mtd/nftlmount.c
+++ b/drivers/mtd/nftlmount.c
@@ -24,6 +24,7 @@
@@ -31819,20 +32380,11 @@ index e3cd1ff..0ea79a3 100644
#include <linux/mtd/mtd.h>
#include <linux/mtd/nand.h>
#include <linux/mtd/nftl.h>
-@@ -45,6 +46,8 @@ static int find_boot_record(struct NFTLrecord *nftl)
- struct mtd_info *mtd = nftl->mbd.mtd;
- unsigned int i;
-
-+ pax_track_stack();
-+
- /* Assume logical EraseSize == physical erasesize for starting the scan.
- We'll sort it out later if we find a MediaHeader which says otherwise */
- /* Actually, we won't. The new DiskOnChip driver has already scanned
diff --git a/drivers/mtd/ubi/build.c b/drivers/mtd/ubi/build.c
-index 65626c1..e1c2102 100644
+index 6c3fb5a..c542a81 100644
--- a/drivers/mtd/ubi/build.c
+++ b/drivers/mtd/ubi/build.c
-@@ -1287,7 +1287,7 @@ module_exit(ubi_exit);
+@@ -1311,7 +1311,7 @@ module_exit(ubi_exit);
static int __init bytes_str_to_int(const char *str)
{
char *endp;
@@ -31841,7 +32393,7 @@ index 65626c1..e1c2102 100644
result = simple_strtoul(str, &endp, 0);
if (str == endp || result >= INT_MAX) {
-@@ -1298,11 +1298,11 @@ static int __init bytes_str_to_int(const char *str)
+@@ -1322,11 +1322,11 @@ static int __init bytes_str_to_int(const char *str)
switch (*endp) {
case 'G':
@@ -31856,7 +32408,7 @@ index 65626c1..e1c2102 100644
if (endp[1] == 'i' && endp[2] == 'B')
endp += 2;
case '\0':
-@@ -1313,7 +1313,13 @@ static int __init bytes_str_to_int(const char *str)
+@@ -1337,7 +1337,13 @@ static int __init bytes_str_to_int(const char *str)
return -EINVAL;
}
@@ -31871,11 +32423,11 @@ index 65626c1..e1c2102 100644
}
/**
-diff --git a/drivers/net/atlx/atl2.c b/drivers/net/atlx/atl2.c
-index 16249e9..6b7a15b 100644
---- a/drivers/net/atlx/atl2.c
-+++ b/drivers/net/atlx/atl2.c
-@@ -2840,7 +2840,7 @@ static void atl2_force_ps(struct atl2_hw *hw)
+diff --git a/drivers/net/ethernet/atheros/atlx/atl2.c b/drivers/net/ethernet/atheros/atlx/atl2.c
+index 1feae59..c2a61d2 100644
+--- a/drivers/net/ethernet/atheros/atlx/atl2.c
++++ b/drivers/net/ethernet/atheros/atlx/atl2.c
+@@ -2857,7 +2857,7 @@ static void atl2_force_ps(struct atl2_hw *hw)
*/
#define ATL2_PARAM(X, desc) \
@@ -31884,184 +32436,35 @@ index 16249e9..6b7a15b 100644
MODULE_PARM(X, "1-" __MODULE_STRING(ATL2_MAX_NIC) "i"); \
MODULE_PARM_DESC(X, desc);
#else
-diff --git a/drivers/net/bna/bfa_ioc_ct.c b/drivers/net/bna/bfa_ioc_ct.c
-index 87aecdf..ec23470 100644
---- a/drivers/net/bna/bfa_ioc_ct.c
-+++ b/drivers/net/bna/bfa_ioc_ct.c
-@@ -48,7 +48,21 @@ static void bfa_ioc_ct_sync_ack(struct bfa_ioc *ioc);
- static bool bfa_ioc_ct_sync_complete(struct bfa_ioc *ioc);
- static enum bfa_status bfa_ioc_ct_pll_init(void __iomem *rb, bool fcmode);
-
--static struct bfa_ioc_hwif nw_hwif_ct;
-+static struct bfa_ioc_hwif nw_hwif_ct = {
-+ .ioc_pll_init = bfa_ioc_ct_pll_init,
-+ .ioc_firmware_lock = bfa_ioc_ct_firmware_lock,
-+ .ioc_firmware_unlock = bfa_ioc_ct_firmware_unlock,
-+ .ioc_reg_init = bfa_ioc_ct_reg_init,
-+ .ioc_map_port = bfa_ioc_ct_map_port,
-+ .ioc_isr_mode_set = bfa_ioc_ct_isr_mode_set,
-+ .ioc_notify_fail = bfa_ioc_ct_notify_fail,
-+ .ioc_ownership_reset = bfa_ioc_ct_ownership_reset,
-+ .ioc_sync_start = bfa_ioc_ct_sync_start,
-+ .ioc_sync_join = bfa_ioc_ct_sync_join,
-+ .ioc_sync_leave = bfa_ioc_ct_sync_leave,
-+ .ioc_sync_ack = bfa_ioc_ct_sync_ack,
-+ .ioc_sync_complete = bfa_ioc_ct_sync_complete
-+};
-
- /**
- * Called from bfa_ioc_attach() to map asic specific calls.
-@@ -56,20 +70,6 @@ static struct bfa_ioc_hwif nw_hwif_ct;
- void
- bfa_nw_ioc_set_ct_hwif(struct bfa_ioc *ioc)
- {
-- nw_hwif_ct.ioc_pll_init = bfa_ioc_ct_pll_init;
-- nw_hwif_ct.ioc_firmware_lock = bfa_ioc_ct_firmware_lock;
-- nw_hwif_ct.ioc_firmware_unlock = bfa_ioc_ct_firmware_unlock;
-- nw_hwif_ct.ioc_reg_init = bfa_ioc_ct_reg_init;
-- nw_hwif_ct.ioc_map_port = bfa_ioc_ct_map_port;
-- nw_hwif_ct.ioc_isr_mode_set = bfa_ioc_ct_isr_mode_set;
-- nw_hwif_ct.ioc_notify_fail = bfa_ioc_ct_notify_fail;
-- nw_hwif_ct.ioc_ownership_reset = bfa_ioc_ct_ownership_reset;
-- nw_hwif_ct.ioc_sync_start = bfa_ioc_ct_sync_start;
-- nw_hwif_ct.ioc_sync_join = bfa_ioc_ct_sync_join;
-- nw_hwif_ct.ioc_sync_leave = bfa_ioc_ct_sync_leave;
-- nw_hwif_ct.ioc_sync_ack = bfa_ioc_ct_sync_ack;
-- nw_hwif_ct.ioc_sync_complete = bfa_ioc_ct_sync_complete;
--
- ioc->ioc_hwif = &nw_hwif_ct;
- }
-
-diff --git a/drivers/net/bna/bnad.c b/drivers/net/bna/bnad.c
-index 44e219c..7e9838d 100644
---- a/drivers/net/bna/bnad.c
-+++ b/drivers/net/bna/bnad.c
-@@ -1681,7 +1681,14 @@ bnad_setup_tx(struct bnad *bnad, uint tx_id)
- struct bna_intr_info *intr_info =
- &res_info[BNA_TX_RES_INTR_T_TXCMPL].res_u.intr_info;
- struct bna_tx_config *tx_config = &bnad->tx_config[tx_id];
-- struct bna_tx_event_cbfn tx_cbfn;
-+ static struct bna_tx_event_cbfn tx_cbfn = {
-+ /* Initialize the tx event handlers */
-+ .tcb_setup_cbfn = bnad_cb_tcb_setup,
-+ .tcb_destroy_cbfn = bnad_cb_tcb_destroy,
-+ .tx_stall_cbfn = bnad_cb_tx_stall,
-+ .tx_resume_cbfn = bnad_cb_tx_resume,
-+ .tx_cleanup_cbfn = bnad_cb_tx_cleanup
-+ };
- struct bna_tx *tx;
- unsigned long flags;
-
-@@ -1690,13 +1697,6 @@ bnad_setup_tx(struct bnad *bnad, uint tx_id)
- tx_config->txq_depth = bnad->txq_depth;
- tx_config->tx_type = BNA_TX_T_REGULAR;
-
-- /* Initialize the tx event handlers */
-- tx_cbfn.tcb_setup_cbfn = bnad_cb_tcb_setup;
-- tx_cbfn.tcb_destroy_cbfn = bnad_cb_tcb_destroy;
-- tx_cbfn.tx_stall_cbfn = bnad_cb_tx_stall;
-- tx_cbfn.tx_resume_cbfn = bnad_cb_tx_resume;
-- tx_cbfn.tx_cleanup_cbfn = bnad_cb_tx_cleanup;
--
- /* Get BNA's resource requirement for one tx object */
- spin_lock_irqsave(&bnad->bna_lock, flags);
- bna_tx_res_req(bnad->num_txq_per_tx,
-@@ -1827,21 +1827,21 @@ bnad_setup_rx(struct bnad *bnad, uint rx_id)
- struct bna_intr_info *intr_info =
- &res_info[BNA_RX_RES_T_INTR].res_u.intr_info;
- struct bna_rx_config *rx_config = &bnad->rx_config[rx_id];
-- struct bna_rx_event_cbfn rx_cbfn;
-+ static struct bna_rx_event_cbfn rx_cbfn = {
-+ /* Initialize the Rx event handlers */
-+ .rcb_setup_cbfn = bnad_cb_rcb_setup,
-+ .rcb_destroy_cbfn = bnad_cb_rcb_destroy,
-+ .ccb_setup_cbfn = bnad_cb_ccb_setup,
-+ .ccb_destroy_cbfn = bnad_cb_ccb_destroy,
-+ .rx_cleanup_cbfn = bnad_cb_rx_cleanup,
-+ .rx_post_cbfn = bnad_cb_rx_post
-+ };
- struct bna_rx *rx;
- unsigned long flags;
-
- /* Initialize the Rx object configuration */
- bnad_init_rx_config(bnad, rx_config);
-
-- /* Initialize the Rx event handlers */
-- rx_cbfn.rcb_setup_cbfn = bnad_cb_rcb_setup;
-- rx_cbfn.rcb_destroy_cbfn = bnad_cb_rcb_destroy;
-- rx_cbfn.ccb_setup_cbfn = bnad_cb_ccb_setup;
-- rx_cbfn.ccb_destroy_cbfn = bnad_cb_ccb_destroy;
-- rx_cbfn.rx_cleanup_cbfn = bnad_cb_rx_cleanup;
-- rx_cbfn.rx_post_cbfn = bnad_cb_rx_post;
--
- /* Get BNA's resource requirement for one Rx object */
- spin_lock_irqsave(&bnad->bna_lock, flags);
- bna_rx_res_req(rx_config, res_info);
-diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c
-index 74580bb..a293e8f 100644
---- a/drivers/net/bnx2.c
-+++ b/drivers/net/bnx2.c
-@@ -5831,6 +5831,8 @@ bnx2_test_nvram(struct bnx2 *bp)
- int rc = 0;
- u32 magic, csum;
-
-+ pax_track_stack();
-+
- if ((rc = bnx2_nvram_read(bp, 0, data, 4)) != 0)
- goto test_nvram_done;
-
-diff --git a/drivers/net/bnx2x/bnx2x_ethtool.c b/drivers/net/bnx2x/bnx2x_ethtool.c
-index 727fe89..1d404ee 100644
---- a/drivers/net/bnx2x/bnx2x_ethtool.c
-+++ b/drivers/net/bnx2x/bnx2x_ethtool.c
-@@ -1705,6 +1705,8 @@ static int bnx2x_test_nvram(struct bnx2x *bp)
- int i, rc;
- u32 magic, crc;
-
-+ pax_track_stack();
-+
- if (BP_NOMCP(bp))
- return 0;
-
-diff --git a/drivers/net/can/mscan/mscan.c b/drivers/net/can/mscan/mscan.c
-index 92feac6..4cc6f44 100644
---- a/drivers/net/can/mscan/mscan.c
-+++ b/drivers/net/can/mscan/mscan.c
-@@ -261,11 +261,13 @@ static netdev_tx_t mscan_start_xmit(struct sk_buff *skb, struct net_device *dev)
- void __iomem *data = &regs->tx.dsr1_0;
- u16 *payload = (u16 *)frame->data;
-
-- /* It is safe to write into dsr[dlc+1] */
-- for (i = 0; i < (frame->can_dlc + 1) / 2; i++) {
-+ for (i = 0; i < frame->can_dlc / 2; i++) {
- out_be16(data, *payload++);
- data += 2 + _MSCAN_RESERVED_DSR_SIZE;
- }
-+ /* write remaining byte if necessary */
-+ if (frame->can_dlc & 1)
-+ out_8(data, frame->data[frame->can_dlc - 1]);
- }
+diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.h b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.h
+index 9a517c2..a50cfcb 100644
+--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.h
++++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.h
+@@ -449,7 +449,7 @@ struct bnx2x_rx_mode_obj {
+
+ int (*wait_comp)(struct bnx2x *bp,
+ struct bnx2x_rx_mode_ramrod_params *p);
+-};
++} __no_const;
- out_8(&regs->tx.dlr, frame->can_dlc);
-@@ -330,10 +332,13 @@ static void mscan_get_rx_frame(struct net_device *dev, struct can_frame *frame)
- void __iomem *data = &regs->rx.dsr1_0;
- u16 *payload = (u16 *)frame->data;
+ /********************** Set multicast group ***********************************/
-- for (i = 0; i < (frame->can_dlc + 1) / 2; i++) {
-+ for (i = 0; i < frame->can_dlc / 2; i++) {
- *payload++ = in_be16(data);
- data += 2 + _MSCAN_RESERVED_DSR_SIZE;
- }
-+ /* read remaining byte if necessary */
-+ if (frame->can_dlc & 1)
-+ frame->data[frame->can_dlc - 1] = in_8(data);
- }
-
- out_8(&regs->canrflg, MSCAN_RXF);
-diff --git a/drivers/net/cxgb3/l2t.h b/drivers/net/cxgb3/l2t.h
-index c4dd066..f49b7cf 100644
---- a/drivers/net/cxgb3/l2t.h
-+++ b/drivers/net/cxgb3/l2t.h
+diff --git a/drivers/net/ethernet/broadcom/tg3.h b/drivers/net/ethernet/broadcom/tg3.h
+index 94b4bd0..73c02de 100644
+--- a/drivers/net/ethernet/broadcom/tg3.h
++++ b/drivers/net/ethernet/broadcom/tg3.h
+@@ -134,6 +134,7 @@
+ #define CHIPREV_ID_5750_A0 0x4000
+ #define CHIPREV_ID_5750_A1 0x4001
+ #define CHIPREV_ID_5750_A3 0x4003
++#define CHIPREV_ID_5750_C1 0x4201
+ #define CHIPREV_ID_5750_C2 0x4202
+ #define CHIPREV_ID_5752_A0_HW 0x5000
+ #define CHIPREV_ID_5752_A0 0x6000
+diff --git a/drivers/net/ethernet/chelsio/cxgb3/l2t.h b/drivers/net/ethernet/chelsio/cxgb3/l2t.h
+index c5f5479..2e8c260 100644
+--- a/drivers/net/ethernet/chelsio/cxgb3/l2t.h
++++ b/drivers/net/ethernet/chelsio/cxgb3/l2t.h
@@ -87,7 +87,7 @@ typedef void (*arp_failure_handler_func)(struct t3cdev * dev,
*/
struct l2t_skb_cb {
@@ -32071,71 +32474,132 @@ index c4dd066..f49b7cf 100644
#define L2T_SKB_CB(skb) ((struct l2t_skb_cb *)(skb)->cb)
-diff --git a/drivers/net/cxgb4/cxgb4_main.c b/drivers/net/cxgb4/cxgb4_main.c
-index 7e3cfbe..da1b61a 100644
---- a/drivers/net/cxgb4/cxgb4_main.c
-+++ b/drivers/net/cxgb4/cxgb4_main.c
-@@ -3396,6 +3396,8 @@ static int __devinit enable_msix(struct adapter *adap)
- unsigned int nchan = adap->params.nports;
- struct msix_entry entries[MAX_INGQ + 1];
+diff --git a/drivers/net/ethernet/dec/tulip/de4x5.c b/drivers/net/ethernet/dec/tulip/de4x5.c
+index 871bcaa..4043505 100644
+--- a/drivers/net/ethernet/dec/tulip/de4x5.c
++++ b/drivers/net/ethernet/dec/tulip/de4x5.c
+@@ -5397,7 +5397,7 @@ de4x5_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
+ for (i=0; i<ETH_ALEN; i++) {
+ tmp.addr[i] = dev->dev_addr[i];
+ }
+- if (copy_to_user(ioc->data, tmp.addr, ioc->len)) return -EFAULT;
++ if (ioc->len > sizeof tmp.addr || copy_to_user(ioc->data, tmp.addr, ioc->len)) return -EFAULT;
+ break;
-+ pax_track_stack();
-+
- for (i = 0; i < ARRAY_SIZE(entries); ++i)
- entries[i].entry = i;
+ case DE4X5_SET_HWADDR: /* Set the hardware address */
+@@ -5437,7 +5437,7 @@ de4x5_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
+ spin_lock_irqsave(&lp->lock, flags);
+ memcpy(&statbuf, &lp->pktStats, ioc->len);
+ spin_unlock_irqrestore(&lp->lock, flags);
+- if (copy_to_user(ioc->data, &statbuf, ioc->len))
++ if (ioc->len > sizeof statbuf || copy_to_user(ioc->data, &statbuf, ioc->len))
+ return -EFAULT;
+ break;
+ }
+diff --git a/drivers/net/ethernet/dec/tulip/eeprom.c b/drivers/net/ethernet/dec/tulip/eeprom.c
+index 14d5b61..1398636 100644
+--- a/drivers/net/ethernet/dec/tulip/eeprom.c
++++ b/drivers/net/ethernet/dec/tulip/eeprom.c
+@@ -79,7 +79,7 @@ static struct eeprom_fixup eeprom_fixups[] __devinitdata = {
+ {NULL}};
-diff --git a/drivers/net/cxgb4/t4_hw.c b/drivers/net/cxgb4/t4_hw.c
-index d1ec111..12735bc 100644
---- a/drivers/net/cxgb4/t4_hw.c
-+++ b/drivers/net/cxgb4/t4_hw.c
-@@ -362,6 +362,8 @@ static int get_vpd_params(struct adapter *adapter, struct vpd_params *p)
- u8 vpd[VPD_LEN], csum;
- unsigned int vpdr_len, kw_offset, id_len;
-+ pax_track_stack();
-+
- ret = pci_read_vpd(adapter->pdev, VPD_BASE, sizeof(vpd), vpd);
- if (ret < 0)
- return ret;
-diff --git a/drivers/net/e1000e/82571.c b/drivers/net/e1000e/82571.c
-index 8295f21..9a2a54b 100644
---- a/drivers/net/e1000e/82571.c
-+++ b/drivers/net/e1000e/82571.c
-@@ -239,7 +239,7 @@ static s32 e1000_init_mac_params_82571(struct e1000_adapter *adapter)
+-static const char *block_name[] __devinitdata = {
++static const char *block_name[] __devinitconst = {
+ "21140 non-MII",
+ "21140 MII PHY",
+ "21142 Serial PHY",
+diff --git a/drivers/net/ethernet/dec/tulip/winbond-840.c b/drivers/net/ethernet/dec/tulip/winbond-840.c
+index 4d01219..b58d26d 100644
+--- a/drivers/net/ethernet/dec/tulip/winbond-840.c
++++ b/drivers/net/ethernet/dec/tulip/winbond-840.c
+@@ -236,7 +236,7 @@ struct pci_id_info {
+ int drv_flags; /* Driver use, intended as capability flags. */
+ };
+
+-static const struct pci_id_info pci_id_tbl[] __devinitdata = {
++static const struct pci_id_info pci_id_tbl[] __devinitconst = {
+ { /* Sometime a Level-One switch card. */
+ "Winbond W89c840", CanHaveMII | HasBrokenTx | FDXOnNoMII},
+ { "Winbond W89c840", CanHaveMII | HasBrokenTx},
+diff --git a/drivers/net/ethernet/dlink/sundance.c b/drivers/net/ethernet/dlink/sundance.c
+index dcd7f7a..ecb7fb3 100644
+--- a/drivers/net/ethernet/dlink/sundance.c
++++ b/drivers/net/ethernet/dlink/sundance.c
+@@ -218,7 +218,7 @@ enum {
+ struct pci_id_info {
+ const char *name;
+ };
+-static const struct pci_id_info pci_id_tbl[] __devinitdata = {
++static const struct pci_id_info pci_id_tbl[] __devinitconst = {
+ {"D-Link DFE-550TX FAST Ethernet Adapter"},
+ {"D-Link DFE-550FX 100Mbps Fiber-optics Adapter"},
+ {"D-Link DFE-580TX 4 port Server Adapter"},
+diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c
+index bf266a0..e024af7 100644
+--- a/drivers/net/ethernet/emulex/benet/be_main.c
++++ b/drivers/net/ethernet/emulex/benet/be_main.c
+@@ -397,7 +397,7 @@ static void accumulate_16bit_val(u32 *acc, u16 val)
+
+ if (wrapped)
+ newacc += 65536;
+- ACCESS_ONCE(*acc) = newacc;
++ ACCESS_ONCE_RW(*acc) = newacc;
+ }
+
+ void be_parse_stats(struct be_adapter *adapter)
+diff --git a/drivers/net/ethernet/fealnx.c b/drivers/net/ethernet/fealnx.c
+index 61d2bdd..7f1154a 100644
+--- a/drivers/net/ethernet/fealnx.c
++++ b/drivers/net/ethernet/fealnx.c
+@@ -150,7 +150,7 @@ struct chip_info {
+ int flags;
+ };
+
+-static const struct chip_info skel_netdrv_tbl[] __devinitdata = {
++static const struct chip_info skel_netdrv_tbl[] __devinitconst = {
+ { "100/10M Ethernet PCI Adapter", HAS_MII_XCVR },
+ { "100/10M Ethernet PCI Adapter", HAS_CHIP_XCVR },
+ { "1000/100/10M Ethernet PCI Adapter", HAS_MII_XCVR },
+diff --git a/drivers/net/ethernet/intel/e1000e/80003es2lan.c b/drivers/net/ethernet/intel/e1000e/80003es2lan.c
+index e1159e5..e18684d 100644
+--- a/drivers/net/ethernet/intel/e1000e/80003es2lan.c
++++ b/drivers/net/ethernet/intel/e1000e/80003es2lan.c
+@@ -205,7 +205,7 @@ static s32 e1000_init_mac_params_80003es2lan(struct e1000_adapter *adapter)
{
struct e1000_hw *hw = &adapter->hw;
struct e1000_mac_info *mac = &hw->mac;
- struct e1000_mac_operations *func = &mac->ops;
+ e1000_mac_operations_no_const *func = &mac->ops;
- u32 swsm = 0;
- u32 swsm2 = 0;
- bool force_clear_smbi = false;
-diff --git a/drivers/net/e1000e/es2lan.c b/drivers/net/e1000e/es2lan.c
-index f4bbeb2..e0c338a 100644
---- a/drivers/net/e1000e/es2lan.c
-+++ b/drivers/net/e1000e/es2lan.c
-@@ -205,7 +205,7 @@ static s32 e1000_init_mac_params_80003es2lan(struct e1000_adapter *adapter)
+
+ /* Set media type */
+ switch (adapter->pdev->device) {
+diff --git a/drivers/net/ethernet/intel/e1000e/82571.c b/drivers/net/ethernet/intel/e1000e/82571.c
+index a3e65fd..f451444 100644
+--- a/drivers/net/ethernet/intel/e1000e/82571.c
++++ b/drivers/net/ethernet/intel/e1000e/82571.c
+@@ -239,7 +239,7 @@ static s32 e1000_init_mac_params_82571(struct e1000_adapter *adapter)
{
struct e1000_hw *hw = &adapter->hw;
struct e1000_mac_info *mac = &hw->mac;
- struct e1000_mac_operations *func = &mac->ops;
+ e1000_mac_operations_no_const *func = &mac->ops;
-
- /* Set media type */
- switch (adapter->pdev->device) {
-diff --git a/drivers/net/e1000e/hw.h b/drivers/net/e1000e/hw.h
-index 6c2fa83..268930d 100644
---- a/drivers/net/e1000e/hw.h
-+++ b/drivers/net/e1000e/hw.h
-@@ -776,6 +776,7 @@ struct e1000_mac_operations {
+ u32 swsm = 0;
+ u32 swsm2 = 0;
+ bool force_clear_smbi = false;
+diff --git a/drivers/net/ethernet/intel/e1000e/hw.h b/drivers/net/ethernet/intel/e1000e/hw.h
+index 2967039..ca8c40c 100644
+--- a/drivers/net/ethernet/intel/e1000e/hw.h
++++ b/drivers/net/ethernet/intel/e1000e/hw.h
+@@ -778,6 +778,7 @@ struct e1000_mac_operations {
void (*write_vfta)(struct e1000_hw *, u32, u32);
s32 (*read_mac_addr)(struct e1000_hw *);
};
+typedef struct e1000_mac_operations __no_const e1000_mac_operations_no_const;
- /* Function pointers for the PHY. */
- struct e1000_phy_operations {
-@@ -799,6 +800,7 @@ struct e1000_phy_operations {
+ /*
+ * When to use various PHY register access functions:
+@@ -818,6 +819,7 @@ struct e1000_phy_operations {
void (*power_up)(struct e1000_hw *);
void (*power_down)(struct e1000_hw *);
};
@@ -32143,7 +32607,7 @@ index 6c2fa83..268930d 100644
/* Function pointers for the NVM. */
struct e1000_nvm_operations {
-@@ -810,9 +812,10 @@ struct e1000_nvm_operations {
+@@ -829,9 +831,10 @@ struct e1000_nvm_operations {
s32 (*validate)(struct e1000_hw *);
s32 (*write)(struct e1000_hw *, u16, u16, u16 *);
};
@@ -32155,7 +32619,7 @@ index 6c2fa83..268930d 100644
u8 addr[ETH_ALEN];
u8 perm_addr[ETH_ALEN];
-@@ -853,7 +856,7 @@ struct e1000_mac_info {
+@@ -872,7 +875,7 @@ struct e1000_mac_info {
};
struct e1000_phy_info {
@@ -32164,7 +32628,7 @@ index 6c2fa83..268930d 100644
enum e1000_phy_type type;
-@@ -887,7 +890,7 @@ struct e1000_phy_info {
+@@ -906,7 +909,7 @@ struct e1000_phy_info {
};
struct e1000_nvm_info {
@@ -32173,36 +32637,10 @@ index 6c2fa83..268930d 100644
enum e1000_nvm_type type;
enum e1000_nvm_override override;
-diff --git a/drivers/net/fealnx.c b/drivers/net/fealnx.c
-index dd54abe..fafe1ed2 100644
---- a/drivers/net/fealnx.c
-+++ b/drivers/net/fealnx.c
-@@ -150,7 +150,7 @@ struct chip_info {
- int flags;
- };
-
--static const struct chip_info skel_netdrv_tbl[] __devinitdata = {
-+static const struct chip_info skel_netdrv_tbl[] __devinitconst = {
- { "100/10M Ethernet PCI Adapter", HAS_MII_XCVR },
- { "100/10M Ethernet PCI Adapter", HAS_CHIP_XCVR },
- { "1000/100/10M Ethernet PCI Adapter", HAS_MII_XCVR },
-diff --git a/drivers/net/hamradio/6pack.c b/drivers/net/hamradio/6pack.c
-index 0d28378..816c05c 100644
---- a/drivers/net/hamradio/6pack.c
-+++ b/drivers/net/hamradio/6pack.c
-@@ -463,6 +463,8 @@ static void sixpack_receive_buf(struct tty_struct *tty,
- unsigned char buf[512];
- int count1;
-
-+ pax_track_stack();
-+
- if (!count)
- return;
-
-diff --git a/drivers/net/igb/e1000_hw.h b/drivers/net/igb/e1000_hw.h
-index 27153e8..c83eccc 100644
---- a/drivers/net/igb/e1000_hw.h
-+++ b/drivers/net/igb/e1000_hw.h
+diff --git a/drivers/net/ethernet/intel/igb/e1000_hw.h b/drivers/net/ethernet/intel/igb/e1000_hw.h
+index 4519a13..f97fcd0 100644
+--- a/drivers/net/ethernet/intel/igb/e1000_hw.h
++++ b/drivers/net/ethernet/intel/igb/e1000_hw.h
@@ -314,6 +314,7 @@ struct e1000_mac_operations {
s32 (*read_mac_addr)(struct e1000_hw *);
s32 (*get_speed_and_duplex)(struct e1000_hw *, u16 *, u16 *);
@@ -32271,10 +32709,10 @@ index 27153e8..c83eccc 100644
struct e1000_mbx_stats stats;
u32 timeout;
u32 usec_delay;
-diff --git a/drivers/net/igbvf/vf.h b/drivers/net/igbvf/vf.h
+diff --git a/drivers/net/ethernet/intel/igbvf/vf.h b/drivers/net/ethernet/intel/igbvf/vf.h
index d7ed58f..64cde36 100644
---- a/drivers/net/igbvf/vf.h
-+++ b/drivers/net/igbvf/vf.h
+--- a/drivers/net/ethernet/intel/igbvf/vf.h
++++ b/drivers/net/ethernet/intel/igbvf/vf.h
@@ -189,9 +189,10 @@ struct e1000_mac_operations {
s32 (*read_mac_addr)(struct e1000_hw *);
s32 (*set_vfta)(struct e1000_hw *, u16, bool);
@@ -32304,38 +32742,11 @@ index d7ed58f..64cde36 100644
struct e1000_mbx_stats stats;
u32 timeout;
u32 usec_delay;
-diff --git a/drivers/net/ixgb/ixgb_main.c b/drivers/net/ixgb/ixgb_main.c
-index 6a130eb..1aeb9e4 100644
---- a/drivers/net/ixgb/ixgb_main.c
-+++ b/drivers/net/ixgb/ixgb_main.c
-@@ -1070,6 +1070,8 @@ ixgb_set_multi(struct net_device *netdev)
- u32 rctl;
- int i;
-
-+ pax_track_stack();
-+
- /* Check for Promiscuous and All Multicast modes */
-
- rctl = IXGB_READ_REG(hw, RCTL);
-diff --git a/drivers/net/ixgb/ixgb_param.c b/drivers/net/ixgb/ixgb_param.c
-index dd7fbeb..44b9bbf 100644
---- a/drivers/net/ixgb/ixgb_param.c
-+++ b/drivers/net/ixgb/ixgb_param.c
-@@ -261,6 +261,9 @@ void __devinit
- ixgb_check_options(struct ixgb_adapter *adapter)
- {
- int bd = adapter->bd_number;
-+
-+ pax_track_stack();
-+
- if (bd >= IXGB_MAX_NIC) {
- pr_notice("Warning: no configuration for board #%i\n", bd);
- pr_notice("Using defaults for all values\n");
-diff --git a/drivers/net/ixgbe/ixgbe_type.h b/drivers/net/ixgbe/ixgbe_type.h
-index fa43f25..4ead8f7 100644
---- a/drivers/net/ixgbe/ixgbe_type.h
-+++ b/drivers/net/ixgbe/ixgbe_type.h
-@@ -2584,6 +2584,7 @@ struct ixgbe_eeprom_operations {
+diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_type.h b/drivers/net/ethernet/intel/ixgbe/ixgbe_type.h
+index 6c5cca8..de8ef63 100644
+--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_type.h
++++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_type.h
+@@ -2708,6 +2708,7 @@ struct ixgbe_eeprom_operations {
s32 (*update_checksum)(struct ixgbe_hw *);
u16 (*calc_checksum)(struct ixgbe_hw *);
};
@@ -32343,15 +32754,15 @@ index fa43f25..4ead8f7 100644
struct ixgbe_mac_operations {
s32 (*init_hw)(struct ixgbe_hw *);
-@@ -2639,6 +2640,7 @@ struct ixgbe_mac_operations {
- /* Flow Control */
- s32 (*fc_enable)(struct ixgbe_hw *, s32);
+@@ -2769,6 +2770,7 @@ struct ixgbe_mac_operations {
+ /* Manageability interface */
+ s32 (*set_fw_drv_ver)(struct ixgbe_hw *, u8, u8, u8, u8);
};
+typedef struct ixgbe_mac_operations __no_const ixgbe_mac_operations_no_const;
struct ixgbe_phy_operations {
s32 (*identify)(struct ixgbe_hw *);
-@@ -2658,9 +2660,10 @@ struct ixgbe_phy_operations {
+@@ -2788,9 +2790,10 @@ struct ixgbe_phy_operations {
s32 (*write_i2c_eeprom)(struct ixgbe_hw *, u8, u8);
s32 (*check_overtemp)(struct ixgbe_hw *);
};
@@ -32363,7 +32774,7 @@ index fa43f25..4ead8f7 100644
enum ixgbe_eeprom_type type;
u32 semaphore_delay;
u16 word_size;
-@@ -2670,7 +2673,7 @@ struct ixgbe_eeprom_info {
+@@ -2800,7 +2803,7 @@ struct ixgbe_eeprom_info {
#define IXGBE_FLAGS_DOUBLE_RESET_REQUIRED 0x01
struct ixgbe_mac_info {
@@ -32372,7 +32783,7 @@ index fa43f25..4ead8f7 100644
enum ixgbe_mac_type type;
u8 addr[IXGBE_ETH_LENGTH_OF_ADDRESS];
u8 perm_addr[IXGBE_ETH_LENGTH_OF_ADDRESS];
-@@ -2698,7 +2701,7 @@ struct ixgbe_mac_info {
+@@ -2828,7 +2831,7 @@ struct ixgbe_mac_info {
};
struct ixgbe_phy_info {
@@ -32381,7 +32792,7 @@ index fa43f25..4ead8f7 100644
struct mdio_if_info mdio;
enum ixgbe_phy_type type;
u32 id;
-@@ -2726,6 +2729,7 @@ struct ixgbe_mbx_operations {
+@@ -2856,6 +2859,7 @@ struct ixgbe_mbx_operations {
s32 (*check_for_ack)(struct ixgbe_hw *, u16);
s32 (*check_for_rst)(struct ixgbe_hw *, u16);
};
@@ -32389,7 +32800,7 @@ index fa43f25..4ead8f7 100644
struct ixgbe_mbx_stats {
u32 msgs_tx;
-@@ -2737,7 +2741,7 @@ struct ixgbe_mbx_stats {
+@@ -2867,7 +2871,7 @@ struct ixgbe_mbx_stats {
};
struct ixgbe_mbx_info {
@@ -32398,10 +32809,10 @@ index fa43f25..4ead8f7 100644
struct ixgbe_mbx_stats stats;
u32 timeout;
u32 usec_delay;
-diff --git a/drivers/net/ixgbevf/vf.h b/drivers/net/ixgbevf/vf.h
+diff --git a/drivers/net/ethernet/intel/ixgbevf/vf.h b/drivers/net/ethernet/intel/ixgbevf/vf.h
index 10306b4..28df758 100644
---- a/drivers/net/ixgbevf/vf.h
-+++ b/drivers/net/ixgbevf/vf.h
+--- a/drivers/net/ethernet/intel/ixgbevf/vf.h
++++ b/drivers/net/ethernet/intel/ixgbevf/vf.h
@@ -70,6 +70,7 @@ struct ixgbe_mac_operations {
s32 (*clear_vfta)(struct ixgbe_hw *);
s32 (*set_vfta)(struct ixgbe_hw *, u32, u32, bool);
@@ -32436,23 +32847,10 @@ index 10306b4..28df758 100644
struct ixgbe_mbx_stats stats;
u32 timeout;
u32 udelay;
-diff --git a/drivers/net/ksz884x.c b/drivers/net/ksz884x.c
-index 41ea592..358ca61 100644
---- a/drivers/net/ksz884x.c
-+++ b/drivers/net/ksz884x.c
-@@ -6534,6 +6534,8 @@ static void netdev_get_ethtool_stats(struct net_device *dev,
- int rc;
- u64 counter[TOTAL_PORT_COUNTER_NUM];
-
-+ pax_track_stack();
-+
- mutex_lock(&hw_priv->lock);
- n = SWITCH_PORT_NUM;
- for (i = 0, p = port->first_port; i < port->mib_port_cnt; i++, p++) {
-diff --git a/drivers/net/mlx4/main.c b/drivers/net/mlx4/main.c
-index 3814fc9..7333446 100644
---- a/drivers/net/mlx4/main.c
-+++ b/drivers/net/mlx4/main.c
+diff --git a/drivers/net/ethernet/mellanox/mlx4/main.c b/drivers/net/ethernet/mellanox/mlx4/main.c
+index 94bbc85..78c12e6 100644
+--- a/drivers/net/ethernet/mellanox/mlx4/main.c
++++ b/drivers/net/ethernet/mellanox/mlx4/main.c
@@ -40,6 +40,7 @@
#include <linux/dma-mapping.h>
#include <linux/slab.h>
@@ -32461,681 +32859,37 @@ index 3814fc9..7333446 100644
#include <linux/mlx4/device.h>
#include <linux/mlx4/doorbell.h>
-@@ -764,6 +765,8 @@ static int mlx4_init_hca(struct mlx4_dev *dev)
- u64 icm_size;
- int err;
+diff --git a/drivers/net/ethernet/neterion/vxge/vxge-config.h b/drivers/net/ethernet/neterion/vxge/vxge-config.h
+index 5046a64..71ca936 100644
+--- a/drivers/net/ethernet/neterion/vxge/vxge-config.h
++++ b/drivers/net/ethernet/neterion/vxge/vxge-config.h
+@@ -514,7 +514,7 @@ struct vxge_hw_uld_cbs {
+ void (*link_down)(struct __vxge_hw_device *devh);
+ void (*crit_err)(struct __vxge_hw_device *devh,
+ enum vxge_hw_event type, u64 ext_data);
+-};
++} __no_const;
-+ pax_track_stack();
-+
- err = mlx4_QUERY_FW(dev);
- if (err) {
- if (err == -EACCES)
-diff --git a/drivers/net/niu.c b/drivers/net/niu.c
-index 2f8c351..6a733b3 100644
---- a/drivers/net/niu.c
-+++ b/drivers/net/niu.c
-@@ -9056,6 +9056,8 @@ static void __devinit niu_try_msix(struct niu *np, u8 *ldg_num_map)
- int i, num_irqs, err;
- u8 first_ldg;
-
-+ pax_track_stack();
-+
- first_ldg = (NIU_NUM_LDG / parent->num_ports) * np->port;
- for (i = 0; i < (NIU_NUM_LDG / parent->num_ports); i++)
- ldg_num_map[i] = first_ldg + i;
-diff --git a/drivers/net/pcnet32.c b/drivers/net/pcnet32.c
-index b48aba9..8dfaf74 100644
---- a/drivers/net/pcnet32.c
-+++ b/drivers/net/pcnet32.c
-@@ -82,7 +82,7 @@ static int cards_found;
/*
- * VLB I/O addresses
- */
--static unsigned int pcnet32_portlist[] __initdata =
-+static unsigned int pcnet32_portlist[] __devinitdata =
- { 0x300, 0x320, 0x340, 0x360, 0 };
-
- static int pcnet32_debug;
-@@ -270,7 +270,7 @@ struct pcnet32_private {
- struct sk_buff **rx_skbuff;
- dma_addr_t *tx_dma_addr;
- dma_addr_t *rx_dma_addr;
-- struct pcnet32_access a;
-+ struct pcnet32_access *a;
- spinlock_t lock; /* Guard lock */
- unsigned int cur_rx, cur_tx; /* The next free ring entry */
- unsigned int rx_ring_size; /* current rx ring size */
-@@ -460,9 +460,9 @@ static void pcnet32_netif_start(struct net_device *dev)
- u16 val;
-
- netif_wake_queue(dev);
-- val = lp->a.read_csr(ioaddr, CSR3);
-+ val = lp->a->read_csr(ioaddr, CSR3);
- val &= 0x00ff;
-- lp->a.write_csr(ioaddr, CSR3, val);
-+ lp->a->write_csr(ioaddr, CSR3, val);
- napi_enable(&lp->napi);
- }
-
-@@ -730,7 +730,7 @@ static u32 pcnet32_get_link(struct net_device *dev)
- r = mii_link_ok(&lp->mii_if);
- } else if (lp->chip_version >= PCNET32_79C970A) {
- ulong ioaddr = dev->base_addr; /* card base I/O address */
-- r = (lp->a.read_bcr(ioaddr, 4) != 0xc0);
-+ r = (lp->a->read_bcr(ioaddr, 4) != 0xc0);
- } else { /* can not detect link on really old chips */
- r = 1;
- }
-@@ -792,7 +792,7 @@ static int pcnet32_set_ringparam(struct net_device *dev,
- pcnet32_netif_stop(dev);
-
- spin_lock_irqsave(&lp->lock, flags);
-- lp->a.write_csr(ioaddr, CSR0, CSR0_STOP); /* stop the chip */
-+ lp->a->write_csr(ioaddr, CSR0, CSR0_STOP); /* stop the chip */
-
- size = min(ering->tx_pending, (unsigned int)TX_MAX_RING_SIZE);
-
-@@ -868,7 +868,7 @@ static void pcnet32_ethtool_test(struct net_device *dev,
- static int pcnet32_loopback_test(struct net_device *dev, uint64_t * data1)
- {
- struct pcnet32_private *lp = netdev_priv(dev);
-- struct pcnet32_access *a = &lp->a; /* access to registers */
-+ struct pcnet32_access *a = lp->a; /* access to registers */
- ulong ioaddr = dev->base_addr; /* card base I/O address */
- struct sk_buff *skb; /* sk buff */
- int x, i; /* counters */
-@@ -888,21 +888,21 @@ static int pcnet32_loopback_test(struct net_device *dev, uint64_t * data1)
- pcnet32_netif_stop(dev);
-
- spin_lock_irqsave(&lp->lock, flags);
-- lp->a.write_csr(ioaddr, CSR0, CSR0_STOP); /* stop the chip */
-+ lp->a->write_csr(ioaddr, CSR0, CSR0_STOP); /* stop the chip */
-
- numbuffs = min(numbuffs, (int)min(lp->rx_ring_size, lp->tx_ring_size));
-
- /* Reset the PCNET32 */
-- lp->a.reset(ioaddr);
-- lp->a.write_csr(ioaddr, CSR4, 0x0915); /* auto tx pad */
-+ lp->a->reset(ioaddr);
-+ lp->a->write_csr(ioaddr, CSR4, 0x0915); /* auto tx pad */
-
- /* switch pcnet32 to 32bit mode */
-- lp->a.write_bcr(ioaddr, 20, 2);
-+ lp->a->write_bcr(ioaddr, 20, 2);
-
- /* purge & init rings but don't actually restart */
- pcnet32_restart(dev, 0x0000);
-
-- lp->a.write_csr(ioaddr, CSR0, CSR0_STOP); /* Set STOP bit */
-+ lp->a->write_csr(ioaddr, CSR0, CSR0_STOP); /* Set STOP bit */
-
- /* Initialize Transmit buffers. */
- size = data_len + 15;
-@@ -947,10 +947,10 @@ static int pcnet32_loopback_test(struct net_device *dev, uint64_t * data1)
-
- /* set int loopback in CSR15 */
- x = a->read_csr(ioaddr, CSR15) & 0xfffc;
-- lp->a.write_csr(ioaddr, CSR15, x | 0x0044);
-+ lp->a->write_csr(ioaddr, CSR15, x | 0x0044);
-
- teststatus = cpu_to_le16(0x8000);
-- lp->a.write_csr(ioaddr, CSR0, CSR0_START); /* Set STRT bit */
-+ lp->a->write_csr(ioaddr, CSR0, CSR0_START); /* Set STRT bit */
-
- /* Check status of descriptors */
- for (x = 0; x < numbuffs; x++) {
-@@ -969,7 +969,7 @@ static int pcnet32_loopback_test(struct net_device *dev, uint64_t * data1)
- }
- }
-
-- lp->a.write_csr(ioaddr, CSR0, CSR0_STOP); /* Set STOP bit */
-+ lp->a->write_csr(ioaddr, CSR0, CSR0_STOP); /* Set STOP bit */
- wmb();
- if (netif_msg_hw(lp) && netif_msg_pktdata(lp)) {
- netdev_printk(KERN_DEBUG, dev, "RX loopback packets:\n");
-@@ -1015,7 +1015,7 @@ clean_up:
- pcnet32_restart(dev, CSR0_NORMAL);
- } else {
- pcnet32_purge_rx_ring(dev);
-- lp->a.write_bcr(ioaddr, 20, 4); /* return to 16bit mode */
-+ lp->a->write_bcr(ioaddr, 20, 4); /* return to 16bit mode */
- }
- spin_unlock_irqrestore(&lp->lock, flags);
-
-@@ -1026,7 +1026,7 @@ static int pcnet32_set_phys_id(struct net_device *dev,
- enum ethtool_phys_id_state state)
- {
- struct pcnet32_private *lp = netdev_priv(dev);
-- struct pcnet32_access *a = &lp->a;
-+ struct pcnet32_access *a = lp->a;
- ulong ioaddr = dev->base_addr;
- unsigned long flags;
- int i;
-@@ -1067,7 +1067,7 @@ static int pcnet32_suspend(struct net_device *dev, unsigned long *flags,
- {
- int csr5;
- struct pcnet32_private *lp = netdev_priv(dev);
-- struct pcnet32_access *a = &lp->a;
-+ struct pcnet32_access *a = lp->a;
- ulong ioaddr = dev->base_addr;
- int ticks;
-
-@@ -1324,8 +1324,8 @@ static int pcnet32_poll(struct napi_struct *napi, int budget)
- spin_lock_irqsave(&lp->lock, flags);
- if (pcnet32_tx(dev)) {
- /* reset the chip to clear the error condition, then restart */
-- lp->a.reset(ioaddr);
-- lp->a.write_csr(ioaddr, CSR4, 0x0915); /* auto tx pad */
-+ lp->a->reset(ioaddr);
-+ lp->a->write_csr(ioaddr, CSR4, 0x0915); /* auto tx pad */
- pcnet32_restart(dev, CSR0_START);
- netif_wake_queue(dev);
- }
-@@ -1337,12 +1337,12 @@ static int pcnet32_poll(struct napi_struct *napi, int budget)
- __napi_complete(napi);
-
- /* clear interrupt masks */
-- val = lp->a.read_csr(ioaddr, CSR3);
-+ val = lp->a->read_csr(ioaddr, CSR3);
- val &= 0x00ff;
-- lp->a.write_csr(ioaddr, CSR3, val);
-+ lp->a->write_csr(ioaddr, CSR3, val);
-
- /* Set interrupt enable. */
-- lp->a.write_csr(ioaddr, CSR0, CSR0_INTEN);
-+ lp->a->write_csr(ioaddr, CSR0, CSR0_INTEN);
-
- spin_unlock_irqrestore(&lp->lock, flags);
- }
-@@ -1365,7 +1365,7 @@ static void pcnet32_get_regs(struct net_device *dev, struct ethtool_regs *regs,
- int i, csr0;
- u16 *buff = ptr;
- struct pcnet32_private *lp = netdev_priv(dev);
-- struct pcnet32_access *a = &lp->a;
-+ struct pcnet32_access *a = lp->a;
- ulong ioaddr = dev->base_addr;
- unsigned long flags;
-
-@@ -1401,9 +1401,9 @@ static void pcnet32_get_regs(struct net_device *dev, struct ethtool_regs *regs,
- for (j = 0; j < PCNET32_MAX_PHYS; j++) {
- if (lp->phymask & (1 << j)) {
- for (i = 0; i < PCNET32_REGS_PER_PHY; i++) {
-- lp->a.write_bcr(ioaddr, 33,
-+ lp->a->write_bcr(ioaddr, 33,
- (j << 5) | i);
-- *buff++ = lp->a.read_bcr(ioaddr, 34);
-+ *buff++ = lp->a->read_bcr(ioaddr, 34);
- }
- }
- }
-@@ -1785,7 +1785,7 @@ pcnet32_probe1(unsigned long ioaddr, int shared, struct pci_dev *pdev)
- ((cards_found >= MAX_UNITS) || full_duplex[cards_found]))
- lp->options |= PCNET32_PORT_FD;
-
-- lp->a = *a;
-+ lp->a = a;
-
- /* prior to register_netdev, dev->name is not yet correct */
- if (pcnet32_alloc_ring(dev, pci_name(lp->pci_dev))) {
-@@ -1844,7 +1844,7 @@ pcnet32_probe1(unsigned long ioaddr, int shared, struct pci_dev *pdev)
- if (lp->mii) {
- /* lp->phycount and lp->phymask are set to 0 by memset above */
-
-- lp->mii_if.phy_id = ((lp->a.read_bcr(ioaddr, 33)) >> 5) & 0x1f;
-+ lp->mii_if.phy_id = ((lp->a->read_bcr(ioaddr, 33)) >> 5) & 0x1f;
- /* scan for PHYs */
- for (i = 0; i < PCNET32_MAX_PHYS; i++) {
- unsigned short id1, id2;
-@@ -1864,7 +1864,7 @@ pcnet32_probe1(unsigned long ioaddr, int shared, struct pci_dev *pdev)
- pr_info("Found PHY %04x:%04x at address %d\n",
- id1, id2, i);
- }
-- lp->a.write_bcr(ioaddr, 33, (lp->mii_if.phy_id) << 5);
-+ lp->a->write_bcr(ioaddr, 33, (lp->mii_if.phy_id) << 5);
- if (lp->phycount > 1)
- lp->options |= PCNET32_PORT_MII;
- }
-@@ -2020,10 +2020,10 @@ static int pcnet32_open(struct net_device *dev)
- }
-
- /* Reset the PCNET32 */
-- lp->a.reset(ioaddr);
-+ lp->a->reset(ioaddr);
-
- /* switch pcnet32 to 32bit mode */
-- lp->a.write_bcr(ioaddr, 20, 2);
-+ lp->a->write_bcr(ioaddr, 20, 2);
-
- netif_printk(lp, ifup, KERN_DEBUG, dev,
- "%s() irq %d tx/rx rings %#x/%#x init %#x\n",
-@@ -2032,14 +2032,14 @@ static int pcnet32_open(struct net_device *dev)
- (u32) (lp->init_dma_addr));
-
- /* set/reset autoselect bit */
-- val = lp->a.read_bcr(ioaddr, 2) & ~2;
-+ val = lp->a->read_bcr(ioaddr, 2) & ~2;
- if (lp->options & PCNET32_PORT_ASEL)
- val |= 2;
-- lp->a.write_bcr(ioaddr, 2, val);
-+ lp->a->write_bcr(ioaddr, 2, val);
-
- /* handle full duplex setting */
- if (lp->mii_if.full_duplex) {
-- val = lp->a.read_bcr(ioaddr, 9) & ~3;
-+ val = lp->a->read_bcr(ioaddr, 9) & ~3;
- if (lp->options & PCNET32_PORT_FD) {
- val |= 1;
- if (lp->options == (PCNET32_PORT_FD | PCNET32_PORT_AUI))
-@@ -2049,14 +2049,14 @@ static int pcnet32_open(struct net_device *dev)
- if (lp->chip_version == 0x2627)
- val |= 3;
- }
-- lp->a.write_bcr(ioaddr, 9, val);
-+ lp->a->write_bcr(ioaddr, 9, val);
- }
-
- /* set/reset GPSI bit in test register */
-- val = lp->a.read_csr(ioaddr, 124) & ~0x10;
-+ val = lp->a->read_csr(ioaddr, 124) & ~0x10;
- if ((lp->options & PCNET32_PORT_PORTSEL) == PCNET32_PORT_GPSI)
- val |= 0x10;
-- lp->a.write_csr(ioaddr, 124, val);
-+ lp->a->write_csr(ioaddr, 124, val);
-
- /* Allied Telesyn AT 2700/2701 FX are 100Mbit only and do not negotiate */
- if (pdev && pdev->subsystem_vendor == PCI_VENDOR_ID_AT &&
-@@ -2075,24 +2075,24 @@ static int pcnet32_open(struct net_device *dev)
- * duplex, and/or enable auto negotiation, and clear DANAS
- */
- if (lp->mii && !(lp->options & PCNET32_PORT_ASEL)) {
-- lp->a.write_bcr(ioaddr, 32,
-- lp->a.read_bcr(ioaddr, 32) | 0x0080);
-+ lp->a->write_bcr(ioaddr, 32,
-+ lp->a->read_bcr(ioaddr, 32) | 0x0080);
- /* disable Auto Negotiation, set 10Mpbs, HD */
-- val = lp->a.read_bcr(ioaddr, 32) & ~0xb8;
-+ val = lp->a->read_bcr(ioaddr, 32) & ~0xb8;
- if (lp->options & PCNET32_PORT_FD)
- val |= 0x10;
- if (lp->options & PCNET32_PORT_100)
- val |= 0x08;
-- lp->a.write_bcr(ioaddr, 32, val);
-+ lp->a->write_bcr(ioaddr, 32, val);
- } else {
- if (lp->options & PCNET32_PORT_ASEL) {
-- lp->a.write_bcr(ioaddr, 32,
-- lp->a.read_bcr(ioaddr,
-+ lp->a->write_bcr(ioaddr, 32,
-+ lp->a->read_bcr(ioaddr,
- 32) | 0x0080);
- /* enable auto negotiate, setup, disable fd */
-- val = lp->a.read_bcr(ioaddr, 32) & ~0x98;
-+ val = lp->a->read_bcr(ioaddr, 32) & ~0x98;
- val |= 0x20;
-- lp->a.write_bcr(ioaddr, 32, val);
-+ lp->a->write_bcr(ioaddr, 32, val);
- }
- }
- } else {
-@@ -2105,10 +2105,10 @@ static int pcnet32_open(struct net_device *dev)
- * There is really no good other way to handle multiple PHYs
- * other than turning off all automatics
- */
-- val = lp->a.read_bcr(ioaddr, 2);
-- lp->a.write_bcr(ioaddr, 2, val & ~2);
-- val = lp->a.read_bcr(ioaddr, 32);
-- lp->a.write_bcr(ioaddr, 32, val & ~(1 << 7)); /* stop MII manager */
-+ val = lp->a->read_bcr(ioaddr, 2);
-+ lp->a->write_bcr(ioaddr, 2, val & ~2);
-+ val = lp->a->read_bcr(ioaddr, 32);
-+ lp->a->write_bcr(ioaddr, 32, val & ~(1 << 7)); /* stop MII manager */
-
- if (!(lp->options & PCNET32_PORT_ASEL)) {
- /* setup ecmd */
-@@ -2118,7 +2118,7 @@ static int pcnet32_open(struct net_device *dev)
- ethtool_cmd_speed_set(&ecmd,
- (lp->options & PCNET32_PORT_100) ?
- SPEED_100 : SPEED_10);
-- bcr9 = lp->a.read_bcr(ioaddr, 9);
-+ bcr9 = lp->a->read_bcr(ioaddr, 9);
-
- if (lp->options & PCNET32_PORT_FD) {
- ecmd.duplex = DUPLEX_FULL;
-@@ -2127,7 +2127,7 @@ static int pcnet32_open(struct net_device *dev)
- ecmd.duplex = DUPLEX_HALF;
- bcr9 |= ~(1 << 0);
- }
-- lp->a.write_bcr(ioaddr, 9, bcr9);
-+ lp->a->write_bcr(ioaddr, 9, bcr9);
- }
-
- for (i = 0; i < PCNET32_MAX_PHYS; i++) {
-@@ -2158,9 +2158,9 @@ static int pcnet32_open(struct net_device *dev)
-
- #ifdef DO_DXSUFLO
- if (lp->dxsuflo) { /* Disable transmit stop on underflow */
-- val = lp->a.read_csr(ioaddr, CSR3);
-+ val = lp->a->read_csr(ioaddr, CSR3);
- val |= 0x40;
-- lp->a.write_csr(ioaddr, CSR3, val);
-+ lp->a->write_csr(ioaddr, CSR3, val);
- }
- #endif
-
-@@ -2176,11 +2176,11 @@ static int pcnet32_open(struct net_device *dev)
- napi_enable(&lp->napi);
-
- /* Re-initialize the PCNET32, and start it when done. */
-- lp->a.write_csr(ioaddr, 1, (lp->init_dma_addr & 0xffff));
-- lp->a.write_csr(ioaddr, 2, (lp->init_dma_addr >> 16));
-+ lp->a->write_csr(ioaddr, 1, (lp->init_dma_addr & 0xffff));
-+ lp->a->write_csr(ioaddr, 2, (lp->init_dma_addr >> 16));
-
-- lp->a.write_csr(ioaddr, CSR4, 0x0915); /* auto tx pad */
-- lp->a.write_csr(ioaddr, CSR0, CSR0_INIT);
-+ lp->a->write_csr(ioaddr, CSR4, 0x0915); /* auto tx pad */
-+ lp->a->write_csr(ioaddr, CSR0, CSR0_INIT);
-
- netif_start_queue(dev);
-
-@@ -2192,19 +2192,19 @@ static int pcnet32_open(struct net_device *dev)
-
- i = 0;
- while (i++ < 100)
-- if (lp->a.read_csr(ioaddr, CSR0) & CSR0_IDON)
-+ if (lp->a->read_csr(ioaddr, CSR0) & CSR0_IDON)
- break;
- /*
- * We used to clear the InitDone bit, 0x0100, here but Mark Stockton
- * reports that doing so triggers a bug in the '974.
- */
-- lp->a.write_csr(ioaddr, CSR0, CSR0_NORMAL);
-+ lp->a->write_csr(ioaddr, CSR0, CSR0_NORMAL);
-
- netif_printk(lp, ifup, KERN_DEBUG, dev,
- "pcnet32 open after %d ticks, init block %#x csr0 %4.4x\n",
- i,
- (u32) (lp->init_dma_addr),
-- lp->a.read_csr(ioaddr, CSR0));
-+ lp->a->read_csr(ioaddr, CSR0));
-
- spin_unlock_irqrestore(&lp->lock, flags);
-
-@@ -2218,7 +2218,7 @@ err_free_ring:
- * Switch back to 16bit mode to avoid problems with dumb
- * DOS packet driver after a warm reboot
- */
-- lp->a.write_bcr(ioaddr, 20, 4);
-+ lp->a->write_bcr(ioaddr, 20, 4);
-
- err_free_irq:
- spin_unlock_irqrestore(&lp->lock, flags);
-@@ -2323,7 +2323,7 @@ static void pcnet32_restart(struct net_device *dev, unsigned int csr0_bits)
-
- /* wait for stop */
- for (i = 0; i < 100; i++)
-- if (lp->a.read_csr(ioaddr, CSR0) & CSR0_STOP)
-+ if (lp->a->read_csr(ioaddr, CSR0) & CSR0_STOP)
- break;
-
- if (i >= 100)
-@@ -2335,13 +2335,13 @@ static void pcnet32_restart(struct net_device *dev, unsigned int csr0_bits)
- return;
-
- /* ReInit Ring */
-- lp->a.write_csr(ioaddr, CSR0, CSR0_INIT);
-+ lp->a->write_csr(ioaddr, CSR0, CSR0_INIT);
- i = 0;
- while (i++ < 1000)
-- if (lp->a.read_csr(ioaddr, CSR0) & CSR0_IDON)
-+ if (lp->a->read_csr(ioaddr, CSR0) & CSR0_IDON)
- break;
-
-- lp->a.write_csr(ioaddr, CSR0, csr0_bits);
-+ lp->a->write_csr(ioaddr, CSR0, csr0_bits);
- }
-
- static void pcnet32_tx_timeout(struct net_device *dev)
-@@ -2353,8 +2353,8 @@ static void pcnet32_tx_timeout(struct net_device *dev)
- /* Transmitter timeout, serious problems. */
- if (pcnet32_debug & NETIF_MSG_DRV)
- pr_err("%s: transmit timed out, status %4.4x, resetting\n",
-- dev->name, lp->a.read_csr(ioaddr, CSR0));
-- lp->a.write_csr(ioaddr, CSR0, CSR0_STOP);
-+ dev->name, lp->a->read_csr(ioaddr, CSR0));
-+ lp->a->write_csr(ioaddr, CSR0, CSR0_STOP);
- dev->stats.tx_errors++;
- if (netif_msg_tx_err(lp)) {
- int i;
-@@ -2397,7 +2397,7 @@ static netdev_tx_t pcnet32_start_xmit(struct sk_buff *skb,
-
- netif_printk(lp, tx_queued, KERN_DEBUG, dev,
- "%s() called, csr0 %4.4x\n",
-- __func__, lp->a.read_csr(ioaddr, CSR0));
-+ __func__, lp->a->read_csr(ioaddr, CSR0));
-
- /* Default status -- will not enable Successful-TxDone
- * interrupt when that option is available to us.
-@@ -2427,7 +2427,7 @@ static netdev_tx_t pcnet32_start_xmit(struct sk_buff *skb,
- dev->stats.tx_bytes += skb->len;
-
- /* Trigger an immediate send poll. */
-- lp->a.write_csr(ioaddr, CSR0, CSR0_INTEN | CSR0_TXPOLL);
-+ lp->a->write_csr(ioaddr, CSR0, CSR0_INTEN | CSR0_TXPOLL);
-
- if (lp->tx_ring[(entry + 1) & lp->tx_mod_mask].base != 0) {
- lp->tx_full = 1;
-@@ -2452,16 +2452,16 @@ pcnet32_interrupt(int irq, void *dev_id)
-
- spin_lock(&lp->lock);
-
-- csr0 = lp->a.read_csr(ioaddr, CSR0);
-+ csr0 = lp->a->read_csr(ioaddr, CSR0);
- while ((csr0 & 0x8f00) && --boguscnt >= 0) {
- if (csr0 == 0xffff)
- break; /* PCMCIA remove happened */
- /* Acknowledge all of the current interrupt sources ASAP. */
-- lp->a.write_csr(ioaddr, CSR0, csr0 & ~0x004f);
-+ lp->a->write_csr(ioaddr, CSR0, csr0 & ~0x004f);
-
- netif_printk(lp, intr, KERN_DEBUG, dev,
- "interrupt csr0=%#2.2x new csr=%#2.2x\n",
-- csr0, lp->a.read_csr(ioaddr, CSR0));
-+ csr0, lp->a->read_csr(ioaddr, CSR0));
-
- /* Log misc errors. */
- if (csr0 & 0x4000)
-@@ -2488,19 +2488,19 @@ pcnet32_interrupt(int irq, void *dev_id)
- if (napi_schedule_prep(&lp->napi)) {
- u16 val;
- /* set interrupt masks */
-- val = lp->a.read_csr(ioaddr, CSR3);
-+ val = lp->a->read_csr(ioaddr, CSR3);
- val |= 0x5f00;
-- lp->a.write_csr(ioaddr, CSR3, val);
-+ lp->a->write_csr(ioaddr, CSR3, val);
-
- __napi_schedule(&lp->napi);
- break;
- }
-- csr0 = lp->a.read_csr(ioaddr, CSR0);
-+ csr0 = lp->a->read_csr(ioaddr, CSR0);
- }
-
- netif_printk(lp, intr, KERN_DEBUG, dev,
- "exiting interrupt, csr0=%#4.4x\n",
-- lp->a.read_csr(ioaddr, CSR0));
-+ lp->a->read_csr(ioaddr, CSR0));
-
- spin_unlock(&lp->lock);
-
-@@ -2520,20 +2520,20 @@ static int pcnet32_close(struct net_device *dev)
-
- spin_lock_irqsave(&lp->lock, flags);
-
-- dev->stats.rx_missed_errors = lp->a.read_csr(ioaddr, 112);
-+ dev->stats.rx_missed_errors = lp->a->read_csr(ioaddr, 112);
-
- netif_printk(lp, ifdown, KERN_DEBUG, dev,
- "Shutting down ethercard, status was %2.2x\n",
-- lp->a.read_csr(ioaddr, CSR0));
-+ lp->a->read_csr(ioaddr, CSR0));
-
- /* We stop the PCNET32 here -- it occasionally polls memory if we don't. */
-- lp->a.write_csr(ioaddr, CSR0, CSR0_STOP);
-+ lp->a->write_csr(ioaddr, CSR0, CSR0_STOP);
-
- /*
- * Switch back to 16bit mode to avoid problems with dumb
- * DOS packet driver after a warm reboot
- */
-- lp->a.write_bcr(ioaddr, 20, 4);
-+ lp->a->write_bcr(ioaddr, 20, 4);
-
- spin_unlock_irqrestore(&lp->lock, flags);
-
-@@ -2556,7 +2556,7 @@ static struct net_device_stats *pcnet32_get_stats(struct net_device *dev)
- unsigned long flags;
-
- spin_lock_irqsave(&lp->lock, flags);
-- dev->stats.rx_missed_errors = lp->a.read_csr(ioaddr, 112);
-+ dev->stats.rx_missed_errors = lp->a->read_csr(ioaddr, 112);
- spin_unlock_irqrestore(&lp->lock, flags);
-
- return &dev->stats;
-@@ -2578,10 +2578,10 @@ static void pcnet32_load_multicast(struct net_device *dev)
- if (dev->flags & IFF_ALLMULTI) {
- ib->filter[0] = cpu_to_le32(~0U);
- ib->filter[1] = cpu_to_le32(~0U);
-- lp->a.write_csr(ioaddr, PCNET32_MC_FILTER, 0xffff);
-- lp->a.write_csr(ioaddr, PCNET32_MC_FILTER+1, 0xffff);
-- lp->a.write_csr(ioaddr, PCNET32_MC_FILTER+2, 0xffff);
-- lp->a.write_csr(ioaddr, PCNET32_MC_FILTER+3, 0xffff);
-+ lp->a->write_csr(ioaddr, PCNET32_MC_FILTER, 0xffff);
-+ lp->a->write_csr(ioaddr, PCNET32_MC_FILTER+1, 0xffff);
-+ lp->a->write_csr(ioaddr, PCNET32_MC_FILTER+2, 0xffff);
-+ lp->a->write_csr(ioaddr, PCNET32_MC_FILTER+3, 0xffff);
- return;
- }
- /* clear the multicast filter */
-@@ -2601,7 +2601,7 @@ static void pcnet32_load_multicast(struct net_device *dev)
- mcast_table[crc >> 4] |= cpu_to_le16(1 << (crc & 0xf));
- }
- for (i = 0; i < 4; i++)
-- lp->a.write_csr(ioaddr, PCNET32_MC_FILTER + i,
-+ lp->a->write_csr(ioaddr, PCNET32_MC_FILTER + i,
- le16_to_cpu(mcast_table[i]));
- }
-
-@@ -2616,28 +2616,28 @@ static void pcnet32_set_multicast_list(struct net_device *dev)
-
- spin_lock_irqsave(&lp->lock, flags);
- suspended = pcnet32_suspend(dev, &flags, 0);
-- csr15 = lp->a.read_csr(ioaddr, CSR15);
-+ csr15 = lp->a->read_csr(ioaddr, CSR15);
- if (dev->flags & IFF_PROMISC) {
- /* Log any net taps. */
- netif_info(lp, hw, dev, "Promiscuous mode enabled\n");
- lp->init_block->mode =
- cpu_to_le16(0x8000 | (lp->options & PCNET32_PORT_PORTSEL) <<
- 7);
-- lp->a.write_csr(ioaddr, CSR15, csr15 | 0x8000);
-+ lp->a->write_csr(ioaddr, CSR15, csr15 | 0x8000);
- } else {
- lp->init_block->mode =
- cpu_to_le16((lp->options & PCNET32_PORT_PORTSEL) << 7);
-- lp->a.write_csr(ioaddr, CSR15, csr15 & 0x7fff);
-+ lp->a->write_csr(ioaddr, CSR15, csr15 & 0x7fff);
- pcnet32_load_multicast(dev);
- }
-
- if (suspended) {
- int csr5;
- /* clear SUSPEND (SPND) - CSR5 bit 0 */
-- csr5 = lp->a.read_csr(ioaddr, CSR5);
-- lp->a.write_csr(ioaddr, CSR5, csr5 & (~CSR5_SUSPEND));
-+ csr5 = lp->a->read_csr(ioaddr, CSR5);
-+ lp->a->write_csr(ioaddr, CSR5, csr5 & (~CSR5_SUSPEND));
- } else {
-- lp->a.write_csr(ioaddr, CSR0, CSR0_STOP);
-+ lp->a->write_csr(ioaddr, CSR0, CSR0_STOP);
- pcnet32_restart(dev, CSR0_NORMAL);
- netif_wake_queue(dev);
- }
-@@ -2655,8 +2655,8 @@ static int mdio_read(struct net_device *dev, int phy_id, int reg_num)
- if (!lp->mii)
- return 0;
-
-- lp->a.write_bcr(ioaddr, 33, ((phy_id & 0x1f) << 5) | (reg_num & 0x1f));
-- val_out = lp->a.read_bcr(ioaddr, 34);
-+ lp->a->write_bcr(ioaddr, 33, ((phy_id & 0x1f) << 5) | (reg_num & 0x1f));
-+ val_out = lp->a->read_bcr(ioaddr, 34);
-
- return val_out;
- }
-@@ -2670,8 +2670,8 @@ static void mdio_write(struct net_device *dev, int phy_id, int reg_num, int val)
- if (!lp->mii)
- return;
-
-- lp->a.write_bcr(ioaddr, 33, ((phy_id & 0x1f) << 5) | (reg_num & 0x1f));
-- lp->a.write_bcr(ioaddr, 34, val);
-+ lp->a->write_bcr(ioaddr, 33, ((phy_id & 0x1f) << 5) | (reg_num & 0x1f));
-+ lp->a->write_bcr(ioaddr, 34, val);
- }
-
- static int pcnet32_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
-@@ -2748,7 +2748,7 @@ static void pcnet32_check_media(struct net_device *dev, int verbose)
- curr_link = mii_link_ok(&lp->mii_if);
- } else {
- ulong ioaddr = dev->base_addr; /* card base I/O address */
-- curr_link = (lp->a.read_bcr(ioaddr, 4) != 0xc0);
-+ curr_link = (lp->a->read_bcr(ioaddr, 4) != 0xc0);
- }
- if (!curr_link) {
- if (prev_link || verbose) {
-@@ -2771,13 +2771,13 @@ static void pcnet32_check_media(struct net_device *dev, int verbose)
- (ecmd.duplex == DUPLEX_FULL)
- ? "full" : "half");
- }
-- bcr9 = lp->a.read_bcr(dev->base_addr, 9);
-+ bcr9 = lp->a->read_bcr(dev->base_addr, 9);
- if ((bcr9 & (1 << 0)) != lp->mii_if.full_duplex) {
- if (lp->mii_if.full_duplex)
- bcr9 |= (1 << 0);
- else
- bcr9 &= ~(1 << 0);
-- lp->a.write_bcr(dev->base_addr, 9, bcr9);
-+ lp->a->write_bcr(dev->base_addr, 9, bcr9);
- }
- } else {
- netif_info(lp, link, dev, "link up\n");
-diff --git a/drivers/net/ppp_generic.c b/drivers/net/ppp_generic.c
-index 4609bc0..b0e9d0a 100644
---- a/drivers/net/ppp_generic.c
-+++ b/drivers/net/ppp_generic.c
-@@ -987,7 +987,6 @@ ppp_net_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
- void __user *addr = (void __user *) ifr->ifr_ifru.ifru_data;
- struct ppp_stats stats;
- struct ppp_comp_stats cstats;
-- char *vers;
-
- switch (cmd) {
- case SIOCGPPPSTATS:
-@@ -1009,8 +1008,7 @@ ppp_net_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
- break;
+ * struct __vxge_hw_blockpool_entry - Block private data structure
+diff --git a/drivers/net/ethernet/neterion/vxge/vxge-traffic.h b/drivers/net/ethernet/neterion/vxge/vxge-traffic.h
+index 4a518a3..936b334 100644
+--- a/drivers/net/ethernet/neterion/vxge/vxge-traffic.h
++++ b/drivers/net/ethernet/neterion/vxge/vxge-traffic.h
+@@ -2088,7 +2088,7 @@ struct vxge_hw_mempool_cbs {
+ struct vxge_hw_mempool_dma *dma_object,
+ u32 index,
+ u32 is_last);
+-};
++} __no_const;
- case SIOCGPPPVER:
-- vers = PPP_VERSION;
-- if (copy_to_user(addr, vers, strlen(vers) + 1))
-+ if (copy_to_user(addr, PPP_VERSION, sizeof(PPP_VERSION)))
- break;
- err = 0;
- break;
-diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c
-index 5f838ef..0ecfabe 100644
---- a/drivers/net/r8169.c
-+++ b/drivers/net/r8169.c
-@@ -645,12 +645,12 @@ struct rtl8169_private {
+ #define VXGE_HW_VIRTUAL_PATH_HANDLE(vpath) \
+ ((struct __vxge_hw_vpath_handle *)(vpath)->vpath_handles.next)
+diff --git a/drivers/net/ethernet/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c
+index c8f47f1..5da9840 100644
+--- a/drivers/net/ethernet/realtek/r8169.c
++++ b/drivers/net/ethernet/realtek/r8169.c
+@@ -698,17 +698,17 @@ struct rtl8169_private {
struct mdio_ops {
void (*write)(void __iomem *, int, int);
int (*read)(void __iomem *, int);
@@ -33148,13 +32902,19 @@ index 5f838ef..0ecfabe 100644
- } pll_power_ops;
+ } __no_const pll_power_ops;
+ struct jumbo_ops {
+ void (*enable)(struct rtl8169_private *);
+ void (*disable)(struct rtl8169_private *);
+- } jumbo_ops;
++ } __no_const jumbo_ops;
+
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/sis190.c b/drivers/net/sis190.c
-index f6d26ab..054113f 100644
---- a/drivers/net/sis190.c
-+++ b/drivers/net/sis190.c
-@@ -1623,7 +1623,7 @@ static int __devinit sis190_get_mac_addr_from_eeprom(struct pci_dev *pdev,
+diff --git a/drivers/net/ethernet/sis/sis190.c b/drivers/net/ethernet/sis/sis190.c
+index 1b4658c..a30dabb 100644
+--- a/drivers/net/ethernet/sis/sis190.c
++++ b/drivers/net/ethernet/sis/sis190.c
+@@ -1624,7 +1624,7 @@ static int __devinit sis190_get_mac_addr_from_eeprom(struct pci_dev *pdev,
static int __devinit sis190_get_mac_addr_from_apc(struct pci_dev *pdev,
struct net_device *dev)
{
@@ -33163,31 +32923,28 @@ index f6d26ab..054113f 100644
struct sis190_private *tp = netdev_priv(dev);
struct pci_dev *isa_bridge;
u8 reg, tmp8;
-diff --git a/drivers/net/sundance.c b/drivers/net/sundance.c
-index 4793df8..44c9849 100644
---- a/drivers/net/sundance.c
-+++ b/drivers/net/sundance.c
-@@ -218,7 +218,7 @@ enum {
- struct pci_id_info {
- const char *name;
- };
--static const struct pci_id_info pci_id_tbl[] __devinitdata = {
-+static const struct pci_id_info pci_id_tbl[] __devinitconst = {
- {"D-Link DFE-550TX FAST Ethernet Adapter"},
- {"D-Link DFE-550FX 100Mbps Fiber-optics Adapter"},
- {"D-Link DFE-580TX 4 port Server Adapter"},
-diff --git a/drivers/net/tg3.h b/drivers/net/tg3.h
-index 5b3d2f3..fd324d8 100644
---- a/drivers/net/tg3.h
-+++ b/drivers/net/tg3.h
-@@ -134,6 +134,7 @@
- #define CHIPREV_ID_5750_A0 0x4000
- #define CHIPREV_ID_5750_A1 0x4001
- #define CHIPREV_ID_5750_A3 0x4003
-+#define CHIPREV_ID_5750_C1 0x4201
- #define CHIPREV_ID_5750_C2 0x4202
- #define CHIPREV_ID_5752_A0_HW 0x5000
- #define CHIPREV_ID_5752_A0 0x6000
+diff --git a/drivers/net/ppp/ppp_generic.c b/drivers/net/ppp/ppp_generic.c
+index edfa15d..002bfa9 100644
+--- a/drivers/net/ppp/ppp_generic.c
++++ b/drivers/net/ppp/ppp_generic.c
+@@ -987,7 +987,6 @@ ppp_net_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
+ void __user *addr = (void __user *) ifr->ifr_ifru.ifru_data;
+ struct ppp_stats stats;
+ struct ppp_comp_stats cstats;
+- char *vers;
+
+ switch (cmd) {
+ case SIOCGPPPSTATS:
+@@ -1009,8 +1008,7 @@ ppp_net_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
+ break;
+
+ case SIOCGPPPVER:
+- vers = PPP_VERSION;
+- if (copy_to_user(addr, vers, strlen(vers) + 1))
++ if (copy_to_user(addr, PPP_VERSION, sizeof(PPP_VERSION)))
+ break;
+ err = 0;
+ break;
diff --git a/drivers/net/tokenring/abyss.c b/drivers/net/tokenring/abyss.c
index 515f122..41dd273 100644
--- a/drivers/net/tokenring/abyss.c
@@ -33209,7 +32966,7 @@ index 515f122..41dd273 100644
return pci_register_driver(&abyss_driver);
}
diff --git a/drivers/net/tokenring/madgemc.c b/drivers/net/tokenring/madgemc.c
-index 2bedc0a..2bb69d3 100644
+index 6153cfd..cf69c1c 100644
--- a/drivers/net/tokenring/madgemc.c
+++ b/drivers/net/tokenring/madgemc.c
@@ -744,9 +744,11 @@ static struct mca_driver madgemc_driver = {
@@ -33265,67 +33022,6 @@ index 46db5c5..37c1536 100644
err = platform_driver_register(&sk_isa_driver);
if (err)
-diff --git a/drivers/net/tulip/de2104x.c b/drivers/net/tulip/de2104x.c
-index e2f6923..b9398d8 100644
---- a/drivers/net/tulip/de2104x.c
-+++ b/drivers/net/tulip/de2104x.c
-@@ -1794,6 +1794,8 @@ static void __devinit de21041_get_srom_info (struct de_private *de)
- struct de_srom_info_leaf *il;
- void *bufp;
-
-+ pax_track_stack();
-+
- /* download entire eeprom */
- for (i = 0; i < DE_EEPROM_WORDS; i++)
- ((__le16 *)ee_data)[i] =
-diff --git a/drivers/net/tulip/de4x5.c b/drivers/net/tulip/de4x5.c
-index efaa1d6..f763636 100644
---- a/drivers/net/tulip/de4x5.c
-+++ b/drivers/net/tulip/de4x5.c
-@@ -5401,7 +5401,7 @@ de4x5_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
- for (i=0; i<ETH_ALEN; i++) {
- tmp.addr[i] = dev->dev_addr[i];
- }
-- if (copy_to_user(ioc->data, tmp.addr, ioc->len)) return -EFAULT;
-+ if (ioc->len > sizeof tmp.addr || copy_to_user(ioc->data, tmp.addr, ioc->len)) return -EFAULT;
- break;
-
- case DE4X5_SET_HWADDR: /* Set the hardware address */
-@@ -5441,7 +5441,7 @@ de4x5_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
- spin_lock_irqsave(&lp->lock, flags);
- memcpy(&statbuf, &lp->pktStats, ioc->len);
- spin_unlock_irqrestore(&lp->lock, flags);
-- if (copy_to_user(ioc->data, &statbuf, ioc->len))
-+ if (ioc->len > sizeof statbuf || copy_to_user(ioc->data, &statbuf, ioc->len))
- return -EFAULT;
- break;
- }
-diff --git a/drivers/net/tulip/eeprom.c b/drivers/net/tulip/eeprom.c
-index fa5eee9..e074432 100644
---- a/drivers/net/tulip/eeprom.c
-+++ b/drivers/net/tulip/eeprom.c
-@@ -81,7 +81,7 @@ static struct eeprom_fixup eeprom_fixups[] __devinitdata = {
- {NULL}};
-
-
--static const char *block_name[] __devinitdata = {
-+static const char *block_name[] __devinitconst = {
- "21140 non-MII",
- "21140 MII PHY",
- "21142 Serial PHY",
-diff --git a/drivers/net/tulip/winbond-840.c b/drivers/net/tulip/winbond-840.c
-index 862eadf..3eee1e6 100644
---- a/drivers/net/tulip/winbond-840.c
-+++ b/drivers/net/tulip/winbond-840.c
-@@ -236,7 +236,7 @@ struct pci_id_info {
- int drv_flags; /* Driver use, intended as capability flags. */
- };
-
--static const struct pci_id_info pci_id_tbl[] __devinitdata = {
-+static const struct pci_id_info pci_id_tbl[] __devinitconst = {
- { /* Sometime a Level-One switch card. */
- "Winbond W89c840", CanHaveMII | HasBrokenTx | FDXOnNoMII},
- { "Winbond W89c840", CanHaveMII | HasBrokenTx},
diff --git a/drivers/net/usb/hso.c b/drivers/net/usb/hso.c
index 304fe78..db112fa 100644
--- a/drivers/net/usb/hso.c
@@ -33427,10 +33123,10 @@ index 304fe78..db112fa 100644
hso_start_serial_device(serial_table[i], GFP_NOIO);
hso_kick_transmit(dev2ser(serial_table[i]));
diff --git a/drivers/net/vmxnet3/vmxnet3_ethtool.c b/drivers/net/vmxnet3/vmxnet3_ethtool.c
-index dc959fe..5eb190d 100644
+index e662cbc..8d4a102 100644
--- a/drivers/net/vmxnet3/vmxnet3_ethtool.c
+++ b/drivers/net/vmxnet3/vmxnet3_ethtool.c
-@@ -594,8 +594,7 @@ vmxnet3_set_rss_indir(struct net_device *netdev,
+@@ -601,8 +601,7 @@ vmxnet3_set_rss_indir(struct net_device *netdev,
* Return with error code if any of the queue indices
* is out of range
*/
@@ -33440,172 +33136,11 @@ index dc959fe..5eb190d 100644
return -EINVAL;
}
-diff --git a/drivers/net/vxge/vxge-config.h b/drivers/net/vxge/vxge-config.h
-index 359b9b9..404aea6 100644
---- a/drivers/net/vxge/vxge-config.h
-+++ b/drivers/net/vxge/vxge-config.h
-@@ -512,7 +512,7 @@ struct vxge_hw_uld_cbs {
- void (*link_down)(struct __vxge_hw_device *devh);
- void (*crit_err)(struct __vxge_hw_device *devh,
- enum vxge_hw_event type, u64 ext_data);
--};
-+} __no_const;
-
- /*
- * struct __vxge_hw_blockpool_entry - Block private data structure
-diff --git a/drivers/net/vxge/vxge-main.c b/drivers/net/vxge/vxge-main.c
-index 8ab870a..91b9e61 100644
---- a/drivers/net/vxge/vxge-main.c
-+++ b/drivers/net/vxge/vxge-main.c
-@@ -98,6 +98,8 @@ static inline void VXGE_COMPLETE_VPATH_TX(struct vxge_fifo *fifo)
- struct sk_buff *completed[NR_SKB_COMPLETED];
- int more;
-
-+ pax_track_stack();
-+
- do {
- more = 0;
- skb_ptr = completed;
-@@ -1920,6 +1922,8 @@ static enum vxge_hw_status vxge_rth_configure(struct vxgedev *vdev)
- u8 mtable[256] = {0}; /* CPU to vpath mapping */
- int index;
-
-+ pax_track_stack();
-+
- /*
- * Filling
- * - itable with bucket numbers
-diff --git a/drivers/net/vxge/vxge-traffic.h b/drivers/net/vxge/vxge-traffic.h
-index 4a518a3..936b334 100644
---- a/drivers/net/vxge/vxge-traffic.h
-+++ b/drivers/net/vxge/vxge-traffic.h
-@@ -2088,7 +2088,7 @@ struct vxge_hw_mempool_cbs {
- struct vxge_hw_mempool_dma *dma_object,
- u32 index,
- u32 is_last);
--};
-+} __no_const;
-
- #define VXGE_HW_VIRTUAL_PATH_HANDLE(vpath) \
- ((struct __vxge_hw_vpath_handle *)(vpath)->vpath_handles.next)
-diff --git a/drivers/net/wan/cycx_x25.c b/drivers/net/wan/cycx_x25.c
-index cf9e15f..9789469 100644
---- a/drivers/net/wan/cycx_x25.c
-+++ b/drivers/net/wan/cycx_x25.c
-@@ -1018,6 +1018,8 @@ static void hex_dump(char *msg, unsigned char *p, int len)
- unsigned char hex[1024],
- * phex = hex;
-
-+ pax_track_stack();
-+
- if (len >= (sizeof(hex) / 2))
- len = (sizeof(hex) / 2) - 1;
-
-diff --git a/drivers/net/wan/hdlc_x25.c b/drivers/net/wan/hdlc_x25.c
-index 70527e5..02eedb6 100644
---- a/drivers/net/wan/hdlc_x25.c
-+++ b/drivers/net/wan/hdlc_x25.c
-@@ -136,16 +136,16 @@ static netdev_tx_t x25_xmit(struct sk_buff *skb, struct net_device *dev)
-
- static int x25_open(struct net_device *dev)
- {
-- struct lapb_register_struct cb;
-+ static struct lapb_register_struct cb = {
-+ .connect_confirmation = x25_connected,
-+ .connect_indication = x25_connected,
-+ .disconnect_confirmation = x25_disconnected,
-+ .disconnect_indication = x25_disconnected,
-+ .data_indication = x25_data_indication,
-+ .data_transmit = x25_data_transmit
-+ };
- int result;
-
-- cb.connect_confirmation = x25_connected;
-- cb.connect_indication = x25_connected;
-- cb.disconnect_confirmation = x25_disconnected;
-- cb.disconnect_indication = x25_disconnected;
-- cb.data_indication = x25_data_indication;
-- cb.data_transmit = x25_data_transmit;
--
- result = lapb_register(dev, &cb);
- if (result != LAPB_OK)
- return result;
-diff --git a/drivers/net/wimax/i2400m/usb-fw.c b/drivers/net/wimax/i2400m/usb-fw.c
-index 1fda46c..f2858f2 100644
---- a/drivers/net/wimax/i2400m/usb-fw.c
-+++ b/drivers/net/wimax/i2400m/usb-fw.c
-@@ -287,6 +287,8 @@ ssize_t i2400mu_bus_bm_wait_for_ack(struct i2400m *i2400m,
- int do_autopm = 1;
- DECLARE_COMPLETION_ONSTACK(notif_completion);
-
-+ pax_track_stack();
-+
- d_fnstart(8, dev, "(i2400m %p ack %p size %zu)\n",
- i2400m, ack, ack_size);
- BUG_ON(_ack == i2400m->bm_ack_buf);
-diff --git a/drivers/net/wireless/airo.c b/drivers/net/wireless/airo.c
-index e1b3e3c..e413f18 100644
---- a/drivers/net/wireless/airo.c
-+++ b/drivers/net/wireless/airo.c
-@@ -3003,6 +3003,8 @@ static void airo_process_scan_results (struct airo_info *ai) {
- BSSListElement * loop_net;
- BSSListElement * tmp_net;
-
-+ pax_track_stack();
-+
- /* Blow away current list of scan results */
- list_for_each_entry_safe (loop_net, tmp_net, &ai->network_list, list) {
- list_move_tail (&loop_net->list, &ai->network_free_list);
-@@ -3794,6 +3796,8 @@ static u16 setup_card(struct airo_info *ai, u8 *mac, int lock)
- WepKeyRid wkr;
- int rc;
-
-+ pax_track_stack();
-+
- memset( &mySsid, 0, sizeof( mySsid ) );
- kfree (ai->flash);
- ai->flash = NULL;
-@@ -4753,6 +4757,8 @@ static int proc_stats_rid_open( struct inode *inode,
- __le32 *vals = stats.vals;
- int len;
-
-+ pax_track_stack();
-+
- if ((file->private_data = kzalloc(sizeof(struct proc_data ), GFP_KERNEL)) == NULL)
- return -ENOMEM;
- data = file->private_data;
-@@ -5476,6 +5482,8 @@ static int proc_BSSList_open( struct inode *inode, struct file *file ) {
- /* If doLoseSync is not 1, we won't do a Lose Sync */
- int doLoseSync = -1;
-
-+ pax_track_stack();
-+
- if ((file->private_data = kzalloc(sizeof(struct proc_data ), GFP_KERNEL)) == NULL)
- return -ENOMEM;
- data = file->private_data;
-@@ -7181,6 +7189,8 @@ static int airo_get_aplist(struct net_device *dev,
- int i;
- int loseSync = capable(CAP_NET_ADMIN) ? 1: -1;
-
-+ pax_track_stack();
-+
- qual = kmalloc(IW_MAX_AP * sizeof(*qual), GFP_KERNEL);
- if (!qual)
- return -ENOMEM;
-@@ -7741,6 +7751,8 @@ static void airo_read_wireless_stats(struct airo_info *local)
- CapabilityRid cap_rid;
- __le32 *vals = stats_rid.vals;
-
-+ pax_track_stack();
-+
- /* Get stats out of the card */
- clear_bit(JOB_WSTATS, &local->jobs);
- if (local->power.event) {
diff --git a/drivers/net/wireless/ath/ath.h b/drivers/net/wireless/ath/ath.h
-index 7cf4317..0db3a44 100644
+index 0f9ee46..e2d6e65 100644
--- a/drivers/net/wireless/ath/ath.h
+++ b/drivers/net/wireless/ath/ath.h
-@@ -121,6 +121,7 @@ struct ath_ops {
+@@ -119,6 +119,7 @@ struct ath_ops {
void (*write_flush) (void *);
u32 (*rmw)(void *, u32 reg_offset, u32 set, u32 clr);
};
@@ -33613,184 +33148,216 @@ index 7cf4317..0db3a44 100644
struct ath_common;
struct ath_bus_ops;
-diff --git a/drivers/net/wireless/ath/ath5k/debug.c b/drivers/net/wireless/ath/ath5k/debug.c
-index 0bf7313..f232bfc 100644
---- a/drivers/net/wireless/ath/ath5k/debug.c
-+++ b/drivers/net/wireless/ath/ath5k/debug.c
-@@ -204,6 +204,8 @@ static ssize_t read_file_beacon(struct file *file, char __user *user_buf,
- unsigned int v;
- u64 tsf;
-
-+ pax_track_stack();
-+
- v = ath5k_hw_reg_read(sc->ah, AR5K_BEACON);
- len += snprintf(buf+len, sizeof(buf)-len,
- "%-24s0x%08x\tintval: %d\tTIM: 0x%x\n",
-@@ -323,6 +325,8 @@ static ssize_t read_file_debug(struct file *file, char __user *user_buf,
- unsigned int len = 0;
- unsigned int i;
-
-+ pax_track_stack();
-+
- len += snprintf(buf+len, sizeof(buf)-len,
- "DEBUG LEVEL: 0x%08x\n\n", sc->debug.level);
-
-@@ -384,6 +388,8 @@ static ssize_t read_file_antenna(struct file *file, char __user *user_buf,
- unsigned int i;
- unsigned int v;
-
-+ pax_track_stack();
-+
- len += snprintf(buf+len, sizeof(buf)-len, "antenna mode\t%d\n",
- sc->ah->ah_ant_mode);
- len += snprintf(buf+len, sizeof(buf)-len, "default antenna\t%d\n",
-@@ -494,6 +500,8 @@ static ssize_t read_file_misc(struct file *file, char __user *user_buf,
- unsigned int len = 0;
- u32 filt = ath5k_hw_get_rx_filter(sc->ah);
-
-+ pax_track_stack();
-+
- len += snprintf(buf+len, sizeof(buf)-len, "bssid-mask: %pM\n",
- sc->bssidmask);
- len += snprintf(buf+len, sizeof(buf)-len, "filter-flags: 0x%x ",
-@@ -550,6 +558,8 @@ static ssize_t read_file_frameerrors(struct file *file, char __user *user_buf,
- unsigned int len = 0;
- int i;
-
-+ pax_track_stack();
-+
- len += snprintf(buf+len, sizeof(buf)-len,
- "RX\n---------------------\n");
- len += snprintf(buf+len, sizeof(buf)-len, "CRC\t%u\t(%u%%)\n",
-@@ -667,6 +677,8 @@ static ssize_t read_file_ani(struct file *file, char __user *user_buf,
- char buf[700];
- unsigned int len = 0;
-
-+ pax_track_stack();
-+
- len += snprintf(buf+len, sizeof(buf)-len,
- "HW has PHY error counters:\t%s\n",
- sc->ah->ah_capabilities.cap_has_phyerr_counters ?
-@@ -827,6 +839,8 @@ static ssize_t read_file_queue(struct file *file, char __user *user_buf,
- struct ath5k_buf *bf, *bf0;
- int i, n;
-
-+ pax_track_stack();
-+
- len += snprintf(buf+len, sizeof(buf)-len,
- "available txbuffers: %d\n", sc->txbuf_len);
-
-diff --git a/drivers/net/wireless/ath/ath9k/ar9003_calib.c b/drivers/net/wireless/ath/ath9k/ar9003_calib.c
-index 7c2aaad..ad14dee 100644
---- a/drivers/net/wireless/ath/ath9k/ar9003_calib.c
-+++ b/drivers/net/wireless/ath/ath9k/ar9003_calib.c
-@@ -758,6 +758,8 @@ static void ar9003_hw_tx_iq_cal_post_proc(struct ath_hw *ah)
- int i, im, j;
- int nmeasurement;
-
-+ pax_track_stack();
-+
- for (i = 0; i < AR9300_MAX_CHAINS; i++) {
- if (ah->txchainmask & (1 << i))
- num_chains++;
-diff --git a/drivers/net/wireless/ath/ath9k/ar9003_paprd.c b/drivers/net/wireless/ath/ath9k/ar9003_paprd.c
-index e4d6a87..8ed13ba 100644
---- a/drivers/net/wireless/ath/ath9k/ar9003_paprd.c
-+++ b/drivers/net/wireless/ath/ath9k/ar9003_paprd.c
-@@ -356,6 +356,8 @@ static bool create_pa_curve(u32 *data_L, u32 *data_U, u32 *pa_table, u16 *gain)
- int theta_low_bin = 0;
- int i;
+diff --git a/drivers/net/wireless/ath/ath9k/ar9002_mac.c b/drivers/net/wireless/ath/ath9k/ar9002_mac.c
+index b592016..fe47870 100644
+--- a/drivers/net/wireless/ath/ath9k/ar9002_mac.c
++++ b/drivers/net/wireless/ath/ath9k/ar9002_mac.c
+@@ -183,8 +183,8 @@ ar9002_set_txdesc(struct ath_hw *ah, void *ds, struct ath_tx_info *i)
+ ads->ds_txstatus6 = ads->ds_txstatus7 = 0;
+ ads->ds_txstatus8 = ads->ds_txstatus9 = 0;
+
+- ACCESS_ONCE(ads->ds_link) = i->link;
+- ACCESS_ONCE(ads->ds_data) = i->buf_addr[0];
++ ACCESS_ONCE_RW(ads->ds_link) = i->link;
++ ACCESS_ONCE_RW(ads->ds_data) = i->buf_addr[0];
+
+ ctl1 = i->buf_len[0] | (i->is_last ? 0 : AR_TxMore);
+ ctl6 = SM(i->keytype, AR_EncrType);
+@@ -198,26 +198,26 @@ ar9002_set_txdesc(struct ath_hw *ah, void *ds, struct ath_tx_info *i)
+
+ if ((i->is_first || i->is_last) &&
+ i->aggr != AGGR_BUF_MIDDLE && i->aggr != AGGR_BUF_LAST) {
+- ACCESS_ONCE(ads->ds_ctl2) = set11nTries(i->rates, 0)
++ ACCESS_ONCE_RW(ads->ds_ctl2) = set11nTries(i->rates, 0)
+ | set11nTries(i->rates, 1)
+ | set11nTries(i->rates, 2)
+ | set11nTries(i->rates, 3)
+ | (i->dur_update ? AR_DurUpdateEna : 0)
+ | SM(0, AR_BurstDur);
+
+- ACCESS_ONCE(ads->ds_ctl3) = set11nRate(i->rates, 0)
++ ACCESS_ONCE_RW(ads->ds_ctl3) = set11nRate(i->rates, 0)
+ | set11nRate(i->rates, 1)
+ | set11nRate(i->rates, 2)
+ | set11nRate(i->rates, 3);
+ } else {
+- ACCESS_ONCE(ads->ds_ctl2) = 0;
+- ACCESS_ONCE(ads->ds_ctl3) = 0;
++ ACCESS_ONCE_RW(ads->ds_ctl2) = 0;
++ ACCESS_ONCE_RW(ads->ds_ctl3) = 0;
+ }
+
+ if (!i->is_first) {
+- ACCESS_ONCE(ads->ds_ctl0) = 0;
+- ACCESS_ONCE(ads->ds_ctl1) = ctl1;
+- ACCESS_ONCE(ads->ds_ctl6) = ctl6;
++ ACCESS_ONCE_RW(ads->ds_ctl0) = 0;
++ ACCESS_ONCE_RW(ads->ds_ctl1) = ctl1;
++ ACCESS_ONCE_RW(ads->ds_ctl6) = ctl6;
+ return;
+ }
-+ pax_track_stack();
-+
- /* disregard any bin that contains <= 16 samples */
- thresh_accum_cnt = 16;
- scale_factor = 5;
-diff --git a/drivers/net/wireless/ath/ath9k/debug.c b/drivers/net/wireless/ath/ath9k/debug.c
-index d55ffd7..f7935a9 100644
---- a/drivers/net/wireless/ath/ath9k/debug.c
-+++ b/drivers/net/wireless/ath/ath9k/debug.c
-@@ -337,6 +337,8 @@ static ssize_t read_file_interrupt(struct file *file, char __user *user_buf,
- char buf[512];
- unsigned int len = 0;
-
-+ pax_track_stack();
-+
- if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_EDMA) {
- len += snprintf(buf + len, sizeof(buf) - len,
- "%8s: %10u\n", "RXLP", sc->debug.stats.istats.rxlp);
-@@ -427,6 +429,8 @@ static ssize_t read_file_wiphy(struct file *file, char __user *user_buf,
- u8 addr[ETH_ALEN];
- u32 tmp;
-
-+ pax_track_stack();
-+
- len += snprintf(buf + len, sizeof(buf) - len,
- "%s (chan=%d center-freq: %d MHz channel-type: %d (%s))\n",
- wiphy_name(sc->hw->wiphy),
-diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_debug.c b/drivers/net/wireless/ath/ath9k/htc_drv_debug.c
-index aa48b3a..947f9fa 100644
---- a/drivers/net/wireless/ath/ath9k/htc_drv_debug.c
-+++ b/drivers/net/wireless/ath/ath9k/htc_drv_debug.c
-@@ -31,6 +31,8 @@ static ssize_t read_file_tgt_int_stats(struct file *file, char __user *user_buf,
- unsigned int len = 0;
- int ret = 0;
+@@ -242,7 +242,7 @@ ar9002_set_txdesc(struct ath_hw *ah, void *ds, struct ath_tx_info *i)
+ break;
+ }
-+ pax_track_stack();
-+
- memset(&cmd_rsp, 0, sizeof(cmd_rsp));
+- ACCESS_ONCE(ads->ds_ctl0) = (i->pkt_len & AR_FrameLen)
++ ACCESS_ONCE_RW(ads->ds_ctl0) = (i->pkt_len & AR_FrameLen)
+ | (i->flags & ATH9K_TXDESC_VMF ? AR_VirtMoreFrag : 0)
+ | SM(i->txpower, AR_XmitPower)
+ | (i->flags & ATH9K_TXDESC_VEOL ? AR_VEOL : 0)
+@@ -252,19 +252,19 @@ ar9002_set_txdesc(struct ath_hw *ah, void *ds, struct ath_tx_info *i)
+ | (i->flags & ATH9K_TXDESC_RTSENA ? AR_RTSEnable :
+ (i->flags & ATH9K_TXDESC_CTSENA ? AR_CTSEnable : 0));
- ath9k_htc_ps_wakeup(priv);
-@@ -89,6 +91,8 @@ static ssize_t read_file_tgt_tx_stats(struct file *file, char __user *user_buf,
- unsigned int len = 0;
- int ret = 0;
+- ACCESS_ONCE(ads->ds_ctl1) = ctl1;
+- ACCESS_ONCE(ads->ds_ctl6) = ctl6;
++ ACCESS_ONCE_RW(ads->ds_ctl1) = ctl1;
++ ACCESS_ONCE_RW(ads->ds_ctl6) = ctl6;
-+ pax_track_stack();
-+
- memset(&cmd_rsp, 0, sizeof(cmd_rsp));
+ if (i->aggr == AGGR_BUF_MIDDLE || i->aggr == AGGR_BUF_LAST)
+ return;
- ath9k_htc_ps_wakeup(priv);
-@@ -159,6 +163,8 @@ static ssize_t read_file_tgt_rx_stats(struct file *file, char __user *user_buf,
- unsigned int len = 0;
- int ret = 0;
+- ACCESS_ONCE(ads->ds_ctl4) = set11nPktDurRTSCTS(i->rates, 0)
++ ACCESS_ONCE_RW(ads->ds_ctl4) = set11nPktDurRTSCTS(i->rates, 0)
+ | set11nPktDurRTSCTS(i->rates, 1);
+
+- ACCESS_ONCE(ads->ds_ctl5) = set11nPktDurRTSCTS(i->rates, 2)
++ ACCESS_ONCE_RW(ads->ds_ctl5) = set11nPktDurRTSCTS(i->rates, 2)
+ | set11nPktDurRTSCTS(i->rates, 3);
+
+- ACCESS_ONCE(ads->ds_ctl7) = set11nRateFlags(i->rates, 0)
++ ACCESS_ONCE_RW(ads->ds_ctl7) = set11nRateFlags(i->rates, 0)
+ | set11nRateFlags(i->rates, 1)
+ | set11nRateFlags(i->rates, 2)
+ | set11nRateFlags(i->rates, 3)
+diff --git a/drivers/net/wireless/ath/ath9k/ar9003_mac.c b/drivers/net/wireless/ath/ath9k/ar9003_mac.c
+index ccde784..db012b3 100644
+--- a/drivers/net/wireless/ath/ath9k/ar9003_mac.c
++++ b/drivers/net/wireless/ath/ath9k/ar9003_mac.c
+@@ -35,47 +35,47 @@ ar9003_set_txdesc(struct ath_hw *ah, void *ds, struct ath_tx_info *i)
+ (i->qcu << AR_TxQcuNum_S) | 0x17;
+
+ checksum += val;
+- ACCESS_ONCE(ads->info) = val;
++ ACCESS_ONCE_RW(ads->info) = val;
+
+ checksum += i->link;
+- ACCESS_ONCE(ads->link) = i->link;
++ ACCESS_ONCE_RW(ads->link) = i->link;
+
+ checksum += i->buf_addr[0];
+- ACCESS_ONCE(ads->data0) = i->buf_addr[0];
++ ACCESS_ONCE_RW(ads->data0) = i->buf_addr[0];
+ checksum += i->buf_addr[1];
+- ACCESS_ONCE(ads->data1) = i->buf_addr[1];
++ ACCESS_ONCE_RW(ads->data1) = i->buf_addr[1];
+ checksum += i->buf_addr[2];
+- ACCESS_ONCE(ads->data2) = i->buf_addr[2];
++ ACCESS_ONCE_RW(ads->data2) = i->buf_addr[2];
+ checksum += i->buf_addr[3];
+- ACCESS_ONCE(ads->data3) = i->buf_addr[3];
++ ACCESS_ONCE_RW(ads->data3) = i->buf_addr[3];
+
+ checksum += (val = (i->buf_len[0] << AR_BufLen_S) & AR_BufLen);
+- ACCESS_ONCE(ads->ctl3) = val;
++ ACCESS_ONCE_RW(ads->ctl3) = val;
+ checksum += (val = (i->buf_len[1] << AR_BufLen_S) & AR_BufLen);
+- ACCESS_ONCE(ads->ctl5) = val;
++ ACCESS_ONCE_RW(ads->ctl5) = val;
+ checksum += (val = (i->buf_len[2] << AR_BufLen_S) & AR_BufLen);
+- ACCESS_ONCE(ads->ctl7) = val;
++ ACCESS_ONCE_RW(ads->ctl7) = val;
+ checksum += (val = (i->buf_len[3] << AR_BufLen_S) & AR_BufLen);
+- ACCESS_ONCE(ads->ctl9) = val;
++ ACCESS_ONCE_RW(ads->ctl9) = val;
+
+ checksum = (u16) (((checksum & 0xffff) + (checksum >> 16)) & 0xffff);
+- ACCESS_ONCE(ads->ctl10) = checksum;
++ ACCESS_ONCE_RW(ads->ctl10) = checksum;
+
+ if (i->is_first || i->is_last) {
+- ACCESS_ONCE(ads->ctl13) = set11nTries(i->rates, 0)
++ ACCESS_ONCE_RW(ads->ctl13) = set11nTries(i->rates, 0)
+ | set11nTries(i->rates, 1)
+ | set11nTries(i->rates, 2)
+ | set11nTries(i->rates, 3)
+ | (i->dur_update ? AR_DurUpdateEna : 0)
+ | SM(0, AR_BurstDur);
+
+- ACCESS_ONCE(ads->ctl14) = set11nRate(i->rates, 0)
++ ACCESS_ONCE_RW(ads->ctl14) = set11nRate(i->rates, 0)
+ | set11nRate(i->rates, 1)
+ | set11nRate(i->rates, 2)
+ | set11nRate(i->rates, 3);
+ } else {
+- ACCESS_ONCE(ads->ctl13) = 0;
+- ACCESS_ONCE(ads->ctl14) = 0;
++ ACCESS_ONCE_RW(ads->ctl13) = 0;
++ ACCESS_ONCE_RW(ads->ctl14) = 0;
+ }
+
+ ads->ctl20 = 0;
+@@ -84,17 +84,17 @@ ar9003_set_txdesc(struct ath_hw *ah, void *ds, struct ath_tx_info *i)
+
+ ctl17 = SM(i->keytype, AR_EncrType);
+ if (!i->is_first) {
+- ACCESS_ONCE(ads->ctl11) = 0;
+- ACCESS_ONCE(ads->ctl12) = i->is_last ? 0 : AR_TxMore;
+- ACCESS_ONCE(ads->ctl15) = 0;
+- ACCESS_ONCE(ads->ctl16) = 0;
+- ACCESS_ONCE(ads->ctl17) = ctl17;
+- ACCESS_ONCE(ads->ctl18) = 0;
+- ACCESS_ONCE(ads->ctl19) = 0;
++ ACCESS_ONCE_RW(ads->ctl11) = 0;
++ ACCESS_ONCE_RW(ads->ctl12) = i->is_last ? 0 : AR_TxMore;
++ ACCESS_ONCE_RW(ads->ctl15) = 0;
++ ACCESS_ONCE_RW(ads->ctl16) = 0;
++ ACCESS_ONCE_RW(ads->ctl17) = ctl17;
++ ACCESS_ONCE_RW(ads->ctl18) = 0;
++ ACCESS_ONCE_RW(ads->ctl19) = 0;
+ return;
+ }
-+ pax_track_stack();
-+
- memset(&cmd_rsp, 0, sizeof(cmd_rsp));
+- ACCESS_ONCE(ads->ctl11) = (i->pkt_len & AR_FrameLen)
++ ACCESS_ONCE_RW(ads->ctl11) = (i->pkt_len & AR_FrameLen)
+ | (i->flags & ATH9K_TXDESC_VMF ? AR_VirtMoreFrag : 0)
+ | SM(i->txpower, AR_XmitPower)
+ | (i->flags & ATH9K_TXDESC_VEOL ? AR_VEOL : 0)
+@@ -130,22 +130,22 @@ ar9003_set_txdesc(struct ath_hw *ah, void *ds, struct ath_tx_info *i)
+ val = (i->flags & ATH9K_TXDESC_PAPRD) >> ATH9K_TXDESC_PAPRD_S;
+ ctl12 |= SM(val, AR_PAPRDChainMask);
- ath9k_htc_ps_wakeup(priv);
-@@ -203,6 +209,8 @@ static ssize_t read_file_xmit(struct file *file, char __user *user_buf,
- char buf[512];
- unsigned int len = 0;
+- ACCESS_ONCE(ads->ctl12) = ctl12;
+- ACCESS_ONCE(ads->ctl17) = ctl17;
++ ACCESS_ONCE_RW(ads->ctl12) = ctl12;
++ ACCESS_ONCE_RW(ads->ctl17) = ctl17;
-+ pax_track_stack();
-+
- len += snprintf(buf + len, sizeof(buf) - len,
- "%20s : %10u\n", "Buffers queued",
- priv->debug.tx_stats.buf_queued);
-@@ -376,6 +384,8 @@ static ssize_t read_file_slot(struct file *file, char __user *user_buf,
- char buf[512];
- unsigned int len = 0;
+- ACCESS_ONCE(ads->ctl15) = set11nPktDurRTSCTS(i->rates, 0)
++ ACCESS_ONCE_RW(ads->ctl15) = set11nPktDurRTSCTS(i->rates, 0)
+ | set11nPktDurRTSCTS(i->rates, 1);
-+ pax_track_stack();
-+
- spin_lock_bh(&priv->tx.tx_lock);
+- ACCESS_ONCE(ads->ctl16) = set11nPktDurRTSCTS(i->rates, 2)
++ ACCESS_ONCE_RW(ads->ctl16) = set11nPktDurRTSCTS(i->rates, 2)
+ | set11nPktDurRTSCTS(i->rates, 3);
- len += snprintf(buf + len, sizeof(buf) - len, "TX slot bitmap : ");
-@@ -411,6 +421,8 @@ static ssize_t read_file_queue(struct file *file, char __user *user_buf,
- char buf[512];
- unsigned int len = 0;
+- ACCESS_ONCE(ads->ctl18) = set11nRateFlags(i->rates, 0)
++ ACCESS_ONCE_RW(ads->ctl18) = set11nRateFlags(i->rates, 0)
+ | set11nRateFlags(i->rates, 1)
+ | set11nRateFlags(i->rates, 2)
+ | set11nRateFlags(i->rates, 3)
+ | SM(i->rtscts_rate, AR_RTSCTSRate);
-+ pax_track_stack();
-+
- len += snprintf(buf + len, sizeof(buf) - len, "%20s : %10u\n",
- "Mgmt endpoint", skb_queue_len(&priv->tx.mgmt_ep_queue));
+- ACCESS_ONCE(ads->ctl19) = AR_Not_Sounding;
++ ACCESS_ONCE_RW(ads->ctl19) = AR_Not_Sounding;
+ }
+ 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 939cc9d..67a3943 100644
+index f389b3c..7359e18 100644
--- a/drivers/net/wireless/ath/ath9k/hw.h
+++ b/drivers/net/wireless/ath/ath9k/hw.h
-@@ -585,7 +585,7 @@ struct ath_hw_private_ops {
+@@ -605,7 +605,7 @@ struct ath_hw_private_ops {
/* ANI */
void (*ani_cache_ini_regs)(struct ath_hw *ah);
@@ -33799,7 +33366,7 @@ index 939cc9d..67a3943 100644
/**
* struct ath_hw_ops - callbacks used by hardware code and driver code
-@@ -637,7 +637,7 @@ struct ath_hw_ops {
+@@ -635,7 +635,7 @@ struct ath_hw_ops {
void (*antdiv_comb_conf_set)(struct ath_hw *ah,
struct ath_hw_antcomb_conf *antconf);
@@ -33808,8 +33375,8 @@ index 939cc9d..67a3943 100644
struct ath_nf_limits {
s16 max;
-@@ -650,7 +650,7 @@ struct ath_nf_limits {
- #define AH_UNPLUGGED 0x2 /* The card has been physically removed. */
+@@ -655,7 +655,7 @@ enum ath_cal_list {
+ #define AH_FASTCC 0x4
struct ath_hw {
- struct ath_ops reg_ops;
@@ -33817,46 +33384,24 @@ index 939cc9d..67a3943 100644
struct ieee80211_hw *hw;
struct ath_common common;
-diff --git a/drivers/net/wireless/ipw2x00/ipw2100.c b/drivers/net/wireless/ipw2x00/ipw2100.c
-index 4430775..a509155 100644
---- a/drivers/net/wireless/ipw2x00/ipw2100.c
-+++ b/drivers/net/wireless/ipw2x00/ipw2100.c
-@@ -2100,6 +2100,8 @@ static int ipw2100_set_essid(struct ipw2100_priv *priv, char *essid,
- int err;
- DECLARE_SSID_BUF(ssid);
-
-+ pax_track_stack();
-+
- IPW_DEBUG_HC("SSID: '%s'\n", print_ssid(ssid, essid, ssid_len));
-
- if (ssid_len)
-@@ -5449,6 +5451,8 @@ static int ipw2100_set_key(struct ipw2100_priv *priv,
- struct ipw2100_wep_key *wep_key = (void *)cmd.host_command_parameters;
- int err;
-
-+ pax_track_stack();
-+
- IPW_DEBUG_HC("WEP_KEY_INFO: index = %d, len = %d/%d\n",
- idx, keylen, len);
-
-diff --git a/drivers/net/wireless/ipw2x00/libipw_rx.c b/drivers/net/wireless/ipw2x00/libipw_rx.c
-index e5ad76c..c8bd5b4 100644
---- a/drivers/net/wireless/ipw2x00/libipw_rx.c
-+++ b/drivers/net/wireless/ipw2x00/libipw_rx.c
-@@ -1565,6 +1565,8 @@ static void libipw_process_probe_response(struct libipw_device
- unsigned long flags;
- DECLARE_SSID_BUF(ssid);
+diff --git a/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_int.h b/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_int.h
+index bea8524..c677c06 100644
+--- a/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_int.h
++++ b/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_int.h
+@@ -547,7 +547,7 @@ struct phy_func_ptr {
+ void (*carrsuppr)(struct brcms_phy *);
+ s32 (*rxsigpwr)(struct brcms_phy *, s32);
+ void (*detach)(struct brcms_phy *);
+-};
++} __no_const;
-+ pax_track_stack();
-+
- LIBIPW_DEBUG_SCAN("'%s' (%pM"
- "): %c%c%c%c %c%c%c%c-%c%c%c%c %c%c%c%c\n",
- print_ssid(ssid, info_element->data, info_element->len),
+ struct brcms_phy {
+ struct brcms_phy_pub pubpi_ro;
diff --git a/drivers/net/wireless/iwlegacy/iwl3945-base.c b/drivers/net/wireless/iwlegacy/iwl3945-base.c
-index 421d5c8..b66312e 100644
+index b282d86..bee832f 100644
--- a/drivers/net/wireless/iwlegacy/iwl3945-base.c
+++ b/drivers/net/wireless/iwlegacy/iwl3945-base.c
-@@ -3962,7 +3962,9 @@ static int iwl3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e
+@@ -3686,7 +3686,9 @@ static int iwl3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e
*/
if (iwl3945_mod_params.disable_hw_scan) {
IWL_DEBUG_INFO(priv, "Disabling hw_scan\n");
@@ -33867,83 +33412,26 @@ index 421d5c8..b66312e 100644
}
IWL_DEBUG_INFO(priv, "*** LOAD DRIVER ***\n");
-diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-rs.c b/drivers/net/wireless/iwlwifi/iwl-agn-rs.c
-index 592b0cf..890faad 100644
---- a/drivers/net/wireless/iwlwifi/iwl-agn-rs.c
-+++ b/drivers/net/wireless/iwlwifi/iwl-agn-rs.c
-@@ -910,6 +910,8 @@ static void rs_tx_status(void *priv_r, struct ieee80211_supported_band *sband,
- struct iwl_station_priv *sta_priv = (void *)sta->drv_priv;
- struct iwl_rxon_context *ctx = sta_priv->common.ctx;
-
-+ pax_track_stack();
-+
- IWL_DEBUG_RATE_LIMIT(priv, "get frame ack response, update rate scale window\n");
-
- /* Treat uninitialized rate scaling data same as non-existing. */
-@@ -2918,6 +2920,8 @@ static void rs_fill_link_cmd(struct iwl_priv *priv,
- container_of(lq_sta, struct iwl_station_priv, lq_sta);
- struct iwl_link_quality_cmd *lq_cmd = &lq_sta->lq;
-
-+ pax_track_stack();
-+
- /* Override starting rate (index 0) if needed for debug purposes */
- rs_dbgfs_set_mcs(lq_sta, &new_rate, index);
-
diff --git a/drivers/net/wireless/iwlwifi/iwl-debug.h b/drivers/net/wireless/iwlwifi/iwl-debug.h
-index 2824ccb..b5630ca 100644
+index 69a77e2..552b42c 100644
--- a/drivers/net/wireless/iwlwifi/iwl-debug.h
+++ b/drivers/net/wireless/iwlwifi/iwl-debug.h
-@@ -68,8 +68,8 @@ do { \
+@@ -71,8 +71,8 @@ do { \
} while (0)
#else
--#define IWL_DEBUG(__priv, level, fmt, args...)
--#define IWL_DEBUG_LIMIT(__priv, level, fmt, args...)
-+#define IWL_DEBUG(__priv, level, fmt, args...) do {} while (0)
-+#define IWL_DEBUG_LIMIT(__priv, level, fmt, args...) do {} while (0)
- static inline void iwl_print_hex_dump(struct iwl_priv *priv, int level,
- const void *p, u32 len)
- {}
-diff --git a/drivers/net/wireless/iwlwifi/iwl-debugfs.c b/drivers/net/wireless/iwlwifi/iwl-debugfs.c
-index 0e6a04b..39636b6 100644
---- a/drivers/net/wireless/iwlwifi/iwl-debugfs.c
-+++ b/drivers/net/wireless/iwlwifi/iwl-debugfs.c
-@@ -548,6 +548,8 @@ static ssize_t iwl_dbgfs_status_read(struct file *file,
- int pos = 0;
- const size_t bufsz = sizeof(buf);
-
-+ pax_track_stack();
-+
- pos += scnprintf(buf + pos, bufsz - pos, "STATUS_HCMD_ACTIVE:\t %d\n",
- test_bit(STATUS_HCMD_ACTIVE, &priv->status));
- pos += scnprintf(buf + pos, bufsz - pos, "STATUS_INT_ENABLED:\t %d\n",
-@@ -680,6 +682,8 @@ static ssize_t iwl_dbgfs_qos_read(struct file *file, char __user *user_buf,
- char buf[256 * NUM_IWL_RXON_CTX];
- const size_t bufsz = sizeof(buf);
-
-+ pax_track_stack();
-+
- for_each_context(priv, ctx) {
- pos += scnprintf(buf + pos, bufsz - pos, "context %d:\n",
- ctx->ctxid);
-diff --git a/drivers/net/wireless/iwmc3200wifi/debugfs.c b/drivers/net/wireless/iwmc3200wifi/debugfs.c
-index 0a0cc96..fd49ad8 100644
---- a/drivers/net/wireless/iwmc3200wifi/debugfs.c
-+++ b/drivers/net/wireless/iwmc3200wifi/debugfs.c
-@@ -327,6 +327,8 @@ static ssize_t iwm_debugfs_fw_err_read(struct file *filp,
- int buf_len = 512;
- size_t len = 0;
-
-+ pax_track_stack();
-+
- if (*ppos != 0)
- return 0;
- if (count < sizeof(buf))
+-#define IWL_DEBUG(m, level, fmt, args...)
+-#define IWL_DEBUG_LIMIT(m, level, fmt, args...)
++#define IWL_DEBUG(m, level, fmt, args...) do {} while (0)
++#define IWL_DEBUG_LIMIT(m, level, fmt, args...) do {} while (0)
+ #define iwl_print_hex_dump(m, level, p, len)
+ #endif /* CONFIG_IWLWIFI_DEBUG */
+
diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c
-index 9d4a40e..add74dd 100644
+index 523ad55..f8c5dc5 100644
--- a/drivers/net/wireless/mac80211_hwsim.c
+++ b/drivers/net/wireless/mac80211_hwsim.c
-@@ -1260,9 +1260,11 @@ static int __init init_mac80211_hwsim(void)
+@@ -1678,9 +1678,11 @@ static int __init init_mac80211_hwsim(void)
return -EINVAL;
if (fake_hw_scan) {
@@ -33958,11 +33446,24 @@ index 9d4a40e..add74dd 100644
}
spin_lock_init(&hwsim_radio_lock);
+diff --git a/drivers/net/wireless/mwifiex/main.h b/drivers/net/wireless/mwifiex/main.h
+index 30f138b..c904585 100644
+--- a/drivers/net/wireless/mwifiex/main.h
++++ b/drivers/net/wireless/mwifiex/main.h
+@@ -543,7 +543,7 @@ struct mwifiex_if_ops {
+ void (*cleanup_mpa_buf) (struct mwifiex_adapter *);
+ int (*cmdrsp_complete) (struct mwifiex_adapter *, struct sk_buff *);
+ int (*event_complete) (struct mwifiex_adapter *, struct sk_buff *);
+-};
++} __no_const;
+
+ struct mwifiex_adapter {
+ u8 iface_type;
diff --git a/drivers/net/wireless/rndis_wlan.c b/drivers/net/wireless/rndis_wlan.c
-index 29f9389..f6d2ce0 100644
+index 0c13840..a5c3ed6 100644
--- a/drivers/net/wireless/rndis_wlan.c
+++ b/drivers/net/wireless/rndis_wlan.c
-@@ -1277,7 +1277,7 @@ static int set_rts_threshold(struct usbnet *usbdev, u32 rts_threshold)
+@@ -1275,7 +1275,7 @@ static int set_rts_threshold(struct usbnet *usbdev, u32 rts_threshold)
netdev_dbg(usbdev->net, "%s(): %i\n", __func__, rts_threshold);
@@ -33971,19 +33472,6 @@ index 29f9389..f6d2ce0 100644
rts_threshold = 2347;
tmp = cpu_to_le32(rts_threshold);
-diff --git a/drivers/net/wireless/rtlwifi/rtl8192c/phy_common.c b/drivers/net/wireless/rtlwifi/rtl8192c/phy_common.c
-index d2cc815..9579e62 100644
---- a/drivers/net/wireless/rtlwifi/rtl8192c/phy_common.c
-+++ b/drivers/net/wireless/rtlwifi/rtl8192c/phy_common.c
-@@ -837,6 +837,8 @@ bool _rtl92c_phy_sw_chnl_step_by_step(struct ieee80211_hw *hw,
- u8 rfpath;
- u8 num_total_rfpath = rtlphy->num_total_rfpath;
-
-+ pax_track_stack();
-+
- precommoncmdcnt = 0;
- _rtl92c_phy_set_sw_chnl_cmdarray(precommoncmd, precommoncmdcnt++,
- MAX_PRECMD_CNT,
diff --git a/drivers/net/wireless/wl1251/wl1251.h b/drivers/net/wireless/wl1251/wl1251.h
index a77f1bb..c608b2b 100644
--- a/drivers/net/wireless/wl1251/wl1251.h
@@ -33997,19 +33485,6 @@ index a77f1bb..c608b2b 100644
struct wl1251 {
struct ieee80211_hw *hw;
-diff --git a/drivers/net/wireless/wl12xx/spi.c b/drivers/net/wireless/wl12xx/spi.c
-index 51662bb..354cd39 100644
---- a/drivers/net/wireless/wl12xx/spi.c
-+++ b/drivers/net/wireless/wl12xx/spi.c
-@@ -280,6 +280,8 @@ static void wl1271_spi_raw_write(struct wl1271 *wl, int addr, void *buf,
- u32 chunk_len;
- int i;
-
-+ pax_track_stack();
-+
- WARN_ON(len > WL1271_AGGR_BUFFER_SIZE);
-
- spi_message_init(&m);
diff --git a/drivers/oprofile/buffer_sync.c b/drivers/oprofile/buffer_sync.c
index f34b5b2..b5abb9f 100644
--- a/drivers/oprofile/buffer_sync.c
@@ -34050,7 +33525,7 @@ index f34b5b2..b5abb9f 100644
}
release_mm(mm);
diff --git a/drivers/oprofile/event_buffer.c b/drivers/oprofile/event_buffer.c
-index dd87e86..bc0148c 100644
+index c0cc4e7..44d4e54 100644
--- a/drivers/oprofile/event_buffer.c
+++ b/drivers/oprofile/event_buffer.c
@@ -53,7 +53,7 @@ void add_event_entry(unsigned long value)
@@ -34097,11 +33572,11 @@ index 917d28e..d62d981 100644
diff --git a/drivers/oprofile/oprofile_stats.h b/drivers/oprofile/oprofile_stats.h
-index 0b54e46..a37c527 100644
+index 38b6fc0..b5cbfce 100644
--- a/drivers/oprofile/oprofile_stats.h
+++ b/drivers/oprofile/oprofile_stats.h
@@ -13,11 +13,11 @@
- #include <asm/atomic.h>
+ #include <linux/atomic.h>
struct oprofile_stat_struct {
- atomic_t sample_lost_no_mm;
@@ -34118,10 +33593,10 @@ index 0b54e46..a37c527 100644
extern struct oprofile_stat_struct oprofile_stats;
diff --git a/drivers/oprofile/oprofilefs.c b/drivers/oprofile/oprofilefs.c
-index e9ff6f7..28e259a 100644
+index 2f0aa0f..90fab02 100644
--- a/drivers/oprofile/oprofilefs.c
+++ b/drivers/oprofile/oprofilefs.c
-@@ -186,7 +186,7 @@ static const struct file_operations atomic_ro_fops = {
+@@ -193,7 +193,7 @@ static const struct file_operations atomic_ro_fops = {
int oprofilefs_create_ro_atomic(struct super_block *sb, struct dentry *root,
@@ -34184,7 +33659,7 @@ index 76ba8a1..20ca857 100644
/* initialize our int15 lock */
diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c
-index 6892601..65aaa93 100644
+index cbfbab1..6a9fced 100644
--- a/drivers/pci/pcie/aspm.c
+++ b/drivers/pci/pcie/aspm.c
@@ -27,9 +27,9 @@
@@ -34201,10 +33676,10 @@ index 6892601..65aaa93 100644
#define ASPM_STATE_ALL (ASPM_STATE_L0S | ASPM_STATE_L1)
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
-index bafb3c3..5f91c5f 100644
+index 04e74f4..a960176 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
-@@ -129,7 +129,7 @@ int __pci_read_base(struct pci_dev *dev, enum pci_bar_type type,
+@@ -136,7 +136,7 @@ int __pci_read_base(struct pci_dev *dev, enum pci_bar_type type,
u32 l, sz, mask;
u16 orig_cmd;
@@ -34234,57 +33709,8 @@ index 27911b5..5b6db88 100644
proc_create("devices", 0, proc_bus_pci_dir,
&proc_bus_pci_dev_operations);
proc_initialized = 1;
-diff --git a/drivers/pci/xen-pcifront.c b/drivers/pci/xen-pcifront.c
-index d4e7a10..0790107 100644
---- a/drivers/pci/xen-pcifront.c
-+++ b/drivers/pci/xen-pcifront.c
-@@ -187,6 +187,8 @@ static int pcifront_bus_read(struct pci_bus *bus, unsigned int devfn,
- struct pcifront_sd *sd = bus->sysdata;
- struct pcifront_device *pdev = pcifront_get_pdev(sd);
-
-+ pax_track_stack();
-+
- if (verbose_request)
- dev_info(&pdev->xdev->dev,
- "read dev=%04x:%02x:%02x.%01x - offset %x size %d\n",
-@@ -226,6 +228,8 @@ static int pcifront_bus_write(struct pci_bus *bus, unsigned int devfn,
- struct pcifront_sd *sd = bus->sysdata;
- struct pcifront_device *pdev = pcifront_get_pdev(sd);
-
-+ pax_track_stack();
-+
- if (verbose_request)
- dev_info(&pdev->xdev->dev,
- "write dev=%04x:%02x:%02x.%01x - "
-@@ -258,6 +262,8 @@ static int pci_frontend_enable_msix(struct pci_dev *dev,
- struct pcifront_device *pdev = pcifront_get_pdev(sd);
- struct msi_desc *entry;
-
-+ pax_track_stack();
-+
- if (nvec > SH_INFO_MAX_VEC) {
- dev_err(&dev->dev, "too much vector for pci frontend: %x."
- " Increase SH_INFO_MAX_VEC.\n", nvec);
-@@ -309,6 +315,8 @@ static void pci_frontend_disable_msix(struct pci_dev *dev)
- struct pcifront_sd *sd = dev->bus->sysdata;
- struct pcifront_device *pdev = pcifront_get_pdev(sd);
-
-+ pax_track_stack();
-+
- err = do_pci_op(pdev, &op);
-
- /* What should do for error ? */
-@@ -328,6 +336,8 @@ static int pci_frontend_enable_msi(struct pci_dev *dev, int vector[])
- struct pcifront_sd *sd = dev->bus->sysdata;
- struct pcifront_device *pdev = pcifront_get_pdev(sd);
-
-+ pax_track_stack();
-+
- err = do_pci_op(pdev, &op);
- if (likely(!err)) {
- vector[0] = op.value;
diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c
-index 26c5b11..fa93a8b 100644
+index 7b82868..b9344c9 100644
--- a/drivers/platform/x86/thinkpad_acpi.c
+++ b/drivers/platform/x86/thinkpad_acpi.c
@@ -2094,7 +2094,7 @@ static int hotkey_mask_get(void)
@@ -34296,6 +33722,125 @@ index 26c5b11..fa93a8b 100644
{
/* log only what the user can fix... */
const u32 wantedmask = hotkey_driver_mask &
+@@ -2325,11 +2325,6 @@ static void hotkey_read_nvram(struct tp_nvram_state *n, const u32 m)
+ }
+ }
+
+-static void hotkey_compare_and_issue_event(struct tp_nvram_state *oldn,
+- struct tp_nvram_state *newn,
+- const u32 event_mask)
+-{
+-
+ #define TPACPI_COMPARE_KEY(__scancode, __member) \
+ do { \
+ if ((event_mask & (1 << __scancode)) && \
+@@ -2343,36 +2338,42 @@ static void hotkey_compare_and_issue_event(struct tp_nvram_state *oldn,
+ tpacpi_hotkey_send_key(__scancode); \
+ } while (0)
+
+- void issue_volchange(const unsigned int oldvol,
+- const unsigned int newvol)
+- {
+- unsigned int i = oldvol;
++static void issue_volchange(const unsigned int oldvol,
++ const unsigned int newvol,
++ const u32 event_mask)
++{
++ unsigned int i = oldvol;
+
+- while (i > newvol) {
+- TPACPI_MAY_SEND_KEY(TP_ACPI_HOTKEYSCAN_VOLUMEDOWN);
+- i--;
+- }
+- while (i < newvol) {
+- TPACPI_MAY_SEND_KEY(TP_ACPI_HOTKEYSCAN_VOLUMEUP);
+- i++;
+- }
++ while (i > newvol) {
++ TPACPI_MAY_SEND_KEY(TP_ACPI_HOTKEYSCAN_VOLUMEDOWN);
++ i--;
+ }
++ while (i < newvol) {
++ TPACPI_MAY_SEND_KEY(TP_ACPI_HOTKEYSCAN_VOLUMEUP);
++ i++;
++ }
++}
+
+- void issue_brightnesschange(const unsigned int oldbrt,
+- const unsigned int newbrt)
+- {
+- unsigned int i = oldbrt;
++static void issue_brightnesschange(const unsigned int oldbrt,
++ const unsigned int newbrt,
++ const u32 event_mask)
++{
++ unsigned int i = oldbrt;
+
+- while (i > newbrt) {
+- TPACPI_MAY_SEND_KEY(TP_ACPI_HOTKEYSCAN_FNEND);
+- i--;
+- }
+- while (i < newbrt) {
+- TPACPI_MAY_SEND_KEY(TP_ACPI_HOTKEYSCAN_FNHOME);
+- i++;
+- }
++ while (i > newbrt) {
++ TPACPI_MAY_SEND_KEY(TP_ACPI_HOTKEYSCAN_FNEND);
++ i--;
++ }
++ while (i < newbrt) {
++ TPACPI_MAY_SEND_KEY(TP_ACPI_HOTKEYSCAN_FNHOME);
++ i++;
+ }
++}
+
++static void hotkey_compare_and_issue_event(struct tp_nvram_state *oldn,
++ struct tp_nvram_state *newn,
++ const u32 event_mask)
++{
+ TPACPI_COMPARE_KEY(TP_ACPI_HOTKEYSCAN_THINKPAD, thinkpad_toggle);
+ TPACPI_COMPARE_KEY(TP_ACPI_HOTKEYSCAN_FNSPACE, zoom_toggle);
+ TPACPI_COMPARE_KEY(TP_ACPI_HOTKEYSCAN_FNF7, display_toggle);
+@@ -2406,7 +2407,7 @@ static void hotkey_compare_and_issue_event(struct tp_nvram_state *oldn,
+ oldn->volume_level != newn->volume_level) {
+ /* recently muted, or repeated mute keypress, or
+ * multiple presses ending in mute */
+- issue_volchange(oldn->volume_level, newn->volume_level);
++ issue_volchange(oldn->volume_level, newn->volume_level, event_mask);
+ TPACPI_MAY_SEND_KEY(TP_ACPI_HOTKEYSCAN_MUTE);
+ }
+ } else {
+@@ -2416,7 +2417,7 @@ static void hotkey_compare_and_issue_event(struct tp_nvram_state *oldn,
+ TPACPI_MAY_SEND_KEY(TP_ACPI_HOTKEYSCAN_VOLUMEUP);
+ }
+ if (oldn->volume_level != newn->volume_level) {
+- issue_volchange(oldn->volume_level, newn->volume_level);
++ issue_volchange(oldn->volume_level, newn->volume_level, event_mask);
+ } else if (oldn->volume_toggle != newn->volume_toggle) {
+ /* repeated vol up/down keypress at end of scale ? */
+ if (newn->volume_level == 0)
+@@ -2429,7 +2430,8 @@ static void hotkey_compare_and_issue_event(struct tp_nvram_state *oldn,
+ /* handle brightness */
+ if (oldn->brightness_level != newn->brightness_level) {
+ issue_brightnesschange(oldn->brightness_level,
+- newn->brightness_level);
++ newn->brightness_level,
++ event_mask);
+ } else if (oldn->brightness_toggle != newn->brightness_toggle) {
+ /* repeated key presses that didn't change state */
+ if (newn->brightness_level == 0)
+@@ -2438,10 +2440,10 @@ static void hotkey_compare_and_issue_event(struct tp_nvram_state *oldn,
+ && !tp_features.bright_unkfw)
+ TPACPI_MAY_SEND_KEY(TP_ACPI_HOTKEYSCAN_FNHOME);
+ }
++}
+
+ #undef TPACPI_COMPARE_KEY
+ #undef TPACPI_MAY_SEND_KEY
+-}
+
+ /*
+ * Polling driver
diff --git a/drivers/pnp/pnpbios/bioscalls.c b/drivers/pnp/pnpbios/bioscalls.c
index b859d16..5cc6b1a 100644
--- a/drivers/pnp/pnpbios/bioscalls.c
@@ -34409,10 +33954,10 @@ index 33f5d9a..d957d3f 100644
/*
diff --git a/drivers/regulator/mc13892-regulator.c b/drivers/regulator/mc13892-regulator.c
-index 3285d41..ab7c22a 100644
+index 023d17d..74ef35b 100644
--- a/drivers/regulator/mc13892-regulator.c
+++ b/drivers/regulator/mc13892-regulator.c
-@@ -564,10 +564,12 @@ static int __devinit mc13892_regulator_probe(struct platform_device *pdev)
+@@ -565,10 +565,12 @@ static int __devinit mc13892_regulator_probe(struct platform_device *pdev)
}
mc13xxx_unlock(mc13892);
@@ -34448,19 +33993,6 @@ index cace6d3..f623fda 100644
return rtc_set_time(rtc, &tm);
case RTC_PIE_ON:
-diff --git a/drivers/scsi/BusLogic.c b/drivers/scsi/BusLogic.c
-index f66c33b..7ae5823 100644
---- a/drivers/scsi/BusLogic.c
-+++ b/drivers/scsi/BusLogic.c
-@@ -962,6 +962,8 @@ static int __init BusLogic_InitializeFlashPointProbeInfo(struct BusLogic_HostAda
- static void __init BusLogic_InitializeProbeInfoList(struct BusLogic_HostAdapter
- *PrototypeHostAdapter)
- {
-+ pax_track_stack();
-+
- /*
- If a PCI BIOS is present, interrogate it for MultiMaster and FlashPoint
- Host Adapters; otherwise, default to the standard ISA MultiMaster probe.
diff --git a/drivers/sc