* Re: [PATCH v4 0/3] KASAN support for RISC-V
[not found] <20191028024101.26655-1-nickhu@andestech.com>
@ 2019-10-28 7:01 ` Greentime Hu
[not found] ` <20191028024101.26655-2-nickhu@andestech.com>
1 sibling, 0 replies; 4+ messages in thread
From: Greentime Hu @ 2019-10-28 7:01 UTC (permalink / raw)
To: Nick Hu, Greentime Hu
Cc: aryabinin, Alexander Potapenko, Dmitry Vyukov, corbet,
Paul Walmsley, Palmer Dabbelt, Albert Ou, Thomas Gleixner, gregkh,
alankao, Anup.Patel, atish.patra, kasan-dev, linux-doc,
Linux Kernel Mailing List, linux-riscv, linux-mm
Nick Hu <nickhu@andestech.com> 於 2019年10月28日 週一 上午10:41寫道:
>
> KASAN is an important runtime memory debugging feature in linux kernel which can
> detect use-after-free and out-of-bounds problems.
>
> Changes in v2:
> - Remove the porting of memmove and exclude the check instead.
> - Fix some code noted by Christoph Hellwig
>
> Changes in v3:
> - Update the KASAN documentation to mention that riscv is supported.
>
> Changes in v4:
> - Correct the commit log
> - Fix the bug reported by Greentime Hu
>
> Nick Hu (3):
> kasan: No KASAN's memmove check if archs don't have it.
> riscv: Add KASAN support
> kasan: Add riscv to KASAN documentation.
>
> Documentation/dev-tools/kasan.rst | 4 +-
> arch/riscv/Kconfig | 1 +
> arch/riscv/include/asm/kasan.h | 27 ++++++++
> arch/riscv/include/asm/pgtable-64.h | 5 ++
> arch/riscv/include/asm/string.h | 9 +++
> arch/riscv/kernel/head.S | 3 +
> arch/riscv/kernel/riscv_ksyms.c | 2 +
> arch/riscv/kernel/setup.c | 5 ++
> arch/riscv/kernel/vmlinux.lds.S | 1 +
> arch/riscv/lib/memcpy.S | 5 +-
> arch/riscv/lib/memset.S | 5 +-
> arch/riscv/mm/Makefile | 6 ++
> arch/riscv/mm/kasan_init.c | 104 ++++++++++++++++++++++++++++
> mm/kasan/common.c | 2 +
> 14 files changed, 173 insertions(+), 6 deletions(-)
> create mode 100644 arch/riscv/include/asm/kasan.h
> create mode 100644 arch/riscv/mm/kasan_init.c
>
Hi Nick,
I have tested KASAN feature with test_kasan.ko based on commit
cd9e72b80090a8cd7d84a47a30a06fa92ff277d1 (tag: riscv/for-v5.4-rc3) and
it passed in Qemu and Unleashed board.
Thank you for fixing the bug. :)
Tested-by: Greentime Hu <greentime.hu@sifive.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v4 1/3] kasan: No KASAN's memmove check if archs don't have it.
[not found] ` <20191028024101.26655-2-nickhu@andestech.com>
@ 2019-11-17 4:57 ` Paul Walmsley
2019-11-18 8:41 ` Dmitry Vyukov
2019-11-18 16:22 ` Andrey Ryabinin
1 sibling, 1 reply; 4+ messages in thread
From: Paul Walmsley @ 2019-11-17 4:57 UTC (permalink / raw)
To: dvyukov, glider, aryabinin
Cc: Nick Hu, corbet, palmer, aou, tglx, gregkh, alankao, Anup.Patel,
atish.patra, kasan-dev, linux-doc, linux-kernel, linux-riscv,
linux-mm, green.hu
Hello Andrey, Alexander, Dmitry,
On Mon, 28 Oct 2019, Nick Hu wrote:
> If archs don't have memmove then the C implementation from lib/string.c is used,
> and then it's instrumented by compiler. So there is no need to add KASAN's
> memmove to manual checks.
>
> Signed-off-by: Nick Hu <nickhu@andestech.com>
If you're happy with this revision of this patch, could you please ack it
so we can merge it as part of the RISC-V KASAN patch set?
Or if you'd prefer to take this patch yourself, please let me know.
- Paul
> ---
> mm/kasan/common.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/mm/kasan/common.c b/mm/kasan/common.c
> index 6814d6d6a023..897f9520bab3 100644
> --- a/mm/kasan/common.c
> +++ b/mm/kasan/common.c
> @@ -107,6 +107,7 @@ void *memset(void *addr, int c, size_t len)
> return __memset(addr, c, len);
> }
>
> +#ifdef __HAVE_ARCH_MEMMOVE
> #undef memmove
> void *memmove(void *dest, const void *src, size_t len)
> {
> @@ -115,6 +116,7 @@ void *memmove(void *dest, const void *src, size_t len)
>
> return __memmove(dest, src, len);
> }
> +#endif
>
> #undef memcpy
> void *memcpy(void *dest, const void *src, size_t len)
> --
> 2.17.0
>
>
> _______________________________________________
> linux-riscv mailing list
> linux-riscv@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-riscv
>
- Paul
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v4 1/3] kasan: No KASAN's memmove check if archs don't have it.
2019-11-17 4:57 ` [PATCH v4 1/3] kasan: No KASAN's memmove check if archs don't have it Paul Walmsley
@ 2019-11-18 8:41 ` Dmitry Vyukov
0 siblings, 0 replies; 4+ messages in thread
From: Dmitry Vyukov @ 2019-11-18 8:41 UTC (permalink / raw)
To: Paul Walmsley
Cc: Alexander Potapenko, Andrey Ryabinin, Nick Hu, Jonathan Corbet,
palmer, aou, Thomas Gleixner, Greg Kroah-Hartman, alankao,
Anup.Patel, atish.patra, kasan-dev, open list:DOCUMENTATION, LKML,
linux-riscv, Linux-MM, green.hu
On Sun, Nov 17, 2019 at 5:58 AM Paul Walmsley <paul.walmsley@sifive.com> wrote:
>
> Hello Andrey, Alexander, Dmitry,
>
> On Mon, 28 Oct 2019, Nick Hu wrote:
>
> > If archs don't have memmove then the C implementation from lib/string.c is used,
> > and then it's instrumented by compiler. So there is no need to add KASAN's
> > memmove to manual checks.
> >
> > Signed-off-by: Nick Hu <nickhu@andestech.com>
>
> If you're happy with this revision of this patch, could you please ack it
> so we can merge it as part of the RISC-V KASAN patch set?
>
> Or if you'd prefer to take this patch yourself, please let me know.
Hi Paul,
Acked-by: Dmitry Vyukov <dvyukov@google.com>
We don't have separate tree for kasan. Merging this via RISC-V tree
should be fine.
Thanks
> -
>
> > ---
> > mm/kasan/common.c | 2 ++
> > 1 file changed, 2 insertions(+)
> >
> > diff --git a/mm/kasan/common.c b/mm/kasan/common.c
> > index 6814d6d6a023..897f9520bab3 100644
> > --- a/mm/kasan/common.c
> > +++ b/mm/kasan/common.c
> > @@ -107,6 +107,7 @@ void *memset(void *addr, int c, size_t len)
> > return __memset(addr, c, len);
> > }
> >
> > +#ifdef __HAVE_ARCH_MEMMOVE
> > #undef memmove
> > void *memmove(void *dest, const void *src, size_t len)
> > {
> > @@ -115,6 +116,7 @@ void *memmove(void *dest, const void *src, size_t len)
> >
> > return __memmove(dest, src, len);
> > }
> > +#endif
> >
> > #undef memcpy
> > void *memcpy(void *dest, const void *src, size_t len)
> > --
> > 2.17.0
> >
> >
> > _______________________________________________
> > linux-riscv mailing list
> > linux-riscv@lists.infradead.org
> > http://lists.infradead.org/mailman/listinfo/linux-riscv
> >
>
>
> - Paul
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v4 1/3] kasan: No KASAN's memmove check if archs don't have it.
[not found] ` <20191028024101.26655-2-nickhu@andestech.com>
2019-11-17 4:57 ` [PATCH v4 1/3] kasan: No KASAN's memmove check if archs don't have it Paul Walmsley
@ 2019-11-18 16:22 ` Andrey Ryabinin
1 sibling, 0 replies; 4+ messages in thread
From: Andrey Ryabinin @ 2019-11-18 16:22 UTC (permalink / raw)
To: Nick Hu, glider, dvyukov, corbet, paul.walmsley, palmer, aou,
tglx, gregkh, alankao, Anup.Patel, atish.patra, kasan-dev,
linux-doc, linux-kernel, linux-riscv, linux-mm, green.hu
On 10/28/19 5:40 AM, Nick Hu wrote:
> If archs don't have memmove then the C implementation from lib/string.c is used,
> and then it's instrumented by compiler. So there is no need to add KASAN's
> memmove to manual checks.
>
> Signed-off-by: Nick Hu <nickhu@andestech.com>
> ---
Acked-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-11-18 16:23 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20191028024101.26655-1-nickhu@andestech.com>
2019-10-28 7:01 ` [PATCH v4 0/3] KASAN support for RISC-V Greentime Hu
[not found] ` <20191028024101.26655-2-nickhu@andestech.com>
2019-11-17 4:57 ` [PATCH v4 1/3] kasan: No KASAN's memmove check if archs don't have it Paul Walmsley
2019-11-18 8:41 ` Dmitry Vyukov
2019-11-18 16:22 ` Andrey Ryabinin
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).