Skip to content

Commit

Permalink
runtime: Fix panic if newstack at runtime.acquireLockRank
Browse files Browse the repository at this point in the history
The function named `acquireLockRank` at `src/runtime/lockrank_on.go`
with `go:nosplit`, but at `src/runtime/lockrank_off.go` without
`go:nosplit`. GOEXPERIMENT="" in default, process will panic if
newstack at runtime.acquireLockRank with `gcflags="all=-N -l"`.
Similarly, function `lockWithRank`, `unlockWithRank`, `releaseLockRank`
and `lockWithRankMayAcquire`.

Fixes golang#40843
  • Loading branch information
chainhelen committed Aug 17, 2020
1 parent 7148abc commit 3cad25e
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/runtime/lockrank_off.go
Expand Up @@ -18,19 +18,24 @@ func getLockRank(l *mutex) lockRank {
return 0
}

//go:nosplit
func lockWithRank(l *mutex, rank lockRank) {
lock2(l)
}

//go:nosplit
func acquireLockRank(rank lockRank) {
}

//go:nosplit
func unlockWithRank(l *mutex) {
unlock2(l)
}

//go:nosplit
func releaseLockRank(rank lockRank) {
}

//go:nosplit
func lockWithRankMayAcquire(l *mutex, rank lockRank) {
}

0 comments on commit 3cad25e

Please sign in to comment.