1. 14 Jan, 2021 16 commits
  2. 13 Jan, 2021 20 commits
  3. 12 Jan, 2021 4 commits
    • Petr Machata's avatar
      net: dcb: Accept RTM_GETDCB messages carrying set-like DCB commands · df85bc14
      Petr Machata authored
      In commit 826f328e ("net: dcb: Validate netlink message in DCB
      handler"), Linux started rejecting RTM_GETDCB netlink messages if they
      contained a set-like DCB_CMD_ command.
      
      The reason was that privileges were only verified for RTM_SETDCB messages,
      but the value that determined the action to be taken is the command, not
      the message type. And validation of message type against the DCB command
      was the obvious missing piece.
      
      Unfortunately it turns out that mlnx_qos, a somewhat widely deployed tool
      for configuration of DCB, accesses the DCB set-like APIs through
      RTM_GETDCB.
      
      Therefore do not bounce the discrepancy between message type and command.
      Instead, in addition to validating privileges based on the actual message
      type, validate them also based on the expected message type. This closes
      the loophole of allowing DCB configuration on non-admin accounts, while
      maintaining backward compatibility.
      
      Fixes: 2f90b865 ("ixgbe: this patch adds support for DCB to the kernel and ixgbe driver")
      Fixes: 826f328e ("net: dcb: Validate netlink message in DCB handler")
      Signed-off-by: default avatarPetr Machata <petrm@nvidia.com>
      Link: https://lore.kernel.org/r/a3edcfda0825f2aa2591801c5232f2bbf2d8a554.1610384801.git.me@pmachata.orgSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      df85bc14
    • Jakub Kicinski's avatar
      Merge branch 'skb-frag-kmap_atomic-fixes' · 1ee527a7
      Jakub Kicinski authored
      Willem de Bruijn says:
      
      ====================
      skb frag: kmap_atomic fixes
      
      skb frags may be backed by highmem and/or compound pages. Various
      code calls kmap_atomic to safely access highmem pages. But this
      needs additional care for compound pages. Fix a few issues:
      
      patch 1 expect kmap mappings with CONFIG_DEBUG_KMAP_LOCAL_FORCE_MAP
      patch 2 fixes kmap_atomic + compound page support in skb_seq_read
      patch 3 fixes kmap_atomic + compound page support in esp
      ====================
      
      Link: https://lore.kernel.org/r/20210109221834.3459768-1-willemdebruijn.kernel@gmail.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      1ee527a7
    • Willem de Bruijn's avatar
      esp: avoid unneeded kmap_atomic call · 9bd6b629
      Willem de Bruijn authored
      esp(6)_output_head uses skb_page_frag_refill to allocate a buffer for
      the esp trailer.
      
      It accesses the page with kmap_atomic to handle highmem. But
      skb_page_frag_refill can return compound pages, of which
      kmap_atomic only maps the first underlying page.
      
      skb_page_frag_refill does not return highmem, because flag
      __GFP_HIGHMEM is not set. ESP uses it in the same manner as TCP.
      That also does not call kmap_atomic, but directly uses page_address,
      in skb_copy_to_page_nocache. Do the same for ESP.
      
      This issue has become easier to trigger with recent kmap local
      debugging feature CONFIG_DEBUG_KMAP_LOCAL_FORCE_MAP.
      
      Fixes: cac2661c ("esp4: Avoid skb_cow_data whenever possible")
      Fixes: 03e2a30f ("esp6: Avoid skb_cow_data whenever possible")
      Signed-off-by: default avatarWillem de Bruijn <willemb@google.com>
      Acked-by: default avatarSteffen Klassert <steffen.klassert@secunet.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      9bd6b629
    • Willem de Bruijn's avatar
      net: compound page support in skb_seq_read · 97550f6f
      Willem de Bruijn authored
      skb_seq_read iterates over an skb, returning pointer and length of
      the next data range with each call.
      
      It relies on kmap_atomic to access highmem pages when needed.
      
      An skb frag may be backed by a compound page, but kmap_atomic maps
      only a single page. There are not enough kmap slots to always map all
      pages concurrently.
      
      Instead, if kmap_atomic is needed, iterate over each page.
      
      As this increases the number of calls, avoid this unless needed.
      The necessary condition is captured in skb_frag_must_loop.
      
      I tried to make the change as obvious as possible. It should be easy
      to verify that nothing changes if skb_frag_must_loop returns false.
      
      Tested:
        On an x86 platform with
          CONFIG_HIGHMEM=y
          CONFIG_DEBUG_KMAP_LOCAL_FORCE_MAP=y
          CONFIG_NETFILTER_XT_MATCH_STRING=y
      
        Run
          ip link set dev lo mtu 1500
          iptables -A OUTPUT -m string --string 'badstring' -algo bm -j ACCEPT
          dd if=/dev/urandom of=in bs=1M count=20
          nc -l -p 8000 > /dev/null &
          nc -w 1 -q 0 localhost 8000 < in
      Signed-off-by: default avatarWillem de Bruijn <willemb@google.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      97550f6f