All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mm: kasan: mark file report so ftrace doesn't trace it
@ 2019-06-03  9:11 Anders Roxell
  2019-06-03 10:50   ` Dmitry Vyukov
  0 siblings, 1 reply; 3+ messages in thread
From: Anders Roxell @ 2019-06-03  9:11 UTC (permalink / raw)
  To: aryabinin; +Cc: kasan-dev, linux-mm, linux-kernel, tglx, mingo, Anders Roxell

__kasan_report() triggers ftrace and the preempt_count() in ftrace
causes a call to __asan_load4(), breaking the circular dependency by
making report as no trace for ftrace.

Signed-off-by: Anders Roxell <anders.roxell@linaro.org>
---
 mm/kasan/Makefile | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/mm/kasan/Makefile b/mm/kasan/Makefile
index 08b43de2383b..2b2da731483c 100644
--- a/mm/kasan/Makefile
+++ b/mm/kasan/Makefile
@@ -3,12 +3,14 @@ KASAN_SANITIZE := n
 UBSAN_SANITIZE_common.o := n
 UBSAN_SANITIZE_generic.o := n
 UBSAN_SANITIZE_generic_report.o := n
+UBSAN_SANITIZE_report.o := n
 UBSAN_SANITIZE_tags.o := n
 KCOV_INSTRUMENT := n
 
 CFLAGS_REMOVE_common.o = $(CC_FLAGS_FTRACE)
 CFLAGS_REMOVE_generic.o = $(CC_FLAGS_FTRACE)
 CFLAGS_REMOVE_generic_report.o = $(CC_FLAGS_FTRACE)
+CFLAGS_REMOVE_report.o = $(CC_FLAGS_FTRACE)
 CFLAGS_REMOVE_tags.o = $(CC_FLAGS_FTRACE)
 
 # Function splitter causes unnecessary splits in __asan_load1/__asan_store1
@@ -17,6 +19,7 @@ CFLAGS_REMOVE_tags.o = $(CC_FLAGS_FTRACE)
 CFLAGS_common.o := $(call cc-option, -fno-conserve-stack -fno-stack-protector)
 CFLAGS_generic.o := $(call cc-option, -fno-conserve-stack -fno-stack-protector)
 CFLAGS_generic_report.o := $(call cc-option, -fno-conserve-stack -fno-stack-protector)
+CFLAGS_report.o := $(call cc-option, -fno-conserve-stack -fno-stack-protector)
 CFLAGS_tags.o := $(call cc-option, -fno-conserve-stack -fno-stack-protector)
 
 obj-$(CONFIG_KASAN) := common.o init.o report.o
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] mm: kasan: mark file report so ftrace doesn't trace it
  2019-06-03  9:11 [PATCH] mm: kasan: mark file report so ftrace doesn't trace it Anders Roxell
@ 2019-06-03 10:50   ` Dmitry Vyukov
  0 siblings, 0 replies; 3+ messages in thread
From: Dmitry Vyukov @ 2019-06-03 10:50 UTC (permalink / raw)
  To: Anders Roxell
  Cc: Andrey Ryabinin, kasan-dev, Linux-MM, LKML, Thomas Gleixner, Ingo Molnar

On Mon, Jun 3, 2019 at 11:11 AM Anders Roxell <anders.roxell@linaro.org> wrote:
>
> __kasan_report() triggers ftrace and the preempt_count() in ftrace
> causes a call to __asan_load4(), breaking the circular dependency by
> making report as no trace for ftrace.
>
> Signed-off-by: Anders Roxell <anders.roxell@linaro.org>
> ---
>  mm/kasan/Makefile | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/mm/kasan/Makefile b/mm/kasan/Makefile
> index 08b43de2383b..2b2da731483c 100644
> --- a/mm/kasan/Makefile
> +++ b/mm/kasan/Makefile
> @@ -3,12 +3,14 @@ KASAN_SANITIZE := n
>  UBSAN_SANITIZE_common.o := n
>  UBSAN_SANITIZE_generic.o := n
>  UBSAN_SANITIZE_generic_report.o := n
> +UBSAN_SANITIZE_report.o := n
>  UBSAN_SANITIZE_tags.o := n
>  KCOV_INSTRUMENT := n
>
>  CFLAGS_REMOVE_common.o = $(CC_FLAGS_FTRACE)
>  CFLAGS_REMOVE_generic.o = $(CC_FLAGS_FTRACE)
>  CFLAGS_REMOVE_generic_report.o = $(CC_FLAGS_FTRACE)
> +CFLAGS_REMOVE_report.o = $(CC_FLAGS_FTRACE)
>  CFLAGS_REMOVE_tags.o = $(CC_FLAGS_FTRACE)
>
>  # Function splitter causes unnecessary splits in __asan_load1/__asan_store1
> @@ -17,6 +19,7 @@ CFLAGS_REMOVE_tags.o = $(CC_FLAGS_FTRACE)
>  CFLAGS_common.o := $(call cc-option, -fno-conserve-stack -fno-stack-protector)
>  CFLAGS_generic.o := $(call cc-option, -fno-conserve-stack -fno-stack-protector)
>  CFLAGS_generic_report.o := $(call cc-option, -fno-conserve-stack -fno-stack-protector)
> +CFLAGS_report.o := $(call cc-option, -fno-conserve-stack -fno-stack-protector)
>  CFLAGS_tags.o := $(call cc-option, -fno-conserve-stack -fno-stack-protector)
>
>  obj-$(CONFIG_KASAN) := common.o init.o report.o


