Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp3194332rwb; Fri, 16 Dec 2022 11:19:19 -0800 (PST) X-Google-Smtp-Source: AA0mqf61IV8qGP8+LR9EoDp/AM4Mo16GfVtMirGhnkwgJs9wTnZ61X3vRUC3t7C3LFYkIw5TTZao X-Received: by 2002:a17:90b:1913:b0:219:396c:9e30 with SMTP id mp19-20020a17090b191300b00219396c9e30mr33782154pjb.20.1671218359354; Fri, 16 Dec 2022 11:19:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671218359; cv=none; d=google.com; s=arc-20160816; b=jRb5CGiawmxCQkzREpGOzHIhcn4TJShTGbP6PSe7gsuSNLW3WX/zg1jlgHmuNqs4Hn DAL2fKW9RzHM8ITdVQt0lmtksEn1W1NGx7aMkAzy8QZDmQSko3CJldLdnIAhVaFbgtWo Lon5HJQEAhP9MC+d+QVAFFqzquroMw5JDHEZOlEjP8XYStEt+ChzAs5D50kNCGAqGOHi Q0kj5YTsTduaZiPXAXviHes1ShD+fxF1dwyWzsNdhQJfPEpGbGikcvzDcVnqeyJRfTYU 2DPCXFJWbXRuiTD6O4ckYO2wO9MUHv1OZolyhMexEQrYOQw3f+EVFPxKSaxLwE9LkS0C VHMw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=/s54dZfSWI9zsr2DFO7iVrmzc9Fvdgz1hVVAV1HaZBk=; b=rNIoi8JORBRClnO7HywW7gGBI3N/HS245YNLjSitxuOMpWEtZY8FhnUht1wk2ZqyUM EJs36yIlO5hBKPIa1NSbYkrgYDtR5lv6JR3B4mqOE2kiK2N7CNVLnKBfcZgbef2QT6Ag 7BD7E/ltKZyZN4/t3xFudVBJy7AUhnSXM+NgzE+Qo4KRe2pFjUCVFx229EN1C8+xaMzb wjxHMVbspaj2H5k3xw4EYfZ3q6e6KKY60GIEwuauUoGcgfuHsgtBFiIN8pnujk94XeKO 8rGWtW3Yah+zKYv6zdx7JQN46D7Vb2gZ62Fcg3MRacKVRXs7WZVIEbh2NeNcrcccYFha 6GnQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=korg header.b=AHlKMqWE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id on2-20020a17090b1d0200b00213ff43fdf1si9873719pjb.185.2022.12.16.11.19.09; Fri, 16 Dec 2022 11:19:19 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=korg header.b=AHlKMqWE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231315AbiLPTBq (ORCPT + 69 others); Fri, 16 Dec 2022 14:01:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52616 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229453AbiLPTBo (ORCPT ); Fri, 16 Dec 2022 14:01:44 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3A7A24F662 for ; Fri, 16 Dec 2022 11:01:43 -0800 (PST) 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 ams.source.kernel.org (Postfix) with ESMTPS id F3EB9B8136A for ; 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-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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.