All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dmitry Vyukov <dvyukov@google.com>
To: Alex Ghiti <alex@ghiti.fr>
Cc: Tobias Klauser <tklauser@distanz.ch>,
	Albert Ou <aou@eecs.berkeley.edu>,
	Bjorn Topel <bjorn.topel@gmail.com>,
	Palmer Dabbelt <palmerdabbelt@google.com>,
	LKML <linux-kernel@vger.kernel.org>,
	nylon7@andestech.com, syzkaller <syzkaller@googlegroups.com>,
	Andreas Schwab <schwab@linux-m68k.org>,
	Paul Walmsley <paul.walmsley@sifive.com>,
	linux-riscv <linux-riscv@lists.infradead.org>
Subject: Re: riscv+KASAN does not boot
Date: Tue, 16 Feb 2021 12:25:28 +0100	[thread overview]
Message-ID: <CACT4Y+awHrJfFo+g33AiAnCj3vq6t6PqbL-3=Qbciy6dAJfVWg@mail.gmail.com> (raw)
In-Reply-To: <CACT4Y+ZNJBnkKHXUf=tm_yuowvZvHwN=0rmJ=7J+xFd+9r_6pQ@mail.gmail.com>

On Tue, Feb 16, 2021 at 12:17 PM Dmitry Vyukov <dvyukov@google.com> wrote:
>
> On Fri, Jan 29, 2021 at 9:11 AM Dmitry Vyukov <dvyukov@google.com> wrote:
> > > I was fixing KASAN support for my sv48 patchset so I took a look at your
> > > issue: I built a kernel on top of the branch riscv/fixes using
> > > https://github.com/google/syzkaller/blob/269d24e857a757d09a898086a2fa6fa5d827c3e1/dashboard/config/linux/upstream-riscv64-kasan.config
> > > and Buildroot 2020.11. I have the warnings regarding the use of
> > > __virt_to_phys on wrong addresses (but that's normal since this function
> > > is used in virt_addr_valid) but not the segfaults you describe.
> >
> > Hi Alex,
> >
> > Let me try to rebuild buildroot image. Maybe there was something wrong
> > with my build, though, I did 'make clean' before doing. But at the
> > same time it worked back in June...
> >
> > Re WARNINGs, they indicate kernel bugs. I am working on setting up a
> > syzbot instance on riscv. If there a WARNING during boot then the
> > kernel will be marked as broken. No further testing will happen.
> > Is it a mis-use of WARN_ON? If so, could anybody please remove it or
> > replace it with pr_err.
>
>
> Hi,
>
> I've localized one issue with riscv/KASAN:
> KASAN breaks VDSO and that's I think the root cause of weird faults I
> saw earlier. The following patch fixes it.
> Could somebody please upstream this fix? I don't know how to add/run
> tests for this.
> Thanks
>
> diff --git a/arch/riscv/kernel/vdso/Makefile b/arch/riscv/kernel/vdso/Makefile
> index 0cfd6da784f84..cf3a383c1799d 100644
> --- a/arch/riscv/kernel/vdso/Makefile
> +++ b/arch/riscv/kernel/vdso/Makefile
> @@ -35,6 +35,7 @@ CFLAGS_REMOVE_vgettimeofday.o = $(CC_FLAGS_FTRACE) -Os
>  # Disable gcov profiling for VDSO code
>  GCOV_PROFILE := n
>  KCOV_INSTRUMENT := n
> +KASAN_SANITIZE := n
>
>  # Force dependency
>  $(obj)/vdso.o: $(obj)/vdso.so



Second issue I am seeing seems to be related to text segment size.
I check out v5.11 and use this config:
https://gist.github.com/dvyukov/6af25474d455437577a84213b0cc9178

Then trying to boot it using:
QEMU emulator version 5.2.0 (Debian 1:5.2+dfsg-3)
$ qemu-system-riscv64 -machine virt -smp 2 -m 4G ...

It shows no output from the kernel whatsoever, even though I have
earlycon and output shows very early with other configs.
Kernel boots fine with defconfig and other smaller configs.

If I enable KASAN_OUTLINE and CC_OPTIMIZE_FOR_SIZE, then this config
also boots fine. Both of these options significantly reduce kernel
size. However, I can also boot the kernel without these 2 configs, if
I disable a whole lot of subsystem configs. This makes me think that
there is an issue related to kernel size somewhere in
qemu/bootloader/kernel bootstrap code.
Does it make sense to you? Can somebody reproduce what I am seeing?

