1. 29 5月, 2017 1 次提交
  2. 14 4月, 2017 1 次提交
  3. 07 4月, 2017 1 次提交
  4. 27 3月, 2017 1 次提交
    • L
      netfilter: invoke synchronize_rcu after set the _hook_ to NULL · 3b7dabf0
      Liping Zhang 提交于
      Otherwise, another CPU may access the invalid pointer. For example:
          CPU0                CPU1
           -              rcu_read_lock();
           -              pfunc = _hook_;
        _hook_ = NULL;          -
        mod unload              -
           -                 pfunc(); // invalid, panic
           -             rcu_read_unlock();
      
      So we must call synchronize_rcu() to wait the rcu reader to finish.
      
      Also note, in nf_nat_snmp_basic_fini, synchronize_rcu() will be invoked
      by later nf_conntrack_helper_unregister, but I'm inclined to add a
      explicit synchronize_rcu after set the nf_nat_snmp_hook to NULL. Depend
      on such obscure assumptions is not a good idea.
      
      Last, in nfnetlink_cttimeout, we use kfree_rcu to free the time object,
      so in cttimeout_exit, invoking rcu_barrier() is not necessary at all,
      remove it too.
      Signed-off-by: NLiping Zhang <zlpnobody@gmail.com>
      Signed-off-by: NPablo Neira Ayuso <pablo@netfilter.org>
      3b7dabf0
  5. 17 3月, 2017 1 次提交
  6. 25 8月, 2016 3 次提交
  7. 18 8月, 2016 1 次提交
    • L
      netfilter: cttimeout: fix use after free error when delete netns · b75911b6
      Liping Zhang 提交于
      In general, when we want to delete a netns, cttimeout_net_exit will
      be called before ipt_unregister_table, i.e. before ctnl_timeout_put.
      
      But after call kfree_rcu in cttimeout_net_exit, we will still decrease
      the timeout object's refcnt in ctnl_timeout_put, this is incorrect,
      and will cause a use after free error.
      
      It is easy to reproduce this problem:
        # while : ; do
        ip netns add xxx
        ip netns exec xxx nfct add timeout testx inet icmp timeout 200
        ip netns exec xxx iptables -t raw -p icmp -I OUTPUT -j CT --timeout testx
        ip netns del xxx
        done
      
        =======================================================================
        BUG kmalloc-96 (Tainted: G    B       E  ): Poison overwritten
        -----------------------------------------------------------------------
        INFO: 0xffff88002b5161e8-0xffff88002b5161e8. First byte 0x6a instead of
        0x6b
        INFO: Allocated in cttimeout_new_timeout+0xd4/0x240 [nfnetlink_cttimeout]
        age=104 cpu=0 pid=3330
        ___slab_alloc+0x4da/0x540
        __slab_alloc+0x20/0x40
        __kmalloc+0x1c8/0x240
        cttimeout_new_timeout+0xd4/0x240 [nfnetlink_cttimeout]
        nfnetlink_rcv_msg+0x21a/0x230 [nfnetlink]
        [ ... ]
      
      So only when the refcnt decreased to 0, we call kfree_rcu to free the
      timeout object. And like nfnetlink_acct do, use atomic_cmpxchg to
      avoid race between ctnl_timeout_try_del and ctnl_timeout_put.
      Signed-off-by: NLiping Zhang <liping.zhang@spreadtrum.com>
      Signed-off-by: NPablo Neira Ayuso <pablo@netfilter.org>
      b75911b6
  8. 11 7月, 2016 1 次提交
    • L
      netfilter: cttimeout: unlink timeout obj again when hash resize happen · 474803d3
      Liping Zhang 提交于
      Imagine such situation, nf_conntrack_htable_size now is 4096, we are doing
      ctnl_untimeout, and iterate on 3000# bucket.
      
      Meanwhile, another user try to reduce hash size to 2048, then all nf_conn
      are removed to the new hashtable. When this hash resize operation finished,
      we still try to itreate ct begin from 3000# bucket, find nothing to do and
      just return.
      
      We may miss unlinking some timeout objects. And later we will end up with
      invalid references to timeout object that are already gone.
      
      So when we find that hash resize happened, try to unlink timeout objects
      from the 0# bucket again.
      Signed-off-by: NLiping Zhang <liping.zhang@spreadtrum.com>
      Signed-off-by: NPablo Neira Ayuso <pablo@netfilter.org>
      474803d3
  9. 05 5月, 2016 1 次提交
  10. 01 2月, 2016 1 次提交
  11. 20 1月, 2016 1 次提交
  12. 29 12月, 2015 1 次提交
  13. 14 12月, 2015 1 次提交
  14. 12 10月, 2015 2 次提交
  15. 01 10月, 2013 1 次提交
    • P
      netfilter: cttimeout: allow to set/get default protocol timeouts · 91cb498e
      Pablo Neira Ayuso 提交于
      Default timeouts are currently set via proc/sysctl interface, the
      typical pattern is a file name like:
      
      /proc/sys/net/netfilter/nf_conntrack_PROTOCOL_timeout_STATE
      
      This results in one entry per default protocol state timeout.
      This patch simplifies this by allowing to set default protocol
      timeouts via cttimeout netlink interface.
      
      This should allow us to get rid of the existing proc/sysctl code
      in the midterm.
      Signed-off-by: NPablo Neira Ayuso <pablo@netfilter.org>
      91cb498e
  16. 20 6月, 2013 1 次提交
  17. 05 6月, 2013 1 次提交
  18. 22 11月, 2012 1 次提交
  19. 11 9月, 2012 1 次提交
  20. 07 6月, 2012 1 次提交
  21. 02 4月, 2012 1 次提交
  22. 23 3月, 2012 1 次提交
  23. 08 3月, 2012 3 次提交