From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753005AbdFLXIF (ORCPT ); Mon, 12 Jun 2017 19:08:05 -0400 Received: from Galois.linutronix.de ([146.0.238.70]:35036 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752790AbdFLXIE (ORCPT ); Mon, 12 Jun 2017 19:08:04 -0400 Date: Tue, 13 Jun 2017 01:08:02 +0200 (CEST) From: Thomas Gleixner To: Al Viro cc: linux-kernel@vger.kernel.org Subject: Re: [PATCH 01/16] move copyout of timespec into do_cpu_nanosleep() In-Reply-To: <20170607084241.28657-1-viro@ZenIV.linux.org.uk> Message-ID: References: <20170607084106.GV6365@ZenIV.linux.org.uk> <20170607084241.28657-1-viro@ZenIV.linux.org.uk> User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Thanks, tglx