From patchwork Thu Oct 24 13:19:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yu Kuai X-Patchwork-Id: 13848993 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 1A19DCE8E70 for ; Thu, 24 Oct 2024 13:23:07 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 751276B009C; Thu, 24 Oct 2024 09:23:06 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 6D80D6B00A0; Thu, 24 Oct 2024 09:23:06 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 577BF6B009E; Thu, 24 Oct 2024 09:23:06 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 37CA36B009B for ; Thu, 24 Oct 2024 09:23:06 -0400 (EDT) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id B73401C70BE for ; Thu, 24 Oct 2024 13:22:44 +0000 (UTC) X-FDA: 82708561194.18.4907048 Received: from dggsgout11.his.huawei.com (dggsgout11.his.huawei.com [45.249.212.51]) by imf02.hostedemail.com (Postfix) with ESMTP id 32D5380016 for ; Thu, 24 Oct 2024 13:22:24 +0000 (UTC) Authentication-Results: imf02.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf02.hostedemail.com: domain of yukuai1@huaweicloud.com designates 45.249.212.51 as permitted sender) smtp.mailfrom=yukuai1@huaweicloud.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1729776132; a=rsa-sha256; cv=none; b=bMwMFbO9MpKLKtsr2Cu+bgmEFVm9XxMQ3AXDVYavP8PdMpXh9GsUdhUDGUerj3WDcAMhh4 4Fcu6mAlvL/6Zyv/WCR3L/Da+GUoXG+3wjCi/XFrrR1i75IndZfnUPZWuffIEdjHeNZAsH 22a9DZ0O+L0+WAkYINMm4iIUJ5FQ3Ms= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf02.hostedemail.com: domain of yukuai1@huaweicloud.com designates 45.249.212.51 as permitted sender) smtp.mailfrom=yukuai1@huaweicloud.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1729776132; 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; bh=BAgTcdvne0Ms16LseO5G8C709DosCv4rYxtL5cMXXRA=; b=QD1q/fpBKun0NyGWKWqpmTRUeBqiC2Go3Rdr0RrUehmfi2MdpH7OB/gJYygXcv2LcN92nD vTdGOA34bpcpUnqyNQS43lO7SI3Pis4ypQEZdaLKZ7sBzTmvhiZTvwcnWawKTlGYyGkFRW gY/lbIEAKb8D89mf60c0xwXjcvjQlNM= Received: from mail.maildlp.com (unknown [172.19.93.142]) by dggsgout11.his.huawei.com (SkyGuard) with ESMTP id 4XZ66925pXz4f3kp5 for ; Thu, 24 Oct 2024 21:22:41 +0800 (CST) Received: from mail02.huawei.com (unknown [10.116.40.128]) by mail.maildlp.com (Postfix) with ESMTP id A4C5B1A018D for ; Thu, 24 Oct 2024 21:22:53 +0800 (CST) Received: from huaweicloud.com (unknown [10.175.104.67]) by APP4 (Coremail) with SMTP id gCh0CgCHusYpShpn7tb6Ew--.444S4; Thu, 24 Oct 2024 21:22:51 +0800 (CST) From: Yu Kuai To: stable@vger.kernel.org, gregkh@linuxfoundation.org, harry.wentland@amd.com, sunpeng.li@amd.com, Rodrigo.Siqueira@amd.com, alexander.deucher@amd.com, christian.koenig@amd.com, Xinhui.Pan@amd.com, airlied@gmail.com, daniel@ffwll.ch, viro@zeniv.linux.org.uk, brauner@kernel.org, Liam.Howlett@oracle.com, akpm@linux-foundation.org, hughd@google.com, willy@infradead.org, sashal@kernel.org, srinivasan.shanmugam@amd.com, chiahsuan.chung@amd.com, mingo@kernel.org, mgorman@techsingularity.net, yukuai3@huawei.com, chengming.zhou@linux.dev, zhangpeng.00@bytedance.com, chuck.lever@oracle.com Cc: amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, maple-tree@lists.infradead.org, linux-mm@kvack.org, yukuai1@huaweicloud.com, yi.zhang@huawei.com, yangerkun@huawei.com Subject: [PATCH 6.6 00/28] fix CVE-2024-46701 Date: Thu, 24 Oct 2024 21:19:41 +0800 Message-Id: <20241024132009.2267260-1-yukuai1@huaweicloud.com> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 X-CM-TRANSID: gCh0CgCHusYpShpn7tb6Ew--.444S4 X-Coremail-Antispam: 1UD129KBjvJXoWxAFy3Zr48Wr4UKF4kGw4Durg_yoW5CF13p3 WDGr15trsrZry8Grs3Aw47Xry7W395W348Jw1DGw15Ar4UKr97XrWruFyfAay3CayxGF47 Kr1Yqw18Ca4UA37anT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUU9I14x267AKxVWrJVCq3wAFc2x0x2IEx4CE42xK8VAvwI8IcIk0 rVWrJVCq3wAFIxvE14AKwVWUJVWUGwA2ocxC64kIII0Yj41l84x0c7CEw4AK67xGY2AK02 1l84ACjcxK6xIIjxv20xvE14v26F1j6w1UM28EF7xvwVC0I7IYx2IY6xkF7I0E14v26r4U JVWxJr1l84ACjcxK6I8E87Iv67AKxVW0oVCq3wA2z4x0Y4vEx4A2jsIEc7CjxVAFwI0_Gc CE3s1le2I262IYc4CY6c8Ij28IcVAaY2xG8wAqx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c40rE7NjHace2gZw1h5tMe3kd8v/DYqwZIVmmFNIm9SQcvk90Osk/0PXWqxI0Cie3LiUWCWn6oeQn0E91k69iYF329farMsVPwS9doyFItpzwhOUUEbJ9bXYUo6Pp/SVAzfGe5HFHS1F6yDreqqoyp29EoOxbIZR6Gm+ABlPGj2AHcyFQd9PRsjlWoM8K6vqDDTxAXKn9t78WwhEbWsSz/Z41OoO7RNg2fX4glb/manvKeCVUyjVJ24MZvxACfLcAfGw71MBJeHuHYwalKEz2okozK/GGdtbotIuDAvKEodM1P9EOWC92f9/qWWGuXWZkcvWhC2DgqMw0ruS4/ur8mFbNA7IAbccjRd9SfjRjmF9l08C8bXjvTcR6To2ogS9BzevyhUZLJ5HDMZjfz/yKzo2GVFm8qRy8byCdlYYx9KZdhGhKz+hXabUNt3W7EjOV5zP6ApsIEyts/FpB38mOME/6AwkyNebmj1QyFN0ikN4nUERfQ56dywdPNv6ttxznrJeL4XbrcNP0toi/HZuwqcMHP+pt40+DZRajfhWFFnCIkFZMfwvshugk490fabetJ6xHpyTTEEX+L6iwQLoGErfIHVnZjQNazEbPPDdRyws8vxtwh8hAiO6B hHBfXBQo POgS/c5443vUTnjyAthi+arV8nWembf3Cs5fNf1vpPl57vYCU3l8i/xKs/o0rb+NZ95ZVOKj2eNtcKrC86OPHwDVDP1keMatJtUCC/gNHyKwaZU0Q5/duu2z+oPXjDoUJKnOZLL+q8NizMVdpYU1TRdXTDncLOgrvddkTBayHH4ITfWV8lJAb/xnYfh2V+oKzK2h8PSPyxJjWmOsft2Bsm+Zkq9p2HHfmqJTI 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: Yu Kuai Fix patch is patch 27, relied patches are from: - patches from set [1] to add helpers to maple_tree, the last patch to improve fork() performance is not backported; - patches from set [2] to change maple_tree, and follow up fixes; - patches from set [3] to convert offset_ctx from xarray to maple_tree; Please notice that I'm not an expert in this area, and I'm afraid to make manual changes. That's why patch 16 revert the commit that is different from mainline and will cause conflict backporting new patches. patch 28 pick the original mainline patch again. (And this is what we did to fix the CVE in downstream kernels). [1] https://lore.kernel.org/all/20231027033845.90608-1-zhangpeng.00@bytedance.com/ [2] https://lore.kernel.org/all/20231101171629.3612299-2-Liam.Howlett@oracle.com/T/ [3] https://lore.kernel.org/all/170820083431.6328.16233178852085891453.stgit@91.116.238.104.host.secureserver.net/ Andrew Morton (1): lib/maple_tree.c: fix build error due to hotfix alteration Chuck Lever (5): libfs: Re-arrange locking in offset_iterate_dir() libfs: Define a minimum directory offset libfs: Add simple_offset_empty() maple_tree: Add mtree_alloc_cyclic() libfs: Convert simple directory offsets to use a Maple Tree Liam R. Howlett (12): maple_tree: remove unnecessary default labels from switch statements maple_tree: make mas_erase() more robust maple_tree: move debug check to __mas_set_range() maple_tree: add end of node tracking to the maple state maple_tree: use cached node end in mas_next() maple_tree: use cached node end in mas_destroy() maple_tree: clean up inlines for some functions maple_tree: separate ma_state node from status maple_tree: remove mas_searchable() maple_tree: use maple state end for write operations maple_tree: don't find node end in mtree_lookup_walk() maple_tree: mtree_range_walk() clean up Lorenzo Stoakes (1): maple_tree: correct tree corruption on spanning store Peng Zhang (7): maple_tree: add mt_free_one() and mt_attr() helpers maple_tree: introduce {mtree,mas}_lock_nested() maple_tree: introduce interfaces __mt_dup() and mtree_dup() maple_tree: skip other tests when BENCH is enabled maple_tree: preserve the tree attributes when destroying maple tree maple_tree: add test for mtree_dup() maple_tree: avoid checking other gaps after getting the largest gap Yu Kuai (1): Revert "maple_tree: correct tree corruption on spanning store" yangerkun (1): libfs: fix infinite directory reads for offset dir fs/libfs.c | 129 ++- include/linux/fs.h | 6 +- include/linux/maple_tree.h | 356 +++--- include/linux/mm_types.h | 3 +- lib/maple_tree.c | 1096 +++++++++++++------ lib/test_maple_tree.c | 218 ++-- mm/internal.h | 10 +- mm/shmem.c | 4 +- tools/include/linux/spinlock.h | 1 + tools/testing/radix-tree/linux/maple_tree.h | 2 +- tools/testing/radix-tree/maple.c | 390 ++++++- 11 files changed, 1564 insertions(+), 651 deletions(-)