From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755302AbcFTUst (ORCPT ); Mon, 20 Jun 2016 16:48:49 -0400 Received: from mx1.redhat.com ([209.132.183.28]:48296 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755212AbcFTUsm (ORCPT ); Mon, 20 Jun 2016 16:48:42 -0400 From: Jeff Moyer To: Arnd Bergmann Cc: Jens Axboe , y2038@lists.linaro.org, Steven Rostedt , Ingo Molnar , Hannes Reinecke , Mike Christie , Shaohua Li , linux-block@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] blktrace: reword comment about time overflow References: <20160620200040.2813298-1-arnd@arndb.de> X-PGP-KeyID: 1F78E1B4 X-PGP-CertKey: F6FE 280D 8293 F72C 65FD 5A58 1FF8 A7CA 1F78 E1B4 X-PCLoadLetter: What the f**k does that mean? Date: Mon, 20 Jun 2016 16:36:58 -0400 In-Reply-To: <20160620200040.2813298-1-arnd@arndb.de> (Arnd Bergmann's message of "Mon, 20 Jun 2016 22:00:12 +0200") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Mon, 20 Jun 2016 20:37:00 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Arnd Bergmann writes: > Jeff Moyer looked up the blktrace source to see if an overflow might > happen. The situation is as follows: > > - The time stamp is not used by the program itself, only for > printing human-readable output. > - We normally don't print the timestamp at all, except when an > undocumented format option is given to blkparse. > - The assumption is that no other program besides blktrace > even looks at this data, but of course cannot be sure. > - On 64-bit systems, the time gets read from the unsigned > 32-bit kernel structure into a timespec in a way that will > work correctly until 2106, so there is no 2038 problem. > - On 32-bit systems that have a new (future) libc build with > a 64-bit time_t type, it will work the same way. > - On current 32-bit systems, the time is passed into localtime(), > at which point the overflow happens, but those systems are > already broken. > > In short, it's good enough for now, so update the comment. > > Signed-off-by: Arnd Bergmann > Fixes: 59a37f8baeb2 ("blktrace: avoid using timespec") > Cc: Jeff Moyer Acked-by: Jeff Moyer > --- > kernel/trace/blktrace.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/kernel/trace/blktrace.c b/kernel/trace/blktrace.c > index b0816e4a61a5..4a3666779589 100644 > --- a/kernel/trace/blktrace.c > +++ b/kernel/trace/blktrace.c > @@ -131,7 +131,8 @@ static void trace_note_time(struct blk_trace *bt) > unsigned long flags; > u32 words[2]; > > - /* need to check user space to see if this breaks in y2038 or y2106 */ > + /* blktrace converts this to a time_t and will overflow in > + 2106, not in 2038 */ > ktime_get_real_ts64(&now); > words[0] = (u32)now.tv_sec; > words[1] = now.tv_nsec;