Skip to content

Commit 3959d54

Browse files
cuonglmgopherbot
authored andcommitted
runtime: mark lockWithRankMayAcquire as nosplit
The function is called in nosplit context already. Fixes #68525 Change-Id: I8b9e324335b7c605d5a20cacdd58df09b7a7cf52 Reviewed-on: https://go-review.googlesource.com/c/go/+/599675 Reviewed-by: Cherry Mui <[email protected]> Reviewed-by: Michael Knyszek <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]> Auto-Submit: Cuong Manh Le <[email protected]>
1 parent 70491a8 commit 3959d54

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

src/runtime/lockrank_off.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ func releaseLockRankAndM(rank lockRank) {
4242
releasem(getg().m)
4343
}
4444

45+
// This function may be called in nosplit context and thus must be nosplit.
46+
//
47+
//go:nosplit
4548
func lockWithRankMayAcquire(l *mutex, rank lockRank) {
4649
}
4750

test/fixedbugs/issue68525.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// run -gcflags='all=-N -l'
2+
3+
// Copyright 2024 The Go Authors. All rights reserved.
4+
// Use of this source code is governed by a BSD-style
5+
// license that can be found in the LICENSE file.
6+
7+
package main
8+
9+
import "os"
10+
11+
func main() {
12+
os.OpenFile(os.DevNull, os.O_WRONLY, 0)
13+
}

0 commit comments

Comments
 (0)