syzkaller on risc-v

Tobias Klauser tklauser at distanz.ch
Wed Jul 1 09:52:09 EDT 2020


On 2020-07-01 at 12:43:43 +0200, Björn Töpel <bjorn.topel at gmail.com> wrote:
> On Wed, 1 Jul 2020 at 12:42, Björn Töpel <bjorn.topel at gmail.com> wrote:
> >
> > On Tue, 30 Jun 2020 at 15:27, Dmitry Vyukov <dvyukov at google.com> wrote:
> > >
> > > On Tue, Jun 30, 2020 at 3:14 PM Andreas Schwab <schwab at suse.de> wrote:
> > > >
> > > > On Jun 30 2020, Dmitry Vyukov wrote:
> > > >
> > > > > KASAN would be a prerequisite for testing risc-v on syzbot.
> > > >
> > > > You need to implement the GCC support first.
> > >
> > > Interesting. Björn claimed KASAN works already.  And there is:
> > >
> > > commit 8ad8b72721d0f07fa02dbe71f901743f9c71c8e6
> > > Author: Nick Hu
> > > Date:   Mon Jan 6 10:38:32 2020 -0800
> > >     riscv: Add KASAN support
> > >
> > > Is there any known issue with gcc?
> > > Did anyone try clang? AddressSanitizer pass in clang is
> > > arch-independent. Not sure about gcc... it looked mostly
> > > arch-independent.
> >
> > Weird. Did a quick bisect (just "does it boot with KASAN or not"
> > test), and this fell out:
> >
> > --
> > efca13989250c3edebaf8fcaa8ca7c966739c65a is the first bad commit
> > commit efca13989250c3edebaf8fcaa8ca7c966739c65a
> > Author: Atish Patra <atish.patra at wdc.com>
> > Date:   Tue Mar 17 18:11:37 2020 -0700
> >
> >     RISC-V: Introduce a new config for SBI v0.1
> >
> >     We now have SBI v0.2 which is more scalable and extendable to handle
> >     future needs for RISC-V supervisor interfaces.
> >
> >     Introduce a new config and move all SBI v0.1 code under that config.
> >     This allows to implement the new replacement SBI extensions cleanly
> >     and remove v0.1 extensions easily in future. Currently, the config
> >     is enabled by default. Once all M-mode software, with v0.1, is no
> >     longer in use, this config option and all relevant code can be easily
> >     removed.
> >
> >     Signed-off-by: Atish Patra <atish.patra at wdc.com>
> >     Reviewed-by: Anup Patel <anup at brainfault.org>
> >     Signed-off-by: Palmer Dabbelt <palmerdabbelt at google.com>
> >
> >  arch/riscv/Kconfig           |   7 +++
> >  arch/riscv/include/asm/sbi.h |   2 +
> >  arch/riscv/kernel/sbi.c      | 132 +++++++++++++++++++++++++++++++++++--------
> >  3 files changed, 118 insertions(+), 23 deletions(-)
> > --
> >
> > I'll dig a bit more.
> >
> 
> Oh, forgot one thing; I'm booting the kernel with OpenSBI (OpenSBI
> v0.8-3-gec3e5b14d52a) and not the Berkley loader.

Thanks for the hint regarding OpenSDBI. I just tried it for booting a
kernel built from the riscv for-next branch at commit a2693fe254e7
("RISC-V: Use a local variable instead of smp_processor_id()") with the
following two additional patches:

  https://lore.kernel.org/linux-riscv/20200626124056.29708-1-tklauser@distanz.ch/
  https://lore.kernel.org/linux-riscv/20200627105050.11088-1-tklauser@distanz.ch/

As soon as I enable KASAN (regardless of CONFIG_KCOV being set or not),
it seems to hang after the OpenSBI boot messages, same as when using BBL.

FWIW I sent an update to the syzkaller docs to use OpenSBI instead of
BBL, since that seems to be the recommended way to boot now:

  https://github.com/google/syzkaller/pull/1888



More information about the linux-riscv mailing list