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 4A02DC4332F for ; Fri, 16 Dec 2022 19:01:45 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DDA998E0002; Fri, 16 Dec 2022 14:01:44 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id D636C8E0001; Fri, 16 Dec 2022 14:01:44 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C04728E0002; Fri, 16 Dec 2022 14:01:44 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id AE9B48E0001 for ; Fri, 16 Dec 2022 14:01:44 -0500 (EST) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 235441211C5 for ; Fri, 16 Dec 2022 19:01:44 +0000 (UTC) X-FDA: 80249088528.09.E923D82 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf09.hostedemail.com (Postfix) with ESMTP id 635A4140024 for ; Fri, 16 Dec 2022 19:01:42 +0000 (UTC) Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b=AHlKMqWE; spf=pass (imf09.hostedemail.com: domain of akpm@linux-foundation.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1671217302; 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:references:dkim-signature; bh=/s54dZfSWI9zsr2DFO7iVrmzc9Fvdgz1hVVAV1HaZBk=; b=rt9GMzb4y+sfHHstkrQ5bUL0/kd97BJb2qiwoyRq/E5h4QzmzgeDerLOidwNiGUJqglZ3H S4oI5pBg9N0p6+SM5dLYzB+k1pdl9rpRH3a5HJnSCrXr5PijEY7IcDIwyML4VcTm0Xeq4B F1zYTsQAYp8b/A/zk28O+f3cCxSoVyk= ARC-Authentication-Results: i=1; imf09.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b=AHlKMqWE; spf=pass (imf09.hostedemail.com: domain of akpm@linux-foundation.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1671217302; a=rsa-sha256; cv=none; b=CyCFPpa8rHpdiOFYlKnMvezf/dx1ZUFdYGVsobRYy79KPzm89TxAsCXv7yYYQBfKxGC9ao 2FpepCwp7I2pmAP7PcwPmOuVb/pIqj5vUM4BfFFLPeq0lJtJR5err9y0GwW/DHY2NxLcTZ ZBf4I7tzk4yWAtrDpcO6jIpFndWKLDI= 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 56F7662179; Fri, 16 Dec 2022 19:01:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 78CD0C433EF; Fri, 16 Dec 2022 19:01:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1671217300; bh=7DPRT0lvHrvQfKmUAwIVk2AORoB5ghy+f1Eolq71vYQ=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=AHlKMqWE4RkGY9kg46mgGCSOAbVuA+HEFpkLCB7Lz8OY3Yt2ylDwmG1doZQ0UWyph XxSR9bRCKu6ic63gtny61f7E8PB5n7Gv4KMdtTjmM/dXU8PDC9jOlxoC7IrAsnUpBP UsuTYlNz+uOUQd1ka/zk6G1xe9Um6bjqrXOCyiJo= Date: Fri, 16 Dec 2022 11:01:39 -0800 From: Andrew Morton To: Liam Howlett Cc: "linux-mm@kvack.org" , "linux-kernel@vger.kernel.org" , "maple-tree@lists.infradead.org" , Andrei Vagin , "usama.anjum@collabora.com" , Mike Rapoport Subject: Re: [PATCH] maple_tree: Fix mas_spanning_rebalance() on insufficient data Message-Id: <20221216110139.fe9b0cc2951014e1856d0042@linux-foundation.org> In-Reply-To: <20221216185233.2036415-1-Liam.Howlett@oracle.com> References: <20221216185233.2036415-1-Liam.Howlett@oracle.com> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.33; x86_64-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Stat-Signature: tcm59heeoarcdqdbb8tynn9ojed4c315 X-Rspam-User: X-Rspamd-Queue-Id: 635A4140024 X-Rspamd-Server: rspam06 X-HE-Tag: 1671217302-167324 X-HE-Meta: U2FsdGVkX1/FM+d+/j5fINdqUATiCkpZoMk50T6E8HBOWYhvSQ5qvi6TGbl/vuvD6Q58fKo9JFO+qxfqffEucfc1AXzJkBfZYgUO92SwM+l8cnKtiaBg1vFJVEOhxjEy9pgARNn02DnMZ1Rwg/ea2chmzrGL2CJ5qkf00Mbyhfo7EkotmyyyfrhCGiu+t8gfTXZXM6dWqoQyiZf9exhGlA06t5t3rW66s9KySt8e/0r3Pnbj2ZoyzqAv8mjZAUT0Pga5XNpewotj7OtaN6XL8nRcmu4s6h6MTQboN1QNV63968i9WtUlOece7JyfCFhHxWICKIWE67Np7RkehzOZSUESqxwHe/pOuIvrt64L1cXe2UV6eG37GbhQ8VUzatk0bpsNlmajjpsSylEasG17CdhJKLwtX++6xesfcy/5QGpKjkFPPcYoKPEHegQMOwbB34rv4zvKSiha+DSAW5RHa5CEe6hcU1x1Ue/5OyO+SOTiZOOPf7tYzMVnZ0q4YWyklB3+Tv7x0ZWxInh8dB5bpZjcDp/9YI9aCmAkqquhmNdJC0PkwDsymG3K956sot52PT+0Oh4Jq2RQ6EBeSUr7LNG4yaW1a4fW/2l3LCRbtJfDQ43fM3mXAaFZ3fy2Dt9Udk1Y+yYvqnWv7PfqVYs44tXLMtDpFXpcuzYZ5jFFiaSAkZ93GmUj1XaVTkXSW4cXkqPZkGj9qA68BfLdMKxJI2SCvMqliafar5DrkRR1XE8LJ3k9nF9F5DmAVE2uIpVO0FamYYx2VEdDlwIgszlYAmEaul2KGVe+mEK0NnZfbCr8YXma2gxqF7c+LZl4ulQ1/Vlp5Xyn2si+OgTurkqAo1n5I4AUvqRNmn7DGZom01sWfaGndw1BtH2wur8pYrmOiN7hvcrxtYl+SFkAeBgqZKYGa49cRpyi7p19r1xYESyQ3Ds/3BWhApJePqrAbZJBCxSPhTOEVgNDZYRHaLe d8QevZ0Z mCL4sjaegegOz4JQfiuct71wHX4S1kpqR3E5gNld7LGP+vbl/i2B35yf47RkM3n14yTVs/PoCdgNs9LKfLRvEFCPrWyQKUmKlyv4lSnSrTqRZz3225q8HZt6y8B+Y6hDUa0PBN0HbC+/gYL7OSFPc0u0ulZix5LqvTgZx 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: On Fri, 16 Dec 2022 18:53:15 +0000 Liam Howlett wrote: > Mike Rapoport contacted me off-list with a regression in running criu. > Periodic tests fail with an RCU stall during execution. Although rare, > it is possible to hit this with other uses so this patch should be > backported to fix the regression. > > An insufficient node was causing an out-of-bounds access on the node in > mas_leaf_max_gap(). The cause was the faulty detection of the new node > being a root node when overwriting many entries at the end of the tree. > > Fix the detection of a new root and ensure there is sufficient data > prior to entering the spanning rebalance loop. > > Add a testcase to the maple tree test suite for this issue. Shall do. > Cc: Andrei Vagin > Cc: usama.anjum@collabora.com > Reported-by: Mike Rapoport > Fixes: 54a611b60590 ("Maple Tree: add new data structure") > Signed-off-by: Liam R. Howlett I guess we want a cc:stable there? > lib/test_maple_tree.c | 23 +++++++++++++++++++++++ Belated review: all this code runs at __init time, so every dang function in there really should be marked __init, data marked __initdata, etc. Like lib/test_bitmap.c. I wonder if there's some trick we can do external to the .c file to have the same effect. Also, maple_tree_seed():set[] could be static ;). So we don't have to initialize it at runtime. Better would be static const. Nitpick.