1. 24 2月, 2021 1 次提交
  2. 16 2月, 2021 1 次提交
  3. 13 2月, 2021 1 次提交
  4. 12 2月, 2021 4 次提交
    • A
      tcp: Sanitize CMSG flags and reserved args in tcp_zerocopy_receive. · 3c5a2fd0
      Arjun Roy 提交于
      Explicitly define reserved field and require it and any subsequent
      fields to be zero-valued for now. Additionally, limit the valid CMSG
      flags that tcp_zerocopy_receive accepts.
      
      Fixes: 7eeba170 ("tcp: Add receive timestamp support for receive zerocopy.")
      Signed-off-by: NArjun Roy <arjunroy@google.com>
      Signed-off-by: NEric Dumazet <edumazet@google.com>
      Signed-off-by: NSoheil Hassas Yeganeh <soheil@google.com>
      Suggested-by: NDavid Ahern <dsahern@gmail.com>
      Suggested-by: NLeon Romanovsky <leon@kernel.org>
      Suggested-by: NJakub Kicinski <kuba@kernel.org>
      Acked-by: NJakub Kicinski <kuba@kernel.org>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      3c5a2fd0
    • V
      net: ipconfig: avoid use-after-free in ic_close_devs · f68cbaed
      Vladimir Oltean 提交于
      Due to the fact that ic_dev->dev is kept open in ic_close_dev, I had
      thought that ic_dev will not be freed either. But that is not the case,
      but instead "everybody dies" when ipconfig cleans up, and just the
      net_device behind ic_dev->dev remains allocated but not ic_dev itself.
      
      This is a problem because in ic_close_devs, for every net device that
      we're about to close, we compare it against the list of lower interfaces
      of ic_dev, to figure out whether we should close it or not. But since
      ic_dev itself is subject to freeing, this means that at some point in
      the middle of the list of ipconfig interfaces, ic_dev will have been
      freed, and we would be still attempting to iterate through its list of
      lower interfaces while checking whether to bring down the remaining
      ipconfig interfaces.
      
      There are multiple ways to avoid the use-after-free: we could delay
      freeing ic_dev until the very end (outside the while loop). Or an even
      simpler one: we can observe that we don't need ic_dev when iterating
      through its lowers, only ic_dev->dev, structure which isn't ever freed.
      So, by keeping ic_dev->dev in a variable assigned prior to freeing
      ic_dev, we can avoid all use-after-free issues.
      
      Fixes: 46acf7bd ("Revert "net: ipv4: handle DSA enabled master network devices"")
      Reported-by: Nkernel test robot <oliver.sang@intel.com>
      Signed-off-by: NVladimir Oltean <vladimir.oltean@nxp.com>
      Reviewed-by: NFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      f68cbaed
    • E
      tcp: add some entropy in __inet_hash_connect() · c579bd1b
      Eric Dumazet 提交于
      Even when implementing RFC 6056 3.3.4 (Algorithm 4: Double-Hash
      Port Selection Algorithm), a patient attacker could still be able
      to collect enough state from an otherwise idle host.
      
      Idea of this patch is to inject some noise, in the
      cases __inet_hash_connect() found a candidate in the first
      attempt.
      
      This noise should not significantly reduce the collision
      avoidance, and should be zero if connection table
      is already well used.
      
      Note that this is not implementing RFC 6056 3.3.5
      because we think Algorithm 5 could hurt typical
      workloads.
      Signed-off-by: NEric Dumazet <edumazet@google.com>
      Cc: David Dworken <ddworken@google.com>
      Cc: Willem de Bruijn <willemb@google.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      c579bd1b
    • E
      tcp: change source port randomizarion at connect() time · 190cc824
      Eric Dumazet 提交于
      RFC 6056 (Recommendations for Transport-Protocol Port Randomization)
      provides good summary of why source selection needs extra care.
      
      David Dworken reminded us that linux implements Algorithm 3
      as described in RFC 6056 3.3.3
      
      Quoting David :
         In the context of the web, this creates an interesting info leak where
         websites can count how many TCP connections a user's computer is
         establishing over time. For example, this allows a website to count
         exactly how many subresources a third party website loaded.
         This also allows:
         - Distinguishing between different users behind a VPN based on
             distinct source port ranges.
         - Tracking users over time across multiple networks.
         - Covert communication channels between different browsers/browser
             profiles running on the same computer
         - Tracking what applications are running on a computer based on
             the pattern of how fast source ports are getting incremented.
      
      Section 3.3.4 describes an enhancement, that reduces
      attackers ability to use the basic information currently
      stored into the shared 'u32 hint'.
      
      This change also decreases collision rate when
      multiple applications need to connect() to
      different destinations.
      Signed-off-by: NEric Dumazet <edumazet@google.com>
      Reported-by: NDavid Dworken <ddworken@google.com>
      Cc: Willem de Bruijn <willemb@google.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      190cc824
  5. 09 2月, 2021 2 次提交
    • A
      IPv4: Extend 'fib_notify_on_flag_change' sysctl · 648106c3
      Amit Cohen 提交于
      Add the value '2' to 'fib_notify_on_flag_change' to allow sending
      notifications only for failed route installation.
      
      Separate value is added for such notifications because there are less of
      them, so they do not impact performance and some users will find them more
      important.
      Signed-off-by: NAmit Cohen <amcohen@nvidia.com>
      Signed-off-by: NIdo Schimmel <idosch@nvidia.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      648106c3
    • A
      IPv4: Add "offload failed" indication to routes · 36c5100e
      Amit Cohen 提交于
      After installing a route to the kernel, user space receives an
      acknowledgment, which means the route was installed in the kernel, but not
      necessarily in hardware.
      
      The asynchronous nature of route installation in hardware can lead to a
      routing daemon advertising a route before it was actually installed in
      hardware. This can result in packet loss or mis-routed packets until the
      route is installed in hardware.
      
      To avoid such cases, previous patch set added the ability to emit
      RTM_NEWROUTE notifications whenever RTM_F_OFFLOAD/RTM_F_TRAP flags
      are changed, this behavior is controlled by sysctl.
      
      With the above mentioned behavior, it is possible to know from user-space
      if the route was offloaded, but if the offload fails there is no indication
      to user-space. Following a failure, a routing daemon will wait indefinitely
      for a notification that will never come.
      
      This patch adds an "offload_failed" indication to IPv4 routes, so that
      users will have better visibility into the offload process.
      
      'struct fib_alias', and 'struct fib_rt_info' are extended with new field
      that indicates if route offload failed. Note that the new field is added
      using unused bit and therefore there is no need to increase structs size.
      Signed-off-by: NAmit Cohen <amcohen@nvidia.com>
      Signed-off-by: NIdo Schimmel <idosch@nvidia.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      36c5100e
  6. 07 2月, 2021 1 次提交
    • V
      Revert "net: ipv4: handle DSA enabled master network devices" · 46acf7bd
      Vladimir Oltean 提交于
      This reverts commit 728c0208.
      
      Since 2015 DSA has gained more integration with the network stack, we
      can now have the same functionality without explicitly open-coding for
      it:
      - It now opens the DSA master netdevice automatically whenever a user
        netdevice is opened.
      - The master and switch interfaces are coupled in an upper/lower
        hierarchy using the netdev adjacency lists.
      
      In the nfsroot example below, the interface chosen by autoconfig was
      swp3, and every interface except that and the DSA master, eth1, was
      brought down afterwards:
      
      [    8.714215] mscc_felix 0000:00:00.5 swp0 (uninitialized): PHY [0000:00:00.3:10] driver [Microsemi GE VSC8514 SyncE] (irq=POLL)
      [    8.978041] mscc_felix 0000:00:00.5 swp1 (uninitialized): PHY [0000:00:00.3:11] driver [Microsemi GE VSC8514 SyncE] (irq=POLL)
      [    9.246134] mscc_felix 0000:00:00.5 swp2 (uninitialized): PHY [0000:00:00.3:12] driver [Microsemi GE VSC8514 SyncE] (irq=POLL)
      [    9.486203] mscc_felix 0000:00:00.5 swp3 (uninitialized): PHY [0000:00:00.3:13] driver [Microsemi GE VSC8514 SyncE] (irq=POLL)
      [    9.512827] mscc_felix 0000:00:00.5: configuring for fixed/internal link mode
      [    9.521047] mscc_felix 0000:00:00.5: Link is Up - 2.5Gbps/Full - flow control off
      [    9.530382] device eth1 entered promiscuous mode
      [    9.535452] DSA: tree 0 setup
      [    9.539777] printk: console [netcon0] enabled
      [    9.544504] netconsole: network logging started
      [    9.555047] fsl_enetc 0000:00:00.2 eth1: configuring for fixed/internal link mode
      [    9.562790] fsl_enetc 0000:00:00.2 eth1: Link is Up - 1Gbps/Full - flow control off
      [    9.564661] 8021q: adding VLAN 0 to HW filter on device bond0
      [    9.637681] fsl_enetc 0000:00:00.0 eth0: PHY [0000:00:00.0:02] driver [Qualcomm Atheros AR8031/AR8033] (irq=POLL)
      [    9.655679] fsl_enetc 0000:00:00.0 eth0: configuring for inband/sgmii link mode
      [    9.666611] mscc_felix 0000:00:00.5 swp0: configuring for inband/qsgmii link mode
      [    9.676216] 8021q: adding VLAN 0 to HW filter on device swp0
      [    9.682086] mscc_felix 0000:00:00.5 swp1: configuring for inband/qsgmii link mode
      [    9.690700] 8021q: adding VLAN 0 to HW filter on device swp1
      [    9.696538] mscc_felix 0000:00:00.5 swp2: configuring for inband/qsgmii link mode
      [    9.705131] 8021q: adding VLAN 0 to HW filter on device swp2
      [    9.710964] mscc_felix 0000:00:00.5 swp3: configuring for inband/qsgmii link mode
      [    9.719548] 8021q: adding VLAN 0 to HW filter on device swp3
      [    9.747811] Sending DHCP requests ..
      [   12.742899] mscc_felix 0000:00:00.5 swp1: Link is Up - 1Gbps/Full - flow control rx/tx
      [   12.743828] mscc_felix 0000:00:00.5 swp0: Link is Up - 1Gbps/Full - flow control off
      [   12.747062] IPv6: ADDRCONF(NETDEV_CHANGE): swp1: link becomes ready
      [   12.755216] fsl_enetc 0000:00:00.0 eth0: Link is Up - 1Gbps/Full - flow control rx/tx
      [   12.766603] IPv6: ADDRCONF(NETDEV_CHANGE): swp0: link becomes ready
      [   12.783188] mscc_felix 0000:00:00.5 swp2: Link is Up - 1Gbps/Full - flow control rx/tx
      [   12.785354] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
      [   12.799535] IPv6: ADDRCONF(NETDEV_CHANGE): swp2: link becomes ready
      [   13.803141] mscc_felix 0000:00:00.5 swp3: Link is Up - 1Gbps/Full - flow control rx/tx
      [   13.811646] IPv6: ADDRCONF(NETDEV_CHANGE): swp3: link becomes ready
      [   15.452018] ., OK
      [   15.470336] IP-Config: Got DHCP answer from 10.0.0.1, my address is 10.0.0.39
      [   15.477887] IP-Config: Complete:
      [   15.481330]      device=swp3, hwaddr=00:04:9f:05:de:0a, ipaddr=10.0.0.39, mask=255.255.255.0, gw=10.0.0.1
      [   15.491846]      host=10.0.0.39, domain=(none), nis-domain=(none)
      [   15.498429]      bootserver=10.0.0.1, rootserver=10.0.0.1, rootpath=
      [   15.498481]      nameserver0=8.8.8.8
      [   15.627542] fsl_enetc 0000:00:00.0 eth0: Link is Down
      [   15.690903] mscc_felix 0000:00:00.5 swp0: Link is Down
      [   15.745216] mscc_felix 0000:00:00.5 swp1: Link is Down
      [   15.800498] mscc_felix 0000:00:00.5 swp2: Link is Down
      Signed-off-by: NVladimir Oltean <vladimir.oltean@nxp.com>
      Reviewed-by: NAndrew Lunn <andrew@lunn.ch>
      Reviewed-by: NFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: NJakub Kicinski <kuba@kernel.org>
      46acf7bd
  7. 05 2月, 2021 2 次提交
  8. 04 2月, 2021 4 次提交
  9. 03 2月, 2021 4 次提交
  10. 02 2月, 2021 2 次提交
  11. 30 1月, 2021 2 次提交
    • E
      net: proc: speedup /proc/net/netstat · 0d6cd689
      Eric Dumazet 提交于
      Use cache friendly helpers to better use cpu caches
      while reading /proc/net/netstat
      
      Tested on a platform with 256 threads (AMD Rome)
      
      Before: 305 usec spent in netstat_seq_show()
      After: 130 usec spent in netstat_seq_show()
      Signed-off-by: NEric Dumazet <edumazet@google.com>
      Link: https://lore.kernel.org/r/20210128162145.1703601-1-eric.dumazet@gmail.comSigned-off-by: NJakub Kicinski <kuba@kernel.org>
      0d6cd689
    • X
      ip_gre: add csum offload support for gre header · efa1a65c
      Xin Long 提交于
      This patch is to add csum offload support for gre header:
      
      On the TX path in gre_build_header(), when CHECKSUM_PARTIAL's set
      for inner proto, it will calculate the csum for outer proto, and
      inner csum will be offloaded later. Otherwise, CHECKSUM_PARTIAL
      and csum_start/offset will be set for outer proto, and the outer
      csum will be offloaded later.
      
      On the GSO path in gre_gso_segment(), when CHECKSUM_PARTIAL is
      not set for inner proto and the hardware supports csum offload,
      CHECKSUM_PARTIAL and csum_start/offset will be set for outer
      proto, and outer csum will be offloaded later. Otherwise, it
      will do csum for outer proto by calling gso_make_checksum().
      
      Note that SCTP has to do the csum by itself for non GSO path in
      sctp_packet_pack(), as gre_build_header() can't handle the csum
      with CHECKSUM_PARTIAL set for SCTP CRC csum offload.
      
      v1->v2:
        - remove the SCTP part, as GRE dev doesn't support SCTP CRC CSUM
          and it will always do checksum for SCTP in sctp_packet_pack()
          when it's not a GSO packet.
      Signed-off-by: NXin Long <lucien.xin@gmail.com>
      Signed-off-by: NJakub Kicinski <kuba@kernel.org>
      efa1a65c
  12. 29 1月, 2021 12 次提交
  13. 28 1月, 2021 2 次提交
  14. 27 1月, 2021 1 次提交
  15. 24 1月, 2021 1 次提交