lkml.org 
[lkml]   [2013]   [Apr]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] ktime_add_ns() may overflow on 32bit architectures
Am 08.04.2013 22:20, schrieb John Stultz:
> 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?

Yes, please tag it for -stable as well because I had the problem with
kernel 3.0 and it can overflow on all current version.

Best regards
- David

> thanks
> -john
>



\
 
 \ /
  Last update: 2013-04-09 09:41    [W:0.063 / U:0.444 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site