[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200911114132.GH1362448@hirez.programming.kicks-ass.net>
Date: Fri, 11 Sep 2020 13:41:32 +0200
From: peterz@...radead.org
To: Adrian Hunter <adrian.hunter@...el.com>
Cc: rostedt@...dmis.org, mingo@...hat.com, mhiramat@...nel.org,
mbenes@...e.cz, linux-kernel@...r.kernel.org,
Paul McKenney <paulmck@...nel.org>
Subject: Re: [PATCH] ftrace: Fix missing synchronize_rcu() removing
trampoline from kallsyms
On Tue, Sep 01, 2020 at 12:16:17PM +0300, Adrian Hunter wrote:
> Add synchronize_rcu() after list_del_rcu() in
> ftrace_remove_trampoline_from_kallsyms() to protect readers of
> ftrace_ops_trampoline_list (in ftrace_get_trampoline_kallsym)
> which is used when kallsyms is read.
>
> Fixes: fc0ea795f53c8d ("ftrace: Add symbols for ftrace trampolines")
> Signed-off-by: Adrian Hunter <adrian.hunter@...el.com>
> ---
> kernel/trace/ftrace.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
> index 275441254bb5..4e64367c9774 100644
> --- a/kernel/trace/ftrace.c
> +++ b/kernel/trace/ftrace.c
> @@ -2782,6 +2782,7 @@ static void ftrace_remove_trampoline_from_kallsyms(struct ftrace_ops *ops)
> {
> lockdep_assert_held(&ftrace_lock);
> list_del_rcu(&ops->list);
> + synchronize_rcu();
> }
Hurmph, we've just done a ton of that:
ftrace_shutdown()
synchronize_rcu_tasks_rude()
ftrace_trampoline_free()
ftrace_remove_trampoline_from_kallsyms()
So would it not be better to move that call before the existing
synchronize_rcu_tasks stuff rather than adding another synchronize_rcu()
call?
Powered by blists - more mailing lists