LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Jisheng Zhang <jszhang3@mail.ustc.edu.cn>
To: Atish Patra <atishp@atishpatra.org>
Cc: Palmer Dabbelt <palmer@dabbelt.com>,
	Andreas Schwab <schwab@linux-m68k.org>,
	tongtiangen@huawei.com, Paul Walmsley <paul.walmsley@sifive.com>,
	Albert Ou <aou@eecs.berkeley.edu>,
	linux-riscv <linux-riscv@lists.infradead.org>,
	"linux-kernel@vger.kernel.org List"
	<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH -next v2] riscv: add VMAP_STACK overflow detection
Date: Thu, 22 Jul 2021 22:24:25 +0800	[thread overview]
Message-ID: <20210722222425.28673e88@xhacker> (raw)
In-Reply-To: <20210722213724.1f12a0e7@xhacker>

On Thu, 22 Jul 2021 21:37:24 +0800
Jisheng Zhang  wrote:

> On Thu, 22 Jul 2021 01:35:23 -0700
> Atish Patra <atishp@atishpatra.org> wrote:
> 
> > On Wed, Jul 21, 2021 at 11:12 PM Palmer Dabbelt <palmer@dabbelt.com> 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

Typo: s/get_wchan/walk_stackframe

> 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    
> > 
> > 
> >   
> 
> 
> 
> _______________________________________________
> linux-riscv mailing list
> linux-riscv@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-riscv



  reply	other threads:[~2021-07-22 14:30 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-21  3:28 Tong Tiangen
2021-07-06 20:24 ` Palmer Dabbelt
2021-07-15 16:22 ` Andreas Schwab
2021-07-16 12:53   ` Jisheng Zhang
2021-07-16 15:53     ` Andreas Schwab
2021-07-17  2:18       ` Jisheng Zhang
2021-07-17  6:55         ` Andreas Schwab
2021-07-19  3:27           ` tongtiangen
2021-07-19  7:23             ` Andreas Schwab
2021-07-22  6:12               ` Palmer Dabbelt
2021-07-22  8:35                 ` Atish Patra
2021-07-22 13:37                   ` Jisheng Zhang
2021-07-22 14:24                     ` Jisheng Zhang [this message]
2021-07-22 15:42                     ` Andreas Schwab
2021-07-22 23:54                       ` Jisheng Zhang
2021-07-23  1:36                         ` tongtiangen
2021-07-23  4:29                           ` Jisheng Zhang
2021-07-23  4:40                             ` Jisheng Zhang
2021-07-22  9:02                 ` Andreas Schwab

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210722222425.28673e88@xhacker \
    --to=jszhang3@mail.ustc.edu.cn \
    --cc=aou@eecs.berkeley.edu \
    --cc=atishp@atishpatra.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=palmer@dabbelt.com \
    --cc=paul.walmsley@sifive.com \
    --cc=schwab@linux-m68k.org \
    --cc=tongtiangen@huawei.com \
    --subject='Re: [PATCH -next v2] riscv: add VMAP_STACK overflow detection' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).