1. 05 10月, 2020 5 次提交
    • P
      netfilter: nf_tables: Implement fast bitwise expression · 10fdd6d8
      Phil Sutter 提交于
      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: NPhil Sutter <phil@nwl.cc>
      Signed-off-by: NPablo Neira Ayuso <pablo@netfilter.org>
      10fdd6d8
    • P
      netfilter: nf_tables: Enable fast nft_cmp for inverted matches · 5f48846d
      Phil Sutter 提交于
      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: NPhil Sutter <phil@nwl.cc>
      Signed-off-by: NPablo Neira Ayuso <pablo@netfilter.org>
      5f48846d
    • F
      netfilter: nfnetlink: place subsys mutexes in distinct lockdep classes · ab6c41ee
      Florian Westphal 提交于
      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: NFlorian Westphal <fw@strlen.de>
      Signed-off-by: NPablo Neira Ayuso <pablo@netfilter.org>
      ab6c41ee
    • V
      netfilter: ipset: enable memory accounting for ipset allocations · 9446ab34
      Vasily Averin 提交于
      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: NVasily Averin <vvs@virtuozzo.com>
      Signed-off-by: NPablo Neira Ayuso <pablo@netfilter.org>
      9446ab34
    • Y
      netfilter: nf_tables_offload: Remove unused macro FLOW_SETUP_BLOCK · 82ec6630
      YueHaibing 提交于
      commit 9a32669f ("netfilter: nf_tables_offload: support indr block call")
      left behind this.
      Signed-off-by: NYueHaibing <yuehaibing@huawei.com>
      Signed-off-by: NPablo Neira Ayuso <pablo@netfilter.org>
      82ec6630
  2. 30 9月, 2020 3 次提交
  3. 22 9月, 2020 26 次提交
  4. 21 9月, 2020 6 次提交