Re: [PATCH 1/2] fs: add loopback/bind mount specific security hook

kernel test robot
2024-12-31T06:03:00Z

Hi Shervin,

kernel test robot noticed the following build errors:

[auto build test ERROR on fc033cf25e612e840e545f8d5ad2edd6ba613ed5]

url: https://github.com/intel-lab-lkp/linux/commits/Shervin-Oloumi/landlock-add-support-for-private-bind-mount/20241231-094806
base: fc033cf25e612e840e545f8d5ad2edd6ba613ed5
patch link: https://lore.kernel.org/r/20241231014632.589049-1-enlightened%40chromium.org
patch subject: [PATCH 1/2] fs: add loopback/bind mount specific security hook
config: um-randconfig-001-20241231 (https://download.01.org/0day-ci/archive/20241231/202412311322.DkS3TbED-lkp@intel.com/config)
compiler: clang version 20.0.0git (https://github.com/llvm/llvm-project 319b89197348b7cad1215e235bdc7b5ec8f9b72c)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241231/202412311322.DkS3TbED-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/202412311322.DkS3TbED-lkp@intel.com/

All errors (new ones prefixed by >>):

>> fs/namespace.c:2768:8: error: call to undeclared function 'security_sb_bindmount'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
2768 | err = security_sb_bindmount(&old_path, path);
| ^
1 error generated.

vim +/security_sb_bindmount +2768 fs/namespace.c

2751
2752 /*
2753 * do loopback mount.
2754 */
2755 static int do_loopback(struct path *path, const char *old_name,
2756 int recurse)
2757 {
2758 struct path old_path;
2759 struct mount *mnt = NULL, *parent;
2760 struct mountpoint *mp;
2761 int err;
2762 if (!old_name || !*old_name)
2763 return -EINVAL;
2764 err = kern_path(old_name, LOOKUP_FOLLOW|LOOKUP_AUTOMOUNT, &old_path);
2765 if (err)
2766 return err;
2767
> 2768 err = security_sb_bindmount(&old_path, path);
2769 if (err)
2770 goto out;
2771
2772 err = -EINVAL;
2773 if (mnt_ns_loop(old_path.dentry))
2774 goto out;
2775
2776 mp = lock_mount(path);
2777 if (IS_ERR(mp)) {
2778 err = PTR_ERR(mp);
2779 goto out;
2780 }
2781
2782 parent = real_mount(path->mnt);
2783 if (!check_mnt(parent))
2784 goto out2;
2785
2786 mnt = __do_loopback(&old_path, recurse);
2787 if (IS_ERR(mnt)) {
2788 err = PTR_ERR(mnt);
2789 goto out2;
2790 }
2791
2792 err = graft_tree(mnt, parent, mp);
2793 if (err) {
2794 lock_mount_hash();
2795 umount_tree(mnt, UMOUNT_SYNC);
2796 unlock_mount_hash();
2797 }
2798 out2:
2799 unlock_mount(mp);
2800 out:
2801 path_put(&old_path);
2802 return err;
2803 }
2804

--
0-DAY CI Kernel Test Service