Thanks

WARNING: multiple messages have this Message-ID (diff)
From: Dmitry Vyukov <dvyukov@google.com>
To: Alex Ghiti <alex@ghiti.fr>
Cc: Albert Ou <aou@eecs.berkeley.edu>,
	Bjorn Topel <bjorn.topel@gmail.com>,
	Palmer Dabbelt <palmerdabbelt@google.com>,
	LKML <linux-kernel@vger.kernel.org>,
	nylon7@andestech.com, syzkaller <syzkaller@googlegroups.com>,
	Andreas Schwab <schwab@linux-m68k.org>,
	Paul Walmsley <paul.walmsley@sifive.com>,
	Tobias Klauser <tklauser@distanz.ch>,
	linux-riscv <linux-riscv@lists.infradead.org>
Subject: Re: riscv+KASAN does not boot
Date: Tue, 16 Feb 2021 12:25:28 +0100	[thread overview]
Message-ID: <CACT4Y+awHrJfFo+g33AiAnCj3vq6t6PqbL-3=Qbciy6dAJfVWg@mail.gmail.com> (raw)
In-Reply-To: <CACT4Y+ZNJBnkKHXUf=tm_yuowvZvHwN=0rmJ=7J+xFd+9r_6pQ@mail.gmail.com>

On Tue, Feb 16, 2021 at 12:17 PM Dmitry Vyukov <dvyukov@google.com> wrote:
>
> On Fri, Jan 29, 2021 at 9:11 AM Dmitry Vyukov <dvyukov@google.com> wrote:
> > > I was fixing KASAN support for my sv48 patchset so I took a look at your
> > > issue: I built a kernel on top of the branch riscv/fixes using
> > > https://github.com/google/syzkaller/blob/269d24e857a757d09a898086a2fa6fa5d827c3e1/dashboard/config/linux/upstream-riscv64-kasan.config
> > > and Buildroot 2020.11. I have the warnings regarding the use of
> > > __virt_to_phys on wrong addresses (but that's normal since this function
> > > is used in virt_addr_valid) but not the segfaults you describe.
> >
> > Hi Alex,
> >
> > Let me try to rebuild buildroot image. Maybe there was something wrong
> > with my build, though, I did 'make clean' before doing. But at the
> > same time it worked back in June...
> >
> > Re WARNINGs, they indicate kernel bugs. I am working on setting up a
> > syzbot instance on riscv. If there a WARNING during boot then the
> > kernel will be marked as broken. No further testing will happen.
> > Is it a mis-use of WARN_ON? If so, could anybody please remove it or
> > replace it with pr_err.
>
>
> Hi,
>
> I've localized one issue with riscv/KASAN:
> KASAN breaks VDSO and that's I think the root cause of weird faults I
> saw earlier. The following patch fixes it.
> Could somebody please upstream this fix? I don't know how to add/run
> tests for this.
> Thanks
>
> diff --git a/arch/riscv/kernel/vdso/Makefile b/arch/riscv/kernel/vdso/Makefile
> index 0cfd6da784f84..cf3a383c1799d 100644
> --- a/arch/riscv/kernel/vdso/Makefile
> +++ b/arch/riscv/kernel/vdso/Makefile
> @@ -35,6 +35,7 @@ CFLAGS_REMOVE_vgettimeofday.o = $(CC_FLAGS_FTRACE) -Os
>  # Disable gcov profiling for VDSO code
>  GCOV_PROFILE := n
>  KCOV_INSTRUMENT := n
> +KASAN_SANITIZE := n
>
>  # Force dependency
>  $(obj)/vdso.o: $(obj)/vdso.so



Second issue I am seeing seems to be related to text segment size.
I check out v5.11 and use this config:
https://gist.github.com/dvyukov/6af25474d455437577a84213b0cc9178

Then trying to boot it using:
QEMU emulator version 5.2.0 (Debian 1:5.2+dfsg-3)
$ qemu-system-riscv64 -machine virt -smp 2 -m 4G ...

It shows no output from the kernel whatsoever, even though I have
earlycon and output shows very early with other configs.
Kernel boots fine with defconfig and other smaller configs.

