[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.20.1706130945110.1919@nanos>
Date: Tue, 13 Jun 2017 09:46:40 +0200 (CEST)
From: Thomas Gleixner <tglx@...utronix.de>
To: Al Viro <viro@...IV.linux.org.uk>
cc: linux-kernel@...r.kernel.org
Subject: Re: [PATCH 01/16] move copyout of timespec into do_cpu_nanosleep()
On Tue, 13 Jun 2017, Thomas Gleixner wrote:
> On Wed, 7 Jun 2017, Al Viro wrote:
> > @@ -1242,12 +1243,14 @@ static int do_cpu_nanosleep(const clockid_t which_clock, int flags,
> >
> > error = -ERESTART_RESTARTBLOCK;
> > + /*
> > + * Report back to the user the time still remaining.
> > + */
> > + rmtp = restart->nanosleep.rmtp;
> > + if (rmtp) {
> > + struct timespec ts;
> > + ts = timespec64_to_timespec(it.it_value);
> > + if (copy_to_user(rmtp, &ts, sizeof(*rmtp)))
> > + return -EFAULT;
> > + }
> > + restart->nanosleep.expires = timespec64_to_ns(rqtp);
>
> Hmm, this looks wrong. But that was wrong before this patch already.
>
> The restart code needs the absolute expiry time of the timer, but in case
> of flags != ABSTIME rqtp contains the relative expiry time.
>
> So that want's to be fixed first. Need to figure out what's the least ugly
> way to do that. I'll have a look tomorrow.
Misread the code. rqtp is updated with the absolute expiry time when a
signal hits. Though with your changes we can simplify that further and
avoid the whole back and forth timespec conversion.
Thanks,
tglx
Powered by blists - more mailing lists