From: kernel test robot <lkp@intel.com>
To: Song Liu <song@kernel.org>,
bpf@vger.kernel.org, linux-fsdevel@vger.kernel.org,
linux-kernel@vger.kernel.org,
linux-security-module@vger.kernel.org
Cc: oe-kbuild-all@lists.linux.dev, kernel-team@meta.com,
andrii@kernel.org, eddyz87@gmail.com, ast@kernel.org,
daniel@iogearbox.net, martin.lau@linux.dev,
viro@zeniv.linux.org.uk, brauner@kernel.org, jack@suse.cz,
kpsingh@kernel.org, mattbobrowski@google.com, amir73il@gmail.com,
repnop@google.com, jlayton@kernel.org, josef@toxicpanda.com,
mic@digikod.net, gnoack@google.com, Song Liu <song@kernel.org>
Subject: Re: [PATCH v3 fanotify 1/2] fanotify: Introduce fanotify filter
Date: Mon, 25 Nov 2024 19:01:14 +0800 [thread overview]
Message-ID: <202411251801.nLqLjFGW-lkp@intel.com> (raw)
In-Reply-To: <20241122225958.1775625-2-song@kernel.org>
Hi Song,
kernel test robot noticed the following build warnings:
[auto build test WARNING on jack-fs/fsnotify]
[also build test WARNING on linus/master v6.12 next-20241125]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Song-Liu/fanotify-Introduce-fanotify-filter/20241125-110818
base: https://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs.git fsnotify
patch link: https://lore.kernel.org/r/20241122225958.1775625-2-song%40kernel.org
patch subject: [PATCH v3 fanotify 1/2] fanotify: Introduce fanotify filter
config: i386-randconfig-001-20241125 (https://download.01.org/0day-ci/archive/20241125/202411251801.nLqLjFGW-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241125/202411251801.nLqLjFGW-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
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202411251801.nLqLjFGW-lkp@intel.com/
All warnings (new ones prefixed by >>):
fs/notify/fanotify/fanotify_filter.c: In function 'fanotify_filter_add':
>> fs/notify/fanotify/fanotify_filter.c:226:55: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
226 | if (copy_from_user(init_args, (void __user *)args.init_args,
| ^
vim +226 fs/notify/fanotify/fanotify_filter.c
156
157 /*
158 * fanotify_filter_add - Add a filter to fsnotify_group.
159 *
160 * Add a filter from filter_list to a fsnotify_group.
161 *
162 * @group: fsnotify_group that will have add
163 * @argp: fanotify_filter_args that specifies the filter
164 * and the init arguments of the filter.
165 *
166 * Returns:
167 * 0 - on success;
168 * -EEXIST - filter of the same name already exists.
169 */
170 int fanotify_filter_add(struct fsnotify_group *group,
171 struct fanotify_filter_args __user *argp)
172 {
173 struct fanotify_filter_hook *filter_hook;
174 struct fanotify_filter_ops *filter_ops;
175 struct fanotify_filter_args args;
176 void *init_args = NULL;
177 int ret = 0;
178
179 ret = copy_from_user(&args, argp, sizeof(args));
180 if (ret)
181 return -EFAULT;
182
183 if (args.init_args_size > FAN_FILTER_ARGS_MAX)
184 return -EINVAL;
185
186 args.name[FAN_FILTER_NAME_MAX - 1] = '\0';
187
188 fsnotify_group_lock(group);
189
190 if (rcu_access_pointer(group->fanotify_data.filter_hook)) {
191 fsnotify_group_unlock(group);
192 return -EBUSY;
193 }
194
195 filter_hook = kzalloc(sizeof(*filter_hook), GFP_KERNEL);
196 if (!filter_hook) {
197 ret = -ENOMEM;
198 goto out;
199 }
200
201 spin_lock(&filter_list_lock);
202 filter_ops = fanotify_filter_find(args.name);
203 if (!filter_ops || !try_module_get(filter_ops->owner)) {
204 spin_unlock(&filter_list_lock);
205 ret = -ENOENT;
206 goto err_free_hook;
207 }
208 spin_unlock(&filter_list_lock);
209
210 if (!capable(CAP_SYS_ADMIN) && (filter_ops->flags & FAN_FILTER_F_SYS_ADMIN_ONLY)) {
211 ret = -EPERM;
212 goto err_module_put;
213 }
214
215 if (filter_ops->filter_init) {
216 if (args.init_args_size != filter_ops->init_args_size) {
217 ret = -EINVAL;
218 goto err_module_put;
219 }
220 if (args.init_args_size) {
221 init_args = kzalloc(args.init_args_size, GFP_KERNEL);
222 if (!init_args) {
223 ret = -ENOMEM;
224 goto err_module_put;
225 }
> 226 if (copy_from_user(init_args, (void __user *)args.init_args,
227 args.init_args_size)) {
228 ret = -EFAULT;
229 goto err_free_args;
230 }
231
232 }
233 ret = filter_ops->filter_init(group, filter_hook, init_args);
234 if (ret)
235 goto err_free_args;
236 kfree(init_args);
237 }
238 filter_hook->ops = filter_ops;
239 rcu_assign_pointer(group->fanotify_data.filter_hook, filter_hook);
240
241 out:
242 fsnotify_group_unlock(group);
243 return ret;
244
245 err_free_args:
246 kfree(init_args);
247 err_module_put:
248 module_put(filter_ops->owner);
249 err_free_hook:
250 kfree(filter_hook);
251 goto out;
252 }
253
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
next prev parent reply other threads:[~2024-11-25 11:01 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-22 22:59 [PATCH v3 fanotify 0/2] Fanotify in kernel filter Song Liu
2024-11-22 22:59 ` [PATCH v3 fanotify 1/2] fanotify: Introduce fanotify filter Song Liu
2024-11-24 6:25 ` Amir Goldstein
2024-11-24 19:08 ` Song Liu
2024-11-28 16:37 ` Jan Kara
2024-11-25 11:01 ` kernel test robot [this message]
2024-11-26 0:06 ` kernel test robot
2024-11-22 22:59 ` [PATCH v3 fanotify 2/2] samples/fanotify: Add a sample fanotify fiter Song Liu
2024-11-24 5:07 ` Amir Goldstein
2024-11-24 18:59 ` Song Liu
2024-11-27 0:50 ` Alexei Starovoitov
2024-11-27 2:16 ` Song Liu
2024-11-28 17:10 ` Jan Kara
2024-12-02 17:38 ` Song Liu
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=202411251801.nLqLjFGW-lkp@intel.com \
--to=lkp@intel.com \
--cc=amir73il@gmail.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=brauner@kernel.org \
--cc=daniel@iogearbox.net \
--cc=eddyz87@gmail.com \
--cc=gnoack@google.com \
--cc=jack@suse.cz \
--cc=jlayton@kernel.org \
--cc=josef@toxicpanda.com \
--cc=kernel-team@meta.com \
--cc=kpsingh@kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-security-module@vger.kernel.org \
--cc=martin.lau@linux.dev \
--cc=mattbobrowski@google.com \
--cc=mic@digikod.net \
--cc=oe-kbuild-all@lists.linux.dev \
--cc=repnop@google.com \
--cc=song@kernel.org \
--cc=viro@zeniv.linux.org.uk \
/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;
as well as URLs for NNTP newsgroup(s).