Re: [PATCH v2] fork: initialize function graph state before copy_exec_state()

Jérémy Jean <[email protected]>
Newsgroups gmane.linux.kernel.stable,gmane.linux.kernel,gmane.linux.kernel.mm
Message-ID <[email protected]>
On 2026-08-22 17:22, Steven Rostedt wrote:
> 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.

Hello Steve,

Done. Thanks for the feedback.
Let me know if I can help more.

Regards,
Jérémy
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.