From 6416bde023d897dcedc6d53bf0bf58821962f435 Mon Sep 17 00:00:00 2001 From: Joel Sing Date: Mon, 31 May 2021 00:18:54 +1000 Subject: [PATCH] runtime: use asmcgocall_no_g when calling sigprocmask on openbsd sigprocmask is called from sigsave, which is called from needm. As such, sigprocmask has to be able to run with no g. For some reason we do not currently trip this on current libc platforms, but we do hit it on openbsd/mips64 with external linking. Updates #36435 Change-Id: I4dfae924245c5f68cc012755d6485939014898a3 Reviewed-on: https://go-review.googlesource.com/c/go/+/334879 Trust: Joel Sing Reviewed-by: Ian Lance Taylor --- src/runtime/sys_openbsd2.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/runtime/sys_openbsd2.go b/src/runtime/sys_openbsd2.go index 190ee4716a..23e0b195fd 100644 --- a/src/runtime/sys_openbsd2.go +++ b/src/runtime/sys_openbsd2.go @@ -199,7 +199,9 @@ func sigaction_trampoline() //go:nosplit //go:cgo_unsafe_args func sigprocmask(how uint32, new *sigset, old *sigset) { - libcCall(unsafe.Pointer(abi.FuncPCABI0(sigprocmask_trampoline)), unsafe.Pointer(&how)) + // sigprocmask is called from sigsave, which is called from needm. + // As such, we have to be able to run with no g here. + asmcgocall_no_g(unsafe.Pointer(abi.FuncPCABI0(sigprocmask_trampoline)), unsafe.Pointer(&how)) } func sigprocmask_trampoline() -- 2.50.0