lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 3 Feb 2022 02:25:32 +0800
From:   kernel test robot <lkp@...el.com>
To:     Imran Khan <imran.f.khan@...cle.com>, tj@...nel.org,
        gregkh@...uxfoundation.org
Cc:     kbuild-all@...ts.01.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v4 2/2] kernfs: Replace per-fs global rwsem with per-fs
 hashed rwsem.

Hi Imran,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on a70bf4a85b43cb952bd39dd948b103b1b3eb2cf8]

url:    https://github.com/0day-ci/linux/commits/Imran-Khan/kernfs-use-hashed-mutex-and-spinlock-in-place-of-global-ones/20220202-225301
base:   a70bf4a85b43cb952bd39dd948b103b1b3eb2cf8
config: um-i386_defconfig (https://download.01.org/0day-ci/archive/20220203/202202030237.zeUR5agU-lkp@intel.com/config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce (this is a W=1 build):
        # https://github.com/0day-ci/linux/commit/e1946294e8a0e6eb1f9876e7521c92f92c8c4af9
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Imran-Khan/kernfs-use-hashed-mutex-and-spinlock-in-place-of-global-ones/20220202-225301
        git checkout e1946294e8a0e6eb1f9876e7521c92f92c8c4af9
        # save the config file to linux build tree
        mkdir build_dir
        make W=1 O=build_dir ARCH=um SUBARCH=i386 SHELL=/bin/bash fs/kernfs/

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@...el.com>

All warnings (new ones prefixed by >>):

   fs/kernfs/dir.c: In function 'kernfs_dop_revalidate':
>> fs/kernfs/dir.c:1056:22: warning: variable 'root' set but not used [-Wunused-but-set-variable]
    1056 |  struct kernfs_root *root;
         |                      ^~~~
   fs/kernfs/dir.c: In function 'kernfs_iop_lookup':
   fs/kernfs/dir.c:1126:22: warning: variable 'root' set but not used [-Wunused-but-set-variable]
    1126 |  struct kernfs_root *root;
         |                      ^~~~
   fs/kernfs/dir.c: In function 'kernfs_remove_by_name_ns':
   fs/kernfs/dir.c:1572:11: warning: unused variable 'p_idx' [-Wunused-variable]
    1572 |  int idx, p_idx;
         |           ^~~~~
   fs/kernfs/dir.c:1572:6: warning: unused variable 'idx' [-Wunused-variable]
    1572 |  int idx, p_idx;
         |      ^~~
   fs/kernfs/dir.c:1571:22: warning: variable 'root' set but not used [-Wunused-but-set-variable]
    1571 |  struct kernfs_root *root;
         |                      ^~~~
   fs/kernfs/dir.c: In function 'kernfs_rename_ns':
   fs/kernfs/dir.c:1607:22: warning: variable 'root' set but not used [-Wunused-but-set-variable]
    1607 |  struct kernfs_root *root;
         |                      ^~~~
   fs/kernfs/dir.c: In function 'kernfs_fop_readdir':
   fs/kernfs/dir.c:1837:22: warning: variable 'root' set but not used [-Wunused-but-set-variable]
    1837 |  struct kernfs_root *root;
         |                      ^~~~


vim +/root +1056 fs/kernfs/dir.c

ea015218f2f7ac Eric W. Biederman 2015-05-13  1052  
d826e0365199cc Ian Kent          2021-06-15  1053  static int kernfs_dop_revalidate(struct dentry *dentry, unsigned int flags)
d826e0365199cc Ian Kent          2021-06-15  1054  {
d826e0365199cc Ian Kent          2021-06-15  1055  	struct kernfs_node *kn;
393c3714081a53 Minchan Kim       2021-11-18 @1056  	struct kernfs_root *root;
d826e0365199cc Ian Kent          2021-06-15  1057  
d826e0365199cc Ian Kent          2021-06-15  1058  	if (flags & LOOKUP_RCU)
d826e0365199cc Ian Kent          2021-06-15  1059  		return -ECHILD;
d826e0365199cc Ian Kent          2021-06-15  1060  
c7e7c04274b13f Ian Kent          2021-07-16  1061  	/* Negative hashed dentry? */
c7e7c04274b13f Ian Kent          2021-07-16  1062  	if (d_really_is_negative(dentry)) {
c7e7c04274b13f Ian Kent          2021-07-16  1063  		struct kernfs_node *parent;
c7e7c04274b13f Ian Kent          2021-07-16  1064  
c7e7c04274b13f Ian Kent          2021-07-16  1065  		/* If the kernfs parent node has changed discard and
c7e7c04274b13f Ian Kent          2021-07-16  1066  		 * proceed to ->lookup.
c7e7c04274b13f Ian Kent          2021-07-16  1067  		 */
c7e7c04274b13f Ian Kent          2021-07-16  1068  		spin_lock(&dentry->d_lock);
c7e7c04274b13f Ian Kent          2021-07-16  1069  		parent = kernfs_dentry_node(dentry->d_parent);
c7e7c04274b13f Ian Kent          2021-07-16  1070  		if (parent) {
c7e7c04274b13f Ian Kent          2021-07-16  1071  			spin_unlock(&dentry->d_lock);
393c3714081a53 Minchan Kim       2021-11-18  1072  			root = kernfs_root(parent);
e1946294e8a0e6 Imran Khan        2022-02-03  1073  			down_read_kernfs_rwsem(parent, LOCK_SELF, 0);
393c3714081a53 Minchan Kim       2021-11-18  1074  			if (kernfs_dir_changed(parent, dentry)) {
e1946294e8a0e6 Imran Khan        2022-02-03  1075  				up_read_kernfs_rwsem(parent);
c7e7c04274b13f Ian Kent          2021-07-16  1076  				return 0;
c7e7c04274b13f Ian Kent          2021-07-16  1077  			}
e1946294e8a0e6 Imran Khan        2022-02-03  1078  			up_read_kernfs_rwsem(parent);
393c3714081a53 Minchan Kim       2021-11-18  1079  		} else
c7e7c04274b13f Ian Kent          2021-07-16  1080  			spin_unlock(&dentry->d_lock);
c7e7c04274b13f Ian Kent          2021-07-16  1081  
c7e7c04274b13f Ian Kent          2021-07-16  1082  		/* The kernfs parent node hasn't changed, leave the
c7e7c04274b13f Ian Kent          2021-07-16  1083  		 * dentry negative and return success.
c7e7c04274b13f Ian Kent          2021-07-16  1084  		 */
c7e7c04274b13f Ian Kent          2021-07-16  1085  		return 1;
c7e7c04274b13f Ian Kent          2021-07-16  1086  	}
d826e0365199cc Ian Kent          2021-06-15  1087  
d826e0365199cc Ian Kent          2021-06-15  1088  	kn = kernfs_dentry_node(dentry);
393c3714081a53 Minchan Kim       2021-11-18  1089  	root = kernfs_root(kn);
e1946294e8a0e6 Imran Khan        2022-02-03  1090  	down_read_kernfs_rwsem(kn, LOCK_SELF, 0);
d826e0365199cc Ian Kent          2021-06-15  1091  
d826e0365199cc Ian Kent          2021-06-15  1092  	/* The kernfs node has been deactivated */
d826e0365199cc Ian Kent          2021-06-15  1093  	if (!kernfs_active(kn))
d826e0365199cc Ian Kent          2021-06-15  1094  		goto out_bad;
d826e0365199cc Ian Kent          2021-06-15  1095  
d826e0365199cc Ian Kent          2021-06-15  1096  	/* The kernfs node has been moved? */
d826e0365199cc Ian Kent          2021-06-15  1097  	if (kernfs_dentry_node(dentry->d_parent) != kn->parent)
d826e0365199cc Ian Kent          2021-06-15  1098  		goto out_bad;
d826e0365199cc Ian Kent          2021-06-15  1099  
d826e0365199cc Ian Kent          2021-06-15  1100  	/* The kernfs node has been renamed */
d826e0365199cc Ian Kent          2021-06-15  1101  	if (strcmp(dentry->d_name.name, kn->name) != 0)
d826e0365199cc Ian Kent          2021-06-15  1102  		goto out_bad;
d826e0365199cc Ian Kent          2021-06-15  1103  
d826e0365199cc Ian Kent          2021-06-15  1104  	/* The kernfs node has been moved to a different namespace */
d826e0365199cc Ian Kent          2021-06-15  1105  	if (kn->parent && kernfs_ns_enabled(kn->parent) &&
d826e0365199cc Ian Kent          2021-06-15  1106  	    kernfs_info(dentry->d_sb)->ns != kn->ns)
d826e0365199cc Ian Kent          2021-06-15  1107  		goto out_bad;
d826e0365199cc Ian Kent          2021-06-15  1108  
e1946294e8a0e6 Imran Khan        2022-02-03  1109  	up_read_kernfs_rwsem(kn);
d826e0365199cc Ian Kent          2021-06-15  1110  	return 1;
d826e0365199cc Ian Kent          2021-06-15  1111  out_bad:
e1946294e8a0e6 Imran Khan        2022-02-03  1112  	up_read_kernfs_rwsem(kn);
d826e0365199cc Ian Kent          2021-06-15  1113  	return 0;
d826e0365199cc Ian Kent          2021-06-15  1114  }
d826e0365199cc Ian Kent          2021-06-15  1115  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