* [PATCH 1/2] kernel/kcov.c: mark funcs in __sanitizer_cov_trace_pc as notrace
@ 2018-11-28 8:12 Anders Roxell
2018-11-28 14:05 ` Steven Rostedt
0 siblings, 1 reply; 2+ messages in thread
From: Anders Roxell @ 2018-11-28 8:12 UTC (permalink / raw)
To: akpm, dvyukov; +Cc: rostedt, mingo, linux-kernel, Anders Roxell, Arnd Bergmann
Since __sanitizer_cov_trace_pc is marked as notrace, function calls in
__sanitizer_cov_trace_pc shouldn't be traced either. The function
ftrace_graph_caller() gets called for each function that isn't marked
'notrace', like canonicalize_ip(). This is the call trace from a run:
[ 139.644550] ftrace_graph_caller+0x1c/0x24
[ 139.648352] canonicalize_ip+0x18/0x28
[ 139.652313] __sanitizer_cov_trace_pc+0x14/0x58
[ 139.656184] sched_clock+0x34/0x1e8
[ 139.659759] trace_clock_local+0x40/0x88
[ 139.663722] ftrace_push_return_trace+0x8c/0x1f0
[ 139.667767] prepare_ftrace_return+0xa8/0x100
[ 139.671709] ftrace_graph_caller+0x1c/0x24
Rework so that the functions check_kcov_mode and canonicalize_ip that is
callef from __sanitizer_cov_trace_pc also is marked as notrace.
Co-developed-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signen-off-by: Anders Roxell <anders.roxell@linaro.org>
---
kernel/kcov.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/kernel/kcov.c b/kernel/kcov.c
index 3ebd09efe72a..97959d7b77e2 100644
--- a/kernel/kcov.c
+++ b/kernel/kcov.c
@@ -56,7 +56,7 @@ struct kcov {
struct task_struct *t;
};
-static bool check_kcov_mode(enum kcov_mode needed_mode, struct task_struct *t)
+static notrace bool check_kcov_mode(enum kcov_mode needed_mode, struct task_struct *t)
{
unsigned int mode;
@@ -78,7 +78,7 @@ static bool check_kcov_mode(enum kcov_mode needed_mode, struct task_struct *t)
return mode == needed_mode;
}
-static unsigned long canonicalize_ip(unsigned long ip)
+static notrace unsigned long canonicalize_ip(unsigned long ip)
{
#ifdef CONFIG_RANDOMIZE_BASE
ip -= kaslr_offset();
--
2.19.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH 1/2] kernel/kcov.c: mark funcs in __sanitizer_cov_trace_pc as notrace
2018-11-28 8:12 [PATCH 1/2] kernel/kcov.c: mark funcs in __sanitizer_cov_trace_pc as notrace Anders Roxell
@ 2018-11-28 14:05 ` Steven Rostedt
0 siblings, 0 replies; 2+ messages in thread
From: Steven Rostedt @ 2018-11-28 14:05 UTC (permalink / raw)
To: Anders Roxell; +Cc: akpm, dvyukov, mingo, linux-kernel, Arnd Bergmann
On Wed, 28 Nov 2018 09:12:39 +0100
Anders Roxell <anders.roxell@linaro.org> wrote:
> Since __sanitizer_cov_trace_pc is marked as notrace, function calls in
> __sanitizer_cov_trace_pc shouldn't be traced either. The function
> ftrace_graph_caller() gets called for each function that isn't marked
> 'notrace', like canonicalize_ip(). This is the call trace from a run:
>
> [ 139.644550] ftrace_graph_caller+0x1c/0x24
> [ 139.648352] canonicalize_ip+0x18/0x28
> [ 139.652313] __sanitizer_cov_trace_pc+0x14/0x58
> [ 139.656184] sched_clock+0x34/0x1e8
> [ 139.659759] trace_clock_local+0x40/0x88
> [ 139.663722] ftrace_push_return_trace+0x8c/0x1f0
> [ 139.667767] prepare_ftrace_return+0xa8/0x100
> [ 139.671709] ftrace_graph_caller+0x1c/0x24
>
> Rework so that the functions check_kcov_mode and canonicalize_ip that is
> callef from __sanitizer_cov_trace_pc also is marked as notrace.
>
> Co-developed-by: Arnd Bergmann <arnd@arndb.de>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> Signen-off-by: Anders Roxell <anders.roxell@linaro.org>
> ---
Acked-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
-- Steve
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-11-28 14:05 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-28 8:12 [PATCH 1/2] kernel/kcov.c: mark funcs in __sanitizer_cov_trace_pc as notrace Anders Roxell
2018-11-28 14:05 ` Steven Rostedt
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.