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: FBSD 5.5 broke nanosleep in libc_r Message-ID: <20060725195839.4E5CF137BB7@scanner.secnap.net>
index | next in thread | raw e-mail
>Submitter-Id: current-users
>Originator: Michael Scheidel
>Organization: SECNAP Network Security
>Confidential:
>Synopsis: FBSD 5.5 broke nanosleep in libc_r
>Severity: serious
>Priority: medium
>Category: threads
>Class: sw-bug
>Release: FreeBSD 5.5-RELEASE-p2 i386
>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.
help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20060725195839.4E5CF137BB7>
