1. 14 Feb, 2018 5 commits
    • Florian Westphal's avatar
      netfilter: x_tables: use pr ratelimiting in xt core · 1b6cd671
      Florian Westphal authored
      most messages are converted to info, since they occur in response to
      wrong usage.
      
      Size mismatch however is a real error (xtables ABI bug) that should not
      occur.
      Signed-off-by: default avatarFlorian Westphal <fw@strlen.de>
      Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
      1b6cd671
    • Florian Westphal's avatar
      netfilter: x_tables: remove pr_info where possible · 0cc9501f
      Florian Westphal authored
      remove several pr_info messages that cannot be triggered with iptables,
      the check is only to ensure input is sane.
      
      iptables(8) already prints error messages in these cases.
      Signed-off-by: default avatarFlorian Westphal <fw@strlen.de>
      Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
      0cc9501f
    • Cong Wang's avatar
      netfilter: ipt_CLUSTERIP: fix a refcount bug in clusterip_config_find_get() · db93a363
      Cong Wang authored
      In clusterip_config_find_get() we hold RCU read lock so it could
      run concurrently with clusterip_config_entry_put(), as a result,
      the refcnt could go back to 1 from 0, which leads to a double
      list_del()... Just replace refcount_inc() with
      refcount_inc_not_zero(), as for c->refcount.
      
      Fixes: d73f33b1 ("netfilter: CLUSTERIP: RCU conversion")
      Cc: Eric Dumazet <eric.dumazet@gmail.com>
      Cc: Pablo Neira Ayuso <pablo@netfilter.org>
      Cc: Florian Westphal <fw@strlen.de>
      Signed-off-by: default avatarCong Wang <xiyou.wangcong@gmail.com>
      Reviewed-by: default avatarFlorian Westphal <fw@strlen.de>
      Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
      db93a363
    • Florian Westphal's avatar
      netfilter: add back stackpointer size checks · 57ebd808
      Florian Westphal authored
      The rationale for removing the check is only correct for rulesets
      generated by ip(6)tables.
      
      In iptables, a jump can only occur to a user-defined chain, i.e.
      because we size the stack based on number of user-defined chains we
      cannot exceed stack size.
      
      However, the underlying binary format has no such restriction,
      and the validation step only ensures that the jump target is a
      valid rule start point.
      
      IOW, its possible to build a rule blob that has no user-defined
      chains but does contain a jump.
      
      If this happens, no jump stack gets allocated and crash occurs
      because no jumpstack was allocated.
      
      Fixes: 7814b6ec ("netfilter: xtables: don't save/restore jumpstack offset")
      Reported-by: syzbot+e783f671527912cd9403@syzkaller.appspotmail.com
      Signed-off-by: default avatarFlorian Westphal <fw@strlen.de>
      Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
      57ebd808
    • Paolo Abeni's avatar
      netfilter: drop outermost socket lock in getsockopt() · 01ea306f
      Paolo Abeni authored
      The Syzbot reported a possible deadlock in the netfilter area caused by
      rtnl lock, xt lock and socket lock being acquired with a different order
      on different code paths, leading to the following backtrace:
      Reviewed-by: default avatarXin Long <lucien.xin@gmail.com>
      
      ======================================================
      WARNING: possible circular locking dependency detected
      4.15.0+ #301 Not tainted
      ------------------------------------------------------
      syzkaller233489/4179 is trying to acquire lock:
        (rtnl_mutex){+.+.}, at: [<0000000048e996fd>] rtnl_lock+0x17/0x20
      net/core/rtnetlink.c:74
      
      but task is already holding lock:
        (&xt[i].mutex){+.+.}, at: [<00000000328553a2>]
      xt_find_table_lock+0x3e/0x3e0 net/netfilter/x_tables.c:1041
      
      which lock already depends on the new lock.
      ===
      
      Since commit 3f34cfae1230 ("netfilter: on sockopt() acquire sock lock
      only in the required scope"), we already acquire the socket lock in
      the innermost scope, where needed. In such commit I forgot to remove
      the outer-most socket lock from the getsockopt() path, this commit
      addresses the issues dropping it now.
      
      v1 -> v2: fix bad subj, added relavant 'fixes' tag
      
      Fixes: 22265a5c ("netfilter: xt_TEE: resolve oif using netdevice notifiers")
      Fixes: 202f59af ("netfilter: ipt_CLUSTERIP: do not hold dev")
      Fixes: 3f34cfae1230 ("netfilter: on sockopt() acquire sock lock only in the required scope")
      Reported-by: syzbot+ddde1c7b7ff7442d7f2d@syzkaller.appspotmail.com
      Suggested-by: default avatarFlorian Westphal <fw@strlen.de>
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
      01ea306f
  2. 08 Feb, 2018 13 commits
  3. 07 Feb, 2018 22 commits