public inbox for llvm@lists.linux.dev
 help / color / mirror / Atom feed
* Re: [PATCH v8 23/24] ima: Make it independent from 'integrity' LSM
       [not found] <20231214170834.3324559-24-roberto.sassu@huaweicloud.com>
@ 2023-12-17  1:52 ` kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2023-12-17  1:52 UTC (permalink / raw)
  To: Roberto Sassu; +Cc: llvm, oe-kbuild-all

Hi Roberto,

kernel test robot noticed the following build warnings:

[auto build test WARNING on next-20231214]
[cannot apply to zohar-integrity/next-integrity shuah-kselftest/next shuah-kselftest/fixes pcmoore-selinux/next brauner-vfs/vfs.all linus/master v6.7-rc5 v6.7-rc4 v6.7-rc3 v6.7-rc5]
[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/Roberto-Sassu/ima-Align-ima_inode_post_setattr-definition-with-LSM-infrastructure/20231215-011948
base:   next-20231214
patch link:    https://lore.kernel.org/r/20231214170834.3324559-24-roberto.sassu%40huaweicloud.com
patch subject: [PATCH v8 23/24] ima: Make it independent from 'integrity' LSM
config: i386-buildonly-randconfig-005-20231217 (https://download.01.org/0day-ci/archive/20231217/202312170940.GnFjqC6b-lkp@intel.com/config)
compiler: clang version 16.0.4 (https://github.com/llvm/llvm-project.git ae42196bc493ffe877a7e3dff8be32035dea4d07)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231217/202312170940.GnFjqC6b-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/202312170940.GnFjqC6b-lkp@intel.com/

All warnings (new ones prefixed by >>):

>> security/integrity/ima/ima_main.c:570:6: warning: variable 'iint' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
           if (ima_policy_flag) {
               ^~~~~~~~~~~~~~~
   security/integrity/ima/ima_main.c:576:8: note: uninitialized use occurs here
           if ((!iint || !(iint->flags & IMA_COLLECTED)) && file) {
                 ^~~~
   security/integrity/ima/ima_main.c:570:2: note: remove the 'if' if its condition is always true
           if (ima_policy_flag) {
           ^~~~~~~~~~~~~~~~~~~~~
   security/integrity/ima/ima_main.c:567:29: note: initialize the variable 'iint' to silence this warning
           struct ima_iint_cache *iint, tmp_iint;
                                      ^
                                       = NULL
   1 warning generated.


vim +570 security/integrity/ima/ima_main.c

8eb988c70e7709 Mimi Zohar     2010-01-20  563  
280fe8367b0dc4 Roberto Sassu  2022-03-02  564  static int __ima_inode_hash(struct inode *inode, struct file *file, char *buf,
280fe8367b0dc4 Roberto Sassu  2022-03-02  565  			    size_t buf_size)
6beea7afcc72b8 Florent Revest 2020-01-13  566  {
7f3b66c6df75b7 Roberto Sassu  2023-12-14  567  	struct ima_iint_cache *iint, tmp_iint;
280fe8367b0dc4 Roberto Sassu  2022-03-02  568  	int rc, hash_algo;
6beea7afcc72b8 Florent Revest 2020-01-13  569  
280fe8367b0dc4 Roberto Sassu  2022-03-02 @570  	if (ima_policy_flag) {
7f3b66c6df75b7 Roberto Sassu  2023-12-14  571  		iint = ima_iint_inode(inode);
280fe8367b0dc4 Roberto Sassu  2022-03-02  572  		if (iint)
280fe8367b0dc4 Roberto Sassu  2022-03-02  573  			mutex_lock(&iint->mutex);
280fe8367b0dc4 Roberto Sassu  2022-03-02  574  	}
280fe8367b0dc4 Roberto Sassu  2022-03-02  575  
280fe8367b0dc4 Roberto Sassu  2022-03-02  576  	if ((!iint || !(iint->flags & IMA_COLLECTED)) && file) {
280fe8367b0dc4 Roberto Sassu  2022-03-02  577  		if (iint)
280fe8367b0dc4 Roberto Sassu  2022-03-02  578  			mutex_unlock(&iint->mutex);
280fe8367b0dc4 Roberto Sassu  2022-03-02  579  
280fe8367b0dc4 Roberto Sassu  2022-03-02  580  		memset(&tmp_iint, 0, sizeof(tmp_iint));
280fe8367b0dc4 Roberto Sassu  2022-03-02  581  		mutex_init(&tmp_iint.mutex);
280fe8367b0dc4 Roberto Sassu  2022-03-02  582  
280fe8367b0dc4 Roberto Sassu  2022-03-02  583  		rc = ima_collect_measurement(&tmp_iint, file, NULL, 0,
280fe8367b0dc4 Roberto Sassu  2022-03-02  584  					     ima_hash_algo, NULL);
8c1d6a050a0f16 Roberto Sassu  2022-11-02  585  		if (rc < 0) {
8c1d6a050a0f16 Roberto Sassu  2022-11-02  586  			/* ima_hash could be allocated in case of failure. */
8c1d6a050a0f16 Roberto Sassu  2022-11-02  587  			if (rc != -ENOMEM)
8c1d6a050a0f16 Roberto Sassu  2022-11-02  588  				kfree(tmp_iint.ima_hash);
8c1d6a050a0f16 Roberto Sassu  2022-11-02  589  
6beea7afcc72b8 Florent Revest 2020-01-13  590  			return -EOPNOTSUPP;
8c1d6a050a0f16 Roberto Sassu  2022-11-02  591  		}
6beea7afcc72b8 Florent Revest 2020-01-13  592  
280fe8367b0dc4 Roberto Sassu  2022-03-02  593  		iint = &tmp_iint;
6beea7afcc72b8 Florent Revest 2020-01-13  594  		mutex_lock(&iint->mutex);
280fe8367b0dc4 Roberto Sassu  2022-03-02  595  	}
280fe8367b0dc4 Roberto Sassu  2022-03-02  596  
280fe8367b0dc4 Roberto Sassu  2022-03-02  597  	if (!iint)
280fe8367b0dc4 Roberto Sassu  2022-03-02  598  		return -EOPNOTSUPP;
aa662fc04f5b29 KP Singh       2020-09-16  599  
aa662fc04f5b29 KP Singh       2020-09-16  600  	/*
aa662fc04f5b29 KP Singh       2020-09-16  601  	 * ima_file_hash can be called when ima_collect_measurement has still
aa662fc04f5b29 KP Singh       2020-09-16  602  	 * not been called, we might not always have a hash.
aa662fc04f5b29 KP Singh       2020-09-16  603  	 */
62622dab0a2850 Matt Bobrowski 2023-01-04  604  	if (!iint->ima_hash || !(iint->flags & IMA_COLLECTED)) {
aa662fc04f5b29 KP Singh       2020-09-16  605  		mutex_unlock(&iint->mutex);
aa662fc04f5b29 KP Singh       2020-09-16  606  		return -EOPNOTSUPP;
aa662fc04f5b29 KP Singh       2020-09-16  607  	}
aa662fc04f5b29 KP Singh       2020-09-16  608  
6beea7afcc72b8 Florent Revest 2020-01-13  609  	if (buf) {
6beea7afcc72b8 Florent Revest 2020-01-13  610  		size_t copied_size;
6beea7afcc72b8 Florent Revest 2020-01-13  611  
6beea7afcc72b8 Florent Revest 2020-01-13  612  		copied_size = min_t(size_t, iint->ima_hash->length, buf_size);
6beea7afcc72b8 Florent Revest 2020-01-13  613  		memcpy(buf, iint->ima_hash->digest, copied_size);
6beea7afcc72b8 Florent Revest 2020-01-13  614  	}
6beea7afcc72b8 Florent Revest 2020-01-13  615  	hash_algo = iint->ima_hash->algo;
6beea7afcc72b8 Florent Revest 2020-01-13  616  	mutex_unlock(&iint->mutex);
6beea7afcc72b8 Florent Revest 2020-01-13  617  
280fe8367b0dc4 Roberto Sassu  2022-03-02  618  	if (iint == &tmp_iint)
280fe8367b0dc4 Roberto Sassu  2022-03-02  619  		kfree(iint->ima_hash);
280fe8367b0dc4 Roberto Sassu  2022-03-02  620  
6beea7afcc72b8 Florent Revest 2020-01-13  621  	return hash_algo;
6beea7afcc72b8 Florent Revest 2020-01-13  622  }
403319be5de511 KP Singh       2020-11-24  623  

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-12-17  1:53 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20231214170834.3324559-24-roberto.sassu@huaweicloud.com>
2023-12-17  1:52 ` [PATCH v8 23/24] ima: Make it independent from 'integrity' LSM kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox