From: John Stultz <john.stultz@linaro.org>
To: David Engraf <david.engraf@sysgo.com>
Cc: Thomas Gleixner <tglx@linutronix.de>, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ktime_add_ns() may overflow on 32bit architectures
Date: Mon, 08 Apr 2013 13:20:03 -0700 [thread overview]
Message-ID: <51632673.8030603@linaro.org> (raw)
In-Reply-To: <51485A43.4020600@sysgo.com>
On 03/19/2013 05:29 AM, David Engraf wrote:
> Hello,
>
> I've triggered an overflow when using ktime_add_ns() on a 32bit
> architecture not supporting CONFIG_KTIME_SCALAR.
>
> When passing a very high value for u64 nsec, e.g. 7881299347898368000
> the do_div() function converts this value to seconds (7881299347)
> which is still to high to pass to the ktime_set() function as long.
> The result in my case is a negative value.
>
> The problem on my system occurs in the tick-sched.c,
> tick_nohz_stop_sched_tick() when time_delta is set to
> timekeeping_max_deferment(). The check for time_delta < KTIME_MAX is
> valid, thus ktime_add_ns() is called with a too large value resulting
> in a negative expire value. This leads to an endless loop in the
> ticker code:
>
> time_delta: 7881299347898368000
> expires = ktime_add_ns(last_update, time_delta)
> expires: negative value
>
> This error doesn't occurs on 64bit or architectures supporting
> CONFIG_KTIME_SCALAR (e.g. ARM, x86-32).
Sorry, this fell through the cracks. I see Andrew caught it, but I've
queued for 3.10 in my tree as well.
This should be tagged for -stable as well, no?
thanks
-john
next prev parent reply other threads:[~2013-04-08 20:20 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-19 12:29 [PATCH] ktime_add_ns() may overflow on 32bit architectures David Engraf
2013-03-19 12:38 ` Eric Dumazet
2013-03-19 12:53 ` David Engraf
2013-04-08 20:20 ` John Stultz [this message]
2013-04-09 7:08 ` David Engraf
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=51632673.8030603@linaro.org \
--to=john.stultz@linaro.org \
--cc=david.engraf@sysgo.com \
--cc=linux-kernel@vger.kernel.org \
--cc=tglx@linutronix.de \
/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