Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 11 Jun 1999 11:55:04 -0700 (PDT)
From:      davids@webmaster.com
To:        freebsd-gnats-submit@freebsd.org
Subject:   kern/12141: libc_r passes negative tv_usec values to setitimer -- crash
Message-ID:  <19990611185504.478F114F01@hub.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         12141
>Category:       kern
>Synopsis:       libc_r passes negative tv_usec values to setitimer -- crash
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Jun 11 12:00:01 PDT 1999
>Closed-Date:
>Last-Modified:
>Originator:     David Schwartz
>Release:        3.2-STABLE
>Organization:
WebMaster, Incorporated
>Environment:
FreeBSD vermithrax.youwant.to 3.2-STABLE FreeBSD 3.2-STABLE #9: Mon Jun  7 10:15:02 PDT 1999     davids@vermithrax.youwant.to:/usr/src/sys/compile/DAVIDS  i386

>Description:
It seems that under some circumstances, the pthreads (libc_r) library computes a negative tv_usec value which it passes to setitimer. setitimer returns EINVAL, causing the threaded program to crash.



>How-To-Repeat:
I'm not sure what it is specifically that's causing it. But it is happening to three of my pthreads-based programs.
>Fix:

This is the *wrong* fix, but it does make the problem go away.

in uthread_kern.c:
                                /*
                                 * Start the interval timer for the
                                 * calculated time interval: 
                                 */
                                if(itimer.it_value.tv_usec<=0)
                                 itimer.it_value.tv_usec=1000;
                                if (setitimer(_ITIMER_SCHED_TIMER, &itimer, NULL
) != 0) {


The 'if' has been added to remove the problem. But the real problem is why it's computing negative values in the first place.

>Release-Note:
>Audit-Trail:
>Unformatted:


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19990611185504.478F114F01>