Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp544739imu; Wed, 23 Jan 2019 01:02:27 -0800 (PST) X-Google-Smtp-Source: ALg8bN6skmBKIcUjPPjKTKRyei0cuS3JS0cs30k/ZKP76vdM7RFHPqIxuGvIW50BnH7o9daJmQgZ X-Received: by 2002:a63:2f07:: with SMTP id v7mr1192467pgv.368.1548234147341; Wed, 23 Jan 2019 01:02:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548234147; cv=none; d=google.com; s=arc-20160816; b=gLlbmzzJwtTUU3GDWO8axx/m22mdqoDFRW1t7vKzB72rBhhPkrX8SbL2KnIFHrtGo/ cC/DA5w6l8jPk6a4bONMUgyZ/NyZcrs8+fHh7J/PGtVveNCEeNJwcdXG8Scw05CdDvN2 DwM6sfCS8bldPaXQRpIk+WLuyLMZ2paGF7czLj2vHiOZvM46hOYhfXinntf2PKyJqzDP POB+RCAgJTZWsldyR0Eyiv0hOXqnIFZXkM6MbmA7nJvkY/skzDc17uvtYZsVo+WOeMoF Rq7h5H4tI/Ri7TdQRDtAiUmIWu3uclVjMmy3jvs1TUQMJQB19OUQ0CHOTj6699CbkTeq VmKg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=3tA3rziNPjkAS1rX9qQlKzLRyhNYQgTQpTyIn8AHL6Q=; b=PnP4AGTlUzNX61tV+zN1i4rFIoT1rbmwz7gLq9SP9RiQzjhtBnoWwvTcBI9yXYuxoS a8jMeRtol7CcqoW7m1dLwj8wh0FPu2u6Kqkv9K16FqJnJjw1lodHSYDfs41PQ//46udC y4THnuCYCQk9BXtafRlkzPUO4I/O1I/S5gQ+dE8hu1Wq3X3aYWH9lveTq58qasSjnDWZ sJFY5wPvKNtbk5Ma5ST81jK8lYyJ4gm4OBCNMYQKQoVFgQJ1iMlVeORFR96FpUUeWTrC Ma3sM+U2aFpCCv0aWsP3BVTQA7ywdU2jMWhvhW3wPsd1Nkbe9j1DU22i8bl0US/DyJRe IDJQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c17si18190961pfb.81.2019.01.23.01.02.11; Wed, 23 Jan 2019 01:02:27 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727152AbfAWJAc (ORCPT + 99 others); Wed, 23 Jan 2019 04:00:32 -0500 Received: from szxga06-in.huawei.com ([45.249.212.32]:57172 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726317AbfAWJAc (ORCPT ); Wed, 23 Jan 2019 04:00:32 -0500 Received: from DGGEMS410-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 3E9969E960ACFDC917AB; Wed, 23 Jan 2019 17:00:30 +0800 (CST) Received: from [127.0.0.1] (10.184.213.217) by DGGEMS410-HUB.china.huawei.com (10.3.19.210) with Microsoft SMTP Server id 14.3.408.0; Wed, 23 Jan 2019 17:00:24 +0800 Subject: Re: [PATCH] squashfs: fix mtime underflow on 64 bit system To: , CC: , References: <20190117082148.129347-1-zhengbin13@huawei.com> From: "zhengbin (A)" Message-ID: <8b7bd95a-ff67-6e8d-8dc0-6a758e25c811@huawei.com> Date: Wed, 23 Jan 2019 17:00:23 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.3.0 MIME-Version: 1.0 In-Reply-To: <20190117082148.129347-1-zhengbin13@huawei.com> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.184.213.217] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Ping? On 2019/1/17 16:21, zhengbin wrote: > If we change the file mtime to 1969, mksquashfs and mount, > the atime/mtime of this file will be underflow. The reason is > treating timestamps with the high bit set as positive > times(before 1970), which should be set as negative times > just like on 32 bit system. After this, the poissble range > of timestamps will be 1901-2038(prev is 1970-2106) on 64 > bit system. > > Signed-off-by: zhengbin > --- > fs/squashfs/inode.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/fs/squashfs/inode.c b/fs/squashfs/inode.c > index e9793b1e49a5..03a6ef77a2d2 100644 > --- a/fs/squashfs/inode.c > +++ b/fs/squashfs/inode.c > @@ -72,7 +72,7 @@ static int squashfs_new_inode(struct super_block *sb, struct inode *inode, > i_uid_write(inode, i_uid); > i_gid_write(inode, i_gid); > inode->i_ino = le32_to_cpu(sqsh_ino->inode_number); > - inode->i_mtime.tv_sec = le32_to_cpu(sqsh_ino->mtime); > + inode->i_mtime.tv_sec = (signed int)le32_to_cpu(sqsh_ino->mtime); > inode->i_atime.tv_sec = inode->i_mtime.tv_sec; > inode->i_ctime.tv_sec = inode->i_mtime.tv_sec; > inode->i_mode = le16_to_cpu(sqsh_ino->mode); > -- > 2.16.2.dirty > > > . >