diff options
author | Frederic Weisbecker <fweisbec@gmail.com> | 2008-11-14 20:37:44 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-11-16 01:57:37 -0500 |
commit | b01c746617da5e260803eb10ed64ca043e9a1241 (patch) | |
tree | 7b835904f337778b604048169dd064a87149aa99 /arch/x86/kernel/ftrace.c | |
parent | 985809608f758a8d3ddda4ce5a53ed0e57fb9e1b (diff) |
tracing/function-return-tracer: add a barrier to ensure return stack index is incremented in memory
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>
Diffstat (limited to 'arch/x86/kernel/ftrace.c')
-rw-r--r-- | arch/x86/kernel/ftrace.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/arch/x86/kernel/ftrace.c b/arch/x86/kernel/ftrace.c index 762222ad1387..d98b5a8ecf4c 100644 --- a/arch/x86/kernel/ftrace.c +++ b/arch/x86/kernel/ftrace.c | |||
@@ -56,6 +56,7 @@ static int push_return_trace(unsigned long ret, unsigned long long time, | |||
56 | return -EBUSY; | 56 | return -EBUSY; |
57 | 57 | ||
58 | index = ++ti->curr_ret_stack; | 58 | index = ++ti->curr_ret_stack; |
59 | barrier(); | ||
59 | ti->ret_stack[index].ret = ret; | 60 | ti->ret_stack[index].ret = ret; |
60 | ti->ret_stack[index].func = func; | 61 | ti->ret_stack[index].func = func; |
61 | ti->ret_stack[index].calltime = time; | 62 | ti->ret_stack[index].calltime = time; |