From patchwork Tue Nov 26 15:54:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chuck Lever X-Patchwork-Id: 13886132 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7C844D3B9B5 for ; Tue, 26 Nov 2024 15:54:57 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B68B56B0082; Tue, 26 Nov 2024 10:54:56 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id B17A16B0083; Tue, 26 Nov 2024 10:54:56 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9DF046B0085; Tue, 26 Nov 2024 10:54:56 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 802E96B0082 for ; Tue, 26 Nov 2024 10:54:56 -0500 (EST) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 0E3B41C7121 for ; Tue, 26 Nov 2024 15:54:56 +0000 (UTC) X-FDA: 82828694382.25.5F58AE7 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf15.hostedemail.com (Postfix) with ESMTP id AEC68A0005 for ; Tue, 26 Nov 2024 15:54:49 +0000 (UTC) Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=lxVVjKpe; spf=pass (imf15.hostedemail.com: domain of cel@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=cel@kernel.org; dmarc=pass (policy=quarantine) header.from=kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1732636490; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:references:dkim-signature; bh=GX5lwUpNYhf54KQI3OcyCIEtjla9VSu5H/JJQ6HERhA=; b=rfQBXUmyQOMjrjnNyTyxm++kfHRma1sl09+82cG4mV5uEgk/bAwHeTsmwFgLcHkFXSCh8R NQcrZLXW8qMnDKW8fyxl0bTu2F3b1u7mm55dLiCpW84EC2o6pFZA4IrkBNhLyR9RExxiyt cEFm+kmLxAPtgEWhr26zhQ2lWX6szQc= ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=lxVVjKpe; spf=pass (imf15.hostedemail.com: domain of cel@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=cel@kernel.org; dmarc=pass (policy=quarantine) header.from=kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1732636490; a=rsa-sha256; cv=none; b=4ZKWep1Kj6yZIuEaNs+aoDYo0t/oGknxO+tOV7IYcO9efw9bm3EVJ9qJrPoIicnmGUwaEG +4GkoXyw82sboPxH8lNq+RyMriwltCjao+PRiEVBgi1/3svB288ulMmCiUn4xKNxCMO/zt bv+sVMhBlhG6uaTtMjS67L2MtEogO78= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id D369E5C581C; Tue, 26 Nov 2024 15:54:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2CC9BC4CECF; Tue, 26 Nov 2024 15:54:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1732636493; bh=8e8Q8/YtSaVAdENoI1U6mbj2xfawBpxlEtPJSKzh+B0=; h=From:To:Cc:Subject:Date:From; b=lxVVjKpeNBqXWucQV4DimWxB2ihN/uWsYVVnf1r99Fn0ggsevGLLNxDX/llUnuVB5 Y2Cn5AyufHhlE+IIlXMUno6OzZAIci1PuRgIZw7vwhALOa4zfu+QyNiolbbWCiogh8 Urgu0egXgOwkxTm6Fupx1V/kWvD3hDOvArR/H31CPueV4/XaMxm2yEdwI1DjrPoG6a Ac/q1VqjgtgaW/Tl6hm+EbDJ+CHGHTBxc9WpvOuTXXhiwKTYyP883HKKmsByFI0bIs tv3GkuEdQj0OnhSb36uIfZJvAm0uDWo0YSEwC2qNUbZGdPZ9tgl6F3hg0aDZlEOpC+ L1PC121YliNyw== From: cel@kernel.org To: Hugh Dickens , Christian Brauner , Al Viro Cc: , , yukuai3@huawei.com, yangerkun@huaweicloud.com, Chuck Lever Subject: [RFC PATCH v2 0/5] Improve simple directory offset wrap behavior Date: Tue, 26 Nov 2024 10:54:39 -0500 Message-ID: <20241126155444.2556-1-cel@kernel.org> X-Mailer: git-send-email 2.47.0 MIME-Version: 1.0 X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: AEC68A0005 X-Stat-Signature: 3tnr368esrozj1e1yj4793ymt3jr5oso X-Rspam-User: X-HE-Tag: 1732636489-165597 X-HE-Meta: U2FsdGVkX1/X7xq3xwDxkwG3olo1/nDeELVPO+p2zq7+6ceMJ5NpG9F1PXtJXGCOsArtAeGajXuXNmJ/B92KHKdThObltaOtFhSPhb4F+GiTx8OlYxxOSVT+wy2s1kAY10LsWwxCB2E4f5pDf9f9Yf/zflu4pGczNdAYvWn4skfVq4Y1nlJ0l9LjvHH/qoNcT8kCLDsx196l3iR0Z91wGP3owVl0nHpjwebzjlGTF/u87NgU0uUr+3v4s/2Y1z8JwvlZ/pNgrXpEzJnRGE4Rraq0gUCQWCxPj/1hOy8m6gdr4cg9LGc31GzFLh//U4cAL8/ermtoyExNCxxnIGy5fD9zMNbywJAgJ5ml8EeFtsH4cEQPfyXgIBctvrm9KrfWeL9XY5CnbmKmWsbVTlEHWftOg5zIKWEEXTEAGmGUV54hjLNHF7t8uZSIOS9Z3OVWlvxeQA+KT4/asKEvu7cvkeJMkAhufIhOA/1fKRZtM568lKdGP8nkHVrAacFP/DzfEzbWtABTKJvj360FZko0PvnlQSyfCWDOL2scR9NNJ5vR+IlC3xait9k5BL3tTNHUDyIenRXucoY7aznN6TnMH+um7ATBdO4NvFIBq1TYOsxnx7NHwJT6ftd+xBJg1Qg9cjCWHrQ9SqaOMvmZCDplRX7sjyOSM+xFJxzoJ3meMZbXU+qvB9A4AGVS6UeBU84K4rN0Z77hAafgNqDc/iN8mYNvZO/kiSZ2P7Ib0IAqv3nSSFr8bc+lGSL3dzYZi7LBekZudV7IBh6GN8Kj2fIGWP09t41QJUN+WLRldgRJ6dVA/DwfzBwp6wg8rn3WLW+Lq3abAYZyuHkcHmbPa+k9ITbLhLzJuF5bDey6fHORI7S9SzVaw7CPOt+ClZLPQEPOf/6NyBGvSqC6Xo9i3hJ4CWJgRUKlWBLxjSaP48KgVrBCJdM7200lXaMayNWuceU/2/Dm5/qTOLg7acG1FLT CiJd2rhZ h20RiC2qcqEyCIfz2+gIsawdyU4DYFi8WzlB6ePytjRTTANdFQgbsQtyXjfT9GssHXrBv91i7toYNHY09J6yj2qSqUi80Zh0vCDLdhJs5/xjJmurUcZdviGUWfJmWhW970x/sfzUGqLSqXDCsydaA7Ka8awytf6eiYlvp2a+4HJ2lh5GrxfMZnoAmy17j5wHUX905G9zJMnwqbfvZdADDfK9XcWG3hHDw0/ihS2SWht52rHx0jDKDg2NNrIzpFPo8LBbUd6IEp4ffio1mAWNBq4tgLw== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: From: Chuck Lever This series attempts to narrow some gaps in the current tmpfs directory offset mechanism that relate to misbehaviors reported by Yu Kuai and Yang Erkun . This series replaces the v1 mechanism I posted last week. It reverts offset_readdir() to use the directory's d_children list, instead of its mtree, for finding the next entry, as readdir did before v6.6. Directory offset values continue to be allocated via an mtree. The purpose of this change is to enable readdir results to continue to appear after a directory offset/cookie value wrap, while not regressing generic/736. That should enable this fix to be backported (manually) to v6.6 to address CVE-2024-46701. These are still a little unpolished. I expect review to find opportunities for further code reuse. These patches pass xfstests except for generic/013, generic/637, and generic/650. There appears to be a problem with WHITEOUT renames which I am still looking into. The series has been pushed to: https://git.kernel.org/pub/scm/linux/kernel/git/cel/linux.git/log/?h=tmpfs-fixes Chuck Lever (5): libfs: Return ENOSPC when the directory offset range is exhausted libfs: Check dentry before locking in simple_offset_empty() Revert "libfs: fix infinite directory reads for offset dir" libfs: Refactor end-of-directory detection for simple_offset directories libfs: Refactor offset_iterate_dir() fs/libfs.c | 145 ++++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 109 insertions(+), 36 deletions(-)