From: Boris Ostrovsky <boris.ostrovsky@oracle.com>
To: "H. Peter Anvin" <hpa@zytor.com>
Cc: tglx@linutronix.de, mingo@redhat.com,
linux-kernel@vger.kernel.org, stefani@seibold.net,
luto@amacapital.net, konrad.wilk@oracle.com,
stable@vger.kernel.org
Subject: Re: [PATCH] time: Cast tv_nsec to u64 for proper shifting in update_vsyscall()
Date: Fri, 09 May 2014 12:23:20 -0400 [thread overview]
Message-ID: <536D00F8.8030801@oracle.com> (raw)
In-Reply-To: <536CFC3C.5030706@zytor.com>
On 05/09/2014 12:03 PM, H. Peter Anvin wrote:
> 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?
Oh, yes, of course. I was just looking at code without thinking. 3.14
only then.
-boris
next prev parent reply other threads:[~2014-05-09 16:19 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-09 15:11 [PATCH] time: Cast tv_nsec to u64 for proper shifting in update_vsyscall() Boris Ostrovsky
2014-05-09 15:43 ` H. Peter Anvin
2014-05-09 15:59 ` Boris Ostrovsky
2014-05-09 16:03 ` H. Peter Anvin
2014-05-09 16:23 ` Boris Ostrovsky [this message]
2014-05-09 16:31 ` [tip:x86/urgent] x86, vdso, " tip-bot for Boris Ostrovsky
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=536D00F8.8030801@oracle.com \
--to=boris.ostrovsky@oracle.com \
--cc=hpa@zytor.com \
--cc=konrad.wilk@oracle.com \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@amacapital.net \
--cc=mingo@redhat.com \
--cc=stable@vger.kernel.org \
--cc=stefani@seibold.net \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.