Skip to content

Commit 19948db

Browse files
committed
runtime: fix panic if newstack at runtime.acquireLockRank
Process may crash becaues acquireLockRank and releaseLockRank may be called in nosplit context. With optimization s and inlining disabled, these functions won't get inlined or have their morestack calls eliminated. Nosplit is not strictly required for lockWithRank, unlockWithRank and lockWithRankMayAcquire, just keep consistency with lockrank_on.go here. Fixes #40843
1 parent a745171 commit 19948db

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/runtime/lockrank_off.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,24 @@ func getLockRank(l *mutex) lockRank {
1818
return 0
1919
}
2020

21+
//go:nosplit
2122
func lockWithRank(l *mutex, rank lockRank) {
2223
lock2(l)
2324
}
2425

26+
//go:nosplit
2527
func acquireLockRank(rank lockRank) {
2628
}
2729

30+
//go:nosplit
2831
func unlockWithRank(l *mutex) {
2932
unlock2(l)
3033
}
3134

35+
//go:nosplit
3236
func releaseLockRank(rank lockRank) {
3337
}
3438

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

0 commit comments

Comments
 (0)