From patchwork Mon Jun 20 20:00:12 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 9188681 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id B38776075E for ; Mon, 20 Jun 2016 20:05:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9FD6B27CDF for ; Mon, 20 Jun 2016 20:05:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 94A3627CF9; Mon, 20 Jun 2016 20:05:55 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2130F27CDF for ; Mon, 20 Jun 2016 20:05:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932157AbcFTUFy (ORCPT ); Mon, 20 Jun 2016 16:05:54 -0400 Received: from mout.kundenserver.de ([212.227.126.130]:51785 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932134AbcFTUFx (ORCPT ); Mon, 20 Jun 2016 16:05:53 -0400 Received: from wuerfel.lan. ([78.42.132.4]) by mrelayeu.kundenserver.de (mreue001) with ESMTPA (Nemesis) id 0Ldhgp-1bgTjP1OcN-00iy69; Mon, 20 Jun 2016 21:58:40 +0200 From: Arnd Bergmann To: Jens Axboe Cc: y2038@lists.linaro.org, Arnd Bergmann , Jeff Moyer , Steven Rostedt , Ingo Molnar , Hannes Reinecke , Mike Christie , Shaohua Li , linux-block@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] blktrace: reword comment about time overflow Date: Mon, 20 Jun 2016 22:00:12 +0200 Message-Id: <20160620200040.2813298-1-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 X-Provags-ID: V03:K0:7Cokgd1yLGmpPGwn6heXTpdqWqh2o1D90Qez6Zoia6ZnTjp812Q r/LYrHE/zmORFaV1yXfJfKHFhQvqdVOR+1Jej5cUWRGzA9Xye3tq2LlBC9rKSJeF9nqQ1+W PZKMM129kxs1In7sCIXkRPzSS/yfys4OOrGu3vua7Xjn4C/Uo1yMr4C2vwIPXAVCPvESMId Do94jhU2ev9Kfy6KEjrlg== X-UI-Out-Filterresults: notjunk:1; V01:K0:51zvFtVrfUs=:/BF7nhlb3TDGHCiACnzE3P CeN5IcTnjOFevVqwLEL7FMjPsr6838zHmu6lo7rhBMXPbxYZAOS0FWT7AuFCRr0oizVV+hp2Z T2GWTXkdZHopBzP7cy1bvsjLUg5a8957dgu2E7sMqvVe8fHzCiTIgDTmkMGe7NQVyepR6Laz0 uWZFYGuV3GILUSklwuJ6cl9nYwkjOH9A8rz5hydE2RgaQa46m13lhmk1g+LR7ZU3pfVzZ3aut iadpMn1V9PRsC6wDI25AvofvmAqguhvoGxgrgSgCskWAeB+WV2Do9Be4boJdmZ3bpcXHuLEA1 BmxxQmgP63lWFj+ILYSE0V5h/PLNSYpNj7qnRTbY9boZfmHddZoXpCjsFV7qk836m0vabNBoB tKqaBOhpIslS/YAr2mSC31ioubbatLCuSBq8IdbR2t1y0hici7xAN0S2gsPZktwouMu71zRxV /PGema9tSNu6OOTVPbPXyYYUbAKBlgWmjbM7quVTVuFDsWUkQTjfqplliEjFUshxot0p0Adn9 ThPh6DoW6eLzVkmkYhsJQMVzCCSX16B49e+95AloUCA5DHofm4E3i9jVSjJtxYhMP2pNBPjPa RUnGO8igSYRh6eFHfysO2O8MCYJBR0UIoTsaNDZcP9jCNr5iC/zQNc3DmrQbWRvrRBaQn4bn5 XDg5PoKNm0dusWLKRXAIoPBhUgVyykOkfB6/ju+yU0OE9gGkLdEJWoIiPWQqebzMHAKE= Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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;