* [PATCH] kcov: disable tracing and branch profiling in kcov
@ 2016-04-21 10:32 Andrey Ryabinin
2016-04-21 10:39 ` Dmitry Vyukov
0 siblings, 1 reply; 3+ messages in thread
From: Andrey Ryabinin @ 2016-04-21 10:32 UTC (permalink / raw)
To: Dmitry Vyukov, Andrew Morton; +Cc: linux-kernel, syzkaller, Andrey Ryabinin
Tracing of __sanitizer_cov_trace_pc() causes unbound recursion and crash,
because __sanitizer_cov_trace_pc() is also called from tracer code.
For the same reason we need to disable profiling of 'if' branches.
Signed-off-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
---
kernel/kcov.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/kernel/kcov.c b/kernel/kcov.c
index 3efbee0..7919253 100644
--- a/kernel/kcov.c
+++ b/kernel/kcov.c
@@ -1,5 +1,6 @@
#define pr_fmt(fmt) "kcov: " fmt
+#define DISABLE_BRANCH_PROFILING
#include <linux/compiler.h>
#include <linux/types.h>
#include <linux/file.h>
@@ -43,7 +44,7 @@ struct kcov {
* Entry point from instrumented code.
* This is called once per basic-block/edge.
*/
-void __sanitizer_cov_trace_pc(void)
+notrace void __sanitizer_cov_trace_pc(void)
{
struct task_struct *t;
enum kcov_mode mode;
--
2.7.3
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] kcov: disable tracing and branch profiling in kcov
2016-04-21 10:32 [PATCH] kcov: disable tracing and branch profiling in kcov Andrey Ryabinin
@ 2016-04-21 10:39 ` Dmitry Vyukov
2016-04-21 12:16 ` [PATCH v2] kcov: don't profile branches " Andrey Ryabinin
0 siblings, 1 reply; 3+ messages in thread
From: Dmitry Vyukov @ 2016-04-21 10:39 UTC (permalink / raw)
To: Andrey Ryabinin; +Cc: Andrew Morton, LKML, syzkaller
On Thu, Apr 21, 2016 at 12:32 PM, Andrey Ryabinin
<aryabinin@virtuozzo.com> wrote:
> Tracing of __sanitizer_cov_trace_pc() causes unbound recursion and crash,
> because __sanitizer_cov_trace_pc() is also called from tracer code.
> For the same reason we need to disable profiling of 'if' branches.
>
> Signed-off-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
> ---
> kernel/kcov.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/kernel/kcov.c b/kernel/kcov.c
> index 3efbee0..7919253 100644
> --- a/kernel/kcov.c
> +++ b/kernel/kcov.c
> @@ -1,5 +1,6 @@
> #define pr_fmt(fmt) "kcov: " fmt
>
> +#define DISABLE_BRANCH_PROFILING
> #include <linux/compiler.h>
> #include <linux/types.h>
> #include <linux/file.h>
> @@ -43,7 +44,7 @@ struct kcov {
> * Entry point from instrumented code.
> * This is called once per basic-block/edge.
> */
> -void __sanitizer_cov_trace_pc(void)
> +notrace void __sanitizer_cov_trace_pc(void)
> {
> struct task_struct *t;
> enum kcov_mode mode;
> --
> 2.7.3
There was a similar patch "kcov: Don't trace the code coverage code"
recently. But it did not add DISABLE_BRANCH_PROFILING.
^ permalink raw reply [flat|nested] 3+ messages in thread* [PATCH v2] kcov: don't profile branches in kcov
2016-04-21 10:39 ` Dmitry Vyukov
@ 2016-04-21 12:16 ` Andrey Ryabinin
0 siblings, 0 replies; 3+ messages in thread
From: Andrey Ryabinin @ 2016-04-21 12:16 UTC (permalink / raw)
To: Dmitry Vyukov, Andrew Morton; +Cc: linux-kernel, syzkaller, Andrey Ryabinin
Profiling 'if' statements in __sanitizer_cov_trace_pc() leads to
unbound recursion and crash:
__sanitizer_cov_trace_pc() ->
ftrace_likely_update ->
__sanitizer_cov_trace_pc() ...
Define DISABLE_BRANCH_PROFILING to disable this tracer.
Signed-off-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
---
kernel/kcov.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/kernel/kcov.c b/kernel/kcov.c
index 3efbee0..aee961f 100644
--- a/kernel/kcov.c
+++ b/kernel/kcov.c
@@ -1,5 +1,6 @@
#define pr_fmt(fmt) "kcov: " fmt
+#define DISABLE_BRANCH_PROFILING
#include <linux/compiler.h>
#include <linux/types.h>
#include <linux/file.h>
--
2.7.3
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-04-21 12:16 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-21 10:32 [PATCH] kcov: disable tracing and branch profiling in kcov Andrey Ryabinin
2016-04-21 10:39 ` Dmitry Vyukov
2016-04-21 12:16 ` [PATCH v2] kcov: don't profile branches " Andrey Ryabinin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome