Re: [PATCH] trace, kasan: silence Kasan warning in check_stack
From: Steven Rostedt
Date: Fri Feb 12 2016 - 14:35:56 EST
On Mon, 8 Feb 2016 10:39:42 -0800
Yang Shi <yang.shi@xxxxxxxxxx> wrote:
>
> Signed-off-by: Yang Shi <yang.shi@xxxxxxxxxx>
> ---
> kernel/trace/trace_stack.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/kernel/trace/trace_stack.c b/kernel/trace/trace_stack.c
> index 202df6c..61e5e1e 100644
> --- a/kernel/trace/trace_stack.c
> +++ b/kernel/trace/trace_stack.c
> @@ -156,7 +156,7 @@ check_stack(unsigned long ip, unsigned long *stack)
> for (; p < top && i < stack_trace_max.nr_entries; p++) {
> if (stack_dump_trace[i] == ULONG_MAX)
> break;
> - if (*p == stack_dump_trace[i]) {
Can you add a comment explaining this. Something like:
/*
* The READ_ONCE_NOCHECK() is used to let KASAN know that
* this is not an stack-out-of-bounds error.
*/
Thanks,
-- Steve
> + if ((READ_ONCE_NOCHECK(*p)) == stack_dump_trace[i]) {
> stack_dump_trace[x] = stack_dump_trace[i++];
> this_size = stack_trace_index[x++] =
> (top - p) * sizeof(unsigned long);