Both netpollblock and netpollunblock read gpp using a non-atomic load.
When consuming a ready event, netpollblock clears gpp using a non-atomic
store, thus skipping a barrier.
Thus on systems with weak memory ordering, a sequence like so this is
1. netpollblock: read gpp -> pdReady
2. netpollblock: store gpp -> 0
3. netpollunblock: read gpp -> pdReady
4. netpollunblock: return
i.e., without a happens-before edge between (2) and (3), netpollunblock
may read the stale value of gpp.
Switch these access to use atomic loads and stores in order to create
For ease of future maintainance, I've simply changed rg and wg to always
be accessed atomically, though I don't believe pollOpen or pollClose
require atomics today.
Trust: Michael Pratt <firstname.lastname@example.org>
Run-TryBot: Michael Pratt <email@example.com>
TryBot-Result: Go Bot <firstname.lastname@example.org>
Reviewed-by: Michael Knyszek <email@example.com>
Reviewed-by: David Chase <firstname.lastname@example.org>
(cherry picked from commit 1b072b3)