]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: mark lockWithRankMayAcquire as nosplit
authorCuong Manh Le <cuong.manhle.vn@gmail.com>
Fri, 19 Jul 2024 17:55:15 +0000 (00:55 +0700)
committerGopher Robot <gobot@golang.org>
Fri, 19 Jul 2024 19:51:57 +0000 (19:51 +0000)
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 <cherryyz@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>

src/runtime/lockrank_off.go
test/fixedbugs/issue68525.go [new file with mode: 0644]

index edeb265f43e874747a81c843c0d3dc2c9bfafd06..18aef6bd2b3f438f161624328370f89709486925 100644 (file)
@@ -42,6 +42,9 @@ func releaseLockRankAndM(rank lockRank) {
        releasem(getg().m)
 }
 
+// This function may be called in nosplit context and thus must be nosplit.
+//
+//go:nosplit
 func lockWithRankMayAcquire(l *mutex, rank lockRank) {
 }
 
diff --git a/test/fixedbugs/issue68525.go b/test/fixedbugs/issue68525.go
new file mode 100644 (file)
index 0000000..e33de38
--- /dev/null
@@ -0,0 +1,13 @@
+// run -gcflags='all=-N -l'
+
+// Copyright 2024 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package main
+
+import "os"
+
+func main() {
+       os.OpenFile(os.DevNull, os.O_WRONLY, 0)
+}