[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#484048: Acknowledgement (gettimeofday() crashes if given a timezone on amd64)



After looking at this a little more, it appears to be a kernel problem in the vdso code. We have in the kernel:

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 (unlikely(tz != NULL)) {
           /* This relies on gcc inlining the memcpy. We'll notice
              if it ever fails to do so. */
           memcpy(tz, &gtod->sys_tz, sizeof(struct timezone));
       }
       return 0;
   }
   asm("syscall" : "=a" (ret) :
       "0" (__NR_gettimeofday), "D" (tv), "S" (tz) : "memory");
   return ret;
}

It appears that the memcpy is not being inlined.



Reply to: