Re: [PATCH nf 1/2] netfilter: ipt_CLUSTERIP: put config struct if we can't increment ct refcount

2018-02-19 Thread Florian Westphal
kbuild test robot  wrote:
> Hi Florian,
> 
> I love your patch! Perhaps something to improve:
> 
> [auto build test WARNING on nf/master]
> 
> url:
> https://github.com/0day-ci/linux/commits/Florian-Westphal/netfilter-ipt_CLUSTERIP-two-more-fixes/20180219-090236
> base:   https://git.kernel.org/pub/scm/linux/kernel/git/pablo/nf.git master
> reproduce:
> # apt-get install sparse
> make ARCH=x86_64 allmodconfig
> make C=1 CF=-D__CHECK_ENDIAN__
> sparse warnings: (new ones prefixed by >>)
> 
> >> include/linux/rculist.h:130:25: sparse: context imbalance in 
> >> 'clusterip_tg_check' - unexpected unlock

above is new
>include/linux/rculist.h:130:25: sparse: context imbalance in 
> 'clusterip_tg_destroy' - unexpected unlock

above is old.  Looks like false positive, both 'unexpected unlock'
come from inlined clusterip_config_entry_put() which has:

if (refcount_dec_and_lock(&c->entries, &cn->lock)) {
...
 list_del_rcu(&c->list);
 spin_unlock(&cn->lock);

so sparse did not 'see' spin_lock().
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH nf 1/2] netfilter: ipt_CLUSTERIP: put config struct if we can't increment ct refcount

2018-02-19 Thread kbuild test robot
Hi Florian,

I love your patch! Perhaps something to improve:

[auto build test WARNING on nf/master]

url:
https://github.com/0day-ci/linux/commits/Florian-Westphal/netfilter-ipt_CLUSTERIP-two-more-fixes/20180219-090236
base:   https://git.kernel.org/pub/scm/linux/kernel/git/pablo/nf.git master
reproduce:
# apt-get install sparse
make ARCH=x86_64 allmodconfig
make C=1 CF=-D__CHECK_ENDIAN__


sparse warnings: (new ones prefixed by >>)

>> include/linux/rculist.h:130:25: sparse: context imbalance in 
>> 'clusterip_tg_check' - unexpected unlock
   include/linux/rculist.h:130:25: sparse: context imbalance in 
'clusterip_tg_destroy' - unexpected unlock

vim +/clusterip_tg_check +130 include/linux/rculist.h

82524746 Franck Bui-Huu 2008-05-12  103  
82524746 Franck Bui-Huu 2008-05-12  104  /**
82524746 Franck Bui-Huu 2008-05-12  105   * list_del_rcu - deletes entry from 
list without re-initialization
82524746 Franck Bui-Huu 2008-05-12  106   * @entry: the element to delete from 
the list.
82524746 Franck Bui-Huu 2008-05-12  107   *
82524746 Franck Bui-Huu 2008-05-12  108   * Note: list_empty() on entry does 
not return true after this,
82524746 Franck Bui-Huu 2008-05-12  109   * the entry is in an undefined state. 
It is useful for RCU based
82524746 Franck Bui-Huu 2008-05-12  110   * lockfree traversal.
82524746 Franck Bui-Huu 2008-05-12  111   *
82524746 Franck Bui-Huu 2008-05-12  112   * In particular, it means that we can 
not poison the forward
82524746 Franck Bui-Huu 2008-05-12  113   * pointers that may still be used for 
walking the list.
82524746 Franck Bui-Huu 2008-05-12  114   *
82524746 Franck Bui-Huu 2008-05-12  115   * The caller must take whatever 
precautions are necessary
82524746 Franck Bui-Huu 2008-05-12  116   * (such as holding appropriate locks) 
to avoid racing
82524746 Franck Bui-Huu 2008-05-12  117   * with another list-mutation 
primitive, such as list_del_rcu()
82524746 Franck Bui-Huu 2008-05-12  118   * or list_add_rcu(), running on this 
same list.
82524746 Franck Bui-Huu 2008-05-12  119   * However, it is perfectly legal to 
run concurrently with
82524746 Franck Bui-Huu 2008-05-12  120   * the _rcu list-traversal primitives, 
such as
82524746 Franck Bui-Huu 2008-05-12  121   * list_for_each_entry_rcu().
82524746 Franck Bui-Huu 2008-05-12  122   *
82524746 Franck Bui-Huu 2008-05-12  123   * Note that the caller is not 
permitted to immediately free
82524746 Franck Bui-Huu 2008-05-12  124   * the newly deleted entry.  Instead, 
either synchronize_rcu()
82524746 Franck Bui-Huu 2008-05-12  125   * or call_rcu() must be used to defer 
freeing until an RCU
82524746 Franck Bui-Huu 2008-05-12  126   * grace period has elapsed.
82524746 Franck Bui-Huu 2008-05-12  127   */
82524746 Franck Bui-Huu 2008-05-12  128  static inline void list_del_rcu(struct 
list_head *entry)
82524746 Franck Bui-Huu 2008-05-12  129  {
559f9bad Dave Jones 2012-03-14 @130 __list_del_entry(entry);
82524746 Franck Bui-Huu 2008-05-12  131 entry->prev = LIST_POISON2;
82524746 Franck Bui-Huu 2008-05-12  132  }
82524746 Franck Bui-Huu 2008-05-12  133  

:: The code at line 130 was first introduced by commit
:: 559f9badd11ddf399f88b18b4c0f110fd511ae53 rcu: List-debug variants of rcu 
list routines.

:: TO: Dave Jones 
:: CC: Paul E. McKenney 

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html