Skip to content

Commit

Permalink
1.21_linux/runtime: bug fix: crash with 'morestack on g0'
Browse files Browse the repository at this point in the history
This address on a remaining task
  • Loading branch information
hajimehoshi committed Sep 20, 2023
1 parent 02e7122 commit eed5a7f
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions 1.21_linux/runtime/cgocall.go.patch
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
//--from
func cgocallbackg(fn, frame unsafe.Pointer, ctxt uintptr) {
gp := getg()
if gp != gp.m.curg {
println("runtime: bad g in cgocallback")
exit(2)
}
//--to
func cgocallbackg(fn, frame unsafe.Pointer, ctxt uintptr) {
gp := getg()
if gp != gp.m.curg {
println("runtime: bad g in cgocallback")
exit(2)
}
// This change is from https://go-review.googlesource.com/c/go/+/527715.
sp := gp.m.g0.sched.sp // system sp saved by cgocallback.
callbackUpdateSystemStack(gp.m, sp, false)
//--append

// This change is from https://go-review.googlesource.com/c/go/+/527715.
Expand Down

0 comments on commit eed5a7f

Please sign in to comment.