R=golang-dev, bradfitz CC=golang-dev https://golang.org/cl/10468043
Fixes #3915. Fixes #3923. R=ken2 CC=golang-dev https://golang.org/cl/7281044