[go] runtime/poll: fix race condition in Window's SendFile

0 views
Skip to first unread message

Quim Muntal (Gerrit)

unread,
Mar 11, 2026, 1:58:11 AM (10 days ago) Mar 11
to goph...@pubsubhelper.golang.org, golang-...@googlegroups.com, Mark Freeman, Alex Brainman, Damien Neil, Go LUCI, golang-co...@googlegroups.com

Quim Muntal submitted the change

Change information

Commit message:
runtime/poll: fix race condition in Window's SendFile

The destination of SendFile is a socket, which doesn't support file
offsets. There is no need to keep track of the file offset, and doing
so causes a race between SendFile and Read.

While here, make sure that SendFile tests do call poll.SendFile.

Fixes #78015
Cq-Include-Trybots: luci.golang.try:gotip-windows-amd64-race,gotip-linux-amd64-race
Change-Id: I8cce45c0c110e848d9bdbc5ba340b92ca041f0a4
Reviewed-by: Damien Neil <dn...@google.com>
Reviewed-by: Alex Brainman <alex.b...@gmail.com>
Reviewed-by: Mark Freeman <markf...@google.com>
Files:
  • M src/internal/poll/sendfile_windows.go
  • M src/net/sendfile.go
  • M src/net/sendfile_stub.go
  • M src/net/sendfile_test.go
  • M src/net/sendfile_windows.go
Change size: S
Delta: 5 files changed, 19 insertions(+), 1 deletion(-)
Branch: refs/heads/master
Submit Requirements:
  • requirement satisfiedCode-Review: +2 by Alex Brainman, +2 by Damien Neil, +1 by Mark Freeman
  • requirement satisfiedTryBots-Pass: LUCI-TryBot-Result+1 by Go LUCI
Open in Gerrit
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: merged
Gerrit-Project: go
Gerrit-Branch: master
Gerrit-Change-Id: I8cce45c0c110e848d9bdbc5ba340b92ca041f0a4
Gerrit-Change-Number: 752860
Gerrit-PatchSet: 13
Gerrit-Owner: Quim Muntal <quimm...@gmail.com>
Gerrit-Reviewer: Alex Brainman <alex.b...@gmail.com>
Gerrit-Reviewer: Damien Neil <dn...@google.com>
Gerrit-Reviewer: Mark Freeman <markf...@google.com>
Gerrit-Reviewer: Quim Muntal <quimm...@gmail.com>
open
diffy
satisfied_requirement

Carlos Amedee (Gerrit)

unread,
12:33 PM (8 hours ago) 12:33 PM
to Quim Muntal, goph...@pubsubhelper.golang.org, golang-...@googlegroups.com, Cherry Mui, Alex Brainman, Mark Freeman, Go LUCI, Dmitri Shuralyov, golang-co...@googlegroups.com

Carlos Amedee submitted the change

Change information

Commit message:
[release-branch.go1.26] runtime/poll: fix race condition in Window's SendFile


The destination of SendFile is a socket, which doesn't support file
offsets. There is no need to keep track of the file offset, and doing
so causes a race between SendFile and Read.

While here, make sure that SendFile tests do call poll.SendFile.

Updates #78015
Fixes #78019


Change-Id: I8cce45c0c110e848d9bdbc5ba340b92ca041f0a4
Reviewed-on: https://go-review.googlesource.com/c/go/+/752860
Reviewed-by: Damien Neil <dn...@google.com>
LUCI-TryBot-Result: Go LUCI <golang...@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Alex Brainman <alex.b...@gmail.com>
Reviewed-by: Mark Freeman <markf...@google.com>
(cherry picked from commit d3651c588846e1147e5a72f71c133dc8288e1e13)
Reviewed-on: https://go-review.googlesource.com/c/go/+/754082
Reviewed-by: Cherry Mui <cher...@google.com>
Files:
  • M src/internal/poll/sendfile_windows.go
  • M src/net/sendfile.go
  • M src/net/sendfile_stub.go
  • M src/net/sendfile_test.go
  • M src/net/sendfile_windows.go
Change size: S
Delta: 5 files changed, 21 insertions(+), 1 deletion(-)
Branch: refs/heads/release-branch.go1.26
Submit Requirements:
  • requirement satisfiedCode-Review: +1 by Cherry Mui, +2 by Alex Brainman, +1 by Mark Freeman
  • requirement satisfiedTryBots-Pass: LUCI-TryBot-Result+1 by Go LUCI
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: merged
Gerrit-Project: go
Gerrit-Branch: release-branch.go1.26
Gerrit-Change-Id: I8cce45c0c110e848d9bdbc5ba340b92ca041f0a4
Gerrit-Change-Number: 754082
Gerrit-PatchSet: 4
Gerrit-Owner: Quim Muntal <quimm...@gmail.com>
Gerrit-Reviewer: Alex Brainman <alex.b...@gmail.com>
Gerrit-Reviewer: Carlos Amedee <car...@golang.org>
Gerrit-Reviewer: Cherry Mui <cher...@google.com>
Gerrit-Reviewer: Dmitri Shuralyov <dmit...@golang.org>
open
diffy
satisfied_requirement
Reply all
Reply to author
Forward
0 new messages