From: Eric Dumazet <dada1@cosmosbay.com>
To: john stultz <johnstul@us.ibm.com>
Cc: lkml <linux-kernel@vger.kernel.org>
Subject: Re: [RFC][PATCH] Use proper casting with signed timespec.tv_nsec values
Date: Thu, 01 Sep 2005 23:37:34 +0200 [thread overview]
Message-ID: <4317749E.3020109@cosmosbay.com> (raw)
In-Reply-To: <1125608627.22448.4.camel@cog.beaverton.ibm.com>
john stultz a écrit :
> All,
> I recently ran into a bug with an older kernel where xtime's tv_nsec
> field had accumulated more then 2 seconds worth of time. The timespec's
> tv_nsec is a signed long, however gettimeofday() treats it as an
> unsigned long. Thus when the failure occured, very strange and difficult
> to debug time problems occurred.
>
> The main cause of the problem I was seeing is already fixed in mainline,
> however just to be safe, I figured the following patch would be wise.
>
> I only audited i386 and x86_64, however other arches probably could have
> similar signed problems as well.
>
> Please let me know if you have any further comments or feedback.
What happens on i386 when/if more than 4 seconds accumulate ?
That should happens too.
Maybe the real fix is elsewhere ?
>
> thanks
> -john
>
> linux-2.6.13_signed-tv_nsec_A0.patch
> ====================================
> --- a/kernel/timer.c
> +++ b/kernel/timer.c
> @@ -824,7 +824,7 @@ static void update_wall_time(unsigned lo
> do {
> ticks--;
> update_wall_time_one_tick();
> - if (xtime.tv_nsec >= 1000000000) {
> + if ((unsigned long)xtime.tv_nsec >= 1000000000) {
> xtime.tv_nsec -= 1000000000;
> xtime.tv_sec++;
> second_overflow();
>
maybe here a :
while ((unsigned long)xtime.tv_nsec >= 1000000000) {
xtime.tv_nsec -= 1000000000;
xtime.tv_sec++;
second_overflow();
...
}
Eric
next prev parent reply other threads:[~2005-09-01 21:37 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-09-01 21:03 [RFC][PATCH] Use proper casting with signed timespec.tv_nsec values john stultz
2005-09-01 21:37 ` Eric Dumazet [this message]
2005-09-01 22:25 ` john stultz
2005-09-02 1:14 ` George Anzinger
2005-09-06 17:33 ` Christoph Lameter
2005-09-06 19:54 ` john stultz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4317749E.3020109@cosmosbay.com \
--to=dada1@cosmosbay.com \
--cc=johnstul@us.ibm.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox