[kernel] r13526 - in dists/lenny/linux-2.6/debian: . patches/bugfix/x86 patches/series

Dann Frazier dannf at alioth.debian.org
Thu Apr 30 17:53:41 UTC 2009


Author: dannf
Date: Thu Apr 30 17:53:39 2009
New Revision: 13526

Log:
[x86] gettimeofday() vDSO: fix segfault when tv == NULL (Closes: #466491)

Added:
   dists/lenny/linux-2.6/debian/patches/bugfix/x86/gettimeofday-vDSO-NULL-tv-segv.patch
Modified:
   dists/lenny/linux-2.6/debian/changelog
   dists/lenny/linux-2.6/debian/patches/series/16

Modified: dists/lenny/linux-2.6/debian/changelog
==============================================================================
--- dists/lenny/linux-2.6/debian/changelog	Thu Apr 30 17:08:03 2009	(r13525)
+++ dists/lenny/linux-2.6/debian/changelog	Thu Apr 30 17:53:39 2009	(r13526)
@@ -21,6 +21,9 @@
   * cdc-acm: Add quirk for MTK II GPS, such as Qstarz BT-Q1000X (closes:
     #525060)
 
+  [ John Wright ]
+  * [x86] gettimeofday() vDSO: fix segfault when tv == NULL (Closes: #466491)
+
  -- maximilian attems <maks at debian.org>  Mon, 30 Mar 2009 17:11:49 +0200
 
 linux-2.6 (2.6.26-15) stable; urgency=high

Added: dists/lenny/linux-2.6/debian/patches/bugfix/x86/gettimeofday-vDSO-NULL-tv-segv.patch
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ dists/lenny/linux-2.6/debian/patches/bugfix/x86/gettimeofday-vDSO-NULL-tv-segv.patch	Thu Apr 30 17:53:39 2009	(r13526)
@@ -0,0 +1,65 @@
+From: John Wright <john.wright at hp.com>
+Date: Wed, 29 Apr 2009 20:32:01 +0000 (-0600)
+Subject: x86: gettimeofday() vDSO: fix segfault when tv == NULL
+X-Git-Url: http://git.kernel.org/?p=linux%2Fkernel%2Fgit%2Ftip%2Flinux-2.6-tip.git;a=commitdiff_plain;h=2f65dd475c6a8a997145ea83cc3d2d5e6dc55af1
+
+x86: gettimeofday() vDSO: fix segfault when tv == NULL
+
+According to the gettimeofday(2) manual:
+
+       If either tv or tz is NULL, the corresponding structure is not
+       set or returned.
+
+Since it is legal to give NULL as the tv argument, the code should make
+sure tv is not NULL before trying to dereference it.
+
+This issue manifests itself on x86_64 when vdso=0 is not on the kernel
+command-line and libc uses the vDSO for gettimeofday() (e.g. glibc >=
+2.7).  A simple reproducer:
+
+  #include <stdio.h>
+  #include <sys/time.h>
+
+  int main(void)
+  {
+      struct timezone tz;
+
+      gettimeofday(NULL, &tz);
+
+      return 0;
+  }
+
+See http://bugs.debian.org/466491 for more details.
+
+[ Impact: fix gettimeofday(NULL, &tz) segfault ]
+
+Signed-off-by: John Wright <john.wright at hp.com>
+Cc: Andi Kleen <ak at suse.de>
+Cc: John Wright <john.wright at hp.com>
+LKML-Reference: <1241037121-14805-1-git-send-email-john.wright at hp.com>
+Signed-off-by: Ingo Molnar <mingo at elte.hu>
+---
+
+diff --git a/arch/x86/vdso/vclock_gettime.c b/arch/x86/vdso/vclock_gettime.c
+index d9d3582..6a40b78 100644
+--- a/arch/x86/vdso/vclock_gettime.c
++++ b/arch/x86/vdso/vclock_gettime.c
+@@ -104,11 +104,13 @@ notrace int __vdso_gettimeofday(struct timeval *tv, struct timezone *tz)
+ {
+ 	long ret;
+ 	if (likely(gtod->sysctl_enabled && gtod->clock.vread)) {
+-		BUILD_BUG_ON(offsetof(struct timeval, tv_usec) !=
+-			     offsetof(struct timespec, tv_nsec) ||
+-			     sizeof(*tv) != sizeof(struct timespec));
+-		do_realtime((struct timespec *)tv);
+-		tv->tv_usec /= 1000;
++		if (likely(tv != NULL)) {
++			BUILD_BUG_ON(offsetof(struct timeval, tv_usec) !=
++				     offsetof(struct timespec, tv_nsec) ||
++				     sizeof(*tv) != sizeof(struct timespec));
++			do_realtime((struct timespec *)tv);
++			tv->tv_usec /= 1000;
++		}
+ 		if (unlikely(tz != NULL)) {
+ 			/* Avoid memcpy. Some old compilers fail to inline it */
+ 			tz->tz_minuteswest = gtod->sys_tz.tz_minuteswest;

Modified: dists/lenny/linux-2.6/debian/patches/series/16
==============================================================================
--- dists/lenny/linux-2.6/debian/patches/series/16	Thu Apr 30 17:08:03 2009	(r13525)
+++ dists/lenny/linux-2.6/debian/patches/series/16	Thu Apr 30 17:53:39 2009	(r13526)
@@ -1,3 +1,4 @@
 + bugfix/all/0001-block-revert-part-of-18ce3751ccd488c78d3827e9f6bf54.patch
 + bugfix/s390/fix__div64_31_for_G5.patch
 + bugfix/all/cdc-acm-mtk-gps-quirk.patch
++ bugfix/x86/gettimeofday-vDSO-NULL-tv-segv.patch



More information about the Kernel-svn-changes mailing list