From 3959d54c0bd5c92fe0a5e33fedb0595723efc23b Mon Sep 17 00:00:00 2001 From: Cuong Manh Le Date: Sat, 20 Jul 2024 00:55:15 +0700 Subject: [PATCH] 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 Reviewed-by: Michael Knyszek LUCI-TryBot-Result: Go LUCI Auto-Submit: Cuong Manh Le --- src/runtime/lockrank_off.go | 3 +++ test/fixedbugs/issue68525.go | 13 +++++++++++++ 2 files changed, 16 insertions(+) create mode 100644 test/fixedbugs/issue68525.go diff --git a/src/runtime/lockrank_off.go b/src/runtime/lockrank_off.go index edeb265f43..18aef6bd2b 100644 --- a/src/runtime/lockrank_off.go +++ b/src/runtime/lockrank_off.go @@ -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 index 0000000000..e33de38be6 --- /dev/null +++ b/test/fixedbugs/issue68525.go @@ -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) +} -- 2.48.1