All of lore.kernel.org
 help / color / mirror / Atom feed
* [intel-linux-intel-lts:4.19/android_r 19120/22633] security/integrity/ima/ima_policy.c:332:58: sparse: sparse: incorrect type in argument 1 (different base types)
@ 2021-04-26 11:31 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2021-04-26 11:31 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 14646 bytes --]

tree:   https://github.com/intel/linux-intel-lts.git 4.19/android_r
head:   e700ea86531f5df3076dbc8a35c09bc7b3c8013c
commit: b652a52d36a85d1b731921ba08e701d7150ce200 [19120/22633] Merge branch 'aosp/android-4.19-stable' into android_r
config: microblaze-randconfig-s032-20210426 (attached as .config)
compiler: microblaze-linux-gcc (GCC) 9.3.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # apt-get install sparse
        # sparse version: v0.6.3-341-g8af24329-dirty
        # https://github.com/intel/linux-intel-lts/commit/b652a52d36a85d1b731921ba08e701d7150ce200
        git remote add intel-linux-intel-lts https://github.com/intel/linux-intel-lts.git
        git fetch --no-tags intel-linux-intel-lts 4.19/android_r
        git checkout b652a52d36a85d1b731921ba08e701d7150ce200
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' W=1 ARCH=microblaze 

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


sparse warnings: (new ones prefixed by >>)
   security/integrity/ima/ima_policy.c: note: in included file (through arch/microblaze/include/uapi/asm/byteorder.h, include/asm-generic/bitops/le.h, include/asm-generic/bitops.h, ...):
   include/linux/byteorder/big_endian.h:8:2: sparse: sparse: inconsistent configuration, needs CONFIG_CPU_BIG_ENDIAN
>> security/integrity/ima/ima_policy.c:332:58: sparse: sparse: incorrect type in argument 1 (different base types) @@     expected unsigned int [usertype] secid @@     got struct secids * @@
   security/integrity/ima/ima_policy.c:332:58: sparse:     expected unsigned int [usertype] secid
   security/integrity/ima/ima_policy.c:332:58: sparse:     got struct secids *
