[arch-commits] Commit in linux-lts/trunk (2 files)

Bartłomiej Piotrowski bpiotrowski at nymeria.archlinux.org
Fri Jan 31 16:13:52 UTC 2014


    Date: Friday, January 31, 2014 @ 17:13:52
  Author: bpiotrowski
Revision: 204934

upgpkg: linux-lts 3.10.28-1.1

fix CVE-2014-0038

Added:
  linux-lts/trunk/0001-x86-x32-Correct-invalid-use-of-user-timespec-in-the-.patch
Modified:
  linux-lts/trunk/PKGBUILD

-----------------------------------------------------------------+
 0001-x86-x32-Correct-invalid-use-of-user-timespec-in-the-.patch |   80 ++++++++++
 PKGBUILD                                                        |   13 +
 2 files changed, 89 insertions(+), 4 deletions(-)

Added: 0001-x86-x32-Correct-invalid-use-of-user-timespec-in-the-.patch
===================================================================
--- 0001-x86-x32-Correct-invalid-use-of-user-timespec-in-the-.patch	                        (rev 0)
+++ 0001-x86-x32-Correct-invalid-use-of-user-timespec-in-the-.patch	2014-01-31 16:13:52 UTC (rev 204934)
@@ -0,0 +1,80 @@
+From 2def2ef2ae5f3990aabdbe8a755911902707d268 Mon Sep 17 00:00:00 2001
+From: PaX Team <pageexec at freemail.hu>
+Date: Thu, 30 Jan 2014 16:59:25 -0800
+Subject: [PATCH] x86, x32: Correct invalid use of user timespec in the kernel
+
+The x32 case for the recvmsg() timout handling is broken:
+
+  asmlinkage long compat_sys_recvmmsg(int fd, struct compat_mmsghdr __user *mmsg,
+                                      unsigned int vlen, unsigned int flags,
+                                      struct compat_timespec __user *timeout)
+  {
+          int datagrams;
+          struct timespec ktspec;
+
+          if (flags & MSG_CMSG_COMPAT)
+                  return -EINVAL;
+
+          if (COMPAT_USE_64BIT_TIME)
+                  return __sys_recvmmsg(fd, (struct mmsghdr __user *)mmsg, vlen,
+                                        flags | MSG_CMSG_COMPAT,
+                                        (struct timespec *) timeout);
+          ...
+
+The timeout pointer parameter is provided by userland (hence the __user
+annotation) but for x32 syscalls it's simply cast to a kernel pointer
+and is passed to __sys_recvmmsg which will eventually directly
+dereference it for both reading and writing.  Other callers to
+__sys_recvmmsg properly copy from userland to the kernel first.
+
+The bug was introduced by commit ee4fa23c4bfc ("compat: Use
+COMPAT_USE_64BIT_TIME in net/compat.c") and should affect all kernels
+since 3.4 (and perhaps vendor kernels if they backported x32 support
+along with this code).
+
+Note that CONFIG_X86_X32_ABI gets enabled at build time and only if
+CONFIG_X86_X32 is enabled and ld can build x32 executables.
+
+Other uses of COMPAT_USE_64BIT_TIME seem fine.
+
+This addresses CVE-2014-0038.
+
+Signed-off-by: PaX Team <pageexec at freemail.hu>
+Signed-off-by: H. Peter Anvin <hpa at linux.intel.com>
+Cc: <stable at vger.kernel.org> # v3.4+
+Signed-off-by: Linus Torvalds <torvalds at linux-foundation.org>
+---
+ net/compat.c | 9 ++-------
+ 1 file changed, 2 insertions(+), 7 deletions(-)
+
+diff --git a/net/compat.c b/net/compat.c
+index dd32e34..f50161f 100644
+--- a/net/compat.c
++++ b/net/compat.c
+@@ -780,21 +780,16 @@ asmlinkage long compat_sys_recvmmsg(int fd, struct compat_mmsghdr __user *mmsg,
+ 	if (flags & MSG_CMSG_COMPAT)
+ 		return -EINVAL;
+ 
+-	if (COMPAT_USE_64BIT_TIME)
+-		return __sys_recvmmsg(fd, (struct mmsghdr __user *)mmsg, vlen,
+-				      flags | MSG_CMSG_COMPAT,
+-				      (struct timespec *) timeout);
+-
+ 	if (timeout == NULL)
+ 		return __sys_recvmmsg(fd, (struct mmsghdr __user *)mmsg, vlen,
+ 				      flags | MSG_CMSG_COMPAT, NULL);
+ 
+-	if (get_compat_timespec(&ktspec, timeout))
++	if (compat_get_timespec(&ktspec, timeout))
+ 		return -EFAULT;
+ 
+ 	datagrams = __sys_recvmmsg(fd, (struct mmsghdr __user *)mmsg, vlen,
+ 				   flags | MSG_CMSG_COMPAT, &ktspec);
+-	if (datagrams > 0 && put_compat_timespec(&ktspec, timeout))
++	if (datagrams > 0 && compat_put_timespec(&ktspec, timeout))
+ 		datagrams = -EFAULT;
+ 
+ 	return datagrams;
+-- 
+1.8.5.3
+

Modified: PKGBUILD
===================================================================
--- PKGBUILD	2014-01-31 15:44:02 UTC (rev 204933)
+++ PKGBUILD	2014-01-31 16:13:52 UTC (rev 204934)
@@ -6,7 +6,7 @@
 #pkgbase=linux-custom       # Build kernel with a different name
 _srcname=linux-3.10
 pkgver=3.10.28
-pkgrel=1
+pkgrel=1.1
 arch=('i686' 'x86_64')
 url="http://www.kernel.org/"
 license=('GPL2')
@@ -19,7 +19,8 @@
         # standard config files for mkinitcpio ramdisk
         'linux-lts.preset'
         'change-default-console-loglevel.patch'
-        'criu-no-expert.patch')
+        'criu-no-expert.patch'
+        '0001-x86-x32-Correct-invalid-use-of-user-timespec-in-the-.patch')
 md5sums=('4f25cd5bec5f8d5a7d935b3f2ccb8481'
          '34514ae21798afcf2a8dc3c77f2714a6'
          '45368ef5c1d03d375c31dcecabc5f0dd'
@@ -26,7 +27,8 @@
          'bf297cf1c74b06552b1013a09a27692f'
          '232b52576a62c7a333e9fe7a1e1ca359'
          'f3def2cefdcbb954c21d8505d23cc83c'
-         'd50c1ac47394e9aec637002ef3392bd1')
+         'd50c1ac47394e9aec637002ef3392bd1'
+         '336d2c4afd7ee5f2bdf0dcb1a54df4b2')
 
 _kernelname=${pkgbase#linux}
 
@@ -54,7 +56,10 @@
   # allow criu without expert option set
   # patch from fedora
   patch -Np1 -i "${srcdir}/criu-no-expert.patch"
- 
+
+  # CVE-2014-0038
+  patch -Np1 -i "${srcdir}/0001-x86-x32-Correct-invalid-use-of-user-timespec-in-the-.patch"
+
   if [ "${CARCH}" = "x86_64" ]; then
     cat "${srcdir}/config.x86_64" > ./.config
   else




More information about the arch-commits mailing list