[go] runtime: clear X15 before calling cgocallbackg

0 views
Skip to first unread message

Gopher Robot (Gerrit)

unread,
Apr 24, 2026, 4:25:56 PM (17 hours ago) Apr 24
to Michael Pratt, goph...@pubsubhelper.golang.org, golang-...@googlegroups.com, Keith Randall, Keith Randall, golang...@luci-project-accounts.iam.gserviceaccount.com, Ariel Otilibili Anieli, golang-co...@googlegroups.com

Gopher Robot submitted the change

Change information

Commit message:
runtime: clear X15 before calling cgocallbackg

CL 765581 uses ABIInternal to call from cgocallback to cgocallbackg.
That CL restores the g to R14, but fails to zero X15 as required by
ABIInternal.

As a result, the undefined value of X15 from C leaks into Go code,
causing all sorts of interesting crashes due to the broken invariant.

For #78934.
Change-Id: I70d131be66e971f7c238d18a84cc44b66a6a6964
Reviewed-by: Keith Randall <k...@google.com>
Reviewed-by: Keith Randall <k...@golang.org>
Auto-Submit: Michael Pratt <mpr...@google.com>
Files:
  • M src/runtime/asm_amd64.s
  • M src/runtime/crash_cgo_test.go
  • A src/runtime/testdata/testprogcgo/callback_amd64.go
  • A src/runtime/testdata/testprogcgo/goasm/x15_amd64.go
  • A src/runtime/testdata/testprogcgo/goasm/x15_amd64.s
Change size: M
Delta: 5 files changed, 82 insertions(+), 1 deletion(-)
Branch: refs/heads/master
Submit Requirements:
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: I70d131be66e971f7c238d18a84cc44b66a6a6964
Gerrit-Change-Number: 770560
Gerrit-PatchSet: 4
Gerrit-Owner: Michael Pratt <mpr...@google.com>
Gerrit-Reviewer: Ariel Otilibili Anieli <otil...@eurecom.fr>
Gerrit-Reviewer: Gopher Robot <go...@golang.org>
Gerrit-Reviewer: Keith Randall <k...@golang.org>
Gerrit-Reviewer: Keith Randall <k...@google.com>
Gerrit-Reviewer: Michael Pratt <mpr...@google.com>
open
diffy
satisfied_requirement
Reply all
Reply to author
Forward
0 new messages