>> security/integrity/ima/ima_policy.c:341:57: sparse: sparse: incorrect type in argument 1 (different base types) @@     expected unsigned int [usertype] secid @@     got struct secids *secid @@
   security/integrity/ima/ima_policy.c:341:57: sparse:     expected unsigned int [usertype] secid
   security/integrity/ima/ima_policy.c:341:57: sparse:     got struct secids *secid
   security/integrity/ima/ima_policy.c: In function 'ima_lsm_update_rules':
   security/integrity/ima/ima_policy.c:253:6: warning: variable 'result' set but not used [-Wunused-but-set-variable]
     253 |  int result;
         |      ^~~~~~
   security/integrity/ima/ima_policy.c: In function 'ima_match_rules':
   security/integrity/ima/ima_policy.c:332:36: warning: passing argument 1 of 'security_filter_rule_match' makes integer from pointer without a cast [-Wint-conversion]
     332 |    rc = security_filter_rule_match(&osid,
         |                                    ^~~~~
         |                                    |
         |                                    struct secids *
   In file included from security/integrity/ima/ima_policy.c:24:
   security/integrity/ima/ima.h:313:50: note: expected 'u32' {aka 'unsigned int'} but argument is of type 'struct secids *'
     313 | static inline int security_filter_rule_match(u32 secid, u32 field, u32 op,
         |                                              ~~~~^~~~~
   security/integrity/ima/ima_policy.c:341:36: warning: passing argument 1 of 'security_filter_rule_match' makes integer from pointer without a cast [-Wint-conversion]
     341 |    rc = security_filter_rule_match(secid,
         |                                    ^~~~~
         |                                    |
         |                                    struct secids *
   In file included from security/integrity/ima/ima_policy.c:24:
   security/integrity/ima/ima.h:313:50: note: expected 'u32' {aka 'unsigned int'} but argument is of type 'struct secids *'
     313 | static inline int security_filter_rule_match(u32 secid, u32 field, u32 op,
         |                                              ~~~~^~~~~
   security/integrity/ima/ima_policy.c: In function 'ima_init_policy':
   security/integrity/ima/ima_policy.c:526:16: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits]
     526 |  for (i = 0; i < ARRAY_SIZE(build_appraise_rules); i++) {
         |                ^
   security/integrity/ima/ima_policy.c: In function 'ima_parse_rule':
   security/integrity/ima/ima_policy.c:855:18: warning: this statement may fall through [-Wimplicit-fallthrough=]
     855 |    entry->uid_op = &uid_gt;
         |    ~~~~~~~~~~~~~~^~~~~~~~~
   security/integrity/ima/ima_policy.c:856:3: note: here
     856 |   case Opt_uid_lt:
         |   ^~~~
   In file included from include/linux/kernel.h:9,
                    from include/linux/list.h:9,
                    from include/linux/module.h:9,
                    from security/integrity/ima/ima_policy.c:13:
   include/linux/compiler.h:58:5: warning: this statement may fall through [-Wimplicit-fallthrough=]
      58 |  if (__builtin_constant_p(!!(cond)) ? !!(cond) :   49-      |     ^
   include/linux/compiler.h:56:23: note: in expansion of macro '__trace_if'
      56 | #define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) )
         |                       ^~~~~~~~~~
   security/integrity/ima/ima_policy.c:858:4: note: in expansion of macro 'if'
     858 |    if ((token == Opt_uid_lt) || (token == Opt_euid_lt))
         |    ^~
   security/integrity/ima/ima_policy.c:860:3: note: here
     860 |   case Opt_uid_eq:
         |   ^~~~
   security/integrity/ima/ima_policy.c:887:21: warning: this statement may fall through [-Wimplicit-fallthrough=]
     887 |    entry->fowner_op = &uid_gt;
         |    ~~~~~~~~~~~~~~~~~^~~~~~~~~
   security/integrity/ima/ima_policy.c:888:3: note: here
     888 |   case Opt_fowner_lt:
         |   ^~~~
   In file included from include/linux/kernel.h:9,
                    from include/linux/list.h:9,
                    from include/linux/module.h:9,
                    from security/integrity/ima/ima_policy.c:13:
   include/linux/compiler.h:58:5: warning: this statement may fall through [-Wimplicit-fallthrough=]
      58 |  if (__builtin_constant_p(!!(cond)) ? !!(cond) :   71-      |     ^
   include/linux/compiler.h:56:23: note: in expansion of macro '__trace_if'
      56 | #define if(cond, ...) __trace_if( (cond , ## __VA_ARGS__) )
         |                       ^~~~~~~~~~
   security/integrity/ima/ima_policy.c:889:4: note: in expansion of macro 'if'
     889 |    if (token == Opt_fowner_lt)
         |    ^~
   security/integrity/ima/ima_policy.c:891:3: note: here
     891 |   case Opt_fowner_eq:
         |   ^~~~
   security/integrity/ima/ima_policy.c:405: warning: Function parameter or member 'flags' not described in 'ima_match_policy'
   security/integrity/ima/ima_policy.c:998: warning: Function parameter or member 'rule' not described in 'ima_parse_add_rule'

vim +332 security/integrity/ima/ima_policy.c

7163a993840f09 Mimi Zohar        2013-01-03  268  
3323eec921efd8 Mimi Zohar        2009-02-04  269  /**
3323eec921efd8 Mimi Zohar        2009-02-04  270   * ima_match_rules - determine whether an inode matches the measure rule.
3323eec921efd8 Mimi Zohar        2009-02-04  271   * @rule: a pointer to a rule
3323eec921efd8 Mimi Zohar        2009-02-04  272   * @inode: a pointer to an inode
d906c10d8a3165 Matthew Garrett   2018-01-08  273   * @cred: a pointer to a credentials structure for user validation
d906c10d8a3165 Matthew Garrett   2018-01-08  274   * @secid: the secid of the task to be validated
3323eec921efd8 Mimi Zohar        2009-02-04  275   * @func: LIM hook identifier
3323eec921efd8 Mimi Zohar        2009-02-04  276   * @mask: requested action (MAY_READ | MAY_WRITE | MAY_APPEND | MAY_EXEC)
3323eec921efd8 Mimi Zohar        2009-02-04  277   *
3323eec921efd8 Mimi Zohar        2009-02-04  278   * Returns true on rule match, false on failure.
3323eec921efd8 Mimi Zohar        2009-02-04  279   */
4ad87a3d7444de Mimi Zohar        2016-01-14  280  static bool ima_match_rules(struct ima_rule_entry *rule, struct inode *inode,
eed83a72594ddc Casey Schaufler   2018-08-28  281  			    const struct cred *cred, struct secids *secid,
4ad87a3d7444de Mimi Zohar        2016-01-14  282  			    enum ima_hooks func, int mask)
3323eec921efd8 Mimi Zohar        2009-02-04  283  {
4af4662fa4a9dc Mimi Zohar        2009-02-04  284  	int i;
3323eec921efd8 Mimi Zohar        2009-02-04  285  
09b1148ef59c93 Dmitry Kasatkin   2013-11-13  286  	if ((rule->flags & IMA_FUNC) &&
09b1148ef59c93 Dmitry Kasatkin   2013-11-13  287  	    (rule->func != func && func != POST_SETATTR))
3323eec921efd8 Mimi Zohar        2009-02-04  288  		return false;
09b1148ef59c93 Dmitry Kasatkin   2013-11-13  289  	if ((rule->flags & IMA_MASK) &&
09b1148ef59c93 Dmitry Kasatkin   2013-11-13  290  	    (rule->mask != mask && func != POST_SETATTR))
3323eec921efd8 Mimi Zohar        2009-02-04  291  		return false;
4351c294b8c102 Mimi Zohar        2014-11-05  292  	if ((rule->flags & IMA_INMASK) &&
4351c294b8c102 Mimi Zohar        2014-11-05  293  	    (!(rule->mask & mask) && func != POST_SETATTR))
4351c294b8c102 Mimi Zohar        2014-11-05  294  		return false;
3323eec921efd8 Mimi Zohar        2009-02-04  295  	if ((rule->flags & IMA_FSMAGIC)
3323eec921efd8 Mimi Zohar        2009-02-04  296  	    && rule->fsmagic != inode->i_sb->s_magic)
3323eec921efd8 Mimi Zohar        2009-02-04  297  		return false;
f1b08bbcbdaf31 Mimi Zohar        2018-01-15  298  	if ((rule->flags & IMA_FSNAME)
f1b08bbcbdaf31 Mimi Zohar        2018-01-15  299  	    && strcmp(rule->fsname, inode->i_sb->s_type->name))
f1b08bbcbdaf31 Mimi Zohar        2018-01-15  300  		return false;
85865c1fa189fc Dmitry Kasatkin   2012-09-03  301  	if ((rule->flags & IMA_FSUUID) &&
85787090a21eb7 Christoph Hellwig 2017-05-10  302  	    !uuid_equal(&rule->fsuuid, &inode->i_sb->s_uuid))
85865c1fa189fc Dmitry Kasatkin   2012-09-03  303  		return false;
3dd0c8d06511c7 Mikhail Kurinnoi  2017-01-27  304  	if ((rule->flags & IMA_UID) && !rule->uid_op(cred->uid, rule->uid))
3323eec921efd8 Mimi Zohar        2009-02-04  305  		return false;
139069eff73884 Mimi Zohar        2014-11-05  306  	if (rule->flags & IMA_EUID) {
139069eff73884 Mimi Zohar        2014-11-05  307  		if (has_capability_noaudit(current, CAP_SETUID)) {
3dd0c8d06511c7 Mikhail Kurinnoi  2017-01-27  308  			if (!rule->uid_op(cred->euid, rule->uid)
3dd0c8d06511c7 Mikhail Kurinnoi  2017-01-27  309  			    && !rule->uid_op(cred->suid, rule->uid)
3dd0c8d06511c7 Mikhail Kurinnoi  2017-01-27  310  			    && !rule->uid_op(cred->uid, rule->uid))
139069eff73884 Mimi Zohar        2014-11-05  311  				return false;
3dd0c8d06511c7 Mikhail Kurinnoi  2017-01-27  312  		} else if (!rule->uid_op(cred->euid, rule->uid))
139069eff73884 Mimi Zohar        2014-11-05  313  			return false;
139069eff73884 Mimi Zohar        2014-11-05  314  	}
139069eff73884 Mimi Zohar        2014-11-05  315  
3dd0c8d06511c7 Mikhail Kurinnoi  2017-01-27  316  	if ((rule->flags & IMA_FOWNER) &&
3dd0c8d06511c7 Mikhail Kurinnoi  2017-01-27  317  	    !rule->fowner_op(inode->i_uid, rule->fowner))
07f6a79415d7d5 Mimi Zohar        2011-03-09  318  		return false;
4af4662fa4a9dc Mimi Zohar        2009-02-04  319  	for (i = 0; i < MAX_LSM_RULES; i++) {
53fc0e2259f261 Mimi Zohar        2009-05-05  320  		int rc = 0;
eed83a72594ddc Casey Schaufler   2018-08-28  321  		struct secids osid;
7163a993840f09 Mimi Zohar        2013-01-03  322  		int retried = 0;
4af4662fa4a9dc Mimi Zohar        2009-02-04  323  
4af4662fa4a9dc Mimi Zohar        2009-02-04  324  		if (!rule->lsm[i].rule)
4af4662fa4a9dc Mimi Zohar        2009-02-04  325  			continue;
7163a993840f09 Mimi Zohar        2013-01-03  326  retry:
4af4662fa4a9dc Mimi Zohar        2009-02-04  327  		switch (i) {
4af4662fa4a9dc Mimi Zohar        2009-02-04  328  		case LSM_OBJ_USER:
4af4662fa4a9dc Mimi Zohar        2009-02-04  329  		case LSM_OBJ_ROLE:
4af4662fa4a9dc Mimi Zohar        2009-02-04  330  		case LSM_OBJ_TYPE:
4af4662fa4a9dc Mimi Zohar        2009-02-04  331  			security_inode_getsecid(inode, &osid);
eed83a72594ddc Casey Schaufler   2018-08-28 @332  			rc = security_filter_rule_match(&osid,
4af4662fa4a9dc Mimi Zohar        2009-02-04  333  							rule->lsm[i].type,
53fc0e2259f261 Mimi Zohar        2009-05-05  334  							Audit_equal,
4af4662fa4a9dc Mimi Zohar        2009-02-04  335  							rule->lsm[i].rule,
4af4662fa4a9dc Mimi Zohar        2009-02-04  336  							NULL);
4af4662fa4a9dc Mimi Zohar        2009-02-04  337  			break;
4af4662fa4a9dc Mimi Zohar        2009-02-04  338  		case LSM_SUBJ_USER:
4af4662fa4a9dc Mimi Zohar        2009-02-04  339  		case LSM_SUBJ_ROLE:
4af4662fa4a9dc Mimi Zohar        2009-02-04  340  		case LSM_SUBJ_TYPE:
d906c10d8a3165 Matthew Garrett   2018-01-08 @341  			rc = security_filter_rule_match(secid,
4af4662fa4a9dc Mimi Zohar        2009-02-04  342  							rule->lsm[i].type,
53fc0e2259f261 Mimi Zohar        2009-05-05  343  							Audit_equal,
4af4662fa4a9dc Mimi Zohar        2009-02-04  344  							rule->lsm[i].rule,
4af4662fa4a9dc Mimi Zohar        2009-02-04  345  							NULL);
4af4662fa4a9dc Mimi Zohar        2009-02-04  346  		default:
4af4662fa4a9dc Mimi Zohar        2009-02-04  347  			break;
4af4662fa4a9dc Mimi Zohar        2009-02-04  348  		}
7163a993840f09 Mimi Zohar        2013-01-03  349  		if ((rc < 0) && (!retried)) {
7163a993840f09 Mimi Zohar        2013-01-03  350  			retried = 1;
7163a993840f09 Mimi Zohar        2013-01-03  351  			ima_lsm_update_rules();
7163a993840f09 Mimi Zohar        2013-01-03  352  			goto retry;
7163a993840f09 Mimi Zohar        2013-01-03  353  		}
4af4662fa4a9dc Mimi Zohar        2009-02-04  354  		if (!rc)
4af4662fa4a9dc Mimi Zohar        2009-02-04  355  			return false;
4af4662fa4a9dc Mimi Zohar        2009-02-04  356  	}
3323eec921efd8 Mimi Zohar        2009-02-04  357  	return true;
3323eec921efd8 Mimi Zohar        2009-02-04  358  }
3323eec921efd8 Mimi Zohar        2009-02-04  359  

:::::: The code@line 332 was first introduced by commit
:::::: eed83a72594ddc4b511764ff1255ae244f8a0bc9 LSM: Use multiple secids in LSM interfaces

:::::: TO: Casey Schaufler <casey@schaufler-ca.com>
:::::: CC: Pan, Kris <kris.pan@intel.com>

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

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 16287 bytes --]

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

only message in thread, other threads:[~2021-04-26 11:31 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-26 11:31 [intel-linux-intel-lts:4.19/android_r 19120/22633] security/integrity/ima/ima_policy.c:332:58: sparse: sparse: incorrect type in argument 1 (different base types) kernel test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.