]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
tracing/function-return-tracer: add a barrier to ensure return stack index is increme...
authorFrederic Weisbecker <fweisbec@gmail.com>
Sat, 15 Nov 2008 01:37:44 +0000 (02:37 +0100)
committerIngo Molnar <mingo@elte.hu>
Sun, 16 Nov 2008 06:57:37 +0000 (07:57 +0100)
Impact: fix possible race condition in ftrace function return tracer

This fixes a possible race condition if index incrementation
is not immediately flushed in memory.

Thanks for Andi Kleen and Steven Rostedt for pointing out this issue
and give me this solution.

Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
arch/x86/kernel/ftrace.c

index 762222ad138784323b6ca1817c2d9a1bcf6dfc81..d98b5a8ecf4ce70d2b3fd7dc0d16aa2a414b92d1 100644 (file)
@@ -56,6 +56,7 @@ static int push_return_trace(unsigned long ret, unsigned long long time,
                return -EBUSY;
 
        index = ++ti->curr_ret_stack;
+       barrier();
        ti->ret_stack[index].ret = ret;
        ti->ret_stack[index].func = func;
        ti->ret_stack[index].calltime = time;