Received: by 2002:a05:6358:700f:b0:131:369:b2a3 with SMTP id 15csp2551232rwo; Thu, 3 Aug 2023 11:01:58 -0700 (PDT) X-Google-Smtp-Source: APBJJlHGV8QmzCfWf9EOgCB3gHjZo8blUqaxGEiFxIyXCPTQ0wRlrvrkOQg52kwiJVXOWHjsh4/r X-Received: by 2002:a17:906:77ce:b0:994:1844:549c with SMTP id m14-20020a17090677ce00b009941844549cmr8906114ejn.0.1691085718053; Thu, 03 Aug 2023 11:01:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691085718; cv=none; d=google.com; s=arc-20160816; b=HhY4fn2XPW/q937w0rD8sy4ufwDz7THqawGfs7zbSPxxAY5BKn1OFUQoyjwCagOsaq Y5TP1zeeJAtgGrJVxDNAvtlArYpDEJ4LW4R5ied9XzDMKiv9u6vUi9gHZVE4hgNo2Sul 4z3h1TA6cNDfTrkbvBVngKEKhVGRlX/IEVo0SpyMXx2OoVkI3KCVScPv1QcinM/IM9Yp l8Nm/TzUGzDBgQQetjJkAojCxPV4wC2n3dN7DybkJIpp4wZWQVz0S4mwnuEnZku3aGaU 9I8bmfH1R0GXq0wQLJTaBvnXeMP5EzmAg2oqBuMJMCmf7zk5096HBAXKrJJo6eM0PzCB 7bnA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:message-id:in-reply-to :date:references:organization:subject:cc:to:from:dkim-signature :dkim-signature; bh=nUrIcCgKfn8Ln+psoMSqthh4paG1THVbdii5u1kozU8=; fh=k9OfdnI6XRCzrwokjBMFiYIUilYmm8DuDW/ukbB0Pgc=; b=LjIUq7rUEaB7VNaCbheXrcMvlUs4+G1mAZ5lwGaG8npsC7XQJQBsn9cVf0bzEzul9o TjhlNuHH3YCrVyDoyzunBMFl+URPv3YlClWasELU3ZQ9E8LR31LthaDSXJ2bIIatITuU u55r+WTWA8pN1iL9ZYfDx68YABIkNjFAwRcGGnYikIFQHoKYoeY+ZzPNdUkF8BMu1f6p oxonhipsVdClkymFV3Vkz9tIPHzH5GkoisuuNJqmkgQFFD4KUaiqB5FzNw806e/1dbM3 jCYVVoOPieilIY1xBOLwIEc9yBBtuphv0owGsfmotX/E1RYuyJQpiURsuaS0DXrEh8op ZBsg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b="OGxF/Y/o"; dkim=neutral (no key) header.i=@suse.de; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id kq20-20020a170906abd400b009888e599645si198749ejb.771.2023.08.03.11.01.24; Thu, 03 Aug 2023 11:01:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b="OGxF/Y/o"; dkim=neutral (no key) header.i=@suse.de; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235101AbjHCRh5 (ORCPT + 99 others); Thu, 3 Aug 2023 13:37:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50034 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235117AbjHCRhv (ORCPT ); Thu, 3 Aug 2023 13:37:51 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E552F10B; Thu, 3 Aug 2023 10:37:48 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 9BDF3218EB; Thu, 3 Aug 2023 17:37:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1691084267; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=nUrIcCgKfn8Ln+psoMSqthh4paG1THVbdii5u1kozU8=; b=OGxF/Y/oYJ1fU84+6F/RoPLLg35d4x0oZCxn7NJYfsPYaWyvnRyXHf4DpYhnHIw3AkH3PX BJZstYEbB8LUqRjqLjnTpX/TyqqePgq5GT48C61y8Lb4rZ9K2dtS1h0Smt0EYdOu76tQNZ CvchZify8FuYF5UYOBMlpefOsxln22g= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1691084267; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=nUrIcCgKfn8Ln+psoMSqthh4paG1THVbdii5u1kozU8=; b=ho8JvdBvLvswROYHxKBwf9LRoHGI9RbaY2o/N43xAICwJABGHb/t2edJT1Nkm29HchCy3L qOnMv5JMwYiyM3CQ== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 5DDA3134B0; Thu, 3 Aug 2023 17:37:47 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id CX3WEOvly2R3fQAAMHmgww (envelope-from ); Thu, 03 Aug 2023 17:37:47 +0000 From: Gabriel Krisman Bertazi To: Eric Biggers Cc: viro@zeniv.linux.org.uk, brauner@kernel.org, tytso@mit.edu, jaegeuk@kernel.org, linux-fsdevel@vger.kernel.org, linux-ext4@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, Gabriel Krisman Bertazi Subject: Re: [PATCH v4 3/7] libfs: Validate negative dentries in case-insensitive directories Organization: SUSE References: <20230727172843.20542-1-krisman@suse.de> <20230727172843.20542-4-krisman@suse.de> <20230729042048.GB4171@sol.localdomain> Date: Thu, 03 Aug 2023 13:37:45 -0400 In-Reply-To: <20230729042048.GB4171@sol.localdomain> (Eric Biggers's message of "Fri, 28 Jul 2023 21:20:48 -0700") Message-ID: <875y5w10ye.fsf@suse.de> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, 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 Eric Biggers writes: > On Thu, Jul 27, 2023 at 01:28:39PM -0400, Gabriel Krisman Bertazi wrote: >> - In __lookup_slow, either the parent inode is read locked by the >> caller (lookup_slow), or it is called with no flags (lookup_one*). >> The read lock suffices to prevent ->d_name modifications, with the >> exception of one case: __d_unalias, will call __d_move to fix a >> directory accessible from multiple dentries, which effectively swaps >> ->d_name while holding only the shared read lock. This happens >> through this flow: >> >> lookup_slow() //LOOKUP_CREATE >> d_lookup() >> ->d_lookup() >> d_splice_alias() >> __d_unalias() >> __d_move() >> >> Nevertheless, this case is not a problem because negative dentries >> are not allowed to be moved with __d_move. > > Isn't it possible for a negative dentry to become a positive one concurrently? Do you mean d_splice_alias racing with a dentry instantiation and __d_move being called on a negative dentry that is turning positive? It is not possible for __d_move to be called with a negative dentry for d_splice_alias, since the inode->i_lock is locked during __d_find_alias, so it can't race with __d_instantiate or d_add. Then, __d_find_alias can't find negative dentries in the first place, so we either have a positive dentry, in which case __d_move is fine with regard to d_revalidate_name, or we don't have any aliases and don't call __d_move. Can you clarify what problem you see here? -- Gabriel Krisman Bertazi