Re: [PATCH] loop: reject binding to procfs and sysfs files
From: kernel test robot
Date: Sat May 30 2026 - 16:51:38 EST
Hi Tetsuo,
kernel test robot noticed the following build errors:
[auto build test ERROR on axboe/for-next]
[also build test ERROR on linus/master v7.1-rc5 next-20260529]
[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/Tetsuo-Handa/loop-reject-binding-to-procfs-and-sysfs-files/20260530-214900
base: https://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux.git for-next
patch link: https://lore.kernel.org/r/148efba2-a0b6-47d7-ac76-b19d2f4b696c%40I-love.SAKURA.ne.jp
patch subject: [PATCH] loop: reject binding to procfs and sysfs files
config: nios2-defconfig (https://download.01.org/0day-ci/archive/20260531/202605310413.Xgk6vCeB-lkp@xxxxxxxxx/config)
compiler: nios2-linux-gcc (GCC) 11.5.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260531/202605310413.Xgk6vCeB-lkp@xxxxxxxxx/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@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202605310413.Xgk6vCeB-lkp@xxxxxxxxx/
All errors (new ones prefixed by >>):
drivers/block/loop.c: In function 'loop_validate_file':
>> drivers/block/loop.c:504:14: error: 'PROC_SUPER_MAGIC' undeclared (first use in this function)
504 | case PROC_SUPER_MAGIC: /* e.g. "losetup -f /proc/sys/kernel/version" */
| ^~~~~~~~~~~~~~~~
drivers/block/loop.c:504:14: note: each undeclared identifier is reported only once for each function it appears in
>> drivers/block/loop.c:505:14: error: 'SYSFS_MAGIC' undeclared (first use in this function)
505 | case SYSFS_MAGIC: /* e.g. "losetup -f /sys/power/state" */
| ^~~~~~~~~~~
vim +/PROC_SUPER_MAGIC +504 drivers/block/loop.c
478
479 static int loop_validate_file(struct file *file, struct block_device *bdev)
480 {
481 struct inode *inode = file->f_mapping->host;
482 struct file *f = file;
483
484 /* Avoid recursion */
485 while (is_loop_device(f)) {
486 struct loop_device *l;
487
488 lockdep_assert_held(&loop_validate_mutex);
489 if (f->f_mapping->host->i_rdev == bdev->bd_dev)
490 return -EBADF;
491
492 l = I_BDEV(f->f_mapping->host)->bd_disk->private_data;
493 if (l->lo_state != Lo_bound)
494 return -EINVAL;
495 /* Order wrt setting lo->lo_backing_file in loop_configure(). */
496 rmb();
497 f = l->lo_backing_file;
498 }
499 if (S_ISBLK(inode->i_mode))
500 return 0;
501 if (!S_ISREG(inode->i_mode))
502 return -EINVAL;
503 switch (inode->i_sb->s_magic) {
> 504 case PROC_SUPER_MAGIC: /* e.g. "losetup -f /proc/sys/kernel/version" */
> 505 case SYSFS_MAGIC: /* e.g. "losetup -f /sys/power/state" */
506 return -EINVAL;
507 }
508 return 0;
509 }
510
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki