Message ID | 1454713487-5239-1-git-send-email-yang.shi@linaro.org (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On 02/06/2016 02:04 AM, Yang Shi wrote: > > #include <asm/irq.h> > #include <asm/stacktrace.h> > @@ -64,7 +65,9 @@ int notrace unwind_frame(struct task_struct *tsk, struct stackframe *frame) > return -EINVAL; > > frame->sp = fp + 0x10; > + kasan_disable_current(); > frame->fp = *(unsigned long *)(fp); It would be better to use READ_ONCE_NOCHECK() here. See f7d27c35ddff7 ("x86/mm, kasan: Silence KASAN warnings in get_wchan()") which solves the same problem for x86. > + kasan_enable_current(); > frame->pc = *(unsigned long *)(fp + 8); Why you left frame->pc out of scope? This line could trigger kasan as well. > > #ifdef CONFIG_FUNCTION_GRAPH_TRACER >
On 2/8/2016 12:51 AM, Andrey Ryabinin wrote: > > > On 02/06/2016 02:04 AM, Yang Shi wrote: >> >> #include <asm/irq.h> >> #include <asm/stacktrace.h> >> @@ -64,7 +65,9 @@ int notrace unwind_frame(struct task_struct *tsk, struct stackframe *frame) >> return -EINVAL; >> >> frame->sp = fp + 0x10; >> + kasan_disable_current(); >> frame->fp = *(unsigned long *)(fp); > > It would be better to use READ_ONCE_NOCHECK() here. > See f7d27c35ddff7 ("x86/mm, kasan: Silence KASAN warnings in get_wchan()") which solves the same problem for x86. Thanks for the suggestion, I'm going to try it soon. > >> + kasan_enable_current(); >> frame->pc = *(unsigned long *)(fp + 8); > > Why you left frame->pc out of scope? This line could trigger kasan as well. Actually, it was not reported as frequently as the first one. In my first a couple of boot test, it was not triggered before I came up with the patch. The first one is triggered every time. It will be fixed in v2 too. Thanks, Yang > >> >> #ifdef CONFIG_FUNCTION_GRAPH_TRACER >>
diff --git a/arch/arm64/kernel/stacktrace.c b/arch/arm64/kernel/stacktrace.c index 4fad978..88278c2 100644 --- a/arch/arm64/kernel/stacktrace.c +++ b/arch/arm64/kernel/stacktrace.c @@ -20,6 +20,7 @@ #include <linux/ftrace.h> #include <linux/sched.h> #include <linux/stacktrace.h> +#include <linux/kasan.h> #include <asm/irq.h> #include <asm/stacktrace.h> @@ -64,7 +65,9 @@ int notrace unwind_frame(struct task_struct *tsk, struct stackframe *frame) return -EINVAL; frame->sp = fp + 0x10; + kasan_disable_current(); frame->fp = *(unsigned long *)(fp); + kasan_enable_current(); frame->pc = *(unsigned long *)(fp + 8); #ifdef CONFIG_FUNCTION_GRAPH_TRACER