Re: [PATCH] trace, kasan: silence Kasan warning in check_stack

From: Shi, Yang
Date: Fri Feb 12 2016 - 14:46:44 EST


On 2/12/2016 11:35 AM, Steven Rostedt wrote:
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.
*/

Sure, will add in v2.

Thanks,
Yang


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);