Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp27034437rwd; Mon, 3 Jul 2023 19:45:07 -0700 (PDT) X-Google-Smtp-Source: APBJJlEjYQCIveCy7YbCm1HQd3b0EHx0/qpm7sEHRflwsppHldOyvt1GFIg7j1SUv9TmOgI/Z/4O X-Received: by 2002:a05:6a00:2d84:b0:66a:386c:e6a6 with SMTP id fb4-20020a056a002d8400b0066a386ce6a6mr16009879pfb.6.1688438707141; Mon, 03 Jul 2023 19:45:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688438707; cv=none; d=google.com; s=arc-20160816; b=QTlSOeegqVDa1In87FotafrsK9/SR9KtREhRRSWASF8uTAE+XNArHSxUP4tkQUyCsa up5Tyr0UJkgv3O9DjM/wSNcrpuq+sYD+1DmfyLJ2oEnQRSeACXDbR9BDP2U2FWDdAt9m CluEo8JrYrQE1RMikPNdCRl6r1KWK7vuHLUkyUSBubPCWU0USCIb3T6YLJuxGP2Ptdvk +MJJqtZLYrhjVS0nF1/b9UQV3LZDScS5XhzCQ9WVVIk7/pAMMqYgZ6wK9hsR3Tusg/3e pDfRAv33d5CHHZPdcP62tZDjJtzfPuegcI9o2tj/Vzv+f/4HmoP4J+KUe6qI0KZBxz6u Uaaw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=aO7eVml/O3X6+0FbiNIO683uCX1yJlTsFWTwSAnwfZw=; fh=mFH+Lyp36yDJZbE0eJd+jrw9wF7EgMeWWVIVD8t2D2c=; b=X0ciSsq20AzAvVA965w8ospwpB7OWWK2jPbkZPxiTV67qzaBlbgIpTHIUUslDUJ+OR lBEm6/ZBbAcwNXmBhde8ewAoJm18+KBxJcTIVsKnx0BbMJ4BFt02O4t3O6aBPtjNCAVG 8Kw8oQ7i0TE1O1bsbB//OGsl5Iz0UFyCYwa3KK4Wi+v8d4idzFgUvxkQdyTx9f1L7Woj 8FFWFerJgpVGnNHV2MfUVWugws/TU1ukSUvCz+q6PPqfArkbfOa/15sytgfpq0QSKLY7 wfAM2UwLuJgrvt6sTYHCVj+WDYgd2ON8a1Q1Uw3Zt0uF9lqBqS5HoLOATxqqF5sMZ3OE MIxA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=SL8qA8aT; 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 v3-20020a655c43000000b005579f529f71si17982690pgr.793.2023.07.03.19.44.53; Mon, 03 Jul 2023 19:45:07 -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=@linux-foundation.org header.s=google header.b=SL8qA8aT; 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 S230301AbjGDCaN (ORCPT + 99 others); Mon, 3 Jul 2023 22:30:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35330 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229844AbjGDCaM (ORCPT ); Mon, 3 Jul 2023 22:30:12 -0400 Received: from mail-ej1-x636.google.com (mail-ej1-x636.google.com [IPv6:2a00:1450:4864:20::636]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CFC1FE59 for ; Mon, 3 Jul 2023 19:30:09 -0700 (PDT) Received: by mail-ej1-x636.google.com with SMTP id a640c23a62f3a-98df3dea907so594410266b.3 for ; Mon, 03 Jul 2023 19:30:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; t=1688437807; x=1691029807; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=aO7eVml/O3X6+0FbiNIO683uCX1yJlTsFWTwSAnwfZw=; b=SL8qA8aTYyLZtPQIBrBzUgO8eWCCxqiLdnKYPvDnOCCAuIoTpBSwRftLEhxWwN+ZLW 7zWghFJjCwFWbCEZ77hGR/2EAhjZciJ76YXnffYImtyKNbhJBUNSDk9BJGx4unDJGMTZ suPcOn2OXDj0IWQU9j8EpWIQqybEtaG55qCl8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688437807; x=1691029807; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=aO7eVml/O3X6+0FbiNIO683uCX1yJlTsFWTwSAnwfZw=; b=eaXESoAZuwQNW1Ji369s4uI0uE+ssUwF8R4dubnbS86X2CY4LdGkfa9RWJwbYwuijT pj8LJHV1FQAnCa0zmEsU9YoN4a66tmaLNhaQDq+Cmb77/A9nXCSbwINXhXbR48Vr7uIy DtDSMK3I72FhinT0eaF/NeQOPiRHtXKfPHVCqFlOsn+svOnJdoxYRiB0XaV40dzugXd1 95BXO1mlM75ndmY6c7+Fq3IXPCHZXLta3AP+4J57nKXekDqP0bu0xzqv+DsvbULpIn1H f0ZHhnyt1LGj0vmBMSbbcrv75X2eno8o6R3JpxzkEJuEFo0VBrl/Wp8pzogkCTFTpHNl xlEw== X-Gm-Message-State: AC+VfDyNoq+HxhW0fZ/ab0RGrIKvJwFIhT4lHPoFuYg6gKa8rvKOWHRi o03TK/58qgIabFzvIUUCIsLW2ehfYoVT3HKKMGPTKCl3 X-Received: by 2002:a17:906:4e06:b0:992:2c5a:808e with SMTP id z6-20020a1709064e0600b009922c5a808emr9020722eju.7.1688437807227; Mon, 03 Jul 2023 19:30:07 -0700 (PDT) Received: from mail-ed1-f52.google.com (mail-ed1-f52.google.com. [209.85.208.52]) by smtp.gmail.com with ESMTPSA id j18-20020a170906831200b0098733a40bb7sm12673099ejx.155.2023.07.03.19.30.05 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 03 Jul 2023 19:30:06 -0700 (PDT) Received: by mail-ed1-f52.google.com with SMTP id 4fb4d7f45d1cf-51d804c7d14so5723653a12.3 for ; Mon, 03 Jul 2023 19:30:05 -0700 (PDT) X-Received: by 2002:aa7:d8d9:0:b0:51d:e498:201 with SMTP id k25-20020aa7d8d9000000b0051de4980201mr8047997eds.27.1688437805666; Mon, 03 Jul 2023 19:30:05 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Linus Torvalds Date: Mon, 3 Jul 2023 19:29:48 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [mm] 408579cd62: WARNING:suspicious_RCU_usage To: Oliver Sang Cc: "Liam R. Howlett" , LKML , lkp@lists.01.org, lkp@intel.com Content-Type: multipart/mixed; boundary="000000000000a1f7f705ffa00fe0" X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE, URIBL_BLOCKED autolearn=no 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 --000000000000a1f7f705ffa00fe0 Content-Type: text/plain; charset="UTF-8" On Mon, 3 Jul 2023 at 18:48, Oliver Sang wrote: > > by patch [1], we found the warning is not fixed. Hmm. I already committed that "fix" as obvious, since the main difference in commit 408579cd627a ("mm: Update do_vmi_align_munmap() return semantics") around that validate_mm() call was how it did that mmap_read_unlock(). > we also found there are some changes in stack backtrace. now it's as below: > (detail dmesg is attached) > > [ 26.412372][ T1] stack backtrace: > [ 26.412846][ T1] CPU: 0 PID: 1 Comm: systemd Not tainted 6.4.0-09908-gcb226fb1fb7a #1 > [ 26.413506][ T1] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.2-debian-1.16.2-1 04/01/2014 > [ 26.414326][ T1] Call Trace: > [ 26.414605][ T1] > [ 26.414847][ T1] dump_stack_lvl+0x73/0xc0 > [ 26.415225][ T1] lockdep_rcu_suspicious+0x1b7/0x280 > [ 26.415669][ T1] mas_start+0x280/0x400 > [ 26.416037][ T1] mas_find+0x27a/0x400 > [ 26.416391][ T1] validate_mm+0x8b/0x2c0 > [ 26.416757][ T1] __se_sys_brk+0xa35/0xc00 Ok, that is indeed a very different stack trace. So maybe the fix is a real fix, but the first complaint shut up lockdep, so this is the *second* and unrelated complaint. And indeed: it turns out that do_vma_munmap() does this: ret = do_vmi_align_munmap(vmi, vma, mm, start, end, uf, unlock); validate_mm(mm); and so we have *another* validate_mm() that is now done outside the lock. That one is actually pretty pointless. We've *just* validated the mm already inside do_vmi_align_munmap(), except we only did it in one of the two return cases. So I think the fix is to just move that validate_mm() into the other return case of do_vmi_align_munmap(), and remove it from the caller. IOW, something like the attached (NOTE! This is in *addition* to the previous patch, which is the same as the one you quoted, just with slightly different whitespace as commit ae80b4041984: "mm: validate the mm before dropping the mmap lock"). Linus --000000000000a1f7f705ffa00fe0 Content-Type: text/x-patch; charset="US-ASCII"; name="patch.diff" Content-Disposition: attachment; filename="patch.diff" Content-Transfer-Encoding: base64 Content-ID: X-Attachment-Id: f_ljno9i7t0 IG1tL21tYXAuYyB8IDYgKystLS0tCiAxIGZpbGUgY2hhbmdlZCwgMiBpbnNlcnRpb25zKCspLCA0 IGRlbGV0aW9ucygtKQoKZGlmZiAtLWdpdCBhL21tL21tYXAuYyBiL21tL21tYXAuYwppbmRleCA1 NDdiNDA1Mz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