* [PATCH] ftrace: Use rcu_assign_pointer() for tmp_ops filter hash
@ 2026-09-11 14:25 Leon Hwang
2026-09-13 20:13 ` Jiri Olsa
0 siblings, 1 reply; 2+ messages in thread
From: Leon Hwang @ 2026-09-11 14:25 UTC (permalink / raw)
To: Steven Rostedt, Masami Hiramatsu, Mark Rutland, Mathieu Desnoyers
Cc: Jiri Olsa, linux-trace-kernel, linux-kernel, Leon Hwang,
kernel test robot
tmp_ops.func_hash->filter_hash is annotated __rcu, but
update_ftrace_direct_mod() assigns hash to it directly. Sparse reports an
address-space mismatch.
Use rcu_assign_pointer() for the assignment.
Fixes: 50b35c9e50a8 ("ftrace: Use hash argument for tmp_ops in update_ftrace_direct_mod")
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202609110704.Q3M5vCDV-lkp@intel.com/
Signed-off-by: Leon Hwang <leon.hwang@linux.dev>
---
kernel/trace/ftrace.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index 53d5db60bfa5..673a54fdf392 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -6675,7 +6675,7 @@ int update_ftrace_direct_mod(struct ftrace_ops *ops, struct ftrace_hash *hash, b
/* Enable the tmp_ops to have the same functions as the hash object. */
ftrace_ops_init(&tmp_ops);
- tmp_ops.func_hash->filter_hash = hash;
+ rcu_assign_pointer(tmp_ops.func_hash->filter_hash, hash);
err = register_ftrace_function_nolock(&tmp_ops);
if (err)
--
2.55.0
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] ftrace: Use rcu_assign_pointer() for tmp_ops filter hash
2026-09-11 14:25 [PATCH] ftrace: Use rcu_assign_pointer() for tmp_ops filter hash Leon Hwang
@ 2026-09-13 20:13 ` Jiri Olsa
0 siblings, 0 replies; 2+ messages in thread
From: Jiri Olsa @ 2026-09-13 20:13 UTC (permalink / raw)
To: Leon Hwang
Cc: Steven Rostedt, Masami Hiramatsu, Mark Rutland,
Mathieu Desnoyers, linux-trace-kernel, linux-kernel,
kernel test robot
On Fri, Sep 11, 2026 at 10:25:12PM +0800, Leon Hwang wrote:
> tmp_ops.func_hash->filter_hash is annotated __rcu, but
> update_ftrace_direct_mod() assigns hash to it directly. Sparse reports an
> address-space mismatch.
>
> Use rcu_assign_pointer() for the assignment.
>
> Fixes: 50b35c9e50a8 ("ftrace: Use hash argument for tmp_ops in update_ftrace_direct_mod")
> Reported-by: kernel test robot <lkp@intel.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202609110704.Q3M5vCDV-lkp@intel.com/
> Signed-off-by: Leon Hwang <leon.hwang@linux.dev>
Acked-by: Jiri Olsa <jolsa@kernel.org>
thanks,
jirka
> ---
> kernel/trace/ftrace.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
> index 53d5db60bfa5..673a54fdf392 100644
> --- a/kernel/trace/ftrace.c
> +++ b/kernel/trace/ftrace.c
> @@ -6675,7 +6675,7 @@ int update_ftrace_direct_mod(struct ftrace_ops *ops, struct ftrace_hash *hash, b
>
> /* Enable the tmp_ops to have the same functions as the hash object. */
> ftrace_ops_init(&tmp_ops);
> - tmp_ops.func_hash->filter_hash = hash;
> + rcu_assign_pointer(tmp_ops.func_hash->filter_hash, hash);
>
> err = register_ftrace_function_nolock(&tmp_ops);
> if (err)
> --
> 2.55.0
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-09-13 20:13 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-11 14:25 [PATCH] ftrace: Use rcu_assign_pointer() for tmp_ops filter hash Leon Hwang
2026-09-13 20:13 ` Jiri Olsa
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®