Received: by 2002:a05:6358:c692:b0:131:369:b2a3 with SMTP id fe18csp327420rwb; Thu, 27 Jul 2023 13:26:03 -0700 (PDT) X-Google-Smtp-Source: APBJJlFmUJPcOfZ01ec3VCt1Z//V7inNP25m/QveYGJPB5xM2A1p6zTHIW1irzwZa9xOHJRLzqy7 X-Received: by 2002:a17:906:7a53:b0:99b:c816:41c2 with SMTP id i19-20020a1709067a5300b0099bc81641c2mr416151ejo.35.1690489563610; Thu, 27 Jul 2023 13:26:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690489563; cv=none; d=google.com; s=arc-20160816; b=nscxbbbdXWil/zPmRFB8W/5SwCY063/xVIRgFRaJ2oZxpdOAuu5E5iVUjskLcnkvj0 3JAASiScW+ciTOXASsm4wtEzLcrq/wNKqi21TXuLXPPu8k3yKBuUHUAdLgBQC1nVO1pW j8rU7H6G1JGEnq0EUeptT1TISddVH6jlKLup8ONnx+Fzj8QW2nnzLH7vqX+m2iJfv16B VuGgIAGZDX1vN/UfixNcYZc/wGHuCJfE0yuNZw1IqPqYr0tt9YScZGBelrdSt2IlRVJU +brXWFMrJeYWltmBDtdo4JsqT1jL8hwrR7V6ZtCLhDJ/rs1K+xK5Ggfp9d7ieoQA2Kky HgVw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=IhWA1oShucXppof+qg42YmcCjhcnT7SAUAkt3rakeD0=; fh=GbRF/PLjfKCfGxYZuCfu2HcWYi01esDTISDIiSiXqpc=; b=Xi7iMS0kq2xI9eKErJ42LSZ/cgIQQy+eUyEFmziu0rl/7yBXVwjVnTdLB4v5FwVbL4 XIo+GGfNkDinXoAojSrPfOuzIppcOdPXLR0qrAwJk+BL0HGFgJym7eJ63CZcqq+O9XzT tr7cUWZyeG+ZAOCGNXUCmeg4VjsHABCoKTW8jAaR4BHySSVS02xGSe+WasIibRKc6YFV TiDK9BQnXe9KLfaYCXg+6btAr/NSInPrha1FCTdma4e2FmJYMVgaaHL4qLCd/hsYktZT a106+wEjTrhUteXES/kei0HdWswui1IAkQUfApsMSF39Q0VFisF/Jf3o1SH23g/e4f90 XWWg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b="R98/Lrn6"; 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 p14-20020a1709061b4e00b0098d7e44a637si1677767ejg.794.2023.07.27.13.25.16; Thu, 27 Jul 2023 13:26:03 -0700 (PDT) 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=@infradead.org header.s=casper.20170209 header.b="R98/Lrn6"; 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 S232692AbjG0UI6 (ORCPT + 99 others); Thu, 27 Jul 2023 16:08:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44632 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232712AbjG0UIz (ORCPT ); Thu, 27 Jul 2023 16:08:55 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 125D230C0 for ; Thu, 27 Jul 2023 13:08:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=IhWA1oShucXppof+qg42YmcCjhcnT7SAUAkt3rakeD0=; b=R98/Lrn6IDomm0tcgvEXEmbsJT xKrwgZdwy0whwBN5p8pITyN2W8julJJeU6q2IDwmubwfSWlNRu6zdrwq2Pkm/MH6DFwcfFula7Am9 ohP4Mz09yuE797XvlVCZuaZQRaK29J1wqhmZvv6+MKg/DmEvmnr1X/Tc64O1TcUhK77xP+d2HtwrQ EghO3TFO3zwiMZMKGTo9kVMWZmmGdoyqZUnrC23QAyia2PZiRtUebFEAl2onZHP0aTB/b3UxkNJmi 5KiUGMIDCKdJfh4wkjJz1YnMvBOHnbiq+iO9Sy5KmXqW9+sOLLxC9hvByFa1FQY982PVc9vb/kLAb erTwwhzw==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1qP7I0-007pjS-0V; Thu, 27 Jul 2023 20:08:48 +0000 Date: Thu, 27 Jul 2023 21:08:47 +0100 From: Matthew Wilcox To: Jann Horn Cc: Suren Baghdasaryan , "Liam R. Howlett" , akpm@linux-foundation.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, syzkaller-bugs@googlegroups.com, syzbot Subject: Re: [syzbot] [mm?] WARNING: suspicious RCU usage in mas_walk (2) Message-ID: References: <000000000000607ff905ffc8e477@google.com> <0000000000000aeb7f06015e5cbd@google.com> <20230727164757.e2di75xjybxncohn@revolver> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE 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 Thu, Jul 27, 2023 at 09:20:33PM +0200, Jann Horn wrote: > One kinda straightforward option would be to pass the vmf (or NULL if > it's not in fault context) to anon_vma_prepare(), teach it to bail if > it runs under the mm lock, and propagate a VM_FAULT_RETRY all the way > up? It can already fail due to OOM, so the bailout paths exist, though > you'd have to work a bit to plumb the right error code up. > > And if you're feeling adventurous, you could try to build a way to > opportunistically upgrade from vma lock to mmap lock, to avoid having > to bail out all the way back up and then dive back in when that > happens. Something that does mmap_read_trylock(); on failure, bail out > with VM_FAULT_RETRY; on success, drop the VMA lock and change > vmf->flags to note the changed locking context. I think that's all a little more adventurous than I'd be comfortable with right now ;-) I just sent the fix patch that syzbot tested to Andrew for integration.