From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933729AbcFQPg4 (ORCPT ); Fri, 17 Jun 2016 11:36:56 -0400 Received: from smtprelay0056.hostedemail.com ([216.40.44.56]:54102 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932628AbcFQPgx (ORCPT ); Fri, 17 Jun 2016 11:36:53 -0400 X-Session-Marker: 726F737465647440676F6F646D69732E6F7267 X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,rostedt@goodmis.org,:::::::::::::::::,RULES_HIT:41:355:379:541:599:800:960:973:988:989:1260:1277:1311:1313:1314:1345:1359:1431:1437:1515:1516:1518:1534:1541:1593:1594:1711:1730:1747:1777:1792:2393:2553:2559:2562:2909:3138:3139:3140:3141:3142:3353:3865:3866:3867:3868:3870:3871:3872:3873:3874:4321:5007:6261:7875:10004:10400:10848:10967:11026:11232:11658:11914:12050:12294:12296:12517:12519:12555:12663:12740:13069:13311:13357:13439:14181:14659:14721:21080:30012:30016:30051:30054:30064:30070:30090:30091,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:2,LUA_SUMMARY:none X-HE-Tag: sugar59_75da1b6e34642 X-Filterd-Recvd-Size: 2495 Date: Fri, 17 Jun 2016 11:36:48 -0400 From: Steven Rostedt To: Jens Axboe Cc: Arnd Bergmann , Ingo Molnar , y2038@lists.linaro.org, Hannes Reinecke , Mike Christie , Shaohua Li , linux-block@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] blktrace: avoid using timespec Message-ID: <20160617113648.69448c9f@gandalf.local.home> In-Reply-To: <20160617145849.3771756-1-arnd@arndb.de> References: <20160617145849.3771756-1-arnd@arndb.de> X-Mailer: Claws Mail 3.13.2 (GTK+ 2.24.30; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Jens, You want to take this, or do you want me to? -- Steve On Fri, 17 Jun 2016 16:58:26 +0200 Arnd Bergmann wrote: > The blktrace code stores the current time in a 32-bit word in its > user interface. This is a bad idea because 32-bit seconds overflow > at some point. > > We probably have until 2106 before this one overflows, as it seems > to use an 'unsigned' variable, but we should confirm that user > space treats it the same way. > > Aside from this, we want to stop using 'struct timespec' here, > so I'm adding a comment about the overflow and change the code > to use timespec64 instead to make the loss of range more obvious. > > Signed-off-by: Arnd Bergmann > --- > kernel/trace/blktrace.c | 7 ++++--- > 1 file changed, 4 insertions(+), 3 deletions(-) > > diff --git a/kernel/trace/blktrace.c b/kernel/trace/blktrace.c > index ef86b965ade3..b0816e4a61a5 100644 > --- a/kernel/trace/blktrace.c > +++ b/kernel/trace/blktrace.c > @@ -127,12 +127,13 @@ static void trace_note_tsk(struct task_struct *tsk) > > static void trace_note_time(struct blk_trace *bt) > { > - struct timespec now; > + struct timespec64 now; > unsigned long flags; > u32 words[2]; > > - getnstimeofday(&now); > - words[0] = now.tv_sec; > + /* need to check user space to see if this breaks in y2038 or y2106 */ > + ktime_get_real_ts64(&now); > + words[0] = (u32)now.tv_sec; > words[1] = now.tv_nsec; > > local_irq_save(flags);