[Bug 693] New: Invalid timeval passed to setitmer()

bugzilla-daemon at bugzilla.openmoko.org bugzilla-daemon at bugzilla.openmoko.org
Tue Aug 7 20:52:35 CEST 2007


http://bugzilla.openmoko.org/cgi-bin/bugzilla/show_bug.cgi?id=693

           Summary: Invalid timeval passed to setitmer()
           Product: OpenMoko
           Version: current svn head
          Platform: All
        OS/Version: Linux
            Status: NEW
          Severity: minor
          Priority: P3
         Component: gsmd
        AssignedTo: laforge at openmoko.org
        ReportedBy: mail at mmontour.net
                CC: buglog at lists.openmoko.org


A system clock step (e.g. caused by NTP synchronization) can cause gsmd/timer.c
to pass a negative time interval to setitmer():

Aug  7 16:53:18 fic-gta01 daemon.info ntpd[1100]: synchronized to 192.168.0.200,
stratum 3
Aug  7 17:15:29 fic-gta01 daemon.notice ntpd[1100]: time reset +70.331006 s
Aug  7 17:15:54 fic-gta01 user.warn kernel: setitimer: gsmd (pid = 1152)
provided invalid timeval it_value: tv_sec = -69 tv_usec = 899874
Aug  7 17:15:54 fic-gta01 user.warn kernel: setitimer: gsmd (pid = 1152)
provided invalid timeval it_value: tv_sec = -69 tv_usec = 899478

There is code which anticipates this condition:
        if (tv_sub(&diff, &min, &now) < 0) {
                /* FIXME: run expired timer callbacks */
                /* we cannot run timers from here since we might be
                 * called from register_timer() within check_n_run() */

                /* FIXME: restart with next minimum timer */
                goto retry;
        }

however tv_sub() currently has an unconditional return value of 0, so this block
will never be executed.

I haven't yet looked at the gsmd timer code in detail, but it might help in some
places to use clock_gettime(CLOCK_MONOTONIC,...) rather than gettimeofday() for
interval-related calculations.



------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.




More information about the buglog mailing list