tracing/function-return-tracer: Add a barrier to ensure return stack index is incremented in memory
PATCH 1/1 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.
--- arch/x86/kernel/ftrace.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
arch/x86/kernel/ftrace.c +1 -0
@@ -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;
Signature · 1 line
1.5.2.5
Quoted 10 lines · Frederic Weisbecker
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 <[email protected]>Cc Steven Rostedt <[email protected]>
-- Steve
Quoted 17 lines
Cc Andi Kleen <[email protected]>--- arch/x86/kernel/ftrace.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)arch/x86/kernel/ftrace.c +1
-0@@ -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;
Ingo Molnar
AppliedQuoted 10 lines · Frederic Weisbecker
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 <[email protected]>Cc Steven Rostedt <[email protected]>
applied, thanks Frederic!
Ingo