Acked-by: Dmitry Vyukov <dvyukov@google.com>

Is it needed in all section? Or you just followed the pattern?
Different flag changes were initially done on very specific files for
specific reasons. E.g. -fno-conserve-stack is only for performance
reasons, so report* should not be there. But I see Peter already added
generic_report.o there. Perhaps we need to give up on selective
per-file changes, because this causes constant flow of new bugs in the
absence of testing and just do something like:

KASAN_SANITIZE := n
KCOV_INSTRUMENT := n
UBSAN_SANITIZE := n
CFLAGS_REMOVE = $(CC_FLAGS_FTRACE)
CFLAGS := $(call cc-option, -fno-conserve-stack -fno-stack-protector)

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] mm: kasan: mark file report so ftrace doesn't trace it
@ 2019-06-03 10:50   ` Dmitry Vyukov
  0 siblings, 0 replies; 3+ messages in thread
From: Dmitry Vyukov @ 2019-06-03 10:50 UTC (permalink / raw)
  To: Anders Roxell
  Cc: Andrey Ryabinin, kasan-dev, Linux-MM, LKML, Thomas Gleixner, Ingo Molnar

On Mon, Jun 3, 2019 at 11:11 AM Anders Roxell <anders.roxell@linaro.org> wrote:
>
> __kasan_report() triggers ftrace and the preempt_count() in ftrace
> causes a call to __asan_load4(), breaking the circular dependency by
> making report as no trace for ftrace.
>
> Signed-off-by: Anders Roxell <anders.roxell@linaro.org>
> ---
>  mm/kasan/Makefile | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/mm/kasan/Makefile b/mm/kasan/Makefile
> index 08b43de2383b..2b2da731483c 100644
> --- a/mm/kasan/Makefile
> +++ b/mm/kasan/Makefile
> @@ -3,12 +3,14 @@ KASAN_SANITIZE := n
>  UBSAN_SANITIZE_common.o := n
>  UBSAN_SANITIZE_generic.o := n
>  UBSAN_SANITIZE_generic_report.o := n
> +UBSAN_SANITIZE_report.o := n
>  UBSAN_SANITIZE_tags.o := n
>  KCOV_INSTRUMENT := n
>
>  CFLAGS_REMOVE_common.o = $(CC_FLAGS_FTRACE)
>  CFLAGS_REMOVE_generic.o = $(CC_FLAGS_FTRACE)
>  CFLAGS_REMOVE_generic_report.o = $(CC_FLAGS_FTRACE)
> +CFLAGS_REMOVE_report.o = $(CC_FLAGS_FTRACE)
>  CFLAGS_REMOVE_tags.o = $(CC_FLAGS_FTRACE)
>
>  # Function splitter causes unnecessary splits in __asan_load1/__asan_store1
> @@ -17,6 +19,7 @@ CFLAGS_REMOVE_tags.o = $(CC_FLAGS_FTRACE)
>  CFLAGS_common.o := $(call cc-option, -fno-conserve-stack -fno-stack-protector)
>  CFLAGS_generic.o := $(call cc-option, -fno-conserve-stack -fno-stack-protector)
>  CFLAGS_generic_report.o := $(call cc-option, -fno-conserve-stack -fno-stack-protector)
> +CFLAGS_report.o := $(call cc-option, -fno-conserve-stack -fno-stack-protector)
>  CFLAGS_tags.o := $(call cc-option, -fno-conserve-stack -fno-stack-protector)
>
>  obj-$(CONFIG_KASAN) := common.o init.o report.o


Acked-by: Dmitry Vyukov <dvyukov@google.com>

Is it needed in all section? Or you just followed the pattern?
Different flag changes were initially done on very specific files for
specific reasons. E.g. -fno-conserve-stack is only for performance
reasons, so report* should not be there. But I see Peter already added
generic_report.o there. Perhaps we need to give up on selective
per-file changes, because this causes constant flow of new bugs in the
absence of testing and just do something like:

KASAN_SANITIZE := n
KCOV_INSTRUMENT := n
UBSAN_SANITIZE := n
CFLAGS_REMOVE = $(CC_FLAGS_FTRACE)
CFLAGS := $(call cc-option, -fno-conserve-stack -fno-stack-protector)


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-06-03 10:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-03  9:11 [PATCH] mm: kasan: mark file report so ftrace doesn't trace it Anders Roxell
2019-06-03 10:50 ` Dmitry Vyukov
2019-06-03 10:50   ` Dmitry Vyukov

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.