1. 09 Jun, 2011 1 commit
    • Jerry Chu's avatar
      tcp: RFC2988bis + taking RTT sample from 3WHS for the passive open side · 9ad7c049
      Jerry Chu authored
      
      This patch lowers the default initRTO from 3secs to 1sec per
      RFC2988bis. It falls back to 3secs if the SYN or SYN-ACK packet
      has been retransmitted, AND the TCP timestamp option is not on.
      
      It also adds support to take RTT sample during 3WHS on the passive
      open side, just like its active open counterpart, and uses it, if
      valid, to seed the initRTO for the data transmission phase.
      
      The patch also resets ssthresh to its initial default at the
      beginning of the data transmission phase, and reduces cwnd to 1 if
      there has been MORE THAN ONE retransmission during 3WHS per RFC5681.
      Signed-off-by: default avatarH.K. Jerry Chu <hkchu@google.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      9ad7c049
  2. 24 May, 2011 1 commit
    • Dan Rosenberg's avatar
      net: convert %p usage to %pK · 71338aa7
      Dan Rosenberg authored
      
      The %pK format specifier is designed to hide exposed kernel pointers,
      specifically via /proc interfaces.  Exposing these pointers provides an
      easy target for kernel write vulnerabilities, since they reveal the
      locations of writable structures containing easily triggerable function
      pointers.  The behavior of %pK depends on the kptr_restrict sysctl.
      
      If kptr_restrict is set to 0, no deviation from the standard %p behavior
      occurs.  If kptr_restrict is set to 1, the default, if the current user
      (intended to be a reader via seq_printf(), etc.) does not have CAP_SYSLOG
      (currently in the LSM tree), kernel pointers using %pK are printed as 0's.
       If kptr_restrict is set to 2, kernel pointers using %pK are printed as
      0's regardless of privileges.  Replacing with 0's was chosen over the
      default "(null)", which cannot be parsed by userland %p, which expects
      "(nil)".
      
      The supporting code for kptr_restrict and %pK are currently in the -mm
      tree.  This patch converts users of %p in net/ to %pK.  Cases of printing
      pointers to the syslog are not covered, since this would eliminate useful
      information for postmortem debugging and the reading of the syslog is
      already optionally protected by the dmesg_restrict sysctl.
      Signed-off-by: default avatarDan Rosenberg <drosenberg@vsecurity.com>
      Cc: James Morris <jmorris@namei.org>
      Cc: Eric Dumazet <eric.dumazet@gmail.com>
      Cc: Thomas Graf <tgraf@infradead.org>
      Cc: Eugene Teo <eugeneteo@kernel.org>
      Cc: Kees Cook <kees.cook@canonical.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: David S. Miller <davem@davemloft.net>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Eric Paris <eparis@parisplace.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      71338aa7
  3. 18 May, 2011 3 commits
  4. 10 May, 2011 1 commit
  5. 08 May, 2011 3 commits
  6. 29 Apr, 2011 2 commits
  7. 28 Apr, 2011 1 commit
    • Eric Dumazet's avatar
      inet: add RCU protection to inet->opt · f6d8bd05
      Eric Dumazet authored
      
      We lack proper synchronization to manipulate inet->opt ip_options
      
      Problem is ip_make_skb() calls ip_setup_cork() and
      ip_setup_cork() possibly makes a copy of ipc->opt (struct ip_options),
      without any protection against another thread manipulating inet->opt.
      
      Another thread can change inet->opt pointer and free old one under us.
      
      Use RCU to protect inet->opt (changed to inet->inet_opt).
      
      Instead of handling atomic refcounts, just copy ip_options when
      necessary, to avoid cache line dirtying.
      
      We cant insert an rcu_head in struct ip_options since its included in
      skb->cb[], so this patch is large because I had to introduce a new
      ip_options_rcu structure.
      Signed-off-by: default avatarEric Dumazet <eric.dumazet@gmail.com>
      Cc: Herbert Xu <herbert@gondor.apana.org.au>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      f6d8bd05
  8. 27 Apr, 2011 1 commit
    • David S. Miller's avatar
      ipv4: Sanitize and simplify ip_route_{connect,newports}() · 2d7192d6
      David S. Miller authored
      
      These functions are used together as a unit for route resolution
      during connect().  They address the chicken-and-egg problem that
      exists when ports need to be allocated during connect() processing,
      yet such port allocations require addressing information from the
      routing code.
      
      It's currently more heavy handed than it needs to be, and in
      particular we allocate and initialize a flow object twice.
      
      Let the callers provide the on-stack flow object.  That way we only
      need to initialize it once in the ip_route_connect() call.
      
      Later, if ip_route_newports() needs to do anything, it re-uses that
      flow object as-is except for the ports which it updates before the
      route re-lookup.
      
      Also, describe why this set of facilities are needed and how it works
      in a big comment.
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Reviewed-by: default avatarEric Dumazet <eric.dumazet@gmail.com>
      2d7192d6
  9. 22 Apr, 2011 1 commit
  10. 02 Mar, 2011 1 commit
  11. 01 Mar, 2011 1 commit
  12. 24 Feb, 2011 1 commit
    • David S. Miller's avatar
      ipv4: Rearrange how ip_route_newports() gets port keys. · dca8b089
      David S. Miller authored
      
      ip_route_newports() is the only place in the entire kernel that
      cares about the port members in the routing cache entry's lookup
      flow key.
      
      Therefore the only reason we store an entire flow inside of the
      struct rtentry is for this one special case.
      
      Rewrite ip_route_newports() such that:
      
      1) The caller passes in the original port values, so we don't need
         to use the rth->fl.fl_ip_{s,d}port values to remember them.
      
      2) The lookup flow is constructed by hand instead of being copied
         from the routing cache entry's flow.
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      dca8b089
  13. 20 Feb, 2011 1 commit
  14. 10 Feb, 2011 1 commit
  15. 24 Jan, 2011 1 commit
    • Eric Dumazet's avatar
      tcp: fix bug in listening_get_next() · fd0273c5
      Eric Dumazet authored
      commit a8b690f9
      
       (tcp: Fix slowness in read /proc/net/tcp)
      introduced a bug in handling of SYN_RECV sockets.
      
      st->offset represents number of sockets found since beginning of
      listening_hash[st->bucket].
      
      We should not reset st->offset when iterating through
      syn_table[st->sbucket], or else if more than ~25 sockets (if
      PAGE_SIZE=4096) are in SYN_RECV state, we exit from listening_get_next()
      with a too small st->offset
      
      Next time we enter tcp_seek_last_pos(), we are not able to seek past
      already found sockets.
      Reported-by: default avatarPK <runningdoglackey@yahoo.com>
      CC: Tom Herbert <therbert@google.com>
      Signed-off-by: default avatarEric Dumazet <eric.dumazet@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      fd0273c5
  16. 23 Dec, 2010 1 commit
  17. 13 Dec, 2010 1 commit
    • David S. Miller's avatar
      net: Abstract default ADVMSS behind an accessor. · 0dbaee3b
      David S. Miller authored
      
      Make all RTAX_ADVMSS metric accesses go through a new helper function,
      dst_metric_advmss().
      
      Leave the actual default metric as "zero" in the real metric slot,
      and compute the actual default value dynamically via a new dst_ops
      AF specific callback.
      
      For stacked IPSEC routes, we use the advmss of the path which
      preserves existing behavior.
      
      Unlike ipv4/ipv6, DecNET ties the advmss to the mtu and thus updates
      advmss on pmtu updates.  This inconsistency in advmss handling
      results in more raw metric accesses than I wish we ended up with.
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      0dbaee3b
  18. 02 Dec, 2010 1 commit
    • David S. Miller's avatar
      timewait_sock: Create and use getpeer op. · ccb7c410
      David S. Miller authored
      
      The only thing AF-specific about remembering the timestamp
      for a time-wait TCP socket is getting the peer.
      
      Abstract that behind a new timewait_sock_ops vector.
      
      Support for real IPV6 sockets is not filled in yet, but
      curiously this makes timewait recycling start to work
      for v4-mapped ipv6 sockets.
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      ccb7c410
  19. 30 Nov, 2010 3 commits
  20. 28 Nov, 2010 1 commit
  21. 12 Nov, 2010 1 commit
  22. 21 Oct, 2010 1 commit
  23. 31 Aug, 2010 1 commit
  24. 13 Jul, 2010 1 commit
  25. 12 Jul, 2010 1 commit
  26. 27 Jun, 2010 1 commit
  27. 16 Jun, 2010 1 commit
    • Eric Dumazet's avatar
      inetpeer: restore small inet_peer structures · 317fe0e6
      Eric Dumazet authored
      
      Addition of rcu_head to struct inet_peer added 16bytes on 64bit arches.
      
      Thats a bit unfortunate, since old size was exactly 64 bytes.
      
      This can be solved, using an union between this rcu_head an four fields,
      that are normally used only when a refcount is taken on inet_peer.
      rcu_head is used only when refcnt=-1, right before structure freeing.
      
      Add a inet_peer_refcheck() function to check this assertion for a while.
      
      We can bring back SLAB_HWCACHE_ALIGN qualifier in kmem cache creation.
      Signed-off-by: default avatarEric Dumazet <eric.dumazet@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      317fe0e6
  28. 11 Jun, 2010 1 commit
  29. 07 Jun, 2010 1 commit
    • Tom Herbert's avatar
      tcp: Fix slowness in read /proc/net/tcp · a8b690f9
      Tom Herbert authored
      This patch address a serious performance issue in reading the
      TCP sockets table (/proc/net/tcp).
      
      Reading the full table is done by a number of sequential read
      operations.  At each read operation, a seek is done to find the
      last socket that was previously read.  This seek operation requires
      that the sockets in the table need to be counted up to the current
      file position, and to count each of these requires taking a lock for
      each non-empty bucket.  The whole algorithm is O(n^2).
      
      The fix is to cache the last bucket value, offset within the bucket,
      and the file position returned by the last read operation.   On the
      next sequential read, the bucket and offset are used to find the
      last read socket immediately without needing ot scan the previous
      buckets  the table.  This algorithm t read the whole table is O(n).
      
      The improvement offered by this patch is easily show by performing
      cat'ing /proc/net/tcp on a machine with a lot of connections.  With
      about 182K connections i...
      a8b690f9
  30. 05 Jun, 2010 2 commits
  31. 04 Jun, 2010 1 commit
    • Eric Dumazet's avatar
      rps: tcp: fix rps_sock_flow_table table updates · ca55158c
      Eric Dumazet authored
      
      I believe a moderate SYN flood attack can corrupt RFS flow table
      (rps_sock_flow_table), making RPS/RFS much less effective.
      
      Even in a normal situation, server handling short lived sessions suffer
      from bad steering for the first data packet of a session, if another SYN
      packet is received for another session.
      
      We do following action in tcp_v4_rcv() :
      
      	sock_rps_save_rxhash(sk, skb->rxhash);
      
      We should _not_ do this if sk is a LISTEN socket, as about each
      packet received on a LISTEN socket has a different rxhash than
      previous one.
       -> RPS_NO_CPU markers are spread all over rps_sock_flow_table.
      
      Also, it makes sense to protect sk->rxhash field changes with socket
      lock (We currently can change it even if user thread owns the lock
      and might use rxhash)
      
      This patch moves sock_rps_save_rxhash() to a sock locked section,
      and only for non LISTEN sockets.
      Signed-off-by: default avatarEric Dumazet <eric.dumazet@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      ca55158c
  32. 16 May, 2010 1 commit
    • Eric Dumazet's avatar
      net: Introduce sk_route_nocaps · a465419b
      Eric Dumazet authored
      
      TCP-MD5 sessions have intermittent failures, when route cache is
      invalidated. ip_queue_xmit() has to find a new route, calls
      sk_setup_caps(sk, &rt->u.dst), destroying the 
      
      sk->sk_route_caps &= ~NETIF_F_GSO_MASK
      
      that MD5 desperately try to make all over its way (from
      tcp_transmit_skb() for example)
      
      So we send few bad packets, and everything is fine when
      tcp_transmit_skb() is called again for this socket.
      
      Since ip_queue_xmit() is at a lower level than TCP-MD5, I chose to use a
      socket field, sk_route_nocaps, containing bits to mask on sk_route_caps.
      Reported-by: default avatarBhaskar Dutta <bhaskie@gmail.com>
      Signed-off-by: default avatarEric Dumazet <eric.dumazet@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      a465419b