mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Leon Hwang <leon.hwang@linux.dev>
To: kernel test robot <lkp@intel.com>
Cc: oe-kbuild-all@lists.linux.dev, linux-kernel@vger.kernel.org,
	Steven Rostedt <rostedt@goodmis.org>,
	Jiri Olsa <jolsa@kernel.org>
Subject: Re: kernel/trace/ftrace.c:6651:40: sparse: sparse: incorrect type in assignment (different address spaces)
Date: Fri, 11 Sep 2026 11:14:00 +0800	[thread overview]
Message-ID: <d876a8c2-3e4d-449a-9127-ec15b34c9e5d@linux.dev> (raw)
In-Reply-To: <202609110704.Q3M5vCDV-lkp@intel.com>

On 11/9/26 07:59, kernel test robot wrote:
> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> head:   50d05c7c76c96b90462f24debacca971d2e86713
> commit: 092f8ec7dbdc71f5bde9bb0f8dead384d2115a44 ftrace: Protect direct_functions in update_ftrace_direct_mod
> date:   5 weeks ago
> config: x86_64-randconfig-122-20260911 (https://download.01.org/0day-ci/archive/20260911/202609110704.Q3M5vCDV-lkp@intel.com/config)
> compiler: gcc-14 (Debian 14.2.0-19) 14.2.0
> sparse: v0.6.5-rc1
> reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260911/202609110704.Q3M5vCDV-lkp@intel.com/reproduce)
> 
> If you fix the issue in a separate patch/commit (i.e. not just a new version of
> the same patch/commit), kindly add following tags
> | Fixes: 092f8ec7dbdc ("ftrace: Protect direct_functions 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/
> 

Hi,

I reproduced the warning with sparse v0.6.5-rc1. The patch below fixes
it locally.

Could you please retest it with the reported config?

Thanks,
Leon

---

From 03079b720a8cba88b3da579acfbcf88d983a838d Mon Sep 17 00:00:00 2001
From: Leon Hwang <leon.hwang@linux.dev>
Date: Fri, 11 Sep 2026 10:43:13 +0800
Subject: [PATCH] ftrace: Use rcu_assign_pointer() for tmp_ops filter hash

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


  reply	other threads:[~2026-09-11  3:14 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-10 23:59 kernel test robot
2026-09-11  3:14 ` Leon Hwang [this message]
2026-09-11 13:28   ` Steven Rostedt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d876a8c2-3e4d-449a-9127-ec15b34c9e5d@linux.dev \
    --to=leon.hwang@linux.dev \
    --cc=jolsa@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkp@intel.com \
    --cc=oe-kbuild-all@lists.linux.dev \
    --cc=rostedt@goodmis.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®