diff --git a/changelog b/changelog index 6ccec73..804579d 100644 --- a/changelog +++ b/changelog @@ -1,3 +1,9 @@ +linux-image (linux-3.2.66-mempo-0.2.106) UNRELEASED; urgency=high + * grsec: pax and upstream fixes + * v0.2.106-001-rc + + -- mempo Fri, 06 Feb 2015 09:15:00 +0200 + linux-image (linux-3.2.66-mempo-0.2.105) UNRELEASED; urgency=high * grsec: fix rcu lock imbalance upstream bug * v0.2.105-001-rc diff --git a/kernel-build/linux-mempo/configs-kernel/deb7-desk.kernel-config b/kernel-build/linux-mempo/configs-kernel/deb7-desk.kernel-config index 4796aac..a59e958 100644 --- a/kernel-build/linux-mempo/configs-kernel/deb7-desk.kernel-config +++ b/kernel-build/linux-mempo/configs-kernel/deb7-desk.kernel-config @@ -62,7 +62,7 @@ CONFIG_IRQ_WORK=y CONFIG_EXPERIMENTAL=y CONFIG_INIT_ENV_ARG_LIMIT=32 CONFIG_CROSS_COMPILE="" -CONFIG_LOCALVERSION="-mempo.desk.0.2.105" +CONFIG_LOCALVERSION="-mempo.desk.0.2.106" # CONFIG_LOCALVERSION_AUTO is not set CONFIG_HAVE_KERNEL_GZIP=y CONFIG_HAVE_KERNEL_BZIP2=y diff --git a/kernel-build/linux-mempo/configs-kernel/deb7-deskmax.kernel-config b/kernel-build/linux-mempo/configs-kernel/deb7-deskmax.kernel-config index d501b71..856903d 100644 --- a/kernel-build/linux-mempo/configs-kernel/deb7-deskmax.kernel-config +++ b/kernel-build/linux-mempo/configs-kernel/deb7-deskmax.kernel-config @@ -62,7 +62,7 @@ CONFIG_IRQ_WORK=y CONFIG_EXPERIMENTAL=y CONFIG_INIT_ENV_ARG_LIMIT=32 CONFIG_CROSS_COMPILE="" -CONFIG_LOCALVERSION="-mempo.deskmax.0.2.105" +CONFIG_LOCALVERSION="-mempo.deskmax.0.2.106" # CONFIG_LOCALVERSION_AUTO is not set CONFIG_HAVE_KERNEL_GZIP=y CONFIG_HAVE_KERNEL_BZIP2=y diff --git a/kernel-build/linux-mempo/configs-kernel/deb7-deskmaxdbg.kernel-config b/kernel-build/linux-mempo/configs-kernel/deb7-deskmaxdbg.kernel-config index 444130c..ba5eb34 100644 --- a/kernel-build/linux-mempo/configs-kernel/deb7-deskmaxdbg.kernel-config +++ b/kernel-build/linux-mempo/configs-kernel/deb7-deskmaxdbg.kernel-config @@ -62,7 +62,7 @@ CONFIG_IRQ_WORK=y CONFIG_EXPERIMENTAL=y CONFIG_INIT_ENV_ARG_LIMIT=32 CONFIG_CROSS_COMPILE="" -CONFIG_LOCALVERSION="-mempo.deskmaxdbg.0.2.105" +CONFIG_LOCALVERSION="-mempo.deskmaxdbg.0.2.106" # CONFIG_LOCALVERSION_AUTO is not set CONFIG_HAVE_KERNEL_GZIP=y CONFIG_HAVE_KERNEL_BZIP2=y diff --git a/kernel-build/linux-mempo/configs-kernel/deb7-insecuregrsoff.kernel-config b/kernel-build/linux-mempo/configs-kernel/deb7-insecuregrsoff.kernel-config index 34f2bfb..ae25265 100644 --- a/kernel-build/linux-mempo/configs-kernel/deb7-insecuregrsoff.kernel-config +++ b/kernel-build/linux-mempo/configs-kernel/deb7-insecuregrsoff.kernel-config @@ -62,11 +62,7 @@ CONFIG_IRQ_WORK=y CONFIG_EXPERIMENTAL=y CONFIG_INIT_ENV_ARG_LIMIT=32 CONFIG_CROSS_COMPILE="" -<<<<<<< HEAD:kernel-build/linux-mempo/configs-kernel/deb7-insecuregrsoff.kernel-config -CONFIG_LOCALVERSION="-mempo.insecuregrsoff.0.2.104" -======= -CONFIG_LOCALVERSION="-mempo.INSECUREgrsOFF.0.2.105" ->>>>>>> 0x20c24/master:kernel-build/linux-mempo/configs-kernel/deb7-INSECUREgrsOFF.kernel-config +CONFIG_LOCALVERSION="-mempo.insecuregrsoff.0.2.106" # CONFIG_LOCALVERSION_AUTO is not set CONFIG_HAVE_KERNEL_GZIP=y CONFIG_HAVE_KERNEL_BZIP2=y diff --git a/kernel-build/linux-mempo/configs-kernel/deb7-serv.kernel-config b/kernel-build/linux-mempo/configs-kernel/deb7-serv.kernel-config index bcc21aa..1f30951 100644 --- a/kernel-build/linux-mempo/configs-kernel/deb7-serv.kernel-config +++ b/kernel-build/linux-mempo/configs-kernel/deb7-serv.kernel-config @@ -62,7 +62,7 @@ CONFIG_IRQ_WORK=y CONFIG_EXPERIMENTAL=y CONFIG_INIT_ENV_ARG_LIMIT=32 CONFIG_CROSS_COMPILE="" -CONFIG_LOCALVERSION="-mempo.serv.0.2.105" +CONFIG_LOCALVERSION="-mempo.serv.0.2.106" # CONFIG_LOCALVERSION_AUTO is not set CONFIG_HAVE_KERNEL_GZIP=y CONFIG_HAVE_KERNEL_BZIP2=y diff --git a/kernel-build/linux-mempo/configs-kernel/deb7-servmax.kernel-config b/kernel-build/linux-mempo/configs-kernel/deb7-servmax.kernel-config index 8f87873..67ec0c3 100644 --- a/kernel-build/linux-mempo/configs-kernel/deb7-servmax.kernel-config +++ b/kernel-build/linux-mempo/configs-kernel/deb7-servmax.kernel-config @@ -62,7 +62,7 @@ CONFIG_IRQ_WORK=y CONFIG_EXPERIMENTAL=y CONFIG_INIT_ENV_ARG_LIMIT=32 CONFIG_CROSS_COMPILE="" -CONFIG_LOCALVERSION="-mempo.servmax.0.2.105" +CONFIG_LOCALVERSION="-mempo.servmax.0.2.106" # CONFIG_LOCALVERSION_AUTO is not set CONFIG_HAVE_KERNEL_GZIP=y CONFIG_HAVE_KERNEL_BZIP2=y diff --git a/kernel-build/linux-mempo/configs-kernel/deb7-servmaxdbg.kernel-config b/kernel-build/linux-mempo/configs-kernel/deb7-servmaxdbg.kernel-config index 578d95c..8709af5 100644 --- a/kernel-build/linux-mempo/configs-kernel/deb7-servmaxdbg.kernel-config +++ b/kernel-build/linux-mempo/configs-kernel/deb7-servmaxdbg.kernel-config @@ -62,7 +62,7 @@ CONFIG_IRQ_WORK=y CONFIG_EXPERIMENTAL=y CONFIG_INIT_ENV_ARG_LIMIT=32 CONFIG_CROSS_COMPILE="" -CONFIG_LOCALVERSION="-mempo.servmaxdbg.0.2.105" +CONFIG_LOCALVERSION="-mempo.servmaxdbg.0.2.106" # CONFIG_LOCALVERSION_AUTO is not set CONFIG_HAVE_KERNEL_GZIP=y CONFIG_HAVE_KERNEL_BZIP2=y diff --git a/kernel-build/linux-mempo/configs-kernel/deb7-zero.kernel-config b/kernel-build/linux-mempo/configs-kernel/deb7-zero.kernel-config index a886ab9..9ef1629 100644 --- a/kernel-build/linux-mempo/configs-kernel/deb7-zero.kernel-config +++ b/kernel-build/linux-mempo/configs-kernel/deb7-zero.kernel-config @@ -58,7 +58,7 @@ CONFIG_EXPERIMENTAL=y CONFIG_BROKEN_ON_SMP=y CONFIG_INIT_ENV_ARG_LIMIT=32 CONFIG_CROSS_COMPILE="" -CONFIG_LOCALVERSION="-mempo.zero.0.2.105" +CONFIG_LOCALVERSION="-mempo.zero.0.2.106" # CONFIG_LOCALVERSION_AUTO is not set CONFIG_HAVE_KERNEL_GZIP=y CONFIG_HAVE_KERNEL_BZIP2=y diff --git a/kernel-build/linux-mempo/env-data.sh b/kernel-build/linux-mempo/env-data.sh index d885248..8eb7123 100755 --- a/kernel-build/linux-mempo/env-data.sh +++ b/kernel-build/linux-mempo/env-data.sh @@ -1,5 +1,5 @@ # place for STATIC settings for release. [autogenerated] export kernel_general_version="3.2.66" # base version (should match the one is sourcecode.list) -export KERNEL_DATE='2015-02-05 17:41:37' # UTC time of mempo version. This is > then max(kernel,grsec,patches) times -export CURRENT_SEED='7e7d82398c3e00474ce640916210297fb31bdb435c7cdfda9f5327795275b1f9' # litecoin block 724068 (*) +export KERNEL_DATE='2015-02-06 08:34:44' # UTC time of mempo version. This is > then max(kernel,grsec,patches) times +export CURRENT_SEED='5c4852c394bd645e4bd8534516742ef3aa8a16fdaa49e9d802dd0a1340746f58' # litecoin block 724450 (*) export DEBIAN_REVISION='001' # see README.md how to update it on git tag, on rc and final releases diff --git a/kernel-build/linux-mempo/sourcecode.list b/kernel-build/linux-mempo/sourcecode.list index 2240a23..9d72a8c 100644 --- a/kernel-build/linux-mempo/sourcecode.list +++ b/kernel-build/linux-mempo/sourcecode.list @@ -1,4 +1,4 @@ V,ID_kernel_vanilla_ID,x,kernel,linux-3.2.66.tar,sha256,49268e647ea9a8732cc6afc949dea2d77a2956653ae0f65e22f7279b3035f9d4,./ -P,ID_grsecurity_main_ID,x,grsecurity,grsecurity-3.0-3.2.66-201502050848.patch,sha256,cae3e7c9c8574548443bb406785504b181366025520dd9b13e276c10180631c4,./tmp-path/ +P,ID_grsecurity_main_ID,x,grsecurity,grsecurity-3.0-3.2.66-201502052350.patch,sha256,b7deea10576f5d107750ffd3d451498e8e0546ab136afd490b05b65063948852,./tmp-path/ P,ID_mempo_grsec_ID,x,mempo,grsecurity-3.0-3.2.55-201402152203-mempo-extra.patch,sha256,a8e81062e44ea899af688a326aaebcfd86d759da69b39f6ed66b7a8e7bcf9a8d,./tmp-path/ P,ID_mempo_determ_ID,x,mempo,linux-3.2.57-grsec-deterministic-build.patch,sha256,aca4001855c4c822c78aee90acc8706a3ffb3b5e4d42f07b4ffe827190d77d59,./tmp-path/ diff --git a/kernel-sources/grsecurity/changelog-stable.txt b/kernel-sources/grsecurity/changelog-stable.txt index 5ad5d20..9e44f4c 100644 --- a/kernel-sources/grsecurity/changelog-stable.txt +++ b/kernel-sources/grsecurity/changelog-stable.txt @@ -1,3 +1,161 @@ +commit 379b0a4d3e2ae5095796d2def99e47b5253fac19 +Merge: ad89d65 307172b +Author: Brad Spengler +Date: Thu Feb 5 22:31:35 2015 -0500 + + Merge branch 'pax-stable' into grsec-stable + +commit 307172b4c08144555935a189c6599a681cb7a24c +Author: Brad Spengler +Date: Thu Feb 5 22:30:49 2015 -0500 + + Update to pax-linux-3.2.66-test164.patch: + - fixed STACKLEAK and stack overflow checking interference, reported by Toralf Förster (https://bugs.gentoo.org/show_bug.cgi?id=536514) and KDE (http://forums.grsecurity.net/viewtopic.php?f=3&t=4121) + - fixed early crash of Xen domU when SSP is enabled (e.g., the default Arch kernel), reported by badchemist + - fixed cc-ldoption to work with the HJL fork of binutils, reported by Rogelio M. Serrano Jr. + - bring is_valid_bugaddr on amd64 in line with the i386 version, should fix BUG() backtraces + - fixed rcu lock imbalance in have_submounts, by Steven Rostedt (https://lkml.org/lkml/2015/1/17/71), reported by rfree@mempo.org + + arch/x86/kernel/dumpstack_64.c | 2 +- + arch/x86/kernel/entry_32.S | 1 + + arch/x86/kernel/entry_64.S | 1 + + arch/x86/kernel/process_32.c | 2 +- + arch/x86/kernel/process_64.c | 2 +- + arch/x86/xen/enlighten.c | 3 +++ + fs/dcache.c | 4 +++- + fs/exec.c | 2 +- + scripts/Kbuild.include | 2 +- + 9 files changed, 13 insertions(+), 6 deletions(-) + +commit ad89d65da4bfbea5fa820fe56ed5e70fabc8247d +Author: Giel van Schijndel +Date: Tue Jan 6 22:37:00 2015 +0100 + + cifs: use memzero_explicit to clear stack buffer + + When leaving a function use memzero_explicit instead of memset(0) to + clear stack allocated buffers. memset(0) may be optimized away. + + This particular buffer is highly likely to contain sensitive data which + we shouldn't leak (it's named 'passwd' after all). + + Signed-off-by: Giel van Schijndel + Acked-by: Herbert Xu + Reported-at: http://www.viva64.com/en/b/0299/ + Reported-by: Andrey Karpov + Reported-by: Svyatoslav Razmyslov + Signed-off-by: Steve French + + fs/cifs/smbencrypt.c | 2 +- + 1 files changed, 1 insertions(+), 1 deletions(-) + +commit 896d0cda0f8bceefe92052c5dfd7ea5d4f51e5ad +Author: Daniel Borkmann +Date: Thu Jan 15 16:34:35 2015 +0100 + + net: sctp: fix race for one-to-many sockets in sendmsg's auto associate + + I.e. one-to-many sockets in SCTP are not required to explicitly + call into connect(2) or sctp_connectx(2) prior to data exchange. + Instead, they can directly invoke sendmsg(2) and the SCTP stack + will automatically trigger connection establishment through 4WHS + via sctp_primitive_ASSOCIATE(). However, this in its current + implementation is racy: INIT is being sent out immediately (as + it cannot be bundled anyway) and the rest of the DATA chunks are + queued up for later xmit when connection is established, meaning + sendmsg(2) will return successfully. This behaviour can result + in an undesired side-effect that the kernel made the application + think the data has already been transmitted, although none of it + has actually left the machine, worst case even after close(2)'ing + the socket. + + Instead, when the association from client side has been shut down + e.g. first gracefully through SCTP_EOF and then close(2), the + client could afterwards still receive the server's INIT_ACK due + to a connection with higher latency. This INIT_ACK is then considered + out of the blue and hence responded with ABORT as there was no + alive assoc found anymore. This can be easily reproduced f.e. + with sctp_test application from lksctp. One way to fix this race + is to wait for the handshake to actually complete. + + The fix defers waiting after sctp_primitive_ASSOCIATE() and + sctp_primitive_SEND() succeeded, so that DATA chunks cooked up + from sctp_sendmsg() have already been placed into the output + queue through the side-effect interpreter, and therefore can then + be bundeled together with COOKIE_ECHO control chunks. + + strace from example application (shortened): + + socket(PF_INET, SOCK_SEQPACKET, IPPROTO_SCTP) = 3 + sendmsg(3, {msg_name(28)={sa_family=AF_INET, sin_port=htons(8888), sin_addr=inet_addr("192.168.1.115")}, + msg_iov(1)=[{"hello", 5}], msg_controllen=0, msg_flags=0}, 0) = 5 + sendmsg(3, {msg_name(28)={sa_family=AF_INET, sin_port=htons(8888), sin_addr=inet_addr("192.168.1.115")}, + msg_iov(1)=[{"hello", 5}], msg_controllen=0, msg_flags=0}, 0) = 5 + sendmsg(3, {msg_name(28)={sa_family=AF_INET, sin_port=htons(8888), sin_addr=inet_addr("192.168.1.115")}, + msg_iov(1)=[{"hello", 5}], msg_controllen=0, msg_flags=0}, 0) = 5 + sendmsg(3, {msg_name(28)={sa_family=AF_INET, sin_port=htons(8888), sin_addr=inet_addr("192.168.1.115")}, + msg_iov(1)=[{"hello", 5}], msg_controllen=0, msg_flags=0}, 0) = 5 + sendmsg(3, {msg_name(28)={sa_family=AF_INET, sin_port=htons(8888), sin_addr=inet_addr("192.168.1.115")}, + msg_iov(0)=[], msg_controllen=48, {cmsg_len=48, cmsg_level=0x84 /* SOL_??? */, cmsg_type=, ...}, + msg_flags=0}, 0) = 0 // graceful shutdown for SOCK_SEQPACKET via SCTP_EOF + close(3) = 0 + + tcpdump before patch (fooling the application): + + 22:33:36.306142 IP 192.168.1.114.41462 > 192.168.1.115.8888: sctp (1) [INIT] [init tag: 3879023686] [rwnd: 106496] [OS: 10] [MIS: 65535] [init TSN: 3139201684] + 22:33:36.316619 IP 192.168.1.115.8888 > 192.168.1.114.41462: sctp (1) [INIT ACK] [init tag: 3345394793] [rwnd: 106496] [OS: 10] [MIS: 10] [init TSN: 3380109591] + 22:33:36.317600 IP 192.168.1.114.41462 > 192.168.1.115.8888: sctp (1) [ABORT] + + tcpdump after patch: + + 14:28:58.884116 IP 192.168.1.114.35846 > 192.168.1.115.8888: sctp (1) [INIT] [init tag: 438593213] [rwnd: 106496] [OS: 10] [MIS: 65535] [init TSN: 3092969729] + 14:28:58.888414 IP 192.168.1.115.8888 > 192.168.1.114.35846: sctp (1) [INIT ACK] [init tag: 381429855] [rwnd: 106496] [OS: 10] [MIS: 10] [init TSN: 2141904492] + 14:28:58.888638 IP 192.168.1.114.35846 > 192.168.1.115.8888: sctp (1) [COOKIE ECHO] , (2) [DATA] (B)(E) [TSN: 3092969729] [...] + 14:28:58.893278 IP 192.168.1.115.8888 > 192.168.1.114.35846: sctp (1) [COOKIE ACK] , (2) [SACK] [cum ack 3092969729] [a_rwnd 106491] [#gap acks 0] [#dup tsns 0] + 14:28:58.893591 IP 192.168.1.114.35846 > 192.168.1.115.8888: sctp (1) [DATA] (B)(E) [TSN: 3092969730] [...] + 14:28:59.096963 IP 192.168.1.115.8888 > 192.168.1.114.35846: sctp (1) [SACK] [cum ack 3092969730] [a_rwnd 106496] [#gap acks 0] [#dup tsns 0] + 14:28:59.097086 IP 192.168.1.114.35846 > 192.168.1.115.8888: sctp (1) [DATA] (B)(E) [TSN: 3092969731] [...] , (2) [DATA] (B)(E) [TSN: 3092969732] [...] + 14:28:59.103218 IP 192.168.1.115.8888 > 192.168.1.114.35846: sctp (1) [SACK] [cum ack 3092969732] [a_rwnd 106486] [#gap acks 0] [#dup tsns 0] + 14:28:59.103330 IP 192.168.1.114.35846 > 192.168.1.115.8888: sctp (1) [SHUTDOWN] + 14:28:59.107793 IP 192.168.1.115.8888 > 192.168.1.114.35846: sctp (1) [SHUTDOWN ACK] + 14:28:59.107890 IP 192.168.1.114.35846 > 192.168.1.115.8888: sctp (1) [SHUTDOWN COMPLETE] + + Looks like this bug is from the pre-git history museum. ;) + + Fixes: 08707d5482df ("lksctp-2_5_31-0_5_1.patch") + Signed-off-by: Daniel Borkmann + Acked-by: Vlad Yasevich + Signed-off-by: David S. Miller + + Conflicts: + + net/sctp/socket.c + + Conflicts: + + net/sctp/socket.c + + net/sctp/socket.c | 7 +++++++ + 1 files changed, 7 insertions(+), 0 deletions(-) + +commit 28e7551a10df3b00676519fa269fc9f21562eefd +Author: Sasha Levin +Date: Tue Feb 3 08:55:58 2015 -0500 + + net: rds: use correct size for max unacked packets and bytes + + Max unacked packets/bytes is an int while sizeof(long) was used in the + sysctl table. + + This means that when they were getting read we'd also leak kernel memory + to userspace along with the timeout values. + + Signed-off-by: Sasha Levin + Signed-off-by: David S. Miller + + net/rds/sysctl.c | 4 ++-- + 1 files changed, 2 insertions(+), 2 deletions(-) + commit ebb75bc888f1613c4e332a48b883b463e492ed63 Author: Brad Spengler Date: Thu Feb 5 08:09:18 2015 -0500 diff --git a/kernel-sources/grsecurity/grsecurity-3.0-3.2.66-201502050848.patch.sig b/kernel-sources/grsecurity/grsecurity-3.0-3.2.66-201502050848.patch.sig deleted file mode 100644 index d9eb33a..0000000 Binary files a/kernel-sources/grsecurity/grsecurity-3.0-3.2.66-201502050848.patch.sig and /dev/null differ diff --git a/kernel-sources/grsecurity/grsecurity-3.0-3.2.66-201502050848.patch b/kernel-sources/grsecurity/grsecurity-3.0-3.2.66-201502052350.patch similarity index 99% rename from kernel-sources/grsecurity/grsecurity-3.0-3.2.66-201502050848.patch rename to kernel-sources/grsecurity/grsecurity-3.0-3.2.66-201502052350.patch index df81a89..520ed1e 100644 --- a/kernel-sources/grsecurity/grsecurity-3.0-3.2.66-201502050848.patch +++ b/kernel-sources/grsecurity/grsecurity-3.0-3.2.66-201502052350.patch @@ -18748,7 +18748,7 @@ index c99f9ed..76cf602 100644 +EXPORT_SYMBOL(pax_check_alloca); +#endif diff --git a/arch/x86/kernel/dumpstack_64.c b/arch/x86/kernel/dumpstack_64.c -index 5e890cc..048f251 100644 +index 5e890cc..66ec71b 100644 --- a/arch/x86/kernel/dumpstack_64.c +++ b/arch/x86/kernel/dumpstack_64.c @@ -118,9 +118,9 @@ void dump_trace(struct task_struct *task, struct pt_regs *regs, @@ -18821,7 +18821,13 @@ index 5e890cc..048f251 100644 struct task_struct *cur = current; sp = regs->sp; -@@ -304,3 +308,50 @@ int is_valid_bugaddr(unsigned long ip) +@@ -299,8 +303,55 @@ int is_valid_bugaddr(unsigned long ip) + { + unsigned short ud2; + +- if (__copy_from_user(&ud2, (const void __user *) ip, sizeof(ud2))) ++ if (probe_kernel_address((unsigned short *)ip, ud2)) + return 0; return ud2 == 0x0b0f; } @@ -18900,10 +18906,10 @@ index cd28a35..c72ed9a 100644 #include #include diff --git a/arch/x86/kernel/entry_32.S b/arch/x86/kernel/entry_32.S -index 0fa4f89..40ff646 100644 +index 0fa4f89..dbbfa58 100644 --- a/arch/x86/kernel/entry_32.S +++ b/arch/x86/kernel/entry_32.S -@@ -180,13 +180,153 @@ +@@ -180,13 +180,154 @@ /*CFI_REL_OFFSET gs, PT_GS*/ .endm .macro SET_KERNEL_GS reg @@ -19032,6 +19038,7 @@ index 0fa4f89..40ff646 100644 + jne 1b + +2: cld ++ or $2*4, %edi + mov %esp, %ecx + sub %edi, %ecx + @@ -19058,7 +19065,7 @@ index 0fa4f89..40ff646 100644 cld PUSH_GS pushl_cfi %fs -@@ -209,7 +349,7 @@ +@@ -209,7 +350,7 @@ CFI_REL_OFFSET ecx, 0 pushl_cfi %ebx CFI_REL_OFFSET ebx, 0 @@ -19067,7 +19074,7 @@ index 0fa4f89..40ff646 100644 movl %edx, %ds movl %edx, %es movl $(__KERNEL_PERCPU), %edx -@@ -217,6 +357,15 @@ +@@ -217,6 +358,15 @@ SET_KERNEL_GS %edx .endm @@ -19083,7 +19090,7 @@ index 0fa4f89..40ff646 100644 .macro RESTORE_INT_REGS popl_cfi %ebx CFI_RESTORE ebx -@@ -302,7 +451,7 @@ ENTRY(ret_from_fork) +@@ -302,7 +452,7 @@ ENTRY(ret_from_fork) popfl_cfi jmp syscall_exit CFI_ENDPROC @@ -19092,7 +19099,7 @@ index 0fa4f89..40ff646 100644 /* * Interrupt exit functions should be protected against kprobes -@@ -336,7 +485,15 @@ resume_userspace_sig: +@@ -336,7 +486,15 @@ resume_userspace_sig: andl $SEGMENT_RPL_MASK, %eax #endif cmpl $USER_RPL, %eax @@ -19108,7 +19115,7 @@ index 0fa4f89..40ff646 100644 ENTRY(resume_userspace) LOCKDEP_SYS_EXIT -@@ -348,8 +505,8 @@ ENTRY(resume_userspace) +@@ -348,8 +506,8 @@ ENTRY(resume_userspace) andl $_TIF_WORK_MASK, %ecx # is there any work to be done on # int/exception return? jne work_pending @@ -19119,7 +19126,7 @@ index 0fa4f89..40ff646 100644 #ifdef CONFIG_PREEMPT ENTRY(resume_kernel) -@@ -364,7 +521,7 @@ need_resched: +@@ -364,7 +522,7 @@ need_resched: jz restore_all call preempt_schedule_irq jmp need_resched @@ -19128,7 +19135,7 @@ index 0fa4f89..40ff646 100644 #endif CFI_ENDPROC /* -@@ -398,23 +555,34 @@ sysenter_past_esp: +@@ -398,23 +556,34 @@ sysenter_past_esp: /*CFI_REL_OFFSET cs, 0*/ /* * Push current_thread_info()->sysenter_return to the stack. @@ -19166,7 +19173,7 @@ index 0fa4f89..40ff646 100644 movl %ebp,PT_EBP(%esp) .section __ex_table,"a" .align 4 -@@ -423,6 +591,10 @@ sysenter_past_esp: +@@ -423,6 +592,10 @@ sysenter_past_esp: GET_THREAD_INFO(%ebp) @@ -19177,7 +19184,7 @@ index 0fa4f89..40ff646 100644 testl $_TIF_WORK_SYSCALL_ENTRY,TI_flags(%ebp) jnz sysenter_audit sysenter_do_call: -@@ -438,12 +610,24 @@ sysenter_after_call: +@@ -438,12 +611,24 @@ sysenter_after_call: testl $_TIF_ALLWORK_MASK, %ecx jne sysexit_audit sysenter_exit: @@ -19202,7 +19209,7 @@ index 0fa4f89..40ff646 100644 PTGS_TO_GS ENABLE_INTERRUPTS_SYSEXIT -@@ -460,6 +644,9 @@ sysenter_audit: +@@ -460,6 +645,9 @@ sysenter_audit: movl %eax,%edx /* 2nd arg: syscall number */ movl $AUDIT_ARCH_I386,%eax /* 1st arg: audit arch */ call audit_syscall_entry @@ -19212,7 +19219,7 @@ index 0fa4f89..40ff646 100644 pushl_cfi %ebx movl PT_EAX(%esp),%eax /* reload syscall number */ jmp sysenter_do_call -@@ -486,11 +673,17 @@ sysexit_audit: +@@ -486,11 +674,17 @@ sysexit_audit: CFI_ENDPROC .pushsection .fixup,"ax" @@ -19232,7 +19239,7 @@ index 0fa4f89..40ff646 100644 .popsection PTGS_TO_GS_EX ENDPROC(ia32_sysenter_target) -@@ -505,6 +698,11 @@ ENTRY(system_call) +@@ -505,6 +699,11 @@ ENTRY(system_call) pushl_cfi %eax # save orig_eax SAVE_ALL GET_THREAD_INFO(%ebp) @@ -19244,7 +19251,7 @@ index 0fa4f89..40ff646 100644 # system call tracing in operation / emulation testl $_TIF_WORK_SYSCALL_ENTRY,TI_flags(%ebp) jnz syscall_trace_entry -@@ -524,6 +722,15 @@ syscall_exit: +@@ -524,6 +723,15 @@ syscall_exit: testl $_TIF_ALLWORK_MASK, %ecx # current->work jne syscall_exit_work @@ -19260,7 +19267,7 @@ index 0fa4f89..40ff646 100644 restore_all: TRACE_IRQS_IRET restore_all_notrace: -@@ -581,14 +788,34 @@ ldt_ss: +@@ -581,14 +789,34 @@ ldt_ss: * compensating for the offset by changing to the ESPFIX segment with * a base address that matches for the difference. */ @@ -19298,7 +19305,7 @@ index 0fa4f89..40ff646 100644 pushl_cfi $__ESPFIX_SS pushl_cfi %eax /* new kernel esp */ /* Disable interrupts, but do not irqtrace this section: we -@@ -618,34 +845,28 @@ work_resched: +@@ -618,34 +846,28 @@ work_resched: movl TI_flags(%ebp), %ecx andl $_TIF_WORK_MASK, %ecx # is there any work to be done other # than syscall tracing? @@ -19338,7 +19345,7 @@ index 0fa4f89..40ff646 100644 # perform syscall exit tracing ALIGN -@@ -653,11 +874,14 @@ syscall_trace_entry: +@@ -653,11 +875,14 @@ syscall_trace_entry: movl $-ENOSYS,PT_EAX(%esp) movl %esp, %eax call syscall_trace_enter @@ -19354,7 +19361,7 @@ index 0fa4f89..40ff646 100644 # perform syscall exit tracing ALIGN -@@ -670,25 +894,29 @@ syscall_exit_work: +@@ -670,25 +895,29 @@ syscall_exit_work: movl %esp, %eax call syscall_trace_leave jmp resume_userspace @@ -19388,7 +19395,7 @@ index 0fa4f89..40ff646 100644 CFI_ENDPROC /* * End of kprobes section -@@ -762,6 +990,36 @@ ptregs_clone: +@@ -762,6 +991,36 @@ ptregs_clone: CFI_ENDPROC ENDPROC(ptregs_clone) @@ -19425,7 +19432,7 @@ index 0fa4f89..40ff646 100644 .macro FIXUP_ESPFIX_STACK /* * Switch back for ESPFIX stack to the normal zerobased stack -@@ -772,8 +1030,15 @@ ENDPROC(ptregs_clone) +@@ -772,8 +1031,15 @@ ENDPROC(ptregs_clone) */ #ifdef CONFIG_X86_ESPFIX32 /* fixup the stack */ @@ -19443,7 +19450,7 @@ index 0fa4f89..40ff646 100644 shl $16, %eax addl %esp, %eax /* the adjusted stack pointer */ pushl_cfi $__KERNEL_DS -@@ -829,7 +1094,7 @@ vector=vector+1 +@@ -829,7 +1095,7 @@ vector=vector+1 .endr 2: jmp common_interrupt .endr @@ -19452,7 +19459,7 @@ index 0fa4f89..40ff646 100644 .previous END(interrupt) -@@ -877,7 +1142,7 @@ ENTRY(coprocessor_error) +@@ -877,7 +1143,7 @@ ENTRY(coprocessor_error) pushl_cfi $do_coprocessor_error jmp error_code CFI_ENDPROC @@ -19461,7 +19468,7 @@ index 0fa4f89..40ff646 100644 ENTRY(simd_coprocessor_error) RING0_INT_FRAME -@@ -898,7 +1163,7 @@ ENTRY(simd_coprocessor_error) +@@ -898,7 +1164,7 @@ ENTRY(simd_coprocessor_error) #endif jmp error_code CFI_ENDPROC @@ -19470,7 +19477,7 @@ index 0fa4f89..40ff646 100644 ENTRY(device_not_available) RING0_INT_FRAME -@@ -906,7 +1171,7 @@ ENTRY(device_not_available) +@@ -906,7 +1172,7 @@ ENTRY(device_not_available) pushl_cfi $do_device_not_available jmp error_code CFI_ENDPROC @@ -19479,7 +19486,7 @@ index 0fa4f89..40ff646 100644 #ifdef CONFIG_PARAVIRT ENTRY(native_iret) -@@ -915,12 +1180,12 @@ ENTRY(native_iret) +@@ -915,12 +1181,12 @@ ENTRY(native_iret) .align 4 .long native_iret, iret_exc .previous @@ -19494,7 +19501,7 @@ index 0fa4f89..40ff646 100644 #endif ENTRY(overflow) -@@ -929,7 +1194,7 @@ ENTRY(overflow) +@@ -929,7 +1195,7 @@ ENTRY(overflow) pushl_cfi $do_overflow jmp error_code CFI_ENDPROC @@ -19503,7 +19510,7 @@ index 0fa4f89..40ff646 100644 ENTRY(bounds) RING0_INT_FRAME -@@ -937,7 +1202,7 @@ ENTRY(bounds) +@@ -937,7 +1203,7 @@ ENTRY(bounds) pushl_cfi $do_bounds jmp error_code CFI_ENDPROC @@ -19512,7 +19519,7 @@ index 0fa4f89..40ff646 100644 ENTRY(invalid_op) RING0_INT_FRAME -@@ -945,7 +1210,7 @@ ENTRY(invalid_op) +@@ -945,7 +1211,7 @@ ENTRY(invalid_op) pushl_cfi $do_invalid_op jmp error_code CFI_ENDPROC @@ -19521,7 +19528,7 @@ index 0fa4f89..40ff646 100644 ENTRY(coprocessor_segment_overrun) RING0_INT_FRAME -@@ -953,35 +1218,35 @@ ENTRY(coprocessor_segment_overrun) +@@ -953,35 +1219,35 @@ ENTRY(coprocessor_segment_overrun) pushl_cfi $do_coprocessor_segment_overrun jmp error_code CFI_ENDPROC @@ -19562,7 +19569,7 @@ index 0fa4f89..40ff646 100644 ENTRY(divide_error) RING0_INT_FRAME -@@ -989,7 +1254,7 @@ ENTRY(divide_error) +@@ -989,7 +1255,7 @@ ENTRY(divide_error) pushl_cfi $do_divide_error jmp error_code CFI_ENDPROC @@ -19571,7 +19578,7 @@ index 0fa4f89..40ff646 100644 #ifdef CONFIG_X86_MCE ENTRY(machine_check) -@@ -998,7 +1263,7 @@ ENTRY(machine_check) +@@ -998,7 +1264,7 @@ ENTRY(machine_check) pushl_cfi machine_check_vector jmp error_code CFI_ENDPROC @@ -19580,7 +19587,7 @@ index 0fa4f89..40ff646 100644 #endif ENTRY(spurious_interrupt_bug) -@@ -1007,7 +1272,7 @@ ENTRY(spurious_interrupt_bug) +@@ -1007,7 +1273,7 @@ ENTRY(spurious_interrupt_bug) pushl_cfi $do_spurious_interrupt_bug jmp error_code CFI_ENDPROC @@ -19589,7 +19596,7 @@ index 0fa4f89..40ff646 100644 /* * End of kprobes section */ -@@ -1123,7 +1388,7 @@ BUILD_INTERRUPT3(xen_hvm_callback_vector, XEN_HVM_EVTCHN_CALLBACK, +@@ -1123,7 +1389,7 @@ BUILD_INTERRUPT3(xen_hvm_callback_vector, XEN_HVM_EVTCHN_CALLBACK, ENTRY(mcount) ret @@ -19598,7 +19605,7 @@ index 0fa4f89..40ff646 100644 ENTRY(ftrace_caller) cmpl $0, function_trace_stop -@@ -1152,7 +1417,7 @@ ftrace_graph_call: +@@ -1152,7 +1418,7 @@ ftrace_graph_call: .globl ftrace_stub ftrace_stub: ret @@ -19607,7 +19614,7 @@ index 0fa4f89..40ff646 100644 #else /* ! CONFIG_DYNAMIC_FTRACE */ -@@ -1188,7 +1453,7 @@ trace: +@@ -1188,7 +1454,7 @@ trace: popl %ecx popl %eax jmp ftrace_stub @@ -19616,7 +19623,7 @@ index 0fa4f89..40ff646 100644 #endif /* CONFIG_DYNAMIC_FTRACE */ #endif /* CONFIG_FUNCTION_TRACER */ -@@ -1209,7 +1474,7 @@ ENTRY(ftrace_graph_caller) +@@ -1209,7 +1475,7 @@ ENTRY(ftrace_graph_caller) popl %ecx popl %eax ret @@ -19625,7 +19632,7 @@ index 0fa4f89..40ff646 100644 .globl return_to_handler return_to_handler: -@@ -1223,7 +1488,6 @@ return_to_handler: +@@ -1223,7 +1489,6 @@ return_to_handler: jmp *%ecx #endif @@ -19633,7 +19640,7 @@ index 0fa4f89..40ff646 100644 #include "syscall_table_32.S" syscall_table_size=(.-sys_call_table) -@@ -1269,15 +1533,18 @@ error_code: +@@ -1269,15 +1534,18 @@ error_code: movl $-1, PT_ORIG_EAX(%esp) # no syscall to restart REG_TO_PTGS %ecx SET_KERNEL_GS %ecx @@ -19654,7 +19661,7 @@ index 0fa4f89..40ff646 100644 /* * Debug traps and NMI can happen at the one SYSENTER instruction -@@ -1319,7 +1586,7 @@ debug_stack_correct: +@@ -1319,7 +1587,7 @@ debug_stack_correct: call do_debug jmp ret_from_exception CFI_ENDPROC @@ -19663,7 +19670,7 @@ index 0fa4f89..40ff646 100644 /* * NMI is doubly nasty. It can happen _while_ we're handling -@@ -1358,6 +1625,9 @@ nmi_stack_correct: +@@ -1358,6 +1626,9 @@ nmi_stack_correct: xorl %edx,%edx # zero error code movl %esp,%eax # pt_regs pointer call do_nmi @@ -19673,7 +19680,7 @@ index 0fa4f89..40ff646 100644 jmp restore_all_notrace CFI_ENDPROC -@@ -1395,13 +1665,16 @@ nmi_espfix_stack: +@@ -1395,13 +1666,16 @@ nmi_espfix_stack: FIXUP_ESPFIX_STACK # %eax == %esp xorl %edx,%edx # zero error code call do_nmi @@ -19691,7 +19698,7 @@ index 0fa4f89..40ff646 100644 ENTRY(int3) RING0_INT_FRAME -@@ -1413,14 +1686,14 @@ ENTRY(int3) +@@ -1413,14 +1687,14 @@ ENTRY(int3) call do_int3 jmp ret_from_exception CFI_ENDPROC @@ -19708,7 +19715,7 @@ index 0fa4f89..40ff646 100644 #ifdef CONFIG_KVM_GUEST ENTRY(async_page_fault) -@@ -1428,7 +1701,7 @@ ENTRY(async_page_fault) +@@ -1428,7 +1702,7 @@ ENTRY(async_page_fault) pushl_cfi $do_async_page_fault jmp error_code CFI_ENDPROC @@ -19718,7 +19725,7 @@ index 0fa4f89..40ff646 100644 /* diff --git a/arch/x86/kernel/entry_64.S b/arch/x86/kernel/entry_64.S -index 9d28dbac..43bde59 100644 +index 9d28dbac..d5f7d1d 100644 --- a/arch/x86/kernel/entry_64.S +++ b/arch/x86/kernel/entry_64.S @@ -56,6 +56,8 @@ @@ -19794,7 +19801,7 @@ index 9d28dbac..43bde59 100644 jmp *%rdi #endif -@@ -179,6 +187,285 @@ ENTRY(native_usergs_sysret64) +@@ -179,6 +187,286 @@ ENTRY(native_usergs_sysret64) ENDPROC(native_usergs_sysret64) #endif /* CONFIG_PARAVIRT */ @@ -20054,6 +20061,7 @@ index 9d28dbac..43bde59 100644 + jne 1b + +2: cld ++ or $2*8, %rdi + mov %esp, %ecx + sub %edi, %ecx + @@ -20080,7 +20088,7 @@ index 9d28dbac..43bde59 100644 .macro TRACE_IRQS_IRETQ offset=ARGOFFSET #ifdef CONFIG_TRACE_IRQFLAGS -@@ -232,8 +519,8 @@ ENDPROC(native_usergs_sysret64) +@@ -232,8 +520,8 @@ ENDPROC(native_usergs_sysret64) .endm .macro UNFAKE_STACK_FRAME @@ -20091,7 +20099,7 @@ index 9d28dbac..43bde59 100644 .endm /* -@@ -302,25 +589,26 @@ ENDPROC(native_usergs_sysret64) +@@ -302,25 +590,26 @@ ENDPROC(native_usergs_sysret64) /* save partial stack frame */ .macro SAVE_ARGS_IRQ cld @@ -20131,7 +20139,7 @@ index 9d28dbac..43bde59 100644 je 1f SWAPGS /* -@@ -341,24 +629,39 @@ ENDPROC(native_usergs_sysret64) +@@ -341,24 +630,39 @@ ENDPROC(native_usergs_sysret64) 0x06 /* DW_OP_deref */, \ 0x08 /* DW_OP_const1u */, SS+8-RBP, \ 0x22 /* DW_OP_plus */ @@ -20175,7 +20183,7 @@ index 9d28dbac..43bde59 100644 /* save complete stack frame */ .pushsection .kprobes.text, "ax" -@@ -387,10 +690,21 @@ ENTRY(save_paranoid) +@@ -387,10 +691,21 @@ ENTRY(save_paranoid) js 1f /* negative -> in kernel */ SWAPGS xorl %ebx,%ebx @@ -20200,7 +20208,7 @@ index 9d28dbac..43bde59 100644 /* * A newly forked process directly context switches into this address. -@@ -411,7 +725,7 @@ ENTRY(ret_from_fork) +@@ -411,7 +726,7 @@ ENTRY(ret_from_fork) RESTORE_REST @@ -20209,7 +20217,7 @@ index 9d28dbac..43bde59 100644 je int_ret_from_sys_call testl $_TIF_IA32, TI_flags(%rcx) # 32-bit compat task needs IRET -@@ -421,7 +735,7 @@ ENTRY(ret_from_fork) +@@ -421,7 +736,7 @@ ENTRY(ret_from_fork) jmp ret_from_sys_call # go to the SYSRET fastpath CFI_ENDPROC @@ -20218,7 +20226,7 @@ index 9d28dbac..43bde59 100644 /* * System call entry. Up to 6 arguments in registers are supported. -@@ -457,7 +771,7 @@ END(ret_from_fork) +@@ -457,7 +772,7 @@ END(ret_from_fork) ENTRY(system_call) CFI_STARTPROC simple CFI_SIGNAL_FRAME @@ -20227,7 +20235,7 @@ index 9d28dbac..43bde59 100644 CFI_REGISTER rip,rcx /*CFI_REGISTER rflags,r11*/ SWAPGS_UNSAFE_STACK -@@ -470,12 +784,18 @@ ENTRY(system_call_after_swapgs) +@@ -470,12 +785,18 @@ ENTRY(system_call_after_swapgs) movq %rsp,PER_CPU_VAR(old_rsp) movq PER_CPU_VAR(kernel_stack),%rsp @@ -20247,7 +20255,7 @@ index 9d28dbac..43bde59 100644 movq %rax,ORIG_RAX-ARGOFFSET(%rsp) movq %rcx,RIP-ARGOFFSET(%rsp) CFI_REL_OFFSET rip,RIP-ARGOFFSET -@@ -504,6 +824,8 @@ sysret_check: +@@ -504,6 +825,8 @@ sysret_check: andl %edi,%edx jnz sysret_careful CFI_REMEMBER_STATE @@ -20256,7 +20264,7 @@ index 9d28dbac..43bde59 100644 /* * sysretq will re-enable interrupts: */ -@@ -562,6 +884,9 @@ auditsys: +@@ -562,6 +885,9 @@ auditsys: movq %rax,%rsi /* 2nd arg: syscall number */ movl $AUDIT_ARCH_X86_64,%edi /* 1st arg: audit arch */ call audit_syscall_entry @@ -20266,7 +20274,7 @@ index 9d28dbac..43bde59 100644 LOAD_ARGS 0 /* reload call-clobbered registers */ jmp system_call_fastpath -@@ -592,12 +917,15 @@ tracesys: +@@ -592,12 +918,15 @@ tracesys: FIXUP_TOP_OF_STACK %rdi movq %rsp,%rdi call syscall_trace_enter @@ -20283,7 +20291,7 @@ index 9d28dbac..43bde59 100644 RESTORE_REST cmpq $__NR_syscall_max,%rax ja int_ret_from_sys_call /* RAX(%rsp) set to -ENOSYS above */ -@@ -613,7 +941,7 @@ tracesys: +@@ -613,7 +942,7 @@ tracesys: GLOBAL(int_ret_from_sys_call) DISABLE_INTERRUPTS(CLBR_NONE) TRACE_IRQS_OFF @@ -20292,7 +20300,7 @@ index 9d28dbac..43bde59 100644 je retint_restore_args movl $_TIF_ALLWORK_MASK,%edi /* edi: mask to check */ -@@ -624,7 +952,9 @@ GLOBAL(int_with_check) +@@ -624,7 +953,9 @@ GLOBAL(int_with_check) andl %edi,%edx jnz int_careful andl $~TS_COMPAT,TI_status(%rcx) @@ -20303,7 +20311,7 @@ index 9d28dbac..43bde59 100644 /* Either reschedule or signal or syscall exit tracking needed. */ /* First do a reschedule test. */ -@@ -670,7 +1000,7 @@ int_restore_rest: +@@ -670,7 +1001,7 @@ int_restore_rest: TRACE_IRQS_OFF jmp int_with_check CFI_ENDPROC @@ -20312,7 +20320,7 @@ index 9d28dbac..43bde59 100644 /* * Certain special system calls that need to save a complete full stack frame. -@@ -678,15 +1008,13 @@ END(system_call) +@@ -678,15 +1009,13 @@ END(system_call) .macro PTREGSCALL label,func,arg ENTRY(\label) PARTIAL_FRAME 1 8 /* offset 8: return address */ @@ -20329,7 +20337,7 @@ index 9d28dbac..43bde59 100644 .endm PTREGSCALL stub_clone, sys_clone, %r8 -@@ -701,12 +1029,17 @@ ENTRY(ptregscall_common) +@@ -701,12 +1030,17 @@ ENTRY(ptregscall_common) movq_cfi_restore R15+8, r15 movq_cfi_restore R14+8, r14 movq_cfi_restore R13+8, r13 @@ -20349,7 +20357,7 @@ index 9d28dbac..43bde59 100644 ENTRY(stub_execve) CFI_STARTPROC -@@ -721,7 +1054,7 @@ ENTRY(stub_execve) +@@ -721,7 +1055,7 @@ ENTRY(stub_execve) RESTORE_REST jmp int_ret_from_sys_call CFI_ENDPROC @@ -20358,7 +20366,7 @@ index 9d28dbac..43bde59 100644 /* * sigreturn is special because it needs to restore all registers on return. -@@ -739,7 +1072,7 @@ ENTRY(stub_rt_sigreturn) +@@ -739,7 +1073,7 @@ ENTRY(stub_rt_sigreturn) RESTORE_REST jmp int_ret_from_sys_call CFI_ENDPROC @@ -20367,7 +20375,7 @@ index 9d28dbac..43bde59 100644 /* * Build the entry stubs and pointer table with some assembler magic. -@@ -774,7 +1107,7 @@ vector=vector+1 +@@ -774,7 +1108,7 @@ vector=vector+1 2: jmp common_interrupt .endr CFI_ENDPROC @@ -20376,7 +20384,7 @@ index 9d28dbac..43bde59 100644 .previous END(interrupt) -@@ -791,8 +1124,8 @@ END(interrupt) +@@ -791,8 +1125,8 @@ END(interrupt) /* 0(%rsp): ~(interrupt number) */ .macro interrupt func /* reserve pt_regs for scratch regs and rbp */ @@ -20387,7 +20395,7 @@ index 9d28dbac..43bde59 100644 SAVE_ARGS_IRQ call \func .endm -@@ -819,13 +1152,13 @@ ret_from_intr: +@@ -819,13 +1153,13 @@ ret_from_intr: /* Restore saved previous stack */ popq %rsi CFI_DEF_CFA_REGISTER rsi @@ -20404,7 +20412,7 @@ index 9d28dbac..43bde59 100644 je retint_kernel /* Interrupt came from user space */ -@@ -847,12 +1180,16 @@ retint_swapgs: /* return to user-space */ +@@ -847,12 +1181,16 @@ retint_swapgs: /* return to user-space */ * The iretq could re-enable interrupts: */ DISABLE_INTERRUPTS(CLBR_ANY) @@ -20421,7 +20429,7 @@ index 9d28dbac..43bde59 100644 /* * The iretq could re-enable interrupts: */ -@@ -890,15 +1227,15 @@ native_irq_return_ldt: +@@ -890,15 +1228,15 @@ native_irq_return_ldt: SWAPGS movq PER_CPU_VAR(espfix_waddr),%rdi movq %rax,(0*8)(%rdi) /* RAX */ @@ -20442,7 +20450,7 @@ index 9d28dbac..43bde59 100644 movq %rax,(4*8)(%rdi) andl $0xffff0000,%eax popq_cfi %rdi -@@ -954,7 +1291,7 @@ ENTRY(retint_kernel) +@@ -954,7 +1292,7 @@ ENTRY(retint_kernel) jmp exit_intr #endif CFI_ENDPROC @@ -20451,7 +20459,7 @@ index 9d28dbac..43bde59 100644 /* * End of kprobes section -@@ -971,7 +1308,7 @@ ENTRY(\sym) +@@ -971,7 +1309,7 @@ ENTRY(\sym) interrupt \do_sym jmp ret_from_intr CFI_ENDPROC @@ -20460,7 +20468,7 @@ index 9d28dbac..43bde59 100644 .endm #ifdef CONFIG_SMP -@@ -1041,7 +1378,7 @@ ENTRY(\sym) +@@ -1041,7 +1379,7 @@ ENTRY(\sym) call \do_sym jmp error_exit /* %ebx: no swapgs flag */ CFI_ENDPROC @@ -20469,7 +20477,7 @@ index 9d28dbac..43bde59 100644 .endm .macro paranoidzeroentry sym do_sym -@@ -1058,10 +1395,10 @@ ENTRY(\sym) +@@ -1058,10 +1396,10 @@ ENTRY(\sym) call \do_sym jmp paranoid_exit /* %ebx: no swapgs flag */ CFI_ENDPROC @@ -20482,7 +20490,7 @@ index 9d28dbac..43bde59 100644 .macro paranoidzeroentry_ist sym do_sym ist ENTRY(\sym) INTR_FRAME -@@ -1073,12 +1410,18 @@ ENTRY(\sym) +@@ -1073,12 +1411,18 @@ ENTRY(\sym) TRACE_IRQS_OFF movq %rsp,%rdi /* pt_regs pointer */ xorl %esi,%esi /* no error code */ @@ -20502,7 +20510,7 @@ index 9d28dbac..43bde59 100644 .endm .macro errorentry sym do_sym -@@ -1095,7 +1438,7 @@ ENTRY(\sym) +@@ -1095,7 +1439,7 @@ ENTRY(\sym) call \do_sym jmp error_exit /* %ebx: no swapgs flag */ CFI_ENDPROC @@ -20511,7 +20519,7 @@ index 9d28dbac..43bde59 100644 .endm /* error code is on the stack already */ -@@ -1114,7 +1457,7 @@ ENTRY(\sym) +@@ -1114,7 +1458,7 @@ ENTRY(\sym) call \do_sym jmp paranoid_exit /* %ebx: no swapgs flag */ CFI_ENDPROC @@ -20520,7 +20528,7 @@ index 9d28dbac..43bde59 100644 .endm zeroentry divide_error do_divide_error -@@ -1144,9 +1487,10 @@ gs_change: +@@ -1144,9 +1488,10 @@ gs_change: 2: mfence /* workaround */ SWAPGS popfq_cfi @@ -20532,7 +20540,7 @@ index 9d28dbac..43bde59 100644 .section __ex_table,"a" .align 8 -@@ -1168,13 +1512,14 @@ ENTRY(kernel_thread_helper) +@@ -1168,13 +1513,14 @@ ENTRY(kernel_thread_helper) * Here we are in the child and the registers are set as they were * at kernel_thread() invocation in the parent. */ @@ -20548,7 +20556,7 @@ index 9d28dbac..43bde59 100644 /* * execve(). This function needs to use IRET, not SYSRET, to set up all state properly. -@@ -1201,11 +1546,11 @@ ENTRY(kernel_execve) +@@ -1201,11 +1547,11 @@ ENTRY(kernel_execve) RESTORE_REST testq %rax,%rax je int_ret_from_sys_call @@ -20562,7 +20570,7 @@ index 9d28dbac..43bde59 100644 /* Call softirq on interrupt stack. Interrupts are off. */ ENTRY(call_softirq) -@@ -1223,9 +1568,10 @@ ENTRY(call_softirq) +@@ -1223,9 +1569,10 @@ ENTRY(call_softirq) CFI_DEF_CFA_REGISTER rsp CFI_ADJUST_CFA_OFFSET -8 decl PER_CPU_VAR(irq_count) @@ -20574,7 +20582,7 @@ index 9d28dbac..43bde59 100644 #ifdef CONFIG_XEN zeroentry xen_hypervisor_callback xen_do_hypervisor_callback -@@ -1263,7 +1609,7 @@ ENTRY(xen_do_hypervisor_callback) # do_hypervisor_callback(struct *pt_regs) +@@ -1263,7 +1610,7 @@ ENTRY(xen_do_hypervisor_callback) # do_hypervisor_callback(struct *pt_regs) decl PER_CPU_VAR(irq_count) jmp error_exit CFI_ENDPROC @@ -20583,7 +20591,7 @@ index 9d28dbac..43bde59 100644 /* * Hypervisor uses this for application faults while it executes. -@@ -1322,7 +1668,7 @@ ENTRY(xen_failsafe_callback) +@@ -1322,7 +1669,7 @@ ENTRY(xen_failsafe_callback) SAVE_ALL jmp error_exit CFI_ENDPROC @@ -20592,7 +20600,7 @@ index 9d28dbac..43bde59 100644 apicinterrupt XEN_HVM_EVTCHN_CALLBACK \ xen_hvm_callback_vector xen_evtchn_do_upcall -@@ -1371,16 +1717,31 @@ ENTRY(paranoid_exit) +@@ -1371,16 +1718,31 @@ ENTRY(paranoid_exit) TRACE_IRQS_OFF testl %ebx,%ebx /* swapgs needed? */ jnz paranoid_restore @@ -20625,7 +20633,7 @@ index 9d28dbac..43bde59 100644 jmp irq_return paranoid_userspace: GET_THREAD_INFO(%rcx) -@@ -1409,7 +1770,7 @@ paranoid_schedule: +@@ -1409,7 +1771,7 @@ paranoid_schedule: TRACE_IRQS_OFF jmp paranoid_userspace CFI_ENDPROC @@ -20634,7 +20642,7 @@ index 9d28dbac..43bde59 100644 /* * Exception entry point. This expects an error code/orig_rax on the stack. -@@ -1436,12 +1797,23 @@ ENTRY(error_entry) +@@ -1436,12 +1798,23 @@ ENTRY(error_entry) movq_cfi r14, R14+8 movq_cfi r15, R15+8 xorl %ebx,%ebx @@ -20659,7 +20667,7 @@ index 9d28dbac..43bde59 100644 ret /* -@@ -1475,7 +1847,7 @@ error_bad_iret: +@@ -1475,7 +1848,7 @@ error_bad_iret: decl %ebx /* Return to usergs */ jmp error_sti CFI_ENDPROC @@ -20668,7 +20676,7 @@ index 9d28dbac..43bde59 100644 /* ebx: no swapgs flag (1: don't need swapgs, 0: need it) */ -@@ -1495,7 +1867,7 @@ ENTRY(error_exit) +@@ -1495,7 +1868,7 @@ ENTRY(error_exit) jnz retint_careful jmp retint_swapgs CFI_ENDPROC @@ -20677,7 +20685,7 @@ index 9d28dbac..43bde59 100644 /* runs on exception stack */ -@@ -1507,6 +1879,7 @@ ENTRY(nmi) +@@ -1507,6 +1880,7 @@ ENTRY(nmi) CFI_ADJUST_CFA_OFFSET ORIG_RAX-R15 call save_paranoid DEFAULT_FRAME 0 @@ -20685,7 +20693,7 @@ index 9d28dbac..43bde59 100644 /* paranoidentry do_nmi, 0; without TRACE_IRQS_OFF */ movq %rsp,%rdi movq $-1,%rsi -@@ -1517,12 +1890,28 @@ ENTRY(nmi) +@@ -1517,12 +1891,28 @@ ENTRY(nmi) DISABLE_INTERRUPTS(CLBR_NONE) testl %ebx,%ebx /* swapgs needed? */ jnz nmi_restore @@ -20715,7 +20723,7 @@ index 9d28dbac..43bde59 100644 jmp irq_return nmi_userspace: GET_THREAD_INFO(%rcx) -@@ -1551,14 +1940,14 @@ nmi_schedule: +@@ -1551,14 +1941,14 @@ nmi_schedule: jmp paranoid_exit CFI_ENDPROC #endif @@ -23015,7 +23023,7 @@ index 59b9b37..f02ee42 100644 +} +#endif diff --git a/arch/x86/kernel/process_32.c b/arch/x86/kernel/process_32.c -index 8598296..7c1af45 100644 +index 8598296..3fd3443 100644 --- a/arch/x86/kernel/process_32.c +++ b/arch/x86/kernel/process_32.c @@ -67,6 +67,7 @@ asmlinkage void ret_from_fork(void) __asm__("ret_from_fork"); @@ -23063,7 +23071,7 @@ index 8598296..7c1af45 100644 p->thread.sp = (unsigned long) childregs; p->thread.sp0 = (unsigned long) (childregs+1); -+ p->tinfo.lowest_stack = (unsigned long)task_stack_page(p); ++ p->tinfo.lowest_stack = (unsigned long)task_stack_page(p) + 2 * sizeof(unsigned long); p->thread.ip = (unsigned long) ret_from_fork; @@ -23112,7 +23120,7 @@ index 8598296..7c1af45 100644 } - diff --git a/arch/x86/kernel/process_64.c b/arch/x86/kernel/process_64.c -index 6a364a6..b147d11 100644 +index 6a364a6..030f5d6 100644 --- a/arch/x86/kernel/process_64.c +++ b/arch/x86/kernel/process_64.c @@ -89,7 +89,7 @@ static void __exit_idle(void) @@ -23138,7 +23146,7 @@ index 6a364a6..b147d11 100644 p->thread.sp = (unsigned long) childregs; p->thread.sp0 = (unsigned long) (childregs+1); p->thread.usersp = me->thread.usersp; -+ p->tinfo.lowest_stack = (unsigned long)task_stack_page(p); ++ p->tinfo.lowest_stack = (unsigned long)task_stack_page(p) + 2 * sizeof(unsigned long); set_tsk_thread_flag(p, TIF_FORK); @@ -32470,7 +32478,7 @@ index 26c731a..fb510c7 100644 This is the Linux Xen port. Enabling this will allow the kernel to boot in a paravirtualized environment under the diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c -index 5189fe8..d937469 100644 +index 5189fe8..1bf8944 100644 --- a/arch/x86/xen/enlighten.c +++ b/arch/x86/xen/enlighten.c @@ -86,8 +86,6 @@ EXPORT_SYMBOL_GPL(xen_start_info); @@ -32549,7 +32557,17 @@ index 5189fe8..d937469 100644 { if (pm_power_off) pm_power_off(); -@@ -1196,7 +1192,17 @@ asmlinkage void __init xen_start_kernel(void) +@@ -1144,6 +1140,9 @@ static void __init xen_setup_stackprotector(void) + pv_cpu_ops.load_gdt = xen_load_gdt_boot; + + setup_stack_canary_segment(0); ++#ifdef CONFIG_X86_64 ++ load_percpu_segment(0); ++#endif + switch_to_new_gdt(0); + + pv_cpu_ops.write_gdt_entry = xen_write_gdt_entry; +@@ -1196,7 +1195,17 @@ asmlinkage void __init xen_start_kernel(void) __userpte_alloc_gfp &= ~__GFP_HIGHMEM; /* Work out if we support NX */ @@ -32568,7 +32586,7 @@ index 5189fe8..d937469 100644 xen_setup_features(); -@@ -1227,13 +1233,6 @@ asmlinkage void __init xen_start_kernel(void) +@@ -1227,13 +1236,6 @@ asmlinkage void __init xen_start_kernel(void) machine_ops = xen_machine_ops; @@ -32582,7 +32600,7 @@ index 5189fe8..d937469 100644 xen_smp_init(); #ifdef CONFIG_ACPI_NUMA -@@ -1418,7 +1417,7 @@ static int __cpuinit xen_hvm_cpu_notify(struct notifier_block *self, +@@ -1418,7 +1420,7 @@ static int __cpuinit xen_hvm_cpu_notify(struct notifier_block *self, return NOTIFY_OK; } @@ -58088,6 +58106,19 @@ index 52a820a..1d8ab03 100644 } /* +diff --git a/fs/cifs/smbencrypt.c b/fs/cifs/smbencrypt.c +index 80d8508..6de30aa 100644 +--- a/fs/cifs/smbencrypt.c ++++ b/fs/cifs/smbencrypt.c +@@ -220,7 +220,7 @@ E_md4hash(const unsigned char *passwd, unsigned char *p16, + } + + rc = mdfour(p16, (unsigned char *) wpwd, len * sizeof(__le16)); +- memset(wpwd, 0, 129 * sizeof(__le16)); ++ memzero_explicit(wpwd, sizeof(wpwd)); + + return rc; + } diff --git a/fs/coda/cache.c b/fs/coda/cache.c index 4b2e5cb..67b96bb 100644 --- a/fs/coda/cache.c @@ -58590,7 +58621,7 @@ index 451b9b8..12e5a03 100644 out_free_fd: diff --git a/fs/exec.c b/fs/exec.c -index 78199eb..8958766 100644 +index 78199eb..a1fb382 100644 --- a/fs/exec.c +++ b/fs/exec.c @@ -55,12 +55,35 @@ @@ -59500,7 +59531,7 @@ index 78199eb..8958766 100644 +{ + unsigned long sp = (unsigned long)&sp; + if (sp < current_thread_info()->lowest_stack && -+ sp > (unsigned long)task_stack_page(current)) ++ sp >= (unsigned long)task_stack_page(current) + 2 * sizeof(unsigned long)) + current_thread_info()->lowest_stack = sp; + if (unlikely((sp & ~(THREAD_SIZE - 1)) < (THREAD_SIZE/16))) + BUG(); @@ -108126,6 +108157,27 @@ index 88eace5..b5947e7 100644 continue; } list_del_init(&rm->m_conn_item); +diff --git a/net/rds/sysctl.c b/net/rds/sysctl.c +index 25ad0c7..065026f 100644 +--- a/net/rds/sysctl.c ++++ b/net/rds/sysctl.c +@@ -71,14 +71,14 @@ static ctl_table rds_sysctl_rds_table[] = { + { + .procname = "max_unacked_packets", + .data = &rds_sysctl_max_unacked_packets, +- .maxlen = sizeof(unsigned long), ++ .maxlen = sizeof(int), + .mode = 0644, + .proc_handler = proc_dointvec, + }, + { + .procname = "max_unacked_bytes", + .data = &rds_sysctl_max_unacked_bytes, +- .maxlen = sizeof(unsigned long), ++ .maxlen = sizeof(int), + .mode = 0644, + .proc_handler = proc_dointvec, + }, diff --git a/net/rds/tcp.c b/net/rds/tcp.c index edac9ef..16bcb98 100644 --- a/net/rds/tcp.c @@ -108570,10 +108622,38 @@ index 76388b0..a967f68 100644 sctp_generate_t1_cookie_event, sctp_generate_t1_init_event, diff --git a/net/sctp/socket.c b/net/sctp/socket.c -index c28eb7b..7afe73d 100644 +index c28eb7b..832978a 100644 --- a/net/sctp/socket.c +++ b/net/sctp/socket.c -@@ -2183,11 +2183,13 @@ static int sctp_setsockopt_events(struct sock *sk, char __user *optval, +@@ -1611,6 +1611,7 @@ SCTP_STATIC int sctp_sendmsg(struct kiocb *iocb, struct sock *sk, + sctp_scope_t scope; + long timeo; + __u16 sinfo_flags = 0; ++ bool wait_connect = false; + struct sctp_datamsg *datamsg; + int msg_flags = msg->msg_flags; + +@@ -1929,6 +1930,7 @@ SCTP_STATIC int sctp_sendmsg(struct kiocb *iocb, struct sock *sk, + err = sctp_primitive_ASSOCIATE(asoc, NULL); + if (err < 0) + goto out_free; ++ wait_connect = true; + SCTP_DEBUG_PRINTK("We associated primitively.\n"); + } + +@@ -1968,6 +1970,11 @@ SCTP_STATIC int sctp_sendmsg(struct kiocb *iocb, struct sock *sk, + else + err = msg_len; + ++ if (unlikely(wait_connect)) { ++ timeo = sock_sndtimeo(sk, msg_flags & MSG_DONTWAIT); ++ sctp_wait_for_connect(asoc, &timeo); ++ } ++ + /* If we are already past ASSOCIATE, the lower + * layers are responsible for association cleanup. + */ +@@ -2183,11 +2190,13 @@ static int sctp_setsockopt_events(struct sock *sk, char __user *optval, { struct sctp_association *asoc; struct sctp_ulpevent *event; @@ -108588,7 +108668,7 @@ index c28eb7b..7afe73d 100644 /* * At the time when a user app subscribes to SCTP_SENDER_DRY_EVENT, -@@ -4173,13 +4175,16 @@ static int sctp_getsockopt_disable_fragments(struct sock *sk, int len, +@@ -4173,13 +4182,16 @@ static int sctp_getsockopt_disable_fragments(struct sock *sk, int len, static int sctp_getsockopt_events(struct sock *sk, int len, char __user *optval, int __user *optlen) { @@ -108606,7 +108686,7 @@ index c28eb7b..7afe73d 100644 return -EFAULT; return 0; } -@@ -4197,6 +4202,8 @@ static int sctp_getsockopt_events(struct sock *sk, int len, char __user *optval, +@@ -4197,6 +4209,8 @@ static int sctp_getsockopt_events(struct sock *sk, int len, char __user *optval, */ static int sctp_getsockopt_autoclose(struct sock *sk, int len, char __user *optval, int __user *optlen) { @@ -108615,7 +108695,7 @@ index c28eb7b..7afe73d 100644 /* Applicable to UDP-style socket only */ if (sctp_style(sk, TCP)) return -EOPNOTSUPP; -@@ -4205,7 +4212,8 @@ static int sctp_getsockopt_autoclose(struct sock *sk, int len, char __user *optv +@@ -4205,7 +4219,8 @@ static int sctp_getsockopt_autoclose(struct sock *sk, int len, char __user *optv len = sizeof(int); if (put_user(len, optlen)) return -EFAULT; @@ -108625,7 +108705,7 @@ index c28eb7b..7afe73d 100644 return -EFAULT; return 0; } -@@ -4569,12 +4577,15 @@ static int sctp_getsockopt_delayed_ack(struct sock *sk, int len, +@@ -4569,12 +4584,15 @@ static int sctp_getsockopt_delayed_ack(struct sock *sk, int len, */ static int sctp_getsockopt_initmsg(struct sock *sk, int len, char __user *optval, int __user *optlen) { @@ -108642,7 +108722,7 @@ index c28eb7b..7afe73d 100644 return -EFAULT; return 0; } -@@ -4615,6 +4626,8 @@ static int sctp_getsockopt_peer_addrs(struct sock *sk, int len, +@@ -4615,6 +4633,8 @@ static int sctp_getsockopt_peer_addrs(struct sock *sk, int len, addrlen = sctp_get_af_specific(temp.sa.sa_family)->sockaddr_len; if (space_left < addrlen) return -ENOMEM; diff --git a/kernel-sources/grsecurity/grsecurity-3.0-3.2.66-201502052350.patch.sig b/kernel-sources/grsecurity/grsecurity-3.0-3.2.66-201502052350.patch.sig new file mode 100644 index 0000000..529f373 Binary files /dev/null and b/kernel-sources/grsecurity/grsecurity-3.0-3.2.66-201502052350.patch.sig differ