From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796454229; b=I5iIR1coYLdg2kzOz31ScWCny3kmo+nO08OQfhuUR4/mFzAJ1yqeBV03AKmh5zauCjbI 76bHKyH0BdNSrciAMCYDPfPJ+/NvPQfcsGF0UWG640WHpaq9GxPrFSIFXH8QJ93Xx5osI mNUTwt9fsVTvO/0qUPGMvmROfuaqGuoOcB6EbpOOo+NfdG687Xvpnykk0QQTjy2KO9N9d 2uoaUIRalLUMuWsBggWBisLhXE6px5tQajDbaN7XXvZvW47V0RNfkB98uQlLssuGYlA30 l0KOgTH3GNZqJbVbg+IJFsLd463VzfVHYS7Mh/+EZ8WeL6nyWfF5ZQLKelx/q2PDPxg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796454229; h=Received:DKIM-Signature:Date:From:To:Cc:Subject:Message-ID: References:MIME-Version:Content-Type:Content-Disposition: Content-Transfer-Encoding:In-Reply-To; bh=bt2BQjAHhgfpanZbcs9gedsygYvxW/dgHW0G4aAhO+E=; b=BaluhJbI5NfrRg8f81d58n+MXOGxgE8BlLiEGBeBuGBkKJlA0FUpXxkJtnMtEethOEy1 DnLozyFYSKNzNAYiKhleykjisYCn8zGnSz0v6aRsLikZV4Gei4F0dhOkH8lDCw9w6TqvE chDBV41GDv7hJ5PVLUkjr1g+pfVDqmN+ZAlYNC4qyihHBXr7QqjzEKw7jPBf/pJ9OQTyB txqdLbGctZy6KfE0Kmka5S5+6uo7LO0QzBt5IdIvD2EhW6VXnmR/w3OFoKhpCFbVuFg3t rFxCSElmlNSSQFIZUzh0aXmxrssH5qwaKEYXQtGLthXRde3BwLy7OpU3xPTwcIaDoXA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b="Nk/i4EKl"; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 136DB606A322; Sat, 5 Dec 2026 07:03:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=Nk/i4EKl Received: by smtp.kernel.org (Postfix) with ESMTPSA id 45A971F0092B; Sat, 5 Dec 2026 07:03:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796454228; bh=bt2BQjAHhgfpanZbcs9gedsygYvxW/dgHW0G4aAhO+E=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=Nk/i4EKlXrDUdhA862jlN4LDIsSkic53TU0zKr74LiKnPLP4rrj7Qa+iizRXaRaKA 59sTX8y/FafFFt3GHqmUG+3RZBDHxyBXyrFhtGFGKg3C7JY/N4gGcNPMOK2ZQrS6d2 54TQIJR5idAJgE9UCoAw1m36EoMsRWeLiHuG+URKL6gfVhxWCAsS7M2707Tp0+ki20 d19Gy/b7QyPJBsiRxNNKri4ljkwsEOTkfrnsVJfhpromt96j2IW2216vXLDhoJ2d7H Pzx6KOcOO1oRA3Wu+iRZuR8UaF0i6SvFXYZartYShP9qTLFn4lsrQ++n92as6+5lS7 kSf6XAPdgzkQw== Date: Sat, 5 Dec 2026 08:03:42 +0100 From: Carlos Maiolino To: Zheng Shuhao Cc: hch@infradead.org, linux-xfs@vger.kernel.org, linux-kernel@vger.kernel.org, djwong@kernel.org, hemanth.selam@gmail.com, shinsj4653@gmail.com, syzbot+e7f24354da9f7915bc54@syzkaller.appspotmail.com Subject: Re: [PATCH v3] xfs: fix slab-use-after-free in xrep_newbt_free() Message-ID: References: <179630412330.565.9260762935217160800@gmail.com> <179644866020.268.4885883217145755379@gmail.com> X-Mailing-List: linux-xfs@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <179644866020.268.4885883217145755379@gmail.com> On Sat, Dec 05, 2026 at 01:31:00PM +0800, Zheng Shuhao wrote: > > The email format is a bit odd. It obviously is a reply continuing > > the previous discussion, but it breaks threading and adds a new subject. > > I was told that new versions of a patch should be posted in a new thread to avoid mess. Sorry :) This is not related to what Christoph is saying. You've got things upside down. Your "patch" obviously contains a reply to another thread, it is not an expected format. Whatever MUA you use, look at how it ends up being viewed: https://lore.kernel.org/linux-xfs/179644866020.268.4885883217145755379@gmail.com/T/#t To quote a small piece of your patch: " On Wed, Dec 2, 2026 at 07:28:34AM +0000, Christoph Hellwig wrote: > Using the control flow instead of global state is usually preferable. > I.e. check which path can free the autoreap information and treat them " ^ This is obvious a reply which very likely should not be in the commit message. This has nothing to do with sending new patch versions as individual threads. Whatever you did, you got the tooling wrong. Not sending patches in the same thread basically means using git-send-email without filling the In-Reply-To fields. If you're having trouble with the tooling I'm happy to help, but it has nothing to do what I told you, i.e. to not send patch versions in reply to old versions. > > > So xfs_alloc_commit_autoreap won't have any effect and we can just > > remove it entirely. > > I've gone through the code carefully.It seems that removing this call in > junkit really doesn't seem to have any noticeable side effects overall... > > If the filesystem is already shut down, the remaining deferred items stay > attached to the transaction until the repair unwinds and the transaction is > canceled. If an EFI was already committed without an EFD, log recovery will > handle it. > > If xfs_defer_finish_noroll() fails, it cancels the paused items before > returning, so the autoreap pointer can already be stale and must not be > unpaused. If the final transaction roll fails after xfs_defer_finish_noroll() > succeeds, the paused items remain attached to the new transaction; teardown > cancels them regardless of whether they are paused. In the successful case, > the reservations have already been removed from the list before execution > falls through to junkit, so its cleanup loop has no autoreap items to unpause. > > I also found another route to junkit: xrep_newbt_free_extent() can return an > error. The reservation that returned the error has already been removed from > the list; any remaining deferred items are canceled when the transaction is > torn down. > > I also ran some tests after removing this call. It looks like it hasn't > introduced any obvious problems, and the results are consistent with the > baseline. I reran the ten tests that had failed in the previous run using > fresh disk overlays and a fresh log device. xfs/310 passed after enabling > CONFIG_DM_SNAPSHOT and CONFIG_DM_DELAY. The other nine failures were also > present in the baseline and list-empty results: four network-dependent generic > tests, generic/794's EOF-gap mismatch, three xfsprogs manpage-output > mismatches, and the same reproducible-image mismatch in xfs/841. There were > no unexpected writeback or no-space errors. > > The focused reproducer also completed without a KASAN/use-after-free report, > and xfs_repair -n exited successfully. The trace recorded one defer-finish > error and one transaction-roll error. This was a rerun of the ten failed > tests, not a new full -g auto run. > > But is it appropriate to do so? It does change the original semantics to some degree — is this the kind of change I shouldn't be the one submitting?