kernel_optimize_test/arch/x86/vdso
John Wright 2f65dd475c 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@hp.com>
Cc: Andi Kleen <ak@suse.de>
Cc: John Wright <john.wright@hp.com>
LKML-Reference: <1241037121-14805-1-git-send-email-john.wright@hp.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
2009-04-30 12:31:45 +02:00
..
vdso32 x86: gitignore arch/x86/vdso files 2008-01-30 13:32:32 +01:00
.gitignore x86: add vdso32-int80-syms.lds to .gitignore 2008-01-30 13:33:24 +01:00
Makefile x86: no stack protector for vdso 2009-02-10 00:41:56 +01:00
vclock_gettime.c x86: gettimeofday() vDSO: fix segfault when tv == NULL 2009-04-30 12:31:45 +02:00
vdso32-setup.c [S390] arch_setup_additional_pages arguments 2008-12-25 13:38:54 +01:00
vdso32.S x86_64: further cleanup of 32-bit compat syscall mechanisms 2008-07-16 11:08:27 +02:00
vdso-layout.lds.S x86 vDSO: new layout 2008-01-30 13:30:41 +01:00
vdso-note.S x86_64: move vdso 2007-10-11 11:17:10 +02:00
vdso.lds.S x86 vDSO: new layout 2008-01-30 13:30:41 +01:00
vdso.S x86_64 vDSO: use initdata 2008-04-28 13:49:35 -07:00
vextern.h x86_64: move vdso 2007-10-11 11:17:10 +02:00
vgetcpu.c x86: add notrace annotations to vsyscall. 2008-05-23 20:31:39 +02:00
vma.c x86, mm: rename TASK_SIZE64 => TASK_SIZE_MAX 2009-02-21 00:09:44 +01:00
vvar.c x86: vdso put vars in rodata 2007-10-17 20:16:43 +02:00