* [PATCH] kernel/kcov.c: mark func write_comp_data() as notrace
@ 2018-12-06 14:30 Anders Roxell
2018-12-06 18:14 ` Steven Rostedt
0 siblings, 1 reply; 2+ messages in thread
From: Anders Roxell @ 2018-12-06 14:30 UTC (permalink / raw)
To: akpm, rostedt, will.deacon; +Cc: linux-kernel, Anders Roxell, Arnd Bergmann
Since __sanitizer_cov_trace_const_cmp4 is marked as notrace, the
function called from __sanitizer_cov_trace_const_cmp4 shouldn't be
traceable either. ftrace_graph_caller() gets called every time func
write_comp_data() gets called if it isn't marked 'notrace'. This is the
backtrace from gdb:
#0 ftrace_graph_caller () at ../arch/arm64/kernel/entry-ftrace.S:179
#1 0xffffff8010201920 in ftrace_caller () at ../arch/arm64/kernel/entry-ftrace.S:151
#2 0xffffff8010439714 in write_comp_data (type=5, arg1=0, arg2=0, ip=18446743524224276596) at ../kernel/kcov.c:116
#3 0xffffff8010439894 in __sanitizer_cov_trace_const_cmp4 (arg1=<optimized out>, arg2=<optimized out>) at ../kernel/kcov.c:188
#4 0xffffff8010201874 in prepare_ftrace_return (self_addr=18446743524226602768, parent=0xffffff801014b918, frame_pointer=18446743524223531344) at ./include/generated/atomic-instrumented.h:27
#5 0xffffff801020194c in ftrace_graph_caller () at ../arch/arm64/kernel/entry-ftrace.S:182
Rework so that write_comp_data() that are called from
__sanitizer_cov_trace_*_cmp*() are marked as 'notrace'.
Commit 903e8ff86753 ("kernel/kcov.c: mark funcs in __sanitizer_cov_trace_pc() as notrace")
missed to mark write_comp_data() as 'notrace'. When that patch was
created gcc-7 was used. In lib/Kconfig.debug
config KCOV_ENABLE_COMPARISONS
depends on $(cc-option,-fsanitize-coverage=trace-cmp)
That code path isn't hit with gcc-7. However, it were that with gcc-8.
Co-developed-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Anders Roxell <anders.roxell@linaro.org>
---
kernel/kcov.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/kcov.c b/kernel/kcov.c
index 97959d7b77e2..c2277dbdbfb1 100644
--- a/kernel/kcov.c
+++ b/kernel/kcov.c
@@ -112,7 +112,7 @@ void notrace __sanitizer_cov_trace_pc(void)
EXPORT_SYMBOL(__sanitizer_cov_trace_pc);
#ifdef CONFIG_KCOV_ENABLE_COMPARISONS
-static void write_comp_data(u64 type, u64 arg1, u64 arg2, u64 ip)
+static void notrace write_comp_data(u64 type, u64 arg1, u64 arg2, u64 ip)
{
struct task_struct *t;
u64 *area;
--
2.19.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] kernel/kcov.c: mark func write_comp_data() as notrace
2018-12-06 14:30 [PATCH] kernel/kcov.c: mark func write_comp_data() as notrace Anders Roxell
@ 2018-12-06 18:14 ` Steven Rostedt
0 siblings, 0 replies; 2+ messages in thread
From: Steven Rostedt @ 2018-12-06 18:14 UTC (permalink / raw)
To: Anders Roxell; +Cc: akpm, will.deacon, linux-kernel, Arnd Bergmann
On Thu, 6 Dec 2018 15:30:11 +0100
Anders Roxell <anders.roxell@linaro.org> wrote:
> Since __sanitizer_cov_trace_const_cmp4 is marked as notrace, the
> function called from __sanitizer_cov_trace_const_cmp4 shouldn't be
> traceable either. ftrace_graph_caller() gets called every time func
> write_comp_data() gets called if it isn't marked 'notrace'. This is the
> backtrace from gdb:
>
> #0 ftrace_graph_caller () at ../arch/arm64/kernel/entry-ftrace.S:179
> #1 0xffffff8010201920 in ftrace_caller () at ../arch/arm64/kernel/entry-ftrace.S:151
> #2 0xffffff8010439714 in write_comp_data (type=5, arg1=0, arg2=0, ip=18446743524224276596) at ../kernel/kcov.c:116
> #3 0xffffff8010439894 in __sanitizer_cov_trace_const_cmp4 (arg1=<optimized out>, arg2=<optimized out>) at ../kernel/kcov.c:188
> #4 0xffffff8010201874 in prepare_ftrace_return (self_addr=18446743524226602768, parent=0xffffff801014b918, frame_pointer=18446743524223531344) at ./include/generated/atomic-instrumented.h:27
> #5 0xffffff801020194c in ftrace_graph_caller () at ../arch/arm64/kernel/entry-ftrace.S:182
>
> Rework so that write_comp_data() that are called from
> __sanitizer_cov_trace_*_cmp*() are marked as 'notrace'.
>
> Commit 903e8ff86753 ("kernel/kcov.c: mark funcs in __sanitizer_cov_trace_pc() as notrace")
> missed to mark write_comp_data() as 'notrace'. When that patch was
> created gcc-7 was used. In lib/Kconfig.debug
> config KCOV_ENABLE_COMPARISONS
> depends on $(cc-option,-fsanitize-coverage=trace-cmp)
>
> That code path isn't hit with gcc-7. However, it were that with gcc-8.
>
> Co-developed-by: Arnd Bergmann <arnd@arndb.de>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> Signed-off-by: Anders Roxell <anders.roxell@linaro.org>
Acked-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
-- Steve
> ---
> kernel/kcov.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/kernel/kcov.c b/kernel/kcov.c
> index 97959d7b77e2..c2277dbdbfb1 100644
> --- a/kernel/kcov.c
> +++ b/kernel/kcov.c
> @@ -112,7 +112,7 @@ void notrace __sanitizer_cov_trace_pc(void)
> EXPORT_SYMBOL(__sanitizer_cov_trace_pc);
>
> #ifdef CONFIG_KCOV_ENABLE_COMPARISONS
> -static void write_comp_data(u64 type, u64 arg1, u64 arg2, u64 ip)
> +static void notrace write_comp_data(u64 type, u64 arg1, u64 arg2, u64 ip)
> {
> struct task_struct *t;
> u64 *area;
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-12-06 18:14 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-06 14:30 [PATCH] kernel/kcov.c: mark func write_comp_data() as notrace Anders Roxell
2018-12-06 18:14 ` Steven Rostedt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).