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=1796221162; b=IU6lAqEjepFyfUPO9ePVw/lBI7Fo0Mc+Gw45pwYi/FL7msD6w7vLQ7QdyvUyFhoC92Pt 0scz6ZZHk0zA7UTW8O0ML0YiprAnxY1d/yASjP6mq+0SOz6T/mXG19eW/ndSoU5L2iCkN 0mS5Ms5wVBfAMEmHSDasKCJeNMrKiiBxi+Ch+Br1Sg0k9KE1+60OdBj8GpmXnlP8Tn0nx RfDtXW8w69Up3+MVNoUZRCKMp+SFRnidbyuI4u12idLEOn5bZPaIeeG5c25Y/zqc7mOCa WDNchyicrJt4ylNujTsUJD7EpvW3F2tQMD0HOBR4CigDngxJgQO5LInZCymUl3Am3yQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796221162; h=Received:DKIM-Signature:Subject:To:Cc:From:Date:Message-ID: MIME-Version:Content-Type:Content-Transfer-Encoding; bh=Y//g/0EH40JYOkXJqD2W5w1PHjUHkvo31Kpn2nOV3zY=; b=ABSclWmfC9YBT/GOHnyFsEc2Uo+/UNqllFuCWj/h3/XEe+DFalJaDdyf7gPJGnqifvbl vhwDsug8UDn4AQK2vGIZxymhisIHQo8ph9Iaj7NHocz+fSO6QF7K8xsEhbmEtMmfMMAnX Zo9el04mDy5bqYw11oyhycI2aSB+cnS28IXuhaIudNNlDY4hGMc5vo0OsZRaiJjiB4RA1 yDKUVC3fWVX7ylkSOUrTF65bIytc/fMM+nLlW1gbm1qDiOjCJ2zKo5lJqS32WJ1MXIGCL 4lKVeT9Le9Oee1SVGyzYozn5D6jiuaF+qqT31lUoEmqKhRfH9hn2FLJPtZNk5IWmQBw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=fjgvWxjU; 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 CE1D7606A31A for ; Wed, 2 Dec 2026 14:19:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=fjgvWxjU Received: by smtp.kernel.org (Postfix) with ESMTPSA id 238B21F0089A; Wed, 2 Dec 2026 14:19:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796221162; bh=Y//g/0EH40JYOkXJqD2W5w1PHjUHkvo31Kpn2nOV3zY=; h=Subject:To:Cc:From:Date; b=fjgvWxjUYhOU9UXkm9zjvgUWHjVcLLRtoVyg1Mk3fIMHVF6F+bsuxRVE6O5biKK4W y0bH8bR5LtiJ2yFKb0k7lvpolhb24m6vfWHUCffv3TgOayCJ0HSrRe/AbkoM0fkDWI stEjJ/Fm6RKe+7QvB0Ls8EkFnTfc8C4yiamb0X+w= Subject: FAILED: patch "[PATCH] maple_tree: update internal warning and bug_on code" failed to apply to 6.6-stable tree To: liam@infradead.org,akpm@linux-foundation.org,aliceryhl@google.com,andrewjballance@gmail.com,ljs@kernel.org,mason@kernel.org,stable@vger.kernel.org Cc: From: Date: Wed, 02 Dec 2026 14:12:21 +0100 Message-ID: <2026120221-stable-earphone-7a9e@gregkh> X-Mailing-List: stable@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=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit The patch below does not apply to the 6.6-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to . To reproduce the conflict and resubmit, you may use the following commands: git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.6.y git checkout FETCH_HEAD git cherry-pick -x f51d35b81fb572c551e82ff72575d6dbb8e35ba9 # git commit -s git send-email --to '' --in-reply-to '2026120221-stable-earphone-7a9e@gregkh' --subject-prefix 'PATCH 6.6.y' 'HEAD^..' Possible dependencies: thanks, greg k-h ------------------ original commit in Linus's tree ------------------ >From f51d35b81fb572c551e82ff72575d6dbb8e35ba9 Mon Sep 17 00:00:00 2001 From: "Liam R. Howlett (Google)" Date: Mon, 2 Nov 2026 21:07:24 -0500 Subject: [PATCH] maple_tree: update internal warning and bug_on code When CONFIG_DEBUG_MAPLE_TREE is set, call WARN_ON() once per site after the custom information is dumped about the tree. Without using the kernel's WARN_ON calls, syzbot will not catch issues detected by this code. The BUG_ON variants now stop instead of dumping and continuing. Update the non-debug code to call WARN_ON_ONCE() as well. The userspace tests asserted on dump_stack() but only print on WARN_ON(), so make WARN() fatal in maple-shared.h and have the maple test exit with the result of maple_tree_seed(). Link: https://lore.kernel.org/20261103020724.2614498-4-liam@infradead.org Fixes: f0a1f866aba1 ("maple_tree: add debug BUG_ON and WARN_ON variants") Signed-off-by: Liam R. Howlett (Google) Signed-off-by: Andrew Morton Reported-by: Lorenzo Stoakes Reviewed-by: Lorenzo Stoakes (ARM) Cc: Chris Mason Cc: Alice Ryhl Cc: Andrew Ballance Cc: diff --git a/include/linux/maple_tree.h b/include/linux/maple_tree.h index 691f6012daea..3892201d7efd 100644 --- a/include/linux/maple_tree.h +++ b/include/linux/maple_tree.h @@ -684,7 +684,7 @@ void mt_cache_shrink(void); pr_info("Pass: %u Run:%u\n", \ atomic_read(&maple_tree_tests_passed), \ atomic_read(&maple_tree_tests_run)); \ - dump_stack(); \ + BUG_ON(1); \ } else { \ atomic_inc(&maple_tree_tests_passed); \ } \ @@ -700,7 +700,7 @@ void mt_cache_shrink(void); pr_info("Pass: %u Run:%u\n", \ atomic_read(&maple_tree_tests_passed), \ atomic_read(&maple_tree_tests_run)); \ - dump_stack(); \ + BUG_ON(1); \ } else { \ atomic_inc(&maple_tree_tests_passed); \ } \ @@ -717,7 +717,7 @@ void mt_cache_shrink(void); pr_info("Pass: %u Run:%u\n", \ atomic_read(&maple_tree_tests_passed), \ atomic_read(&maple_tree_tests_run)); \ - dump_stack(); \ + BUG_ON(1); \ } else { \ atomic_inc(&maple_tree_tests_passed); \ } \ @@ -726,16 +726,16 @@ void mt_cache_shrink(void); #define MT_WARN_ON(__tree, __x) ({ \ int ret = !!(__x); \ atomic_inc(&maple_tree_tests_run); \ - if (ret) { \ - pr_info("WARN at %s:%d (%u)\n", \ - __func__, __LINE__, __x); \ + if (!ret) { \ + atomic_inc(&maple_tree_tests_passed); \ + } else if (__ONCE_LITE_IF(ret)) { \ + pr_info("WARN at %s:%d\n", \ + __func__, __LINE__); \ mt_dump(__tree, mt_dump_hex); \ pr_info("Pass: %u Run:%u\n", \ atomic_read(&maple_tree_tests_passed), \ atomic_read(&maple_tree_tests_run)); \ - dump_stack(); \ - } else { \ - atomic_inc(&maple_tree_tests_passed); \ + WARN_ON(1); \ } \ unlikely(ret); \ }) @@ -743,17 +743,17 @@ void mt_cache_shrink(void); #define MAS_WARN_ON(__mas, __x) ({ \ int ret = !!(__x); \ atomic_inc(&maple_tree_tests_run); \ - if (ret) { \ - pr_info("WARN at %s:%d (%u)\n", \ - __func__, __LINE__, __x); \ + if (!ret) { \ + atomic_inc(&maple_tree_tests_passed); \ + } else if (__ONCE_LITE_IF(ret)) { \ + pr_info("WARN at %s:%d\n", \ + __func__, __LINE__); \ mas_dump(__mas); \ mt_dump((__mas)->tree, mt_dump_hex); \ pr_info("Pass: %u Run:%u\n", \ atomic_read(&maple_tree_tests_passed), \ atomic_read(&maple_tree_tests_run)); \ - dump_stack(); \ - } else { \ - atomic_inc(&maple_tree_tests_passed); \ + WARN_ON(1); \ } \ unlikely(ret); \ }) @@ -761,18 +761,18 @@ void mt_cache_shrink(void); #define MAS_WR_WARN_ON(__wrmas, __x) ({ \ int ret = !!(__x); \ atomic_inc(&maple_tree_tests_run); \ - if (ret) { \ - pr_info("WARN at %s:%d (%u)\n", \ - __func__, __LINE__, __x); \ + if (!ret) { \ + atomic_inc(&maple_tree_tests_passed); \ + } else if (__ONCE_LITE_IF(ret)) { \ + pr_info("WARN at %s:%d\n", \ + __func__, __LINE__); \ mas_wr_dump(__wrmas); \ mas_dump((__wrmas)->mas); \ mt_dump((__wrmas)->mas->tree, mt_dump_hex); \ pr_info("Pass: %u Run:%u\n", \ atomic_read(&maple_tree_tests_passed), \ atomic_read(&maple_tree_tests_run)); \ - dump_stack(); \ - } else { \ - atomic_inc(&maple_tree_tests_passed); \ + WARN_ON(1); \ } \ unlikely(ret); \ }) @@ -780,9 +780,9 @@ void mt_cache_shrink(void); #define MT_BUG_ON(__tree, __x) BUG_ON(__x) #define MAS_BUG_ON(__mas, __x) BUG_ON(__x) #define MAS_WR_BUG_ON(__mas, __x) BUG_ON(__x) -#define MT_WARN_ON(__tree, __x) WARN_ON(__x) -#define MAS_WARN_ON(__mas, __x) WARN_ON(__x) -#define MAS_WR_WARN_ON(__mas, __x) WARN_ON(__x) +#define MT_WARN_ON(__tree, __x) WARN_ON_ONCE(__x) +#define MAS_WARN_ON(__mas, __x) WARN_ON_ONCE(__x) +#define MAS_WR_WARN_ON(__mas, __x) WARN_ON_ONCE(__x) #endif /* CONFIG_DEBUG_MAPLE_TREE */ /** diff --git a/tools/testing/radix-tree/maple.c b/tools/testing/radix-tree/maple.c index bfe4b8626c42..846c67e20e82 100644 --- a/tools/testing/radix-tree/maple.c +++ b/tools/testing/radix-tree/maple.c @@ -36502,22 +36502,27 @@ static void regression_tests(void) test_spanning_store_regression(); } -void maple_tree_tests(void) +int maple_tree_tests(void) { + int ret; + #if !defined(BENCH) regression_tests(); farmer_tests(); #endif - maple_tree_seed(); + ret = maple_tree_seed(); maple_tree_harvest(); + return ret; } int __weak main(void) { + int ret; + maple_tree_init(); - maple_tree_tests(); + ret = maple_tree_tests(); rcu_barrier(); if (nr_allocated) printf("nr_allocated = %d\n", nr_allocated); - return 0; + return ret ? EXIT_FAILURE : EXIT_SUCCESS; } diff --git a/tools/testing/shared/maple-shared.h b/tools/testing/shared/maple-shared.h index 2a1e9a8594a2..5f827709773a 100644 --- a/tools/testing/shared/maple-shared.h +++ b/tools/testing/shared/maple-shared.h @@ -8,6 +8,7 @@ #include "shared.h" #include #include +#include #include "linux/init.h" void maple_rcu_cb(struct rcu_head *head); @@ -20,5 +21,37 @@ do { \ call_rcu(&((_p_struct)->_memb), rcu_cb); \ } while(0); +/* Make WARN() fatal */ +#undef WARN +#undef WARN_ON +#undef WARN_ONCE +#undef WARN_ON_ONCE +#define WARN(condition, format...) ({ \ + int __ret_warn_on = !!(condition); \ + if (unlikely(__ret_warn_on)) { \ + __WARN_printf(format); \ + assert(0); \ + } \ + unlikely(__ret_warn_on); \ +}) +#define WARN_ON(condition) \ + WARN(condition, "assertion failed at %s:%d\n", __FILE__, __LINE__) +#define WARN_ONCE(condition, format...) WARN(condition, format) +#define WARN_ON_ONCE(condition) WARN_ON(condition) + +/* Once state for the debug macros */ +#ifndef __ONCE_LITE_IF +#define __ONCE_LITE_IF(condition) \ + ({ \ + static bool __already_done; \ + bool __ret_once = false; \ + \ + if ((condition) && !__already_done) { \ + __already_done = true; \ + __ret_once = true; \ + } \ + __ret_once; \ + }) +#endif #endif /* __MAPLE_SHARED_H__ */