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]
Message-ID: <202412111225.cNzuFVRM-lkp@intel.com>
Date: Wed, 11 Dec 2024 13:12:14 +0800
From: kernel test robot <lkp@...el.com>
To: Thadeu Lima de Souza Cascardo <cascardo@...lia.com>,
	linux-ext4@...r.kernel.org
Cc: oe-kbuild-all@...ts.linux.dev, Theodore Ts'o <tytso@....edu>,
	Andreas Dilger <adilger.kernel@...ger.ca>,
	Mingming Cao <cmm@...ibm.com>, Kalpak Shah <kalpak@...sterfs.com>,
	linux-kernel@...r.kernel.org, kernel-dev@...lia.com,
	Thadeu Lima de Souza Cascardo <cascardo@...lia.com>,
	syzbot+57934e2c8e7a99992e41@...kaller.appspotmail.com
Subject: Re: [PATCH] ext4: only test for inode xattr state when expanding
 inode

Hi Thadeu,

kernel test robot noticed the following build warnings:

[auto build test WARNING on tytso-ext4/dev]
[also build test WARNING on linus/master v6.13-rc2 next-20241210]
[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/Thadeu-Lima-de-Souza-Cascardo/ext4-only-test-for-inode-xattr-state-when-expanding-inode/20241211-015015
base:   https://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4.git dev
patch link:    https://lore.kernel.org/r/20241210174850.4027690-1-cascardo%40igalia.com
patch subject: [PATCH] ext4: only test for inode xattr state when expanding inode
config: csky-randconfig-002-20241211 (https://download.01.org/0day-ci/archive/20241211/202412111225.cNzuFVRM-lkp@intel.com/config)
compiler: csky-linux-gcc (GCC) 14.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241211/202412111225.cNzuFVRM-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@...el.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202412111225.cNzuFVRM-lkp@intel.com/

All warnings (new ones prefixed by >>):

   fs/ext4/inode.c: In function '__ext4_expand_extra_isize':
>> fs/ext4/inode.c:5818:41: warning: variable 'header' set but not used [-Wunused-but-set-variable]
    5818 |         struct ext4_xattr_ibody_header *header;
         |                                         ^~~~~~


vim +/header +5818 fs/ext4/inode.c

ac27a0ec112a089 Dave Kleikamp                 2006-10-11  5811  
c03b45b853f5829 Miao Xie                      2017-08-06  5812  static int __ext4_expand_extra_isize(struct inode *inode,
c03b45b853f5829 Miao Xie                      2017-08-06  5813  				     unsigned int new_extra_isize,
c03b45b853f5829 Miao Xie                      2017-08-06  5814  				     struct ext4_iloc *iloc,
c03b45b853f5829 Miao Xie                      2017-08-06  5815  				     handle_t *handle, int *no_expand)
c03b45b853f5829 Miao Xie                      2017-08-06  5816  {
c03b45b853f5829 Miao Xie                      2017-08-06  5817  	struct ext4_inode *raw_inode;
c03b45b853f5829 Miao Xie                      2017-08-06 @5818  	struct ext4_xattr_ibody_header *header;
4ea99936a1630f5 Theodore Ts'o                 2019-11-07  5819  	unsigned int inode_size = EXT4_INODE_SIZE(inode->i_sb);
4ea99936a1630f5 Theodore Ts'o                 2019-11-07  5820  	struct ext4_inode_info *ei = EXT4_I(inode);
c03b45b853f5829 Miao Xie                      2017-08-06  5821  	int error;
c03b45b853f5829 Miao Xie                      2017-08-06  5822  
4ea99936a1630f5 Theodore Ts'o                 2019-11-07  5823  	/* this was checked at iget time, but double check for good measure */
4ea99936a1630f5 Theodore Ts'o                 2019-11-07  5824  	if ((EXT4_GOOD_OLD_INODE_SIZE + ei->i_extra_isize > inode_size) ||
4ea99936a1630f5 Theodore Ts'o                 2019-11-07  5825  	    (ei->i_extra_isize & 3)) {
4ea99936a1630f5 Theodore Ts'o                 2019-11-07  5826  		EXT4_ERROR_INODE(inode, "bad extra_isize %u (inode size %u)",
4ea99936a1630f5 Theodore Ts'o                 2019-11-07  5827  				 ei->i_extra_isize,
4ea99936a1630f5 Theodore Ts'o                 2019-11-07  5828  				 EXT4_INODE_SIZE(inode->i_sb));
4ea99936a1630f5 Theodore Ts'o                 2019-11-07  5829  		return -EFSCORRUPTED;
4ea99936a1630f5 Theodore Ts'o                 2019-11-07  5830  	}
4ea99936a1630f5 Theodore Ts'o                 2019-11-07  5831  	if ((new_extra_isize < ei->i_extra_isize) ||
4ea99936a1630f5 Theodore Ts'o                 2019-11-07  5832  	    (new_extra_isize < 4) ||
4ea99936a1630f5 Theodore Ts'o                 2019-11-07  5833  	    (new_extra_isize > inode_size - EXT4_GOOD_OLD_INODE_SIZE))
4ea99936a1630f5 Theodore Ts'o                 2019-11-07  5834  		return -EINVAL;	/* Should never happen */
4ea99936a1630f5 Theodore Ts'o                 2019-11-07  5835  
c03b45b853f5829 Miao Xie                      2017-08-06  5836  	raw_inode = ext4_raw_inode(iloc);
c03b45b853f5829 Miao Xie                      2017-08-06  5837  
c03b45b853f5829 Miao Xie                      2017-08-06  5838  	header = IHDR(inode, raw_inode);
c03b45b853f5829 Miao Xie                      2017-08-06  5839  
c03b45b853f5829 Miao Xie                      2017-08-06  5840  	/* No extended attributes present */
555d75b1e3bf941 Thadeu Lima de Souza Cascardo 2024-12-10  5841  	if (!ext4_test_inode_state(inode, EXT4_STATE_XATTR)) {
c03b45b853f5829 Miao Xie                      2017-08-06  5842  		memset((void *)raw_inode + EXT4_GOOD_OLD_INODE_SIZE +
c03b45b853f5829 Miao Xie                      2017-08-06  5843  		       EXT4_I(inode)->i_extra_isize, 0,
c03b45b853f5829 Miao Xie                      2017-08-06  5844  		       new_extra_isize - EXT4_I(inode)->i_extra_isize);
c03b45b853f5829 Miao Xie                      2017-08-06  5845  		EXT4_I(inode)->i_extra_isize = new_extra_isize;
c03b45b853f5829 Miao Xie                      2017-08-06  5846  		return 0;
c03b45b853f5829 Miao Xie                      2017-08-06  5847  	}
c03b45b853f5829 Miao Xie                      2017-08-06  5848  
8994d11395f8165 Jan Kara                      2022-12-07  5849  	/*
8994d11395f8165 Jan Kara                      2022-12-07  5850  	 * We may need to allocate external xattr block so we need quotas
8994d11395f8165 Jan Kara                      2022-12-07  5851  	 * initialized. Here we can be called with various locks held so we
8994d11395f8165 Jan Kara                      2022-12-07  5852  	 * cannot affort to initialize quotas ourselves. So just bail.
8994d11395f8165 Jan Kara                      2022-12-07  5853  	 */
8994d11395f8165 Jan Kara                      2022-12-07  5854  	if (dquot_initialize_needed(inode))
8994d11395f8165 Jan Kara                      2022-12-07  5855  		return -EAGAIN;
8994d11395f8165 Jan Kara                      2022-12-07  5856  
c03b45b853f5829 Miao Xie                      2017-08-06  5857  	/* try to expand with EAs present */
c03b45b853f5829 Miao Xie                      2017-08-06  5858  	error = ext4_expand_extra_isize_ea(inode, new_extra_isize,
c03b45b853f5829 Miao Xie                      2017-08-06  5859  					   raw_inode, handle);
c03b45b853f5829 Miao Xie                      2017-08-06  5860  	if (error) {
c03b45b853f5829 Miao Xie                      2017-08-06  5861  		/*
c03b45b853f5829 Miao Xie                      2017-08-06  5862  		 * Inode size expansion failed; don't try again
c03b45b853f5829 Miao Xie                      2017-08-06  5863  		 */
c03b45b853f5829 Miao Xie                      2017-08-06  5864  		*no_expand = 1;
c03b45b853f5829 Miao Xie                      2017-08-06  5865  	}
c03b45b853f5829 Miao Xie                      2017-08-06  5866  
c03b45b853f5829 Miao Xie                      2017-08-06  5867  	return error;
c03b45b853f5829 Miao Xie                      2017-08-06  5868  }
c03b45b853f5829 Miao Xie                      2017-08-06  5869  

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