• Aram Hăvărneanu's avatar
    runtime: fix use after close race in Solaris network poller · 199e7030
    Aram Hăvărneanu authored
    The Solaris network poller uses event ports, which are
    level-triggered. As such, it has to re-arm itself after each
    wakeup. The arming mechanism (which runs in its own thread) raced
    with the closing of a file descriptor happening in a different
    thread. When a network file descriptor is about to be closed,
    the network poller is awaken to give it a chance to remove its
    association with the file descriptor. Because the poller always
    re-armed itself, it raced with code that closed the descriptor.
    
    This change makes the network poller check before re-arming if
    the file descriptor is about to be closed, in which case it will
    ignore the re-arming request. It uses the per-PollDesc lock in
    order to serialize access to the PollDesc.
    
    This change also adds extensive documentation describing the
    Solaris implementation of the network poller.
    
    Fixes #7410.
    
    LGTM=dvyukov, iant
    R=golang-codereviews, bradfitz, iant, dvyukov, aram.h, gobot
    CC=golang-codereviews
    https://golang.org/cl/69190044
    199e7030
Name
Last commit
Last update
..
cmd Loading commit data...
lib9 Loading commit data...
libbio Loading commit data...
liblink Loading commit data...
libmach Loading commit data...
pkg Loading commit data...
Make.dist Loading commit data...
all.bash Loading commit data...
all.bat Loading commit data...
all.rc Loading commit data...
clean.bash Loading commit data...
clean.bat Loading commit data...
clean.rc Loading commit data...
make.bash Loading commit data...
make.bat Loading commit data...
make.rc Loading commit data...
race.bash Loading commit data...
race.bat Loading commit data...
run.bash Loading commit data...
run.bat Loading commit data...
run.rc Loading commit data...
sudo.bash Loading commit data...