bug-gnulib
[Top][All Lists]
Advanced

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

Re: RFC: too aggressive nanosleep replacement on 64 bit Linux?


From: Paul Eggert
Subject: Re: RFC: too aggressive nanosleep replacement on 64 bit Linux?
Date: Tue, 05 Aug 2014 13:31:00 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.0

[CC'ing Thomas Gleixner, who maintains the Linux kernel's POSIX clocks and timers. Thomas, this thread started at <http://lists.gnu.org/archive/html/bug-gnulib/2014-08/msg00005.html>.]

Pádraig Brady wrote:
I noticed that nanosleep() was replaced on 64 bit Linux ...
Should we be more conservative with our replacement, and be happy with 292 
years?

It'd be nicer to get the kernel bug fixed (eventually it's bound to break something when the kernel is off by 293 billion years :-).

I'm attaching a program that illustrates the bug on Fedora 20 (kernel 3.15.7-200.fc20.x86_64) and on Ubuntu 14.04.1 (kernel 3.13.0-32-generic #57-Ubuntu x86-64). Running this program on a buggy host outputs something like this:

Setting alarm for 1 second from now ...
Sleeping for 9223372036854775807.999999999 seconds...
After alarm sent off, remaining time is 9223357678.462306617 seconds;
i.e., nanosleep claimed that it slept for about 293079448610.606445 years.

and the program exits with status 4. Gnulib-using applications have a workaround for this bug, but a workaround shouldn't be necessary. For what it's worth, the bug is fixed in Solaris 11 (x86-64), though it's present in Solaris 10 (64-bit sparc).

Thomas, are you the right person to get it fixed in the Linux kernel, or should I email a bug report somewhere else? Thanks.

Attachment: nanosleep-bug.c
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]