Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1823633imm; Tue, 10 Jul 2018 08:27:49 -0700 (PDT) X-Google-Smtp-Source: AAOMgper0w012/RgIWmxZTmpTEFTCYoyP8DutrYtDZYFJdgxIqgMaUav9gEGnLkLbjQi2/MNL6Vn X-Received: by 2002:a17:902:b08a:: with SMTP id p10-v6mr25772376plr.0.1531236469916; Tue, 10 Jul 2018 08:27:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531236469; cv=none; d=google.com; s=arc-20160816; b=nk6YQNC6z1xFdbd6HSMFBVVAoC8oOQXndbMvHtBGS11zkT8FVRDrDQD0bOpyhx8kxF goxrZt3P2Y6HT9v5vtdDSNPMTT3aBXOpIlvcdeY2PwwFGJ4fS0bMbt5XPGh7aMElYC2B l7VTHhMLBEUsycXroXoAwMF2omtaVezEkyktYwKZV/G2+cpWwfp3Bg6R5gMHqt6dPj4n djAF9CA4A0Ypz8Yx+86ehyaKN3WFvWDC9MINuaBTpaF93HUMLRE2V/GVdfy1qmMUKLNi PYBzZTgYH6wz36WzKEpRpxOML0nCqiy31QpvWIFVPQ+Y3d6MW9KFpgixjcmaYyXYd0cE hzBQ== 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:cc:to:subject :message-id:date:from:references:in-reply-to:mime-version :dkim-signature:arc-authentication-results; bh=MsyxdTDW+5YCxjUrZ4Rdza7bf/aLTFz9sI/59pjfE7Q=; b=tuA5Ph5ma0rONdCBSdSmjh6SNnDXlUcoxQnGqbpDFx7kU8AU3wWuamJNKSGUbroo9v mjQkvYb591/nBft3kyL8POSs53XZEJp0mnXNsnMF4McDkXuxWwlP8kpyu7UKQw5k5Bqi eHodAYHu3/zKuQA53xlFLgHrnTdc1HqohNYYcVHGcaqBE40YuJcmLWSD8NPRbMMhULgn /I1lPdQixlfjW7hobNGkYcWZ3Os6mdlU0kIZAJtj5g2nmg0cKB9ImNnhQOyInvrd44Vx ILJde2BJ4NTyLJa0CmoIOzmk9QEJnw5D2OZyFZHeo3iFhiY5mm3Q9DBEWhQ804+WcxXM xCKQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=OmqXXKRp; 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 97-v6si16774877plm.444.2018.07.10.08.27.34; Tue, 10 Jul 2018 08:27:49 -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=OmqXXKRp; 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 S934137AbeGJP0M (ORCPT + 99 others); Tue, 10 Jul 2018 11:26:12 -0400 Received: from mail-lj1-f195.google.com ([209.85.208.195]:33481 "EHLO mail-lj1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933374AbeGJP0K (ORCPT ); Tue, 10 Jul 2018 11:26:10 -0400 Received: by mail-lj1-f195.google.com with SMTP id t21-v6so17052445lji.0; Tue, 10 Jul 2018 08:26:09 -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:content-transfer-encoding; bh=MsyxdTDW+5YCxjUrZ4Rdza7bf/aLTFz9sI/59pjfE7Q=; b=OmqXXKRpuGVYEIfffVA770yKy77qhnDhpqAOzbcqei4usj+ENmX7teGdZ5gJmGlEMX XDB3aRDH4IDSGQvOaJoOm5LE++1uOVRNafswZ5P6cD8mwO/ppvfg2r8+6wHLnpduGpOA /KeTEvvrn40TfP9B5s4pYRuWvWwX3Tg7UerTF0ILnr7l3niRThywtgAfFMOz2JM5B7A0 SHnRz9l6zF/8XS+eYUSwu6bHbbBxn+lwu6L1q8pW6E6EN5YO7Ag/PEFuMpAz0KPIFrFv CP/lYJ5HoBmOUbqbVVsAtiH4AaYPplAV1EDxZ6l9gn9qSoUN/rJJYu9pq2Fh7BqoiGMD fIng== 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:content-transfer-encoding; bh=MsyxdTDW+5YCxjUrZ4Rdza7bf/aLTFz9sI/59pjfE7Q=; b=uRy1whPI4zZrHPgie909081kJbF8q+qer6J3TI/MaOeEh4uKGiJKjaDdkmO9svZ5Iu +uVJcp7mAgBOkNmWlclBseBIwPpnyNCltbYywwavNpXEiGYildvCiVJjblzbNHJiAfxw 7wtZRJRslcuj97Z4zvtIQtXJtUxS6eOskbG7LZa7lGSkf8gGw1frpkhSr/6JXLiTjZWh hFmJszHmhPzqTsXOGWwBUn5lDefZyjELqzb0mHux1Bf6ifVPzzLki9xi5evcjyq/svkR D97IU/pyPE0LI2UzlFM1nTvywWDFeW62Jdcn/dseBJe9M2eheFccDqtJx+XRTtwrh1mN BxRA== X-Gm-Message-State: APt69E30ZY9hpBM0Wu84ZV8/cNWlif2bs2PZjlDgcaDedTcnxD0O588S OM5GTGz3uqANPUzIVflgDccnkC2ew7Nr6xxttzY= X-Received: by 2002:a2e:1207:: with SMTP id t7-v6mr16050253lje.129.1531236368514; Tue, 10 Jul 2018 08:26:08 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a2e:41c1:0:0:0:0:0 with HTTP; Tue, 10 Jul 2018 08:26:07 -0700 (PDT) In-Reply-To: <20180623060052.ufrlbybeys2xxt5l@eaf> References: <20180622141758.229589-1-arnd@arndb.de> <20180623060052.ufrlbybeys2xxt5l@eaf> From: Arnd Bergmann Date: Tue, 10 Jul 2018 17:26:07 +0200 X-Google-Sender-Auth: jg4Txwk_AUom30vJMlVEOafv2RM Message-ID: Subject: Re: [PATCH] hfs/hfsplus: use documented official timestamp range To: =?UTF-8?Q?Ernesto_A=2E_Fern=C3=A1ndez?= Cc: Vyacheslav Dubeyko , y2038 Mailman List , "# 3.4.x" , Linux FS-devel Mailing List , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Jun 23, 2018 at 8:00 AM, Ernesto A. Fern=C3=A1ndez wrote: > On Fri, Jun 22, 2018 at 04:17:32PM +0200, Arnd Bergmann wrote: >> According to the official documentation for HFS+ [1], inode timestamps >> are supposed to cover the time range from 1904 to 2040 as originally >> used in classic MacOS. >> >> The traditional Linux usage is to convert the timestamps into an unsigne= d >> 32-bit number based on the Unix epoch and from there to a time_t. On >> 32-bit systems, that wraps the time from 2038 to 1902, so the last >> two years of the valid time range become garbled. On 64-bit systems, >> all times before 1970 get turned into timestamps between 2038 and 2106, >> which is more convenient but also different from the documented behavior= . >> >> The same behavior is used in Darwin and presumaby all versions of MacOS = X, >> as seen in the to_hfs_time() function in [2]. It is unclear whether this >> is a bug in the file system code, or intentional but undocumented behavi= or. > > But the to_bsd_time() function considers wrapped timestamps as invalid, > doesn't it? So it seems they simply don't care about the post-2040 (or > pre-1970) case? Sorry for the late reply. Just got back to looking at what remains for the file systems. You are of course right, my mistake: Apple writes a wrapped date when converting from bsd time to on-disk format, but does treat the wrapped dates as invalid when reading >> diff --git a/fs/hfsplus/hfsplus_fs.h b/fs/hfsplus/hfsplus_fs.h >> index d9255abafb81..57838ef4dcdc 100644 >> --- a/fs/hfsplus/hfsplus_fs.h >> +++ b/fs/hfsplus/hfsplus_fs.h >> @@ -530,8 +530,9 @@ int hfsplus_submit_bio(struct super_block *sb, secto= r_t sector, void *buf, >> void **data, int op, int op_flags); >> int hfsplus_read_wrapper(struct super_block *sb); >> >> -/* time macros */ >> -#define __hfsp_mt2ut(t) (be32_to_cpu(t) - 2082844800U) >> +/* time macros: convert between 1904-2040 and 1970-2106 range, >> + * pre-1970 timestamps are interpreted as post-2038 times after wrap-ar= ound */ > > This comment seems to be from the original series, maybe you forgot to > change it? Correct. I'll change it and resend it with a fixed changelog. Arnd