[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230706095624.3a846b8e@gandalf.local.home>
Date: Thu, 6 Jul 2023 09:56:24 -0400
From: Steven Rostedt <rostedt@...dmis.org>
To: "Masami Hiramatsu (Google)" <mhiramat@...nel.org>
Cc: Jiri Olsa <jolsa@...nel.org>, Mark Rutland <mark.rutland@....com>,
lkml <linux-kernel@...r.kernel.org>,
linux-trace-kernel@...r.kernel.org, bpf@...r.kernel.org
Subject: Re: [PATCH] fprobe: Ensure running fprobe_exit_handler() finished
before calling rethook_free()
On Thu, 6 Jul 2023 14:10:12 +0900
Masami Hiramatsu (Google) <mhiramat@...nel.org> wrote:
> With only Jiri's patch, following flow can happen;
>
> ------
> CPU1 CPU2
> call unregister_fprobe()
> ...
> __fprobe_handler()
> rethook_hook() on probed function
> unregister_ftrace_function()
> return from probed function
> rethook hooks
> find rh->handler == fprobe_exit_handler
> call fprobe_exit_handler()
> rethook_free():
> set rh->handler = NULL;
> return from unreigster_fprobe;
> call fp->exit_handler() <- (*)
>
> (*) In this point, the exit handler is called after returning from
> unregister_fprobe().
> ------
>
> So, this patch changes it as following;
> ------
> CPU1 CPU2
> call unregister_fprobe()
> ...
> rethook_stop():
> set rh->handler = NULL;
> __fprobe_handler()
> rethook_hook() on probed function
> unregister_ftrace_function()
> return from probed function
> rethook hooks
> find rh->handler == NULL
> return from rethook
> rethook_free()
> return from unreigster_fprobe;
> ------
>
> I can also just put a synchronize_sched_rcu() right after rethook_free()
> to wait for all running fprobe_exit_handler() too.
>
This makes more sense. Can you please add the above to the change log.
Thanks,
-- Steve
Powered by blists - more mailing lists