[PATCH v25 22/25] Audit: Add new record for multiple process LSM attributes

kernel test robot lkp at intel.com
Tue Mar 9 17:04:35 UTC 2021


Hi Casey,

I love your patch! Yet something to improve:

[auto build test ERROR on nf/master]
[also build test ERROR on linus/master v5.12-rc2 next-20210309]
[cannot apply to pcmoore-audit/next nf-next/master security/next-testing]
[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/Casey-Schaufler/LSM-Infrastructure-management-of-the-sock-security/20210309-234224
base:   https://git.kernel.org/pub/scm/linux/kernel/git/pablo/nf.git master
config: alpha-randconfig-r024-20210308 (attached as .config)
compiler: alpha-linux-gcc (GCC) 9.3.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/cfacc4ba1644ab90394c02c84f60ac35476463fa
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Casey-Schaufler/LSM-Infrastructure-management-of-the-sock-security/20210309-234224
        git checkout cfacc4ba1644ab90394c02c84f60ac35476463fa
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=alpha 

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

All error/warnings (new ones prefixed by >>):

   In file included from security/integrity/ima/ima.h:22,
                    from security/integrity/ima/ima_api.c:18:
   include/linux/audit.h:579:1: error: expected identifier or '(' before '+' token
     579 | +static inline struct audit_context *audit_alloc_local(gfp_t gfpflags)
         | ^
   security/integrity/ima/ima_api.c: In function 'ima_audit_measurement':
>> security/integrity/ima/ima_api.c:362:12: error: implicit declaration of function 'audit_alloc_for_lsm'; did you mean 'audit_log_lsm'? [-Werror=implicit-function-declaration]
     362 |  context = audit_alloc_for_lsm(GFP_KERNEL);
         |            ^~~~~~~~~~~~~~~~~~~
         |            audit_log_lsm
>> security/integrity/ima/ima_api.c:362:10: warning: assignment to 'struct audit_context *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
     362 |  context = audit_alloc_for_lsm(GFP_KERNEL);
         |          ^
   In file included from security/integrity/ima/ima.h:22,
                    from security/integrity/ima/ima_api.c:18:
   At top level:
   include/linux/audit.h:261:13: warning: 'audit_log_lsm' defined but not used [-Wunused-function]
     261 | static void audit_log_lsm(struct audit_context *context)
         |             ^~~~~~~~~~~~~
   cc1: some warnings being treated as errors


vim +362 security/integrity/ima/ima_api.c

   341	
   342	void ima_audit_measurement(struct integrity_iint_cache *iint,
   343				   const unsigned char *filename)
   344	{
   345		struct audit_context *context;
   346		struct audit_buffer *ab;
   347		char *hash;
   348		const char *algo_name = hash_algo_name[iint->ima_hash->algo];
   349		int i;
   350	
   351		if (iint->flags & IMA_AUDITED)
   352			return;
   353	
   354		hash = kzalloc((iint->ima_hash->length * 2) + 1, GFP_KERNEL);
   355		if (!hash)
   356			return;
   357	
   358		for (i = 0; i < iint->ima_hash->length; i++)
   359			hex_byte_pack(hash + (i * 2), iint->ima_hash->digest[i]);
   360		hash[i * 2] = '\0';
   361	
 > 362		context = audit_alloc_for_lsm(GFP_KERNEL);
   363		ab = audit_log_start(context, GFP_KERNEL, AUDIT_INTEGRITY_RULE);
   364		if (!ab)
   365			goto out;
   366	
   367		audit_log_format(ab, "file=");
   368		audit_log_untrustedstring(ab, filename);
   369		audit_log_format(ab, " hash=\"%s:%s\"", algo_name, hash);
   370	
   371		audit_log_task_info(ab);
   372		audit_log_end_local(ab, context);
   373	
   374		iint->flags |= IMA_AUDITED;
   375	out:
   376		kfree(hash);
   377		return;
   378	}
   379	

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


More information about the Linux-security-module-archive mailing list