From patchwork Wed Jul 12 15:02:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 1806842 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=ozlabs.org (client-ip=2404:9400:2221:ea00::3; helo=gandalf.ozlabs.org; envelope-from=srs0=qcw1=c6=vger.kernel.org=linux-ext4-owner@ozlabs.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=ZUnYHTDJ; dkim-atps=neutral Received: from gandalf.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4R1Lb32M9cz20bt for ; Thu, 13 Jul 2023 01:03:11 +1000 (AEST) Received: from gandalf.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) by gandalf.ozlabs.org (Postfix) with ESMTP id 4R1Lb30qMdz4wyN for ; Thu, 13 Jul 2023 01:03:11 +1000 (AEST) Received: by gandalf.ozlabs.org (Postfix) id 4R1LZy1YjMz4wyL; Thu, 13 Jul 2023 01:03:06 +1000 (AEST) Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: gandalf.ozlabs.org; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: gandalf.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=ZUnYHTDJ; dkim-atps=neutral Authentication-Results: gandalf.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=2620:137:e000::1:20; helo=out1.vger.email; envelope-from=linux-ext4-owner@vger.kernel.org; receiver=ozlabs.org) Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by gandalf.ozlabs.org (Postfix) with ESMTP id 4R1LZy1QL2z4wyK for ; Thu, 13 Jul 2023 01:03:06 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232135AbjGLPDF (ORCPT ); Wed, 12 Jul 2023 11:03:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51866 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233014AbjGLPC4 (ORCPT ); Wed, 12 Jul 2023 11:02:56 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 54C66BB; Wed, 12 Jul 2023 08:02:55 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id C049B61830; Wed, 12 Jul 2023 15:02:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 85FD7C433C9; Wed, 12 Jul 2023 15:02:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1689174174; bh=S1pegj1qL8CVQOEK2cfiVJMp8lPq/SPQs4CNL9BiRFA=; h=From:To:Cc:Subject:Date:From; b=ZUnYHTDJSUDnL5/k82eolh32DV9zKzMvnsTlBrXPu+hQeX6CHzCz+cSvhJimVipd/ FqCUvMZ7t4FjCm5M+i90mDYMzSyPXCfOPhpsu42G1Jjhy48Ou6f/ra7czYpMgvJXtC 1RjGbP19OiULk8twbfGC7tQlISlAjnQyQsDczsPFoTmCHoSjJDZu3+EWfAX8gAywxV iX6ysP8WteLer5B4u6ONjtmLfNAKMjtPoftDrlrkBzJql2XyCp5yoMEf0ONbSF+et9 w0W9XFikfyhfI5fTXKAaTSqIOuFH27WdDS7BkqGNdc5qUOufjkja7p7/dVKe9Z0p6E lGyPtK2LjX/4Q== From: Jeff Layton To: brauner@kernel.org, "Theodore Ts'o" , Andreas Dilger , Jan Kara Cc: linux-fsdevel@vger.kernel.org, linux-ext4@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] ext4: fix decoding of raw_inode timestamps Date: Wed, 12 Jul 2023 11:02:49 -0400 Message-ID: <20230712150251.163790-1-jlayton@kernel.org> X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org When we covert a timestamp from raw disk format, we need to consider it to be signed, as the value may represent a date earlier than 1970. This fixes generic/258 on ext4. Cc: Jan Kara Fixes: f2ddb05870fb ("ext4: convert to ctime accessor functions") Signed-off-by: Jeff Layton Acked-by: Theodore Ts'o --- fs/ext4/ext4.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) It might be best to just squash this fix in with the ext4 conversion in the vfs tree. diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h index d63543187359..2af347669db7 100644 --- a/fs/ext4/ext4.h +++ b/fs/ext4/ext4.h @@ -877,7 +877,7 @@ static inline __le32 ext4_encode_extra_time(struct timespec64 ts) static inline struct timespec64 ext4_decode_extra_time(__le32 base, __le32 extra) { - struct timespec64 ts = { .tv_sec = le32_to_cpu(base) }; + struct timespec64 ts = { .tv_sec = (signed)le32_to_cpu(base) }; if (unlikely(extra & cpu_to_le32(EXT4_EPOCH_MASK))) ts.tv_sec += (u64)(le32_to_cpu(extra) & EXT4_EPOCH_MASK) << 32;