Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 25 Jul 2006 15:58:39 -0400 (EDT)
From:      Michael Scheidell <scheidell@secnap.net>
To:        FreeBSD-gnats-submit@FreeBSD.org
Cc:        freebsd-hackers@FreeBSD.org
Subject:   threads/100815: FBSD 5.5 broke nanosleep in libc_r
Message-ID:  <20060725195839.4E5CF137BB7@scanner.secnap.net>
Resent-Message-ID: <200607252000.k6PK0X4D099109@freefall.freebsd.org>

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

>Number:         100815
>Category:       threads
>Synopsis:       FBSD 5.5 broke nanosleep in libc_r
>Confidential:   yes
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-threads
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Jul 25 20:00:32 GMT 2006
>Closed-Date:
>Last-Modified:
>Originator:     Michael Scheidel
>Release:        FreeBSD 5.5-RELEASE-p2 i386
>Organization:
SECNAP Network Security
>Environment:
System: FreeBSD audit18.hackertrap.net 5.5-RELEASE-p2 FreeBSD 5.5-RELEASE-p2 #6: Tue Jul 25 10:34:16 EDT 2006     admin@audit18.hackertrap.net:/usr/obj/usr/src/sys/HACKERTRAP_305  i386

>Description:
	nanosleep returns after time+delta if wallclock changed with libc_r
>How-To-Repeat:
        5.4 works, not including libc_r in 5.5 works
        Given this POC:
        int main( int argc, char **argv )
{
char execs1[256] = "/bin/date +A%Y%m%d%H%M.%S";
char execs2[256] = "/bin/date +B%Y%m%d%H%M.%S";
int a;
  
  while ( 1) {
  
    system( execs1 );
     usleep( 500*1000);
    system( execs2 );
  }

  return 0;
}  /* main */

compile with: 
cc -g  -c nanotest.c
cc -g  -o nanotest nanotest.o -lc_r

run it, set clock back 45 seconds, observe 45 second delay
>Fix:

compile with:
cc -g  -c nanotest.c
cc -g  -o nanotest nanotest.o

or compile on 5.4 system.
(I have only tried compiling and running on 5.4 system.
I have not yet tried compiling on 5.4 and running on 5.5 or visa versa)

I used ntpdate -su to change clock.
(I have an internal system that is 45 seconds behind, just for this test)

output with 5.4 or without libc_r
shows wallclock 'stepping' when you change time
no delay in display.

5.5 with libc_r shows stepping if moving clock head, but if you move
wallclock back 45 seconds, display stops for 45 seconds.


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



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