* [PATCH] riscv: Disable KSAN_SANITIZE for vDSO
@ 2021-02-16 17:33 Tobias Klauser
2021-02-17 4:36 ` Dmitry Vyukov
2021-02-19 7:15 ` Palmer Dabbelt
0 siblings, 2 replies; 4+ messages in thread
From: Tobias Klauser @ 2021-02-16 17:33 UTC (permalink / raw)
To: Paul Walmsley, Palmer Dabbelt, Albert Ou; +Cc: linux-riscv, Dmitry Vyukov
Dmitry Vyukov reports:
> 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.
Verified the fix on a kernel with KASAN enabled using vDSO selftests.
Link: https://lore.kernel.org/lkml/CACT4Y+ZNJBnkKHXUf=tm_yuowvZvHwN=0rmJ=7J+xFd+9r_6pQ@mail.gmail.com/
Cc: Dmitry Vyukov <dvyukov@google.com>
Tested-by: Tobias Klauser <tklauser@distanz.ch>
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
---
arch/riscv/kernel/vdso/Makefile | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/arch/riscv/kernel/vdso/Makefile b/arch/riscv/kernel/vdso/Makefile
index 0cfd6da784f8..71a315e73cbe 100644
--- a/arch/riscv/kernel/vdso/Makefile
+++ b/arch/riscv/kernel/vdso/Makefile
@@ -32,9 +32,10 @@ CPPFLAGS_vdso.lds += -P -C -U$(ARCH)
# Disable -pg to prevent insert call site
CFLAGS_REMOVE_vgettimeofday.o = $(CC_FLAGS_FTRACE) -Os
-# Disable gcov profiling for VDSO code
+# Disable profiling and instrumentation for VDSO code
GCOV_PROFILE := n
KCOV_INSTRUMENT := n
+KASAN_SANITIZE := n
# Force dependency
$(obj)/vdso.o: $(obj)/vdso.so
--
2.30.0
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] riscv: Disable KSAN_SANITIZE for vDSO
2021-02-16 17:33 [PATCH] riscv: Disable KSAN_SANITIZE for vDSO Tobias Klauser
@ 2021-02-17 4:36 ` Dmitry Vyukov
2021-02-19 7:15 ` Palmer Dabbelt
1 sibling, 0 replies; 4+ messages in thread
From: Dmitry Vyukov @ 2021-02-17 4:36 UTC (permalink / raw)
To: Tobias Klauser; +Cc: linux-riscv, Albert Ou, Palmer Dabbelt, Paul Walmsley
On Tue, Feb 16, 2021 at 6:33 PM Tobias Klauser <tklauser@distanz.ch> wrote:
>
> Dmitry Vyukov reports:
> > 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.
>
> Verified the fix on a kernel with KASAN enabled using vDSO selftests.
>
> Link: https://lore.kernel.org/lkml/CACT4Y+ZNJBnkKHXUf=tm_yuowvZvHwN=0rmJ=7J+xFd+9r_6pQ@mail.gmail.com/
> Cc: Dmitry Vyukov <dvyukov@google.com>
> Tested-by: Tobias Klauser <tklauser@distanz.ch>
> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Thanks for the quick fix!
Tested-by: Dmitry Vyukov <dvyukov@google.com>
> ---
> arch/riscv/kernel/vdso/Makefile | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/arch/riscv/kernel/vdso/Makefile b/arch/riscv/kernel/vdso/Makefile
> index 0cfd6da784f8..71a315e73cbe 100644
> --- a/arch/riscv/kernel/vdso/Makefile
> +++ b/arch/riscv/kernel/vdso/Makefile
> @@ -32,9 +32,10 @@ CPPFLAGS_vdso.lds += -P -C -U$(ARCH)
> # Disable -pg to prevent insert call site
> CFLAGS_REMOVE_vgettimeofday.o = $(CC_FLAGS_FTRACE) -Os
>
> -# Disable gcov profiling for VDSO code
> +# Disable profiling and instrumentation for VDSO code
> GCOV_PROFILE := n
> KCOV_INSTRUMENT := n
> +KASAN_SANITIZE := n
>
> # Force dependency
> $(obj)/vdso.o: $(obj)/vdso.so
> --
> 2.30.0
>
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] riscv: Disable KSAN_SANITIZE for vDSO
2021-02-16 17:33 [PATCH] riscv: Disable KSAN_SANITIZE for vDSO Tobias Klauser
2021-02-17 4:36 ` Dmitry Vyukov
@ 2021-02-19 7:15 ` Palmer Dabbelt
2021-02-19 9:09 ` Tobias Klauser
1 sibling, 1 reply; 4+ messages in thread
From: Palmer Dabbelt @ 2021-02-19 7:15 UTC (permalink / raw)
To: tklauser; +Cc: linux-riscv, aou, dvyukov, Paul Walmsley
On Tue, 16 Feb 2021 09:33:05 PST (-0800), tklauser@distanz.ch wrote:
> Dmitry Vyukov reports:
>> 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.
>
> Verified the fix on a kernel with KASAN enabled using vDSO selftests.
>
> Link: https://lore.kernel.org/lkml/CACT4Y+ZNJBnkKHXUf=tm_yuowvZvHwN=0rmJ=7J+xFd+9r_6pQ@mail.gmail.com/
> Cc: Dmitry Vyukov <dvyukov@google.com>
> Tested-by: Tobias Klauser <tklauser@distanz.ch>
> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
> ---
> arch/riscv/kernel/vdso/Makefile | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/arch/riscv/kernel/vdso/Makefile b/arch/riscv/kernel/vdso/Makefile
> index 0cfd6da784f8..71a315e73cbe 100644
> --- a/arch/riscv/kernel/vdso/Makefile
> +++ b/arch/riscv/kernel/vdso/Makefile
> @@ -32,9 +32,10 @@ CPPFLAGS_vdso.lds += -P -C -U$(ARCH)
> # Disable -pg to prevent insert call site
> CFLAGS_REMOVE_vgettimeofday.o = $(CC_FLAGS_FTRACE) -Os
>
> -# Disable gcov profiling for VDSO code
> +# Disable profiling and instrumentation for VDSO code
> GCOV_PROFILE := n
> KCOV_INSTRUMENT := n
> +KASAN_SANITIZE := n
>
> # Force dependency
> $(obj)/vdso.o: $(obj)/vdso.so
This seems reasonable. Building the VDSO with asan results in a bunch of PLT
entries for the VDSO stubs. I don't see a sane way to resolve those, and it
looks like this is what everyone else is doing.
That said, the commit text is a bit funny so I've written one of my own. This
is on for-next, as it's still the merge window. Let me know if the text
doesn't make sense.
Thanks!
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] riscv: Disable KSAN_SANITIZE for vDSO
2021-02-19 7:15 ` Palmer Dabbelt
@ 2021-02-19 9:09 ` Tobias Klauser
0 siblings, 0 replies; 4+ messages in thread
From: Tobias Klauser @ 2021-02-19 9:09 UTC (permalink / raw)
To: Palmer Dabbelt; +Cc: linux-riscv, aou, dvyukov, Paul Walmsley
On 2021-02-19 at 08:15:34 +0100, Palmer Dabbelt <palmer@dabbelt.com> wrote:
> On Tue, 16 Feb 2021 09:33:05 PST (-0800), tklauser@distanz.ch wrote:
> > Dmitry Vyukov reports:
> > > 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.
> >
> > Verified the fix on a kernel with KASAN enabled using vDSO selftests.
> >
> > Link: https://lore.kernel.org/lkml/CACT4Y+ZNJBnkKHXUf=tm_yuowvZvHwN=0rmJ=7J+xFd+9r_6pQ@mail.gmail.com/
> > Cc: Dmitry Vyukov <dvyukov@google.com>
> > Tested-by: Tobias Klauser <tklauser@distanz.ch>
> > Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
> > ---
> > arch/riscv/kernel/vdso/Makefile | 3 ++-
> > 1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/arch/riscv/kernel/vdso/Makefile b/arch/riscv/kernel/vdso/Makefile
> > index 0cfd6da784f8..71a315e73cbe 100644
> > --- a/arch/riscv/kernel/vdso/Makefile
> > +++ b/arch/riscv/kernel/vdso/Makefile
> > @@ -32,9 +32,10 @@ CPPFLAGS_vdso.lds += -P -C -U$(ARCH)
> > # Disable -pg to prevent insert call site
> > CFLAGS_REMOVE_vgettimeofday.o = $(CC_FLAGS_FTRACE) -Os
> >
> > -# Disable gcov profiling for VDSO code
> > +# Disable profiling and instrumentation for VDSO code
> > GCOV_PROFILE := n
> > KCOV_INSTRUMENT := n
> > +KASAN_SANITIZE := n
> >
> > # Force dependency
> > $(obj)/vdso.o: $(obj)/vdso.so
>
> This seems reasonable. Building the VDSO with asan results in a bunch of PLT
> entries for the VDSO stubs. I don't see a sane way to resolve those, and it
> looks like this is what everyone else is doing.
>
> That said, the commit text is a bit funny so I've written one of my own. This
> is on for-next, as it's still the merge window. Let me know if the text
> doesn't make sense.
Thanks for fixing up the commit message and adding the Fixes line. Makes
sense to me.
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-02-19 10:46 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-16 17:33 [PATCH] riscv: Disable KSAN_SANITIZE for vDSO Tobias Klauser
2021-02-17 4:36 ` Dmitry Vyukov
2021-02-19 7:15 ` Palmer Dabbelt
2021-02-19 9:09 ` Tobias Klauser
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.