[Devel] [PATCH rh7 2/4] ms/kcov: don't trace the code coverage code

Andrey Ryabinin aryabinin at virtuozzo.com
Fri Oct 14 05:01:27 PDT 2016


From: James Morse <james.morse at arm.com>

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.

This patch lets arm64 with KCOV and STACK_TRACER boot.

Signed-off-by: James Morse <james.morse at arm.com>
Acked-by: Dmitry Vyukov <dvyukov at google.com>
Cc: Alexander Potapenko <glider at google.com>
Signed-off-by: Andrew Morton <akpm at linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds at linux-foundation.org>

(cherry picked from commit bdab42dfc974d15303afbf259f340f374a453974)
Signed-off-by: Andrey Ryabinin <aryabinin at virtuozzo.com>
---
 kernel/kcov.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/kcov.c b/kernel/kcov.c
index 9ea7a05..f963fca 100644
--- a/kernel/kcov.c
+++ b/kernel/kcov.c
@@ -44,7 +44,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.7.3



More information about the Devel mailing list