From: Masami Hiramatsu <mhiramat@kernel.org>
To: kernel test robot <lkp@intel.com>
Cc: kbuild-all@lists.01.org, linux-kernel@vger.kernel.org,
Alexei Starovoitov <ast@kernel.org>,
"Steven Rostedt (Google)" <rostedt@goodmis.org>
Subject: Re: [bpf-next:master 209/265] kernel/trace/fprobe.c:201:14: sparse: sparse: incorrect type in assignment (different address spaces)
Date: Tue, 22 Mar 2022 20:44:50 +0900 [thread overview]
Message-ID: <20220322204450.a09369b16d3e585be31dc394@kernel.org> (raw)
In-Reply-To: <202203221549.JQIr40CT-lkp@intel.com>
On Tue, 22 Mar 2022 15:22:30 +0800
kernel test robot <lkp@intel.com> wrote:
> tree: https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git master
> head: f97b8b9bd630fb76c0e9e11cbf390e3d64a144d7
> commit: 5b0ab78998e32564a011b14c4c7f9c81e2d42b9d [209/265] fprobe: Add exit_handler support
> config: i386-allmodconfig (https://download.01.org/0day-ci/archive/20220322/202203221549.JQIr40CT-lkp@intel.com/config)
> compiler: gcc-9 (Ubuntu 9.4.0-1ubuntu1~20.04) 9.4.0
> reproduce:
> # apt-get install sparse
> # sparse version: v0.6.4-dirty
> # https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git/commit/?id=5b0ab78998e32564a011b14c4c7f9c81e2d42b9d
> git remote add bpf-next https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git
> git fetch --no-tags bpf-next master
> git checkout 5b0ab78998e32564a011b14c4c7f9c81e2d42b9d
> # save the config file to linux build tree
> mkdir build_dir
> make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=i386 SHELL=/bin/bash kernel/trace/ samples/
>
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kernel test robot <lkp@intel.com>
>
>
> sparse warnings: (new ones prefixed by >>)
> >> kernel/trace/rethook.c:68:9: sparse: sparse: incompatible types in comparison expression (different address spaces):
> >> kernel/trace/rethook.c:68:9: sparse: void ( [noderef] __rcu * )( ... )
> >> kernel/trace/rethook.c:68:9: sparse: void ( * )( ... )
> --
> >> kernel/trace/fprobe.c:201:14: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected struct ftrace_hash *hash @@ got struct ftrace_hash [noderef] __rcu *filter_hash @@
> kernel/trace/fprobe.c:201:14: sparse: expected struct ftrace_hash *hash
> kernel/trace/fprobe.c:201:14: sparse: got struct ftrace_hash [noderef] __rcu *filter_hash
>
> vim +201 kernel/trace/fprobe.c
>
> 158
> 159 /**
> 160 * register_fprobe() - Register fprobe to ftrace by pattern.
> 161 * @fp: A fprobe data structure to be registered.
> 162 * @filter: A wildcard pattern of probed symbols.
> 163 * @notfilter: A wildcard pattern of NOT probed symbols.
> 164 *
> 165 * Register @fp to ftrace for enabling the probe on the symbols matched to @filter.
> 166 * If @notfilter is not NULL, the symbols matched the @notfilter are not probed.
> 167 *
> 168 * Return 0 if @fp is registered successfully, -errno if not.
> 169 */
> 170 int register_fprobe(struct fprobe *fp, const char *filter, const char *notfilter)
> 171 {
> 172 struct ftrace_hash *hash;
> 173 unsigned char *str;
> 174 int ret, len;
> 175
> 176 if (!fp || !filter)
> 177 return -EINVAL;
> 178
> 179 fprobe_init(fp);
> 180
> 181 len = strlen(filter);
> 182 str = kstrdup(filter, GFP_KERNEL);
> 183 ret = ftrace_set_filter(&fp->ops, str, len, 0);
> 184 kfree(str);
> 185 if (ret)
> 186 return ret;
> 187
> 188 if (notfilter) {
> 189 len = strlen(notfilter);
> 190 str = kstrdup(notfilter, GFP_KERNEL);
> 191 ret = ftrace_set_notrace(&fp->ops, str, len, 0);
> 192 kfree(str);
> 193 if (ret)
> 194 goto out;
> 195 }
> 196
> 197 /* TODO:
> 198 * correctly calculate the total number of filtered symbols
> 199 * from both filter and notfilter.
> 200 */
> > 201 hash = fp->ops.local_hash.filter_hash;
Hm, I need to use rcu_access_pointer() to access the filter_hash field,
because it is a __rcu pointer.
Thank you,
> 202 if (WARN_ON_ONCE(!hash))
> 203 goto out;
> 204
> 205 ret = fprobe_init_rethook(fp, (int)hash->count);
> 206 if (!ret)
> 207 ret = register_ftrace_function(&fp->ops);
> 208
> 209 out:
> 210 if (ret)
> 211 fprobe_fail_cleanup(fp);
> 212 return ret;
> 213 }
> 214 EXPORT_SYMBOL_GPL(register_fprobe);
> 215
>
> --
> 0-DAY CI Kernel Test Service
> https://01.org/lkp
--
Masami Hiramatsu <mhiramat@kernel.org>
prev parent reply other threads:[~2022-03-22 11:45 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-22 7:22 kernel test robot
2022-03-22 11:44 ` Masami Hiramatsu [this message]
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=20220322204450.a09369b16d3e585be31dc394@kernel.org \
--to=mhiramat@kernel.org \
--cc=ast@kernel.org \
--cc=kbuild-all@lists.01.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lkp@intel.com \
--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®