Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp1172077imm; Wed, 20 Jun 2018 12:56:19 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKsDb2d5gGSosqexLh9nmokHGmuhyESJaZpQNP5PZvTCcIMOb1NAzmi5VvGqP7QWjVSWWbq X-Received: by 2002:a17:902:622:: with SMTP id 31-v6mr25012539plg.135.1529524579250; Wed, 20 Jun 2018 12:56:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529524579; cv=none; d=google.com; s=arc-20160816; b=1BKwuQHLCp+jbStoou/RAxokGyrMFgdK0Cqwmk81LlOUOPJeD9IQwye7BxMewxbtVx bXd6SFBxTfdddKTKzf9LAYfmA7E0JQvgbPJOBhw+CaJ3wRNd35eZbvNoN0ZsagaC2liF 8Lx2CegE1wPF8JVqa8JbAgewjy/oQp9aXDiaeNEWuG4hG5Pgwty7vi4ooiard5J+R2aN x1I729i0zeg5//4asVMP1DaQ8Yh4GEH8kyx7yUjAFpuTK0EKHLLosCybcTaPU2Yd9XVJ TzVAjGQkqBkzw8gnFT8Ili3N/NuL48jpwc9SqiuVaYdOlQ9vM6XmZCi7f/0ejLtvgdNV ibSg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=XvOCgmDhhrDhs4XBU1Pz7JIORVfXz8atk6MrvVDy3MU=; b=ZdgoNbG/SmeE6+oqYylEzsGdpFoCqQph9HBQjAgT8wSVop9eqgwnF1OVlCvGNs5MQ7 u3IXOHJq5zGGk9QQrSbBeW9Inr5+VQVamGIZmHG0fftV2ccuqh+v0FTED6VlJCMEw6ke gczPLvggwm99LVN8WtuYqhla5SuVy1dgWiQjVc/e7sbXDj9gGvTwDAl/HtepB5T3mYzJ gHLRA0B7RiSNzJZBs+MvbdCAsjWpohKHVYAonTn4yXsO25p2z3q/dYBRn/ndqexfhjoP cFJLFgUJG771nABJ24iXMkpDFjVpRS8B6R+9gGPcNwdB9An70p5hITz1zP4T4lrd/TtG B++A== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=BTYnUG+j; 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 w28-v6si2305868pge.329.2018.06.20.12.56.04; Wed, 20 Jun 2018 12:56:19 -0700 (PDT) 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; dkim=fail header.i=@gmail.com header.s=20161025 header.b=BTYnUG+j; 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 S932856AbeFTTz1 (ORCPT + 99 others); Wed, 20 Jun 2018 15:55:27 -0400 Received: from mail-lf0-f65.google.com ([209.85.215.65]:42050 "EHLO mail-lf0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932372AbeFTTzZ (ORCPT ); Wed, 20 Jun 2018 15:55:25 -0400 Received: by mail-lf0-f65.google.com with SMTP id z207-v6so1099996lff.9; Wed, 20 Jun 2018 12:55:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=XvOCgmDhhrDhs4XBU1Pz7JIORVfXz8atk6MrvVDy3MU=; b=BTYnUG+jG0wmbub6ln40yo+bDCf+8l90ESh5eIbnGqBi/l5/wdCmiKGA0WaIHAMqvu QYGq0a2VlyM7jclnqY4gths9CgN7slnQtmr1h0K9B4R0B0rxTczDQgOyffuZ3YxBfeMF bPFsYbp8cORlyCGJSc/0Mjd2DgIimTSgTWfC52G/LdimHsdUlg2DZcW10U11n80B/GfI jAUoKFdJqdEyYlPM05Wqg5LeyxtQ1xlNZoaj2BJx8ZsBX4J47/HTkfa2FFm7paiz3UwP sWKggXt7/yR4Pu/QEofmudIPuDZf07CEs8v3sMwVTIQCIQSB569PfxTM83P3k/ZKFueR fHcA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=XvOCgmDhhrDhs4XBU1Pz7JIORVfXz8atk6MrvVDy3MU=; b=WvLYpV1IenXzVo85CaqgBHUMNABK0pAdJvCwPVH8sr4hOWfq7vWLiKHe21aRSlhyMT dpRAlLwaAg44AkZQ6mn2voXI4ooT9lwubBOTPBTZWNN1EWSpy3/aB6EW6Fxxqq+LcZC9 JIlmlDa9/IcU0/9hLY/CNLdSrb5CviVdFYROYKZl7X9qmCC3Gl4Vk9THtn7estrNb7S3 5UauDm+LZzu5xp4Mj5HW/0Pt2ydttbiNtA3FHPhi2TLymWQJ59NCrfSgbRMXMbq2GKOi h52GYDMILRNQZO+XGIj6Qn8Inj46no67/P1vd7UKLbb3xKRHQ9u60jCMNubeW98KbOLx Sx6g== X-Gm-Message-State: APt69E1v2AM7AfjeEgkRF4+abIVnqPfSPH0pWN2ckFyarHBX7SxIzjWl 5hD63+GGCVYd+3vAMSGV3/quadLiSlC2cQ+tYkU= X-Received: by 2002:a19:d5c7:: with SMTP id m190-v6mr4169458lfg.12.1529524523477; Wed, 20 Jun 2018 12:55:23 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a2e:56c8:0:0:0:0:0 with HTTP; Wed, 20 Jun 2018 12:55:22 -0700 (PDT) In-Reply-To: <1529513708.5833.29.camel@dubeyko.com> References: <20180619160223.4108556-1-arnd@arndb.de> <1529427809.2624.16.camel@dubeyko.com> <1529513708.5833.29.camel@dubeyko.com> From: Arnd Bergmann Date: Wed, 20 Jun 2018 21:55:22 +0200 X-Google-Sender-Auth: pv7jimHlQq9WPalbInagxQnMBrk Message-ID: Subject: Re: [PATCH 1/3] hfs: stop using timespec based interfaces To: Viacheslav Dubeyko Cc: Al Viro , Andrew Morton , y2038 Mailman List , Jeff Layton , Jan Kara , Deepa Dinamani , Linux FS-devel Mailing List , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jun 20, 2018 at 6:55 PM, Viacheslav Dubeyko wrote: > On Tue, 2018-06-19 at 21:42 +0200, Arnd Bergmann wrote: >> On Tue, Jun 19, 2018 at 7:03 PM, Viacheslav Dubeyko wrote: >> We never followed that interpretation in Linux though. As I wrote, >> on 64-bit machines, these two calculations (hfs and hfs+, >> respectively) >> >> #define __hfs_m_to_utime(sec) (be32_to_cpu(sec) - 2082844800U + >> sys_tz.tz_minuteswest * 60) >> #define __hfsp_mt2ut(t) (be32_to_cpu(t) - 2082844800U) >> >> just wrap around when reading the timestamps before 1970 from >> disk. On 32-bit machines they get wrapped another time when >> we assign them to a signed 32-bit time_t. >> > > The whole patchset looks reasonable for me. I simply guess what the > correct behaviour of HFS/HFS+ file system driver could look like for > the case of achieving 2040 year. So, maybe the good way could be to > mount in the READ-ONLY mode. What do you think? We've discussed doing that in VFS before, this is something we need to revisit, but I'd like to do it in common code rather than in every file system with a particular limit. Deepa has a patch set to introduce minimum/maximum timestamps in the superblock for this. We definitely want to use that for limiting the range of utimensat() arguments from user space, and the idea we had discussed in the past was to have a way to enforce read-only mounting of file systems that cannot write current i_mtime values past a certain (user-defined) future date. We actually need something like that soon, as there are some organizations that want to support super-long service lifetimes for Linux systems (e.g. cars, industrial machines, ...) and want an early-fail behavior to ensure that everything that works today can in principle keep working for the foreseeable future, while everything that is known to break can be forced to break already. This is clearly not a priority for HFS in particular, but there is no reason for HFS to be different from ext3 here, which has a similar problem (timestamps are defined to range from 1902 to 2038). >> /* time macros: convert between 1904-2040 and 1970-2106 range, >> * pre-1970 timestamps are interpreted as post-2038 times after >> wrap-around */ >> -#define __hfsp_mt2ut(t) (be32_to_cpu(t) - >> 2082844800U) >> +#define __hfsp_mt2ut(t) ((time64_t)be32_to_cpu(t) - >> 2082844800U) >> #define __hfsp_ut2mt(t) (cpu_to_be32(t + >> 2082844800U)) >> >> /* compatibility */ >> >> I can submit that separately so that it can get backported into >> stable kernels if you like, with the type changes as a follow-up >> on top. >> > > Sounds good. Ok, I'll send an updated version with that patch first then. Arnd