linux/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
.gitignore
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
vdso-layout.lds.S
vdso-note.S
vdso.S
vdso.lds.S
vdso32-setup.c
vdso32.S
vextern.h
vgetcpu.c
vma.c x86, mm: rename TASK_SIZE64 => TASK_SIZE_MAX 2009-02-21 00:09:44 +01:00
vvar.c