lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210722213724.1f12a0e7@xhacker>
Date:   Thu, 22 Jul 2021 21:37:24 +0800
From:   Jisheng Zhang <jszhang3@...l.ustc.edu.cn>
To:     Atish Patra <atishp@...shpatra.org>
Cc:     Palmer Dabbelt <palmer@...belt.com>,
        Andreas Schwab <schwab@...ux-m68k.org>, tongtiangen@...wei.com,
        Paul Walmsley <paul.walmsley@...ive.com>,
        Albert Ou <aou@...s.berkeley.edu>,
        linux-riscv <linux-riscv@...ts.infradead.org>,
        "linux-kernel@...r.kernel.org List" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH -next v2] riscv: add VMAP_STACK overflow detection

On Thu, 22 Jul 2021 01:35:23 -0700
Atish Patra <atishp@...shpatra.org> wrote:

> On Wed, Jul 21, 2021 at 11:12 PM Palmer Dabbelt <palmer@...belt.com> wrote:
> >
> > On Mon, 19 Jul 2021 00:23:06 PDT (-0700), schwab@...ux-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@...ts.infradead.org
> > http://lists.infradead.org/mailman/listinfo/linux-riscv  
> 
> 
> 


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