If I enable KASAN_OUTLINE and CC_OPTIMIZE_FOR_SIZE, then this config
also boots fine. Both of these options significantly reduce kernel
size. However, I can also boot the kernel without these 2 configs, if
I disable a whole lot of subsystem configs. This makes me think that
there is an issue related to kernel size somewhere in
qemu/bootloader/kernel bootstrap code.
Does it make sense to you? Can somebody reproduce what I am seeing?

Thanks

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

  reply	other threads:[~2021-02-16 11:26 UTC|newest]

Thread overview: 55+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-25 14:55 riscv+KASAN does not boot Dmitry Vyukov
2020-12-25 14:55 ` Dmitry Vyukov
2020-12-25 16:58 ` Andreas Schwab
2020-12-25 16:58   ` Andreas Schwab
2020-12-25 17:13   ` Dmitry Vyukov
2020-12-25 17:13     ` Dmitry Vyukov
2021-01-14  4:57     ` Palmer Dabbelt
2021-01-14  4:57       ` Palmer Dabbelt
2021-01-14  9:23       ` Dmitry Vyukov
2021-01-14  9:23         ` Dmitry Vyukov
2021-01-14 10:24         ` Dmitry Vyukov
2021-01-14 10:24           ` Dmitry Vyukov
2021-01-14 11:24           ` Dmitry Vyukov
2021-01-14 11:24             ` Dmitry Vyukov
2021-01-18 14:53           ` Tobias Klauser
2021-01-18 14:53             ` Tobias Klauser
2021-01-18 15:05             ` Dmitry Vyukov
2021-01-18 15:05               ` Dmitry Vyukov
2021-01-18 15:43               ` Dmitry Vyukov
2021-01-18 15:43                 ` Dmitry Vyukov
2021-01-29  7:45                 ` Alex Ghiti
2021-01-29  7:45                   ` Alex Ghiti
2021-01-29  8:11                   ` Dmitry Vyukov
2021-02-16 11:17                     ` Dmitry Vyukov
2021-02-16 11:17                       ` Dmitry Vyukov
2021-02-16 11:25                       ` Dmitry Vyukov [this message]
2021-02-16 11:25                         ` Dmitry Vyukov
2021-02-16 13:45                         ` Dmitry Vyukov
2021-02-16 13:45                           ` Dmitry Vyukov
2021-02-16 20:42                         ` Alex Ghiti
2021-02-16 20:42                           ` Alex Ghiti
2021-02-17  4:42                           ` Dmitry Vyukov
2021-02-17  4:42                             ` Dmitry Vyukov
2021-02-17 16:36                             ` Alex Ghiti
2021-02-17 16:36                               ` Alex Ghiti
2021-02-17 17:34                               ` Dmitry Vyukov
2021-02-17 17:34                                 ` Dmitry Vyukov
2021-02-18  7:54                                 ` Alex Ghiti
2021-02-18  7:54                                   ` Alex Ghiti
2021-02-18 11:36                                   ` Dmitry Vyukov
2021-02-18 11:36                                     ` Dmitry Vyukov
2021-02-19 17:01                                     ` Alex Ghiti
2021-02-19 17:01                                       ` Alex Ghiti
2021-02-19 18:53                                       ` Dmitry Vyukov
2021-02-19 18:53                                         ` Dmitry Vyukov
2021-02-19 22:26                                         ` Palmer Dabbelt
2021-02-19 22:26                                           ` Palmer Dabbelt
2021-03-09 17:11                                           ` Dmitry Vyukov
2021-03-09 17:11                                             ` Dmitry Vyukov
2021-03-09 19:49                                             ` Alex Ghiti
2021-03-09 19:49                                               ` Alex Ghiti
2021-03-10 17:25                                               ` Dmitry Vyukov
2021-03-10 17:25                                                 ` Dmitry Vyukov
2021-02-16 17:35                       ` Tobias Klauser
2021-02-16 17:35                         ` Tobias Klauser

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='CACT4Y+awHrJfFo+g33AiAnCj3vq6t6PqbL-3=Qbciy6dAJfVWg@mail.gmail.com' \
    --to=dvyukov@google.com \
    --cc=alex@ghiti.fr \
    --cc=aou@eecs.berkeley.edu \
    --cc=bjorn.topel@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=nylon7@andestech.com \
    --cc=palmerdabbelt@google.com \
    --cc=paul.walmsley@sifive.com \
    --cc=schwab@linux-m68k.org \
    --cc=syzkaller@googlegroups.com \
    --cc=tklauser@distanz.ch \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.