Skip to content

Commit

Permalink
runtime: mark lockWithRankMayAcquire as nosplit
Browse files Browse the repository at this point in the history
The function is called in nosplit context already.

Fixes golang#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]>
  • Loading branch information
cuonglm authored and gopherbot committed Jul 19, 2024
1 parent 70491a8 commit 3959d54
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/runtime/lockrank_off.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
}

Expand Down
13 changes: 13 additions & 0 deletions test/fixedbugs/issue68525.go
Original file line number Diff line number Diff line change
@@ -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)
}

0 comments on commit 3959d54

Please sign in to comment.