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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id CC871C77B6E for ; Wed, 12 Apr 2023 08:13:26 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6A8ED900005; Wed, 12 Apr 2023 04:13:26 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 65825900002; Wed, 12 Apr 2023 04:13:26 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4FCA7900005; Wed, 12 Apr 2023 04:13:26 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 3E790900002 for ; Wed, 12 Apr 2023 04:13:26 -0400 (EDT) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 072EF1A0D29 for ; Wed, 12 Apr 2023 08:13:26 +0000 (UTC) X-FDA: 80672024412.28.51707C1 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf08.hostedemail.com (Postfix) with ESMTP id 46F3C160003 for ; Wed, 12 Apr 2023 08:13:24 +0000 (UTC) Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=linuxfoundation.org header.s=korg header.b=yq09Lwk+; dmarc=pass (policy=none) header.from=linuxfoundation.org; spf=pass (imf08.hostedemail.com: domain of gregkh@linuxfoundation.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=gregkh@linuxfoundation.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1681287204; 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-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:dkim-signature; bh=mNR4v6SjwdspR9XkW9WpvH4capekrk8/UuchK6d/11U=; b=RmCooBf5TWdjY3sYFL3317mD74EEF/M1kAZEYqb5xRCyYNIli0thikTT3jo04smEL3VxAF 2RE6AkOcxPWT3JnnvbHfQ8ZZWodKs593ClnjCuFdsJcV+R9skBuZiujHMC/1uRZ6KEq7Bi VUpJAgGHQrfzVSW1JQzslT7XgbjU0kU= ARC-Authentication-Results: i=1; imf08.hostedemail.com; dkim=pass header.d=linuxfoundation.org header.s=korg header.b=yq09Lwk+; dmarc=pass (policy=none) header.from=linuxfoundation.org; spf=pass (imf08.hostedemail.com: domain of gregkh@linuxfoundation.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=gregkh@linuxfoundation.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1681287204; a=rsa-sha256; cv=none; b=oPWvsruw/zaT+RTf7JITAagoUD+ftjzINuh8zY5ENXxIb/Tzw70oO/RR1hNUo50ff0LbjH 1jfv3eU7O5A5FyOwvPj2kwz1Ue8Zkiymfm1STX1iUNMqLv1mtFvM9WN+Lrh7q6IpmcmV/r W6iBki+Ucl/1x0Kv2uwRW1SDR2oOq8w= Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 778D2629C7; Wed, 12 Apr 2023 08:13:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8AF78C433EF; Wed, 12 Apr 2023 08:13:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1681287202; bh=OIJkBKIzZt+FkU4qW/VMFdn6tAQyVoQMfOX7YE1d0Q8=; h=Subject:To:Cc:From:Date:In-Reply-To:From; b=yq09Lwk+tOIwBg0U+7GgGv7LMWMC5ycm6PXMjKzFHnDB6/GZxiC3JRBUZrTPCqcC8 JEHRvWFUp8so9P1T0b78SgCIgfRalrPatR9QlpIeDdm5JDIVnKk6KmvKidfwCAv7p6 YGQVFW7YjLyeGPxCEcenSkelqzoMf7YuMYBL2diI= Subject: Patch "maple_tree: add smp_rmb() to dead node detection" has been added to the 6.1-stable tree To: Liam.Howlett@Oracle.com,Liam.Howlett@oracle.com,gregkh@linuxfoundation.org,linux-mm@kvack.org,maple-tree@lists.infradead.org Cc: From: Date: Wed, 12 Apr 2023 10:13:17 +0200 In-Reply-To: <20230411151055.2910579-13-Liam.Howlett@oracle.com> Message-ID: <2023041216-grumbly-romp-b037@gregkh> MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit X-stable: commit X-Patchwork-Hint: ignore X-Rspamd-Queue-Id: 46F3C160003 X-Rspamd-Server: rspam09 X-Rspam-User: X-Stat-Signature: cwswbzpbrborbs8efkuzz99tfze5y31e X-HE-Tag: 1681287204-875640 X-HE-Meta: U2FsdGVkX1/kOSd4KCSVigtO3zI7aqo1I3fxUmN3Yv2/ndDz3zHmQ3T/ed8xhbO4tMr4Bn1oLWVy7A3s85JANmoaCH5uCrMa2wALPIrjwxQNGoTQWCIJO+BqThbqdp8VvGwKNB0ESApvqPDJwp0xTAXhn2gIwnLm5adFaWPySmjdVEMreVlBVbkx2Tvm0QjpwHnjFfpHqvTJ83ZtdNTOvLlDkAqjLB6YqfqnW5C4bzgk+vUg1H5X7nH3kHcI9l99wkdtIZW6l6YJOEueFNx8lVLDlMzeKQPYjmrEuc0/N9ho9lqh6mjZgOak3v9lHvWBdvhMyQbqymJdVNA08y6nFaEL9w3L0Ju6C3ceLjwNbi+RJRFo1gng5r+bG37dxPOBhQjntLjV5OFD6++i6T0HXP1SJUtzFkXirmv/+0NZe1XQYjsIQG69RVSd17SkdQePxEKzGq3B9N+l+du1E1x9IjjBgfXLbE8j9+dy4wLhg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sXMVSyqSFKdyzfFKyCTz/syaQrZO2von6GxYTgxwPnlVecvRlVMCsJJLAOPegbdojLsenecB8pYfIx9H6I6sqjIvLhOekayA== 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: This is a note to let you know that I've just added the patch titled maple_tree: add smp_rmb() to dead node detection to the 6.1-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: maple_tree-add-smp_rmb-to-dead-node-detection.patch and it can be found in the queue-6.1 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let know about it. >From stable-owner@vger.kernel.org Tue Apr 11 17:15:03 2023 From: "Liam R. Howlett" Date: Tue, 11 Apr 2023 11:10:53 -0400 Subject: maple_tree: add smp_rmb() to dead node detection To: Greg Kroah-Hartman , stable@vger.kernel.org Cc: maple-tree@lists.infradead.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, "Liam R. Howlett" , "Liam R . Howlett" Message-ID: <20230411151055.2910579-13-Liam.Howlett@oracle.com> From: "Liam R. Howlett" commit 0a2b18d948838e16912b3b627b504ab062b7d02a upstream. Add an smp_rmb() before reading the parent pointer to ensure that anything read from the node prior to the parent pointer hasn't been reordered ahead of this check. The is necessary for RCU mode. Link: https://lkml.kernel.org/r/20230227173632.3292573-7-surenb@google.com Fixes: 54a611b60590 ("Maple Tree: add new data structure") Cc: stable@vger.kernel.org Signed-off-by: Liam R. Howlett Signed-off-by: Greg Kroah-Hartman --- lib/maple_tree.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -529,9 +529,11 @@ static inline struct maple_node *mte_par */ static inline bool ma_dead_node(const struct maple_node *node) { - struct maple_node *parent = (void *)((unsigned long) - node->parent & ~MAPLE_NODE_MASK); + struct maple_node *parent; + /* Do not reorder reads from the node prior to the parent check */ + smp_rmb(); + parent = (void *)((unsigned long) node->parent & ~MAPLE_NODE_MASK); return (parent == node); } @@ -546,6 +548,8 @@ static inline bool mte_dead_node(const s struct maple_node *parent, *node; node = mte_to_node(enode); + /* Do not reorder reads from the node prior to the parent check */ + smp_rmb(); parent = mte_parent(enode); return (parent == node); } Patches currently in stable-queue which might be from stable-owner@vger.kernel.org are queue-6.1/maple_tree-fix-potential-rcu-issue.patch queue-6.1/maple_tree-add-smp_rmb-to-dead-node-detection.patch queue-6.1/maple_tree-add-rcu-lock-checking-to-rcu-callback-functions.patch queue-6.1/maple_tree-fix-handle-of-invalidated-state-in-mas_wr_store_setup.patch queue-6.1/maple_tree-reduce-user-error-potential.patch queue-6.1/maple_tree-fix-mas_prev-and-mas_find-state-handling.patch queue-6.1/maple_tree-remove-gfp_zero-from-kmem_cache_alloc-and-kmem_cache_alloc_bulk.patch queue-6.1/maple_tree-be-more-cautious-about-dead-nodes.patch queue-6.1/mm-enable-maple-tree-rcu-mode-by-default.patch queue-6.1/maple_tree-detect-dead-nodes-in-mas_start.patch queue-6.1/maple_tree-fix-freeing-of-nodes-in-rcu-mode.patch queue-6.1/maple_tree-remove-extra-smp_wmb-from-mas_dead_leaves.patch queue-6.1/maple_tree-refine-ma_state-init-from-mas_start.patch