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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 442C3C41513 for ; Mon, 14 Aug 2023 19:24:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231987AbjHNTYN (ORCPT ); Mon, 14 Aug 2023 15:24:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45076 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232208AbjHNTYK (ORCPT ); Mon, 14 Aug 2023 15:24:10 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ACE659C; Mon, 14 Aug 2023 12:24:09 -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 34AD9640B6; Mon, 14 Aug 2023 19:24:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6BD7FC433C7; Mon, 14 Aug 2023 19:24:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1692041048; bh=o3Hr6U8ctryPOyOYt2lVWBvOEWrDutJ89GR/VnTpMVY=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=OesZRZ9PiKG3L4wcz5xDW1Lc17kKT6aeN3dnVAkSQhARhNhfBUyE0oYpJ/gUTaoOq 7JilTzw3/wuSlhdNjZBUa7rI+S4+p9MlFG/CiqXRp+AdBfPoe39cdJgls4yIpHxclK /OusVTJntyl8hB6HdZ0ao55bHLfQxMDfEcpH3Uiur2RirmnspkqQCNB87xR7WEoGWd OiHNr/1tNgHnwuczie1P8jvYZbbOAD9Va9fEChQCNma4Ho7ZoPB77zg3eqekSRThuO LQQtnT2DedPomEAg2K8Ig14ntksk+q6IVdLYsdYu4tv8gu2+Ro9loD+cNtfH5QJz7f rgQ7sXM/R7TwQ== Date: Mon, 14 Aug 2023 12:24:06 -0700 From: Eric Biggers To: Gabriel Krisman Bertazi Cc: linux-ext4@vger.kernel.org, Theodore Ts'o , linux-fsdevel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net Subject: Re: [PATCH 1/3] ext4: reject casefold inode flag without casefold feature Message-ID: <20230814192406.GD1171@sol.localdomain> References: <20230814182903.37267-1-ebiggers@kernel.org> <20230814182903.37267-2-ebiggers@kernel.org> <87jztx5tle.fsf@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87jztx5tle.fsf@suse.de> Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On Mon, Aug 14, 2023 at 03:09:33PM -0400, Gabriel Krisman Bertazi wrote: > Eric Biggers writes: > > > From: Eric Biggers > > > > It is invalid for the casefold inode flag to be set without the casefold > > superblock feature flag also being set. e2fsck already considers this > > case to be invalid and handles it by offering to clear the casefold flag > > on the inode. __ext4_iget() also already considered this to be invalid, > > sort of, but it only got so far as logging an error message; it didn't > > actually reject the inode. Make it reject the inode so that other code > > doesn't have to handle this case. This matches what f2fs does. > > > > Note: we could check 's_encoding != NULL' instead of > > ext4_has_feature_casefold(). This would make the check robust against > > the casefold feature being enabled by userspace writing to the page > > cache of the mounted block device. However, it's unsolvable in general > > for filesystems to be robust against concurrent writes to the page cache > > of the mounted block device. Though this very particular scenario > > involving the casefold feature is solvable, we should not pretend that > > we can support this model, so let's just check the casefold feature. > > tune2fs already forbids enabling casefold on a mounted filesystem. > > just because we can't fix the general issue for the entire filesystem > doesn't mean this case *must not* ever be addressed. What is the > advantage of making the code less robust against the syzbot code? Just > check sb->s_encoding and be safe later knowing the unicode map is > available. > Just to make sure, it sounds like you agree that the late checks of ->s_encoding are not needed and only __ext4_iget() should handle it, right? That simplifies the code so it is obviously beneficial if we can do it. As for whether __ext4_iget() should check the casefold feature or ->s_encoding, we should simply go with the one that makes the code clearer, as per what I've said. I think it's casefold, but it could be ->s_encoding if others prefer. - Eric 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 Received: from lists.sourceforge.net (lists.sourceforge.net [216.105.38.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 51972C04A94 for ; Mon, 14 Aug 2023 19:24:19 +0000 (UTC) Received: from [127.0.0.1] (helo=sfs-ml-4.v29.lw.sourceforge.com) by sfs-ml-4.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1qVdAo-00009k-2C; Mon, 14 Aug 2023 19:24:18 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-4.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1qVdAk-00009c-Uo for linux-f2fs-devel@lists.sourceforge.net; Mon, 14 Aug 2023 19:24:15 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=In-Reply-To:Content-Type:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=Wr0jlOrbqQZ4Ja8r3hNSjj2Kw1StEQwdvxiB/7DzNag=; b=RrhYXq4CIIIS0R6jnhyislIVw9 1HjX/fyZYSE7lvtpUkciwd9fAeJevlK+mZy9p2ZChqNSbTKFpl4kYL7xmmMszFnkzWHW/o28gmwLY T3Vum1RHJJsddVis19Fh3knFfvxsx0T93K3DzFTeso/ALZ4tVbbhzOBidDl5yyNLMcs4=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=In-Reply-To:Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To :From:Date:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=Wr0jlOrbqQZ4Ja8r3hNSjj2Kw1StEQwdvxiB/7DzNag=; b=g8GE9Hemdmmw68sIwyhCT7oCi2 b/XYhSo82fNR9pDcMkDfcAX+ZGcUVQtLiw69Jmw1w+LLP4ybhIu9CABHKPn6f8SxAcw9zdfDeE9f/ xYkRd6OzHzOL90SKInnjPqDEJlETvsV/BnRKmwyGqPsB7JkVlajSBZzr4cvEaM2vkbRY=; Received: from dfw.source.kernel.org ([139.178.84.217]) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1qVdAk-0005Kj-Ot for linux-f2fs-devel@lists.sourceforge.net; Mon, 14 Aug 2023 19:24:15 +0000 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 2B90762C15; Mon, 14 Aug 2023 19:24:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6BD7FC433C7; Mon, 14 Aug 2023 19:24:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1692041048; bh=o3Hr6U8ctryPOyOYt2lVWBvOEWrDutJ89GR/VnTpMVY=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=OesZRZ9PiKG3L4wcz5xDW1Lc17kKT6aeN3dnVAkSQhARhNhfBUyE0oYpJ/gUTaoOq 7JilTzw3/wuSlhdNjZBUa7rI+S4+p9MlFG/CiqXRp+AdBfPoe39cdJgls4yIpHxclK /OusVTJntyl8hB6HdZ0ao55bHLfQxMDfEcpH3Uiur2RirmnspkqQCNB87xR7WEoGWd OiHNr/1tNgHnwuczie1P8jvYZbbOAD9Va9fEChQCNma4Ho7ZoPB77zg3eqekSRThuO LQQtnT2DedPomEAg2K8Ig14ntksk+q6IVdLYsdYu4tv8gu2+Ro9loD+cNtfH5QJz7f rgQ7sXM/R7TwQ== Date: Mon, 14 Aug 2023 12:24:06 -0700 From: Eric Biggers To: Gabriel Krisman Bertazi Message-ID: <20230814192406.GD1171@sol.localdomain> References: <20230814182903.37267-1-ebiggers@kernel.org> <20230814182903.37267-2-ebiggers@kernel.org> <87jztx5tle.fsf@suse.de> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <87jztx5tle.fsf@suse.de> X-Headers-End: 1qVdAk-0005Kj-Ot Subject: Re: [f2fs-dev] [PATCH 1/3] ext4: reject casefold inode flag without casefold feature X-BeenThere: linux-f2fs-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-fsdevel@vger.kernel.org, linux-ext4@vger.kernel.org, Theodore Ts'o , linux-f2fs-devel@lists.sourceforge.net Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: linux-f2fs-devel-bounces@lists.sourceforge.net On Mon, Aug 14, 2023 at 03:09:33PM -0400, Gabriel Krisman Bertazi wrote: > Eric Biggers writes: > > > From: Eric Biggers > > > > It is invalid for the casefold inode flag to be set without the casefold > > superblock feature flag also being set. e2fsck already considers this > > case to be invalid and handles it by offering to clear the casefold flag > > on the inode. __ext4_iget() also already considered this to be invalid, > > sort of, but it only got so far as logging an error message; it didn't > > actually reject the inode. Make it reject the inode so that other code > > doesn't have to handle this case. This matches what f2fs does. > > > > Note: we could check 's_encoding != NULL' instead of > > ext4_has_feature_casefold(). This would make the check robust against > > the casefold feature being enabled by userspace writing to the page > > cache of the mounted block device. However, it's unsolvable in general > > for filesystems to be robust against concurrent writes to the page cache > > of the mounted block device. Though this very particular scenario > > involving the casefold feature is solvable, we should not pretend that > > we can support this model, so let's just check the casefold feature. > > tune2fs already forbids enabling casefold on a mounted filesystem. > > just because we can't fix the general issue for the entire filesystem > doesn't mean this case *must not* ever be addressed. What is the > advantage of making the code less robust against the syzbot code? Just > check sb->s_encoding and be safe later knowing the unicode map is > available. > Just to make sure, it sounds like you agree that the late checks of ->s_encoding are not needed and only __ext4_iget() should handle it, right? That simplifies the code so it is obviously beneficial if we can do it. As for whether __ext4_iget() should check the casefold feature or ->s_encoding, we should simply go with the one that makes the code clearer, as per what I've said. I think it's casefold, but it could be ->s_encoding if others prefer. - Eric _______________________________________________ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel