Skip to content
  1. Oct 05, 2020
    • Phil Sutter's avatar
      netfilter: nf_tables: Implement fast bitwise expression · 10fdd6d8
      Phil Sutter authored
      
      
      A typical use of bitwise expression is to mask out parts of an IP
      address when matching on the network part only. Optimize for this common
      use with a fast variant for NFT_BITWISE_BOOL-type expressions operating
      on 32bit-sized values.
      
      Signed-off-by: default avatarPhil Sutter <phil@nwl.cc>
      Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
      10fdd6d8
    • Phil Sutter's avatar
      netfilter: nf_tables: Enable fast nft_cmp for inverted matches · 5f48846d
      Phil Sutter authored
      
      
      Add a boolean indicating NFT_CMP_NEQ. To include it into the match
      decision, it is sufficient to XOR it with the data comparison's result.
      
      While being at it, store the mask that is calculated during expression
      init and free the eval routine from having to recalculate it each time.
      
      Signed-off-by: default avatarPhil Sutter <phil@nwl.cc>
      Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
      5f48846d
    • Florian Westphal's avatar
      netfilter: nfnetlink: place subsys mutexes in distinct lockdep classes · ab6c41ee
      Florian Westphal authored
      
      
      From time to time there are lockdep reports similar to this one:
      
       WARNING: possible circular locking dependency detected
       ------------------------------------------------------
       000000004f61aa56 (&table[i].mutex){+.+.}, at: nfnl_lock [nfnetlink]
       but task is already holding lock:
       [..] (&net->nft.commit_mutex){+.+.}, at: nf_tables_valid_genid [nf_tables]
       which lock already depends on the new lock.
       the existing dependency chain (in reverse order) is:
       -> #1 (&net->nft.commit_mutex){+.+.}:
       [..]
              nf_tables_valid_genid+0x18/0x60 [nf_tables]
              nfnetlink_rcv_batch+0x24c/0x620 [nfnetlink]
              nfnetlink_rcv+0x110/0x140 [nfnetlink]
              netlink_unicast+0x12c/0x1e0
       [..]
              sys_sendmsg+0x18/0x40
              linux_sparc_syscall+0x34/0x44
       -> #0 (&table[i].mutex){+.+.}:
       [..]
              nfnl_lock+0x24/0x40 [nfnetlink]
              ip_set_nfnl_get_byindex+0x19c/0x280 [ip_set]
              set_match_v1_checkentry+0x14/0xc0 [xt_set]
              xt_check_match+0x238/0x260 [x_tables]
              __nft_match_init+0x160/0x180 [nft_compat]
       [..]
              sys_sendmsg+0x18/0x40
              linux_sparc_syscall+0x34/0x44
       other info that might help us debug this:
        Possible unsafe locking scenario:
              CPU0                    CPU1
              ----                    ----
         lock(&net->nft.commit_mutex);
                                      lock(&table[i].mutex);
                                      lock(&net->nft.commit_mutex);
         lock(&table[i].mutex);
      
      Lockdep considers this an ABBA deadlock because the different nfnl subsys
      mutexes reside in the same lockdep class, but this is a false positive.
      
      CPU1 table[i] refers to the nftables subsys mutex, whereas CPU1 locks
      the ipset subsys mutex.
      
      Yi Che reported a similar lockdep splat, this time between ipset and
      ctnetlink subsys mutexes.
      
      Time to place them in distinct classes to avoid these warnings.
      
      Signed-off-by: default avatarFlorian Westphal <fw@strlen.de>
      Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
      ab6c41ee
    • Vasily Averin's avatar
      netfilter: ipset: enable memory accounting for ipset allocations · 9446ab34
      Vasily Averin authored
      
      
      Currently netadmin inside non-trusted container can quickly allocate
      whole node's memory via request of huge ipset hashtable.
      Other ipset-related memory allocations should be restricted too.
      
      v2: fixed typo ALLOC -> ACCOUNT
      
      Signed-off-by: default avatarVasily Averin <vvs@virtuozzo.com>
      Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
      9446ab34
    • YueHaibing's avatar
      netfilter: nf_tables_offload: Remove unused macro FLOW_SETUP_BLOCK · 82ec6630
      YueHaibing authored
      
      
      commit 9a32669f ("netfilter: nf_tables_offload: support indr block call")
      left behind this.
      
      Signed-off-by: default avatarYueHaibing <yuehaibing@huawei.com>
      Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
      82ec6630
  2. Sep 30, 2020
  3. Sep 22, 2020
  4. Sep 21, 2020