diff options
| author | Aram Hăvărneanu <aram@mgk.ro> | 2014-03-14 17:53:05 +0400 |
|---|---|---|
| committer | Dmitriy Vyukov <dvyukov@google.com> | 2014-03-14 17:53:05 +0400 |
| commit | 199e70308351c2780f19ee0471febfd3cfd8f30f (patch) | |
| tree | 0dd9a2044a02423156cf164f17d2a3b26d06fd89 /src/pkg/runtime/runtime.h | |
| parent | 4c6d2d6aa8aff8876a511882dd2a1facf4965667 (diff) | |
| download | go-199e70308351c2780f19ee0471febfd3cfd8f30f.tar.xz | |
runtime: fix use after close race in Solaris network poller
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
Diffstat (limited to 'src/pkg/runtime/runtime.h')
| -rw-r--r-- | src/pkg/runtime/runtime.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/pkg/runtime/runtime.h b/src/pkg/runtime/runtime.h index 01294b70a0..baa751cd72 100644 --- a/src/pkg/runtime/runtime.h +++ b/src/pkg/runtime/runtime.h @@ -965,6 +965,9 @@ void runtime·netpollready(G**, PollDesc*, int32); uintptr runtime·netpollfd(PollDesc*); void runtime·netpollarm(PollDesc*, int32); void** runtime·netpolluser(PollDesc*); +bool runtime·netpollclosing(PollDesc*); +void runtime·netpolllock(PollDesc*); +void runtime·netpollunlock(PollDesc*); void runtime·crash(void); void runtime·parsedebugvars(void); void _rt0_go(void); |
