tree: https://gitee.com/openeuler/kernel.git openEuler-1.0-LTS head: 9b2f1457c730cd7915663ac5d9ccb849f2657714 commit: 72ee1590dc860d0091f8e7714b467be5878d51ae [4034/23827] cgroups: Resource controller for open files config: x86_64-randconfig-123-20241012 (https://download.01.org/0day-ci/archive/20241012/202410120916.m0AjmQWh-lkp@i...) 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/20241012/202410120916.m0AjmQWh-lkp@i...)
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/202410120916.m0AjmQWh-lkp@intel.com/
sparse warnings: (new ones prefixed by >>) fs/file.c:339:17: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected struct file **old_fds @@ got struct file [noderef] asn:4 **fd @@ fs/file.c:339:17: sparse: expected struct file **old_fds fs/file.c:339:17: sparse: got struct file [noderef] asn:4 **fd fs/file.c:340:17: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected struct file **new_fds @@ got struct file [noderef] asn:4 **fd @@ fs/file.c:340:17: sparse: expected struct file **new_fds fs/file.c:340:17: sparse: got struct file [noderef] asn:4 **fd
fs/file.c:368:17: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected struct file **[assigned] new_fds @@ got struct file [noderef] asn:4 **fd @@
fs/file.c:368:17: sparse: expected struct file **[assigned] new_fds fs/file.c:368:17: sparse: got struct file [noderef] asn:4 **fd fs/file.c:409:54: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected struct file *file @@ got struct file [noderef] asn:4 *[assigned] __ret @@ fs/file.c:409:54: sparse: expected struct file *file fs/file.c:409:54: sparse: got struct file [noderef] asn:4 *[assigned] __ret fs/file.c:477:28: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected struct fdtable [noderef] asn:4 *fdt @@ got struct fdtable * @@ fs/file.c:477:28: sparse: expected struct fdtable [noderef] asn:4 *fdt fs/file.c:477:28: sparse: got struct fdtable * fs/file.c:666:14: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected struct file *file @@ got struct file [noderef] asn:4 * @@ fs/file.c:666:14: sparse: expected struct file *file fs/file.c:666:14: sparse: got struct file [noderef] asn:4 * fs/file.c:701:30: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected struct file *file @@ got struct file [noderef] asn:4 * @@ fs/file.c:701:30: sparse: expected struct file *file fs/file.c:701:30: sparse: got struct file [noderef] asn:4 * fs/file.c:868:16: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected struct file *tofree @@ got struct file [noderef] asn:4 * @@ fs/file.c:868:16: sparse: expected struct file *tofree fs/file.c:868:16: sparse: got struct file [noderef] asn:4 * fs/file.o: warning: objtool: alloc_fdtable()+0x2d: sibling call from callable instruction with modified stack frame fs/file.o: warning: objtool: __fget()+0x2c3: sibling call from callable instruction with modified stack frame fs/file.o: warning: objtool: __put_unused_fd()+0x56: sibling call from callable instruction with modified stack frame fs/file.o: warning: objtool: __close_fd()+0x63: sibling call from callable instruction with modified stack frame fs/file.o: warning: objtool: do_dup2()+0x62: sibling call from callable instruction with modified stack frame fs/file.o: warning: objtool: iterate_fd.part.0()+0x187: sibling call from callable instruction with modified stack frame fs/file.o: warning: objtool: expand_fdtable.constprop.0()+0x108: sibling call from callable instruction with modified stack frame fs/file.o: warning: objtool: expand_files()+0x145: sibling call from callable instruction with modified stack frame fs/file.o: warning: objtool: ksys_dup3()+0x148: sibling call from callable instruction with modified stack frame fs/file.o: warning: objtool: __se_sys_dup2()+0x1da: sibling call from callable instruction with modified stack frame fs/file.o: warning: objtool: dup_fd()+0x87e: sibling call from callable instruction with modified stack frame fs/file.o: warning: objtool: __alloc_fd()+0x39e: sibling call from callable instruction with modified stack frame fs/file.o: warning: objtool: __fd_install()+0xb1: sibling call from callable instruction with modified stack frame fs/file.o: warning: objtool: do_close_on_exec()+0x9d: sibling call from callable instruction with modified stack frame fs/file.o: warning: objtool: set_close_on_exec()+0x97: sibling call from callable instruction with modified stack frame fs/file.o: warning: objtool: get_close_on_exec()+0x141: sibling call from callable instruction with modified stack frame
vim +368 fs/file.c
300 301 spin_lock(&oldf->file_lock); 302 old_fdt = files_fdtable(oldf); 303 open_files = count_open_files(old_fdt); 304 305 /* 306 * Check whether we need to allocate a larger fd array and fd set. 307 */ 308 while (unlikely(open_files > new_fdt->max_fds)) { 309 spin_unlock(&oldf->file_lock); 310 311 if (new_fdt != &newf->fdtab) 312 __free_fdtable(new_fdt); 313 314 new_fdt = alloc_fdtable(open_files - 1); 315 if (!new_fdt) { 316 *errorp = -ENOMEM; 317 goto out_release; 318 } 319 320 /* beyond sysctl_nr_open; nothing to do */ 321 if (unlikely(new_fdt->max_fds < open_files)) { 322 __free_fdtable(new_fdt); 323 *errorp = -EMFILE; 324 goto out_release; 325 } 326 327 /* 328 * Reacquire the oldf lock and a pointer to its fd table 329 * who knows it may have a new bigger fd table. We need 330 * the latest pointer. 331 */ 332 spin_lock(&oldf->file_lock); 333 old_fdt = files_fdtable(oldf); 334 open_files = count_open_files(old_fdt); 335 } 336 337 copy_fd_bitmaps(new_fdt, old_fdt, open_files); 338 339 old_fds = old_fdt->fd; 340 new_fds = new_fdt->fd; 341 342 for (i = open_files; i != 0; i--) { 343 struct file *f = *old_fds++; 344 if (f) { 345 get_file(f); 346 } else { 347 /* 348 * The fd may be claimed in the fd bitmap but not yet 349 * instantiated in the files array if a sibling thread 350 * is partway through open(). So make sure that this 351 * fd is available to the new process. 352 */ 353 __clear_open_fd(open_files - i, new_fdt); 354 } 355 rcu_assign_pointer(*new_fds++, f); 356 } 357 spin_unlock(&oldf->file_lock); 358 359 /* clear the remainder */ 360 memset(new_fds, 0, (new_fdt->max_fds - open_files) * sizeof(struct file *)); 361 362 rcu_assign_pointer(newf->fdt, new_fdt); 363 #ifdef CONFIG_CGROUP_FILES 364 if (!files_cgroup_alloc_fd(newf, files_cgroup_count_fds(newf))) 365 return newf; 366 367 /* could not get enough FD resources. Need to clean up. */
368 new_fds = new_fdt->fd;
369 for (i = open_files; i != 0; i--) { 370 struct file *f = *new_fds++; 371 372 if (f) 373 fput(f); 374 } 375 if (new_fdt != &newf->fdtab) 376 __free_fdtable(new_fdt); 377 *errorp = -EMFILE; 378 #else 379 return newf; 380 #endif 381 382 out_release: 383 #ifdef CONFIG_CGROUP_FILES 384 files_cgroup_remove(newf); 385 #endif 386 kmem_cache_free(files_cachep, newf); 387 out: 388 return NULL; 389 } 390