Re: [zohar-integrity:next-integrity-testing 1/1] security/integrity/ima/ima_policy.c:684:25: sparse: sparse: incompatible types in comparison expression (different address spaces):

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Mimi,

According to "Documentation/RCU/rcu_dereference":
 
	"->rcu_protected_pointer might be declared as follows:
	struct foo __rcu *rcu_protected_pointer; "

it seems only "ima_rules" should add "__rcu" annotation,
because it a "rcu_protected_pointer". "sparse" only check this
pointer. Adding ""__rcu" annotation to "ima_rules_tmp", it 
could not help to avoid the warnings.
 

在 2021年09月17日 22:27, Mimi Zohar 写道:

> On Thu, 2021-09-16 at 20:05 +0800, liqiong wrote:
>> Hi Mini,
>>
>> I got this sparse warnings, should i fix it ?
>>
>> It seems the follow patch can fix, but i don't think should do
>> this check (ima_rules_tmp == NULL).
>>
>>
>> -static struct list_head *ima_rules = &ima_default_rules;
>> +static struct list_head __rcu *ima_rules = (struct list_head __rcu *)(&ima_default_rules);
>>
>> ima_rules_tmp = rcu_dereference(ima_rules);
>> +if (ima_rules_tmp == NULL)
>> +	return ;
> Agreed,  the "__rcu" annotation is missing.  Probably both ima_rules
> and ima_rules_tmp should be annotated with "__rcu".   Agreed,
> ima_rules_tmp will either point to the default or custom policy rules. 
> No need for the check.
>
> Please post a new version of the patch, with "Reported-by: kernel test
> robot <lkp@xxxxxxxxx>  (Fix sparse: incompatible types in comparison
> expression)".
>
> thanks,
>
> Mimi
>



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux Kernel]     [Linux Kernel Hardening]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux