mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] kcov: Don't trace the code coverage code
@ 2016-04-13 16:22 James Morse
  2016-04-13 16:27 ` Dmitry Vyukov
  0 siblings, 1 reply; 2+ messages in thread
From: James Morse @ 2016-04-13 16:22 UTC (permalink / raw)
  To: linux-kernel
  Cc: Dmitry Vyukov, Andrew Morton, Alexander Potapenko, James Morse

Kcov causes the compiler to add a call to __sanitizer_cov_trace_pc() in
every basic block. Ftrace patches in a call to _mcount() to each function
it has annotated.

Letting these mechanisms annotate each other is a bad thing. Break the
loop by adding 'notrace' to __sanitizer_cov_trace_pc() so that ftrace
won't try to patch this code.

Signed-off-by: James Morse <james.morse@arm.com>
---
This patch lets arm64 with KCOV and STACK_TRACER boot.

 kernel/kcov.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/kcov.c b/kernel/kcov.c
index 3efbee0834a8..78bed7125515 100644
--- a/kernel/kcov.c
+++ b/kernel/kcov.c
@@ -43,7 +43,7 @@ struct kcov {
  * Entry point from instrumented code.
  * This is called once per basic-block/edge.
  */
-void __sanitizer_cov_trace_pc(void)
+void notrace __sanitizer_cov_trace_pc(void)
 {
 	struct task_struct *t;
 	enum kcov_mode mode;
-- 
2.8.0.rc3

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

* Re: [PATCH] kcov: Don't trace the code coverage code
  2016-04-13 16:22 [PATCH] kcov: Don't trace the code coverage code James Morse
@ 2016-04-13 16:27 ` Dmitry Vyukov
  0 siblings, 0 replies; 2+ messages in thread
From: Dmitry Vyukov @ 2016-04-13 16:27 UTC (permalink / raw)
  To: James Morse; +Cc: LKML, Andrew Morton, Alexander Potapenko

On Wed, Apr 13, 2016 at 6:22 PM, James Morse <james.morse@arm.com> wrote:
> Kcov causes the compiler to add a call to __sanitizer_cov_trace_pc() in
> every basic block. Ftrace patches in a call to _mcount() to each function
> it has annotated.
>
> Letting these mechanisms annotate each other is a bad thing. Break the
> loop by adding 'notrace' to __sanitizer_cov_trace_pc() so that ftrace
> won't try to patch this code.
>
> Signed-off-by: James Morse <james.morse@arm.com>
> ---
> This patch lets arm64 with KCOV and STACK_TRACER boot.
>
>  kernel/kcov.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/kernel/kcov.c b/kernel/kcov.c
> index 3efbee0834a8..78bed7125515 100644
> --- a/kernel/kcov.c
> +++ b/kernel/kcov.c
> @@ -43,7 +43,7 @@ struct kcov {
>   * Entry point from instrumented code.
>   * This is called once per basic-block/edge.
>   */
> -void __sanitizer_cov_trace_pc(void)
> +void notrace __sanitizer_cov_trace_pc(void)
>  {
>         struct task_struct *t;
>         enum kcov_mode mode;
> --
> 2.8.0.rc3

Thanks!

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

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

end of thread, other threads:[~2016-04-13 16:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-13 16:22 [PATCH] kcov: Don't trace the code coverage code James Morse
2016-04-13 16:27 ` Dmitry Vyukov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®