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] [day] [month] [year] [list]
Date:   Tue, 24 Aug 2021 07:33:41 +0800
From:   kernel test robot <lkp@...el.com>
To:     sishuaigong <sishuai@...due.edu>, jlbec@...lplan.org, hch@....de
Cc:     kbuild-all@...ts.01.org, linux-kernel@...r.kernel.org,
        sishuaigong <sishuai@...due.edu>
Subject: Re: [PATCH v2] configfs: fix a race in configfs_lookup()

Hi sishuaigong,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on hch-configfs/for-next]
[also build test WARNING on v5.14-rc7 next-20210823]
[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]

url:    https://github.com/0day-ci/linux/commits/sishuaigong/configfs-fix-a-race-in-configfs_lookup/20210824-034517
base:   git://git.infradead.org/users/hch/configfs.git for-next
config: m68k-buildonly-randconfig-r006-20210822 (attached as .config)
compiler: m68k-linux-gcc (GCC) 11.2.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/0day-ci/linux/commit/ff28c41926fb184655325e34dba02c438963dcf5
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review sishuaigong/configfs-fix-a-race-in-configfs_lookup/20210824-034517
        git checkout ff28c41926fb184655325e34dba02c438963dcf5
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross ARCH=m68k 

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/configfs/dir.c: In function 'configfs_lookup':
>> fs/configfs/dir.c:446:25: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
     446 |                         struct configfs_attribute *attr = sd->s_element;
         |                         ^~~~~~


vim +446 fs/configfs/dir.c

   419	
   420	static struct dentry * configfs_lookup(struct inode *dir,
   421					       struct dentry *dentry,
   422					       unsigned int flags)
   423	{
   424		struct configfs_dirent * parent_sd = dentry->d_parent->d_fsdata;
   425		struct configfs_dirent * sd;
   426		struct inode *inode = NULL;
   427	
   428		/*
   429		 * Fake invisibility if dir belongs to a group/default groups hierarchy
   430		 * being attached
   431		 *
   432		 * This forbids userspace to read/write attributes of items which may
   433		 * not complete their initialization, since the dentries of the
   434		 * attributes won't be instantiated.
   435		 */
   436		if (!configfs_dirent_is_ready(parent_sd))
   437			return ERR_PTR(-ENOENT);
   438	
   439		spin_lock(&configfs_dirent_lock);
   440		list_for_each_entry(sd, &parent_sd->s_children, s_sibling) {
   441			if (sd->s_type & CONFIGFS_NOT_PINNED) {
   442				const unsigned char *name = configfs_get_name(sd);
   443				if (strcmp(name, dentry->d_name.name))
   444					continue;
   445	
 > 446				struct configfs_attribute *attr = sd->s_element;
   447				umode_t mode = (attr->ca_mode & S_IALLUGO) | S_IFREG;
   448	
   449				dentry->d_fsdata = configfs_get(sd);
   450				sd->s_dentry = dentry;
   451	
   452				spin_unlock(&configfs_dirent_lock);
   453	
   454				inode = configfs_create(dentry, mode);
   455				if (IS_ERR(inode)) {
   456					configfs_put(sd);
   457					return ERR_CAST(inode);
   458				}
   459				if (sd->s_type & CONFIGFS_ITEM_BIN_ATTR) {
   460					inode->i_size = 0;
   461					inode->i_fop = &configfs_bin_file_operations;
   462				} else {
   463					inode->i_size = PAGE_SIZE;
   464					inode->i_fop = &configfs_file_operations;
   465				}
   466				goto out;
   467			}
   468		}
   469		spin_unlock(&configfs_dirent_lock);
   470	
   471		/*
   472		 * If it doesn't exist and it isn't a NOT_PINNED item,
   473		 * it must be negative.
   474		 */
   475		if (dentry->d_name.len > NAME_MAX)
   476			return ERR_PTR(-ENAMETOOLONG);
   477	out:
   478		d_add(dentry, inode);
   479		return NULL;
   480	}
   481	

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

Download attachment ".config.gz" of type "application/gzip" (20766 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