Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp552300pxv; Thu, 22 Jul 2021 06:48:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxMauneFNPpBNgp3o3M9isrFt5IwHRUO7ixT7YCE87YUSB828L9HIhgvHQaTLi/9pQwgIcb X-Received: by 2002:aa7:db54:: with SMTP id n20mr54729072edt.21.1626961719066; Thu, 22 Jul 2021 06:48:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626961719; cv=none; d=google.com; s=arc-20160816; b=X+lr9NlKpZZ30a0pl0yFOK3Bx4nu8pqVNp+IecWfgiUjPcLvT0EssUJOOPHP3jDHK/ qXLqzjnTkj8m/hnmGxWM+E+yg72C/ab98LaEnVOqvki63A0VSXRO8sn7aUaupaZSFa9X jG9PLHB/ruxmw+ezjQKJRoZJX2vMLhl2FZ3VcU13Q+BKdUKBLLGaBzq3VdcYJtZG7LpV /TWX9jLgMlLzjM5VpLRIS15hmlveMDYzuC3F8qLz55MdEK5i2mIaMslBmdvib4A1Tgdy QLaSfVNPrDHqnggW3O9B74geTDRsSCo+DD/XZCUH/RDJ3OV+KfrlaEZ+RAlpWS6k1Rt3 EmIg== 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=l8zDJN5bZAFId48Si81LajFQMuJUpb9aZVtz4iKiX70=; b=As44yheIevBh6eqaPu1m2KHV5LexPeF5UBXCTMFdd0vppUN0F6FFnTsRXPSVFKMKlO 5fvqgmz+nsVys7Mw65FE2Uv9XPFQvdG77+gw9Y01TSELxg6dn271T0TH3tASYH/MmQzw LmuvNudx0q10veqL+NJuhXsIKa0CZyZ9CsP9EwFITw0sEURuj+pXynoDEIoiXr08Obw/ gkfEEwn+u4VRceGt7li6oBasQfz3kL+ksYk9SOFiAsMzRIr+G6OIMIsD3neknv6ZdjjH QMDXJBvcFz0ZQHmbjBARph0IUloEdXRjRVTiR6x2cEQyifLE32HztY895L86nuOskekb 7NFQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mail.ustc.edu.cn header.s=dkim header.b=pDSuexZR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mail.ustc.edu.cn Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x41si29079438edy.469.2021.07.22.06.48.15; Thu, 22 Jul 2021 06:48:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@mail.ustc.edu.cn header.s=dkim header.b=pDSuexZR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mail.ustc.edu.cn Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232071AbhGVND4 (ORCPT + 99 others); Thu, 22 Jul 2021 09:03:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35160 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231925AbhGVNDl (ORCPT ); Thu, 22 Jul 2021 09:03:41 -0400 Received: from ustc.edu.cn (email6.ustc.edu.cn [IPv6:2001:da8:d800::8]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 44A3DC061575 for ; Thu, 22 Jul 2021 06:44:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mail.ustc.edu.cn; s=dkim; h=Received:Date:From:To:Cc:Subject: Message-ID:In-Reply-To:References:MIME-Version:Content-Type: Content-Transfer-Encoding; bh=l8zDJN5bZAFId48Si81LajFQMuJUpb9aZV tz4iKiX70=; b=pDSuexZRJSwskhXS56Ku+e485AW1Of13d4IeKO5gdv/Amhkdkj 7oetqXQ/hxI4Q2uq9Nz7mXZg3QJ202tNc9q/BL1hoLUgkIu/IYisWTyhonHj3ndw WUT6Os8qYOS40vzhN83BW+3PNv/XG2ZIgwire7BBXq1k+9H68Cpp8OyqU= Received: from xhacker (unknown [101.86.20.15]) by newmailweb.ustc.edu.cn (Coremail) with SMTP id LkAmygB3fm75dflgWBgmAA--.466S2; Thu, 22 Jul 2021 21:43:21 +0800 (CST) Date: Thu, 22 Jul 2021 21:37:24 +0800 From: Jisheng Zhang To: Atish Patra Cc: Palmer Dabbelt , Andreas Schwab , tongtiangen@huawei.com, Paul Walmsley , Albert Ou , linux-riscv , "linux-kernel@vger.kernel.org List" Subject: Re: [PATCH -next v2] riscv: add VMAP_STACK overflow detection Message-ID: <20210722213724.1f12a0e7@xhacker> In-Reply-To: References: <87bl6yrcmd.fsf@igel.home> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-CM-TRANSID: LkAmygB3fm75dflgWBgmAA--.466S2 X-Coremail-Antispam: 1UD129KBjvJXoW7ZFyxXFyDAFykXF45Gry3urg_yoW8trW3pF 45Gan09FWDtr1rtwn2vw1kWrW0vrnxJ3yaq3s8JFy5XryqvF15Xr1DWF15CrsrZrn8K3Wj vr4jgwsruw1DJa7anT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUyYb7Iv0xC_Kw4lb4IE77IF4wAFF20E14v26r4j6ryUM7CY07I2 0VC2zVCF04k26cxKx2IYs7xG6rWj6s0DM7CIcVAFz4kK6r1j6r18M28lY4IEw2IIxxk0rw A2F7IY1VAKz4vEj48ve4kI8wA2z4x0Y4vE2Ix0cI8IcVAFwI0_Xr0_Ar1l84ACjcxK6xII jxv20xvEc7CjxVAFwI0_Gr0_Cr1l84ACjcxK6I8E87Iv67AKxVW0oVCq3wA2z4x0Y4vEx4 A2jsIEc7CjxVAFwI0_GcCE3s1le2I262IYc4CY6c8Ij28IcVAaY2xG8wAqx4xG64xvF2IE w4CE5I8CrVC2j2WlYx0E2Ix0cI8IcVAFwI0_Jr0_Jr4lYx0Ex4A2jsIE14v26r1j6r4UMc vjeVCFs4IE7xkEbVWUJVW8JwACjcxG0xvEwIxGrwCF04k20xvY0x0EwIxGrwCFx2IqxVCF s4IE7xkEbVWUJVW8JwC20s026c02F40E14v26r1j6r18MI8I3I0E7480Y4vE14v26r106r 1rMI8E67AF67kF1VAFwI0_Jw0_GFylIxkGc2Ij64vIr41lIxAIcVC0I7IYx2IY67AKxVWU JVWUCwCI42IY6xIIjxv20xvEc7CjxVAFwI0_Jr0_Gr1lIxAIcVCF04k26cxKx2IYs7xG6r W3Jr0E3s1lIxAIcVC2z280aVAFwI0_Jr0_Gr1lIxAIcVC2z280aVCY1x0267AKxVWUJVW8 JbIYCTnIWIevJa73UjIFyTuYvjxUqEoXUUUUU X-CM-SenderInfo: xmv2xttqjtqzxdloh3xvwfhvlgxou0/ Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 22 Jul 2021 01:35:23 -0700 Atish Patra wrote: > On Wed, Jul 21, 2021 at 11:12 PM Palmer Dabbelt wrote: > > > > On Mon, 19 Jul 2021 00:23:06 PDT (-0700), schwab@linux-m68k.org wrote: > > > On Jul 19 2021, tongtiangen wrote: > > > > > >> On 2021/7/17 14:55, Andreas Schwab wrote: > > >>> Please use > > >>> https://download.opensuse.org/repositories/home:/Andreas_Schwab:/riscv:/jeos/images/openSUSE-Tumbleweed-RISC-V-JeOS-efi.riscv64.raw.xz > > >>> and run it in qemu with u-boot as kernel. > > >>> > > >>> Andreas. > > >>> > > >> > > >> Hi andreas: > > >> I used today's latest mainline code and .config provided by you, and I > > >> can't reproduce this panic. > > > > > > Did you test it like I said above? > > > > > > Andreas. > > > > I'm getting this on and off, with just > > > > CONFIG_VMAP_STACK=y > > > > on top of defconfig, when running on QEMU. It's not showing up right > > now: I'd thought it was an issue with that initrd patch, but it went > > away when I re-ran the tests so I'm guessing it's something > > non-deterministic. I'll try to take a look if it comes back. > > > > I got it very frequently on beagleV with the following branch & config. > https://github.com/esmil/linux/commits/beaglev > > beaglev_defconfig > > Disabling CONFIG_VMAP_STACK avoids the crash. Hi all, I think we need to pin the stack before calling get_wchan(), could you please try below patch? Thanks diff --git a/arch/riscv/kernel/stacktrace.c b/arch/riscv/kernel/stacktrace.c index ff467b98c3e3..ac7593607fa6 100644 --- a/arch/riscv/kernel/stacktrace.c +++ b/arch/riscv/kernel/stacktrace.c @@ -132,8 +132,12 @@ unsigned long get_wchan(struct task_struct *task) { unsigned long pc = 0; - if (likely(task && task != current && !task_is_running(task))) + if (likely(task && task != current && !task_is_running(task))) { + if (!try_get_task_stack(task)) + return 0; walk_stackframe(task, NULL, save_wchan, &pc); + put_task_stack(task); + } return pc; } > > > _______________________________________________ > > linux-riscv mailing list > > linux-riscv@lists.infradead.org > > http://lists.infradead.org/mailman/listinfo/linux-riscv > > >