1. 10 Aug, 2022 2 commits
    • Christophe JAILLET's avatar
    • Jakub Kicinski's avatar
      Merge git://git.kernel.org/pub/scm/linux/kernel/git/netfilter/nf · 690bf643
      Jakub Kicinski authored
      Pablo Neira Ayuso says:
      
      ====================
      Netfilter fixes for net
      
      The following patchset contains Netfilter fixes for net:
      
      1) Harden set element field checks to avoid out-of-bound memory access,
         this patch also fixes the type of issue described in 7e6bc1f6
         ("netfilter: nf_tables: stricter validation of element data") in a
         broader way.
      
      2) Patches to restrict the chain, set, and rule id lookup in the
         transaction to the corresponding top-level table, patches from
         Thadeu Lima de Souza Cascardo.
      
      3) Fix incorrect comment in ip6t_LOG.h
      
      4) nft_data_init() performs upfront validation of the expected data.
         struct nft_data_desc is used to describe the expected data to be
         received from userspace. The .size field represents the maximum size
         that can be stored, for bound checks. Then, .len is an input/output field
         which stores the expected length as input (this is optional, to restrict
         the checks), as output it stores the real length received from userspace
         (if it was not specified as input). This patch comes in response to
         7e6bc1f6 ("netfilter: nf_tables: stricter validation of element data")
         to address this type of issue in a more generic way by avoid opencoded
         data validation. Next patch requires this as a dependency.
      
      5) Disallow jump to implicit chain from set element, this configuration
         is invalid. Only allow jump to chain via immediate expression is
         supported at this stage.
      
      6) Fix possible null-pointer derefence in the error path of table updates,
         if memory allocation of the transaction fails. From Florian Westphal.
      
      * git://git.kernel.org/pub/scm/linux/kernel/git/netfilter/nf:
        netfilter: nf_tables: fix null deref due to zeroed list head
        netfilter: nf_tables: disallow jump to implicit chain from set element
        netfilter: nf_tables: upfront validation of data via nft_data_init()
        netfilter: ip6t_LOG: Fix a typo in a comment
        netfilter: nf_tables: do not allow RULE_ID to refer to another chain
        netfilter: nf_tables: do not allow CHAIN_ID to refer to another table
        netfilter: nf_tables: do not allow SET_ID to refer to another table
        netfilter: nf_tables: validate variable length element extension
      ====================
      
      Link: https://lore.kernel.org/r/20220809220532.130240-1-pablo@netfilter.org/Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      690bf643
  2. 09 Aug, 2022 33 commits
  3. 08 Aug, 2022 4 commits
  4. 06 Aug, 2022 1 commit
    • Nick Desaulniers's avatar
      net: seg6: initialize induction variable to first valid array index · ac0dbed9
      Nick Desaulniers authored
      Fixes the following warnings observed when building
      CONFIG_IPV6_SEG6_LWTUNNEL=y with clang:
      
        net/ipv6/seg6_local.o: warning: objtool: seg6_local_fill_encap() falls
        through to next function seg6_local_get_encap_size()
        net/ipv6/seg6_local.o: warning: objtool: seg6_local_cmp_encap() falls
        through to next function input_action_end()
      
      LLVM can fully unroll loops in seg6_local_get_encap_size() and
      seg6_local_cmp_encap(). One issue in those loops is that the induction
      variable is initialized to 0. The loop iterates over members of
      seg6_action_params, a global array of struct seg6_action_param calling
      their put() function pointer members.  seg6_action_param uses an array
      initializer to initialize SEG6_LOCAL_SRH and later elements, which is
      the third enumeration of an anonymous union.
      
      The guard `if (attrs & SEG6_F_ATTR(i))` may prevent this from being
      called at runtime, but it would still be UB for
      `seg6_action_params[0]->put` to be called; the unrolled loop will make
      the initial iterations unreachable, which LLVM will later rotate to
      fallthrough to the next function.
      
      Make this more obvious that this cannot happen to the compiler by
      initializing the loop induction variable to the minimum valid index that
      seg6_action_params is initialized to.
      Reported-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Signed-off-by: default avatarNick Desaulniers <ndesaulniers@google.com>
      Link: https://lore.kernel.org/r/20220802161203.622293-1-ndesaulniers@google.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      ac0dbed9