lkml.org 
[lkml]   [2014]   [May]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] time: Cast tv_nsec to u64 for proper shifting in update_vsyscall()
On 05/09/2014 08:59 AM, Boris Ostrovsky wrote:
> On 05/09/2014 11:43 AM, H. Peter Anvin wrote:
>> On 05/09/2014 08:11 AM, Boris Ostrovsky wrote:
>>> With tk->wall_to_monotonic.tv_nsec being a 32-bit value on 32-bit
>>> systems, (tk->wall_to_monotonic.tv_nsec << tk->shift) in
>>> update_vsyscall()
>>> may lose upper bits or, worse, add them since compiler will do this:
>>> (u64)(tk->wall_to_monotonic.tv_nsec << tk->shift)
>>> instead of
>>> ((u64)tk->wall_to_monotonic.tv_nsec << tk->shift)
>>>
>>> So if, for example, tv_nsec is 0x800000 and shift is 8 we will end up
>>> with 0xffffffff80000000 instead of 0x80000000. And then we are stuck in
>>> the subsequent 'while' loop.
>>>
>>> We need explicit cast.
>>>
>>> Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
>>> Acked-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
>>> Cc: stable@vger.kernel.org
>> This is needed in stable only for v3.14, right?
>
> I suspect anything that has commit 650ea024 needs to be fixed. I see
> this code, for example, in 3.12 (it used to be in vsyscall_64.c).
>

But you're talking about 32-bit platforms. Vsyscalls aren't used on
x86-32 until 3.14. Am I missing something?

-hpa




\
 
 \ /
  Last update: 2014-05-09 18:41    [W:1.004 / U:0.056 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site