Re: [PATCH v2] fork: initialize function graph state before copy_exec_state()
Steven Rostedt <[email protected]>
| Newsgroups | org.kvack.linux-mm,org.kernel.vger.linux-kernel,org.kernel.vger.stable |
|---|---|
| Message-ID | <20260822112248.1b7e1b1d@fedora> |
On Sat, 22 Aug 2026 08:49:27 +0000 Jérémy Jean <[email protected]> wrote: > dup_task_struct() copies the parent's task_struct, including ret_stack. > ftrace_graph_init_task() clears the copied function graph state, but it > currently runs after copy_exec_state(). > > For non-CLONE_VM forks, copy_exec_state() allocates a new task_exec_state. > If that allocation fails, copy_process() reaches bad_fork_free and > free_task() calls ftrace_graph_exit_task(). Since the child still carries > the parent's ret_stack pointer, the unwind frees the parent's active > function graph return stack. The parent subsequently accesses freed memory > from function_graph_enter_regs(). > As this effects function_graph tracing, please resend and Cc: [email protected] so that it gets to the proper patchwork. It will need to go through my tree so that it gets the proper testing. Thanks, -- Steve