From: Helge Deller <deller@gmx.de>
To: Arnd Bergmann <arnd@arndb.de>
Cc: "James E.J. Bottomley" <jejb@parisc-linux.org>,
y2038 Mailman List <y2038@lists.linaro.org>,
Thomas Gleixner <tglx@linutronix.de>,
Parisc List <linux-parisc@vger.kernel.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [RFC] parisc64: change __kernel_suseconds_t to match glibc
Date: Tue, 25 Sep 2018 19:53:13 +0200 [thread overview]
Message-ID: <7fdae639-6871-df29-ffbb-1096822ebb34@gmx.de> (raw)
In-Reply-To: <CAK8P3a1WT87CFyz7457R_cx=ueVjG+xUWXAA6SSw+C4ZnaZHVw@mail.gmail.com>
On 25.09.2018 12:53, Arnd Bergmann wrote:
> On Mon, Sep 17, 2018 at 9:46 PM Helge Deller <deller@gmx.de> wrote:
>> On 13.09.2018 17:59, Arnd Bergmann wrote:
>>> There are only two 64-bit architecture ports that have a 32-bit
>>> suseconds_t: sparc64 and parisc64. I've encountered a number of problems
>>> with this, while trying to get a proper 64-bit time_t working on 32-bit
>>> architectures. Having a 32-bit suseconds_t combined with a 64-bit time_t
>>> means that we get extra padding in data structures that may leak kernel
>>> stack data to user space, and it breaks all code that assumes that
>>> timespec and timeval have the same layout.
>>>
>>> While we can't change sparc64, it seems that glibc on parisc64 has always
>>> set suseconds_t to 'long', and the current version would give incorrect
>>> results for gettimeofday() and many other interfaces: timestamps passed
>>> from user space into the kernel result in tv_usec being always zero
>>> (the lower bits contain the intended value but are ignored) while data
>>> passed from the kernel to user space contains either zeroes or random
>>> data in tv_usec.
>
> [back from traveling now, sorry for the delay in replying]
>
>> Should this wrong behavior be visible with 32-bit userspace or
>> with 64-bit userspace (or both)?
>> I didn't noticed such wrong behavior yet.
>
> Only 64-bit user space.
>
...
> A simple 64-bit gettimeofday() should report incorrect
> nanoseconds using the upstream glibc implementation.
Yes, you are right.
Since we don't have any 64-bit userspace yet, it's safe to fix it now as you suggested.
I've added your patch as is to my for-next tree and tagged it for stable-tree.
Thanks for catching this!
Helge
prev parent reply other threads:[~2018-09-25 17:53 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-13 15:59 Arnd Bergmann
2018-09-17 19:46 ` Helge Deller
2018-09-25 10:53 ` Arnd Bergmann
2018-09-25 17:53 ` Helge Deller [this message]
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=7fdae639-6871-df29-ffbb-1096822ebb34@gmx.de \
--to=deller@gmx.de \
--cc=arnd@arndb.de \
--cc=jejb@parisc-linux.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-parisc@vger.kernel.org \
--cc=tglx@linutronix.de \
--cc=y2038@lists.linaro.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
all inboxes | Powered by JetHome®