git: network - Fix multiple MP races

Matthew Dillon dillon at crater.dragonflybsd.org
Sun Sep 12 22:40:30 PDT 2010


commit 0ce0603ec479756ab4cb88f1958bf08b2772a4cd
Author: Matthew Dillon <dillon at apollo.backplane.com>
Date:   Sun Sep 12 22:33:08 2010 -0700

    network - Fix multiple MP races
    
    * Fix sonewconn() races.  sonewconn() was attaching prior to changing
      the socket->so_port, relying on the caller to set the socket->so_port.
      This resulted in a race where userland wound up with visibility on the
      socket and could issue commands, like close(), which would end up going
      to the original protocol thread instead of the post-connect protocol thread
      which was handling the sonewconn().
    
      Thus the close() could message the backend to detach and compete
      against the sonewconn() because the detach message was going to
      a different protocol thread.
    
    * When the socket->so_port is changed the inpcb was not being moved
      from the old pcbinfo->pcblisthead list to the new one, resulting
      in MP races later on during removal.
    
    * Add more debugging kprintf()s.
    
    * Clean up sosetport() use, remove the now-unused *_soport_attach().
    
    Reported-by: Many

Summary of changes:
 sys/kern/uipc_socket2.c    |    9 +++
 sys/net/netisr.c           |   18 +++++-
 sys/netinet/in_pcb.c       |  169 ++++++++++++++++++++++++++++++++++----------
 sys/netinet/in_pcb.h       |    6 ++
 sys/netinet/ip_demux.c     |   20 -----
 sys/netinet/ip_divert.c    |    2 +-
 sys/netinet/tcp_subr.c     |   11 +++
 sys/netinet/tcp_syncache.c |   16 +++--
 sys/netinet/tcp_usrreq.c   |   40 ++++++++---
 sys/netinet/tcp_var.h      |    2 -
 sys/netinet/udp_usrreq.c   |    9 ++-
 sys/netinet/udp_var.h      |    1 -
 sys/netinet6/in6_pcb.c     |   16 ++++-
 sys/netinet6/udp6_usrreq.c |    3 +-
 14 files changed, 234 insertions(+), 88 deletions(-)

http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/0ce0603ec479756ab4cb88f1958bf08b2772a4cd


-- 
DragonFly BSD source repository





More information about the Commits mailing list