From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 41AF1C433EF for ; Sun, 5 Sep 2021 11:49:46 +0000 (UTC) Received: from shelob.surriel.com (shelob.surriel.com [96.67.55.147]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id ACA9160F92 for ; Sun, 5 Sep 2021 11:49:45 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org ACA9160F92 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmx.net Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kernelnewbies.org Received: from localhost ([::1] helo=shelob.surriel.com) by shelob.surriel.com with esmtp (Exim 4.94.2) (envelope-from ) id 1mMqeS-0007s9-81; Sun, 05 Sep 2021 07:49:32 -0400 Received: from mout.gmx.net ([212.227.15.18]) by shelob.surriel.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1mMqeO-0007rk-Mj for kernelnewbies@kernelnewbies.org; Sun, 05 Sep 2021 07:49:28 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1630842566; bh=U/FqWTh1MBNJULQopyztQpV6B5cur6xc6hGAeWyflxY=; h=X-UI-Sender-Class:Date:From:To:Subject:Cc:References:In-Reply-To; b=ligcyeVLE86NB9sF/HxIudHIg/gh8jMpLmmoWaKhSiHLr6uPCcbpYuTXxijp9rHDv 2QGYJkE7jerCcTEA+EgJLp9HYdQxQ8I+51ZItlPOK0nf2XIE0S4iLXy4H9Sq5RClGo CzeXhfXM96aFKYbka3ZpPSST3pzjG0kzd1NRpePY= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from scdbackup.webframe.org ([79.222.32.79]) by mail.gmx.net (mrgmx004 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MHXFr-1m9uMh0tt3-00DWXx; Sun, 05 Sep 2021 13:49:26 +0200 Date: Sun, 05 Sep 2021 13:48:37 +0200 From: "Thomas Schmitt" To: kernelnewbies@kernelnewbies.org Subject: Re: Kernel bug tracker References: <1630836614.781283386@f753.i.mail.ru> In-Reply-To: <1630836614.781283386@f753.i.mail.ru> Message-Id: <292361858473424095@scdbackup.webframe.org> X-Provags-ID: V03:K1:jeklQc/j4FktedqZZZR2cy/E4iwFnYPuhjNDOGjwHI6iMKtRVDT jR80pgfumrJtqOnmRUNu8p3D0Z6URxpuY/3FRo1SlWE5MMY2XFa4zDQAUpwR4y8WDNC6nWv mvLrsA0PY5iqXySnHCuEkAEKnJbXd/i5rEQs+GnsCLie+BiK1mDOPbumsEUlXbeH6B8cVPw GhUkBgjbqt6l8vPXUaZug== X-UI-Out-Filterresults: notjunk:1;V03:K0:6pzjX0/3Dfs=:P9NX3KSvDf5rKA8yk6m7XW yUvduu7q4t4rpGoqmBu+GfusHfW9EQ6r8f9pALIySF4oFaymB/iIXIyl+EGErpzGVpzAopKiP dGWARdeCMVi3rgvUNHKp1zWkRoTwS+mEB7Bn2DnhxY8SbMNJyEaBUlpUodHZsRI1rP1x9UcqN j50F2+wdGj8AhzO4czSX1PaA8DsxjMJfath9lJDXWDw2tsMVFNSd+scRsdkChNVVK8fDqufbO bKocl0WZaHo6x8nhSPDd7Z1kSJrYnCERvZBbEbEo//ZdZLvfYRopVFVSAAUYKzMOih5v0QqEd SWbBcbBHxXizVxUcM++lEta6XsB/Gtwjbc/xojpTQt/1ozLkVkBJw+BVjUsZRDcaK2gdFKkIJ K/U8wvorY/M+3q2eGD0W/qts8909X/+C/GlcKmrRt14o9OQvnr0ZRuGjq/ozbsyZF/Hn1mOqx nXC/ljWmC6B9LeEIbDJb3QFFCW5KutEgLdwrqr7wtFxPMWbiowUJDNogVxA8bIqtdvJUcNeol tUu7980bgO6cwhBeNyaklwu62xkqMx4ZDZb00oAE7LRKHoyjcQpWA6Jvmbf/13Y/Wgcgm3HpA GrEm7sjZyARYx4+Jm719KKYtwgzH4bHRF5cMO6VmlwxSPXBKOd/5UBSL9iJqIVmCokHDwQGuP hl9ZrHbmgxq05E3zL+G0LA7wFDcyCSD8dwFj0YlQPP+yld36inxBGgxHXpQksnG9mB/wKj8+G q3IZCqCiw+n5rLyP1D4EX/aCyRDiaxHMMW9IKVpH30mYIMb3/ssJKyRKBgzCUnqcAG0L4Psa5 TvFsoWYyAdXWl5+tDBkLWBGWiVv8jcYq2H3wJGCQpVksL3cCOQooWAFuc8N96wWr1x3+P6uP9 GeOYiYsN2YkNJ9R7Z6o7hU99f/oRAgSF9TlokMivmLh4FKO2pnDk1GpPmyVxDiaGohkUzcsAP imD9oXIxdD44LUBYs5TWs1U8OU9UYSDA7HVgUkXgTtL/2hFulLRHoq6Kgn9gjwPl9yh6WrNbn w1xw/UV2AgaXI315uxMXRAfkSqxVliuwCqwhvb2VdI+0JOrBLACo6M2cZCSl9ITETBM12qn+k F6zGB7FuFMvctZbCV0R6nEk/UuJoKLlXzVdeajj0eOnYVpBlNTciWQyWQ== Cc: ebashinskii@mail.ru X-BeenThere: kernelnewbies@kernelnewbies.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Learn about the Linux kernel List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: kernelnewbies-bounces@kernelnewbies.org Hi, Adverg Ebashinskii wrote: > If you could share your patch here to understand the problem better I would > gladly dig into it. Ok. Here is the simple one. The other comes in a separate mail. The following texts stem from git format-patch. If submitting for real, i would send them by git send-email to linux-kernel@vger.kernel.org and linux-scsi@vger.kernel.org. (The latter because Jens Axboe committed a few isofs changes in the past and because isofs is historically related to sr and cdrom.) ======================================================================== 0000-cover-letter.patch >From 154a68527351db091e5de60388ba4cfb1fe779fd Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Mon, 21 Sep 2020 18:20:14 +0200 Subject: [PATCH 0/1] isofs: prevent file time rollover after year 2038 The time values in struct inode of isofs result from calls to function iso_date() in isofs/util.c, which returns seconds in the range of signed int. This will rollover in 2038. ISO 9660 directory record timestamps are good for up to year 2155. (ECMA-119 9.1.5: 1900 + 255) The only callers of iso_date() are in isofs/inode.c and isofs/rock.c and put the result into struct inode.i_{a,c,m}time.tv_sec which is of type time64_t. The time value of iso_date() essentially stems from mktime64(). So return type time64_t is appropriate for iso_date(). -------------------------------------------------------------------------- Demonstration of the problem: Create an ISO 9660 filesystem with file date in 2040, using file /bin/true as victim payload: xorriso -outdev /tmp/test_date.iso \ -blank as_needed \ -map /bin/true /victim \ -alter_date m 'Oct 01 22:06:12 2040' /victim -- Inspect the current representation by isofs: mount /tmp/test_date.iso /mnt/iso ls -l /mnt/iso/victim This yields with int iso_date(): ... Aug 26 1904 /mnt/iso/victim After changing the type of iso_date() to time64_t: ... Oct 1 2040 /mnt/iso/victim For completeness i tested the last possible second: xorriso ... -alter_date m 'Dec 31 23:59:59 2155' /victim -- and got properly: ... Dec 31 2155 /mnt/iso/victim (When reproducing this it might be to wise to use December 30, to avoid any potential timezone problems.) -------------------------------------------------------------------------- Have a nice day :) Thomas Thomas Schmitt (1): isofs: prevent file time rollover after year 2038 fs/isofs/isofs.h | 3 ++- fs/isofs/util.c | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) -- 2.20.1 ======================================================================== 0001-isofs-prevent-file-time-rollover-after-year-2038.patch >From 154a68527351db091e5de60388ba4cfb1fe779fd Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Mon, 21 Sep 2020 18:20:06 +0200 Subject: [PATCH 1/1] isofs: prevent file time rollover after year 2038 Change the return type of function iso_date() from int to time64_t. Signed-off-by: Thomas Schmitt --- fs/isofs/isofs.h | 3 ++- fs/isofs/util.c | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/fs/isofs/isofs.h b/fs/isofs/isofs.h index 055ec6c586f7..527c0db72ff9 100644 --- a/fs/isofs/isofs.h +++ b/fs/isofs/isofs.h @@ -107,7 +107,8 @@ static inline unsigned int isonum_733(u8 *p) /* Ignore bigendian datum due to broken mastering programs */ return get_unaligned_le32(p); } -extern int iso_date(u8 *, int); + +time64_t iso_date(u8 *, int); struct inode; /* To make gcc happy */ diff --git a/fs/isofs/util.c b/fs/isofs/util.c index e88dba721661..348af786a8a4 100644 --- a/fs/isofs/util.c +++ b/fs/isofs/util.c @@ -16,10 +16,10 @@ * to GMT. Thus we should always be correct. */ -int iso_date(u8 *p, int flag) +time64_t iso_date(u8 *p, int flag) { int year, month, day, hour, minute, second, tz; - int crtime; + time64_t crtime; year = p[0]; month = p[1]; -- 2.20.1 ======================================================================== Have a nice day :) Thomas _______________________________________________ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies