[RFC,17/32] function_graph: Fix to update curr_ret_stack with ARRAY entry size

Message ID 169920059747.482486.11622923727523240888.stgit@devnote2
State New
Headers
Series tracing: fprobe: function_graph: Multi-function graph and fprobe on fgraph |

Commit Message

Masami Hiramatsu (Google) Nov. 5, 2023, 4:09 p.m. UTC
  From: Masami Hiramatsu (Google) <mhiramat@kernel.org>

__ftrace_return_to_handler() missed to update the curr_ret_stack when it
gets a FGRAPH_TYPE_ARRAY. Since that type entry will follows some data
words, it must update curr_ret_stack by entry size value (__get_index(val))
instead of 1.

Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
---
 kernel/trace/fgraph.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
  

Patch

diff --git a/kernel/trace/fgraph.c b/kernel/trace/fgraph.c
index 0f8e9f22e9e0..597250bd30dc 100644
--- a/kernel/trace/fgraph.c
+++ b/kernel/trace/fgraph.c
@@ -740,7 +740,8 @@  static unsigned long __ftrace_return_to_handler(struct fgraph_ret_regs *ret_regs
 		case FGRAPH_TYPE_ARRAY:
 			idx = __get_array(val);
 			fgraph_array[idx]->retfunc(&trace, fgraph_array[idx]);
-			fallthrough;
+			curr_ret_stack -= __get_index(val);
+			break;
 		case FGRAPH_TYPE_RESERVED:
 			curr_ret_stack--;
 			break;