-
Notifications
You must be signed in to change notification settings - Fork 18.3k
Closed
Labels
CriticalA critical problem that affects the availability or correctness of production systems built using GoA critical problem that affects the availability or correctness of production systems built using GoNeedsFixThe path to resolution is known, but the work has not been done.The path to resolution is known, but the work has not been done.OS-Windowscompiler/runtimeIssues related to the Go compiler and/or runtime.Issues related to the Go compiler and/or runtime.
Milestone
Description
Go version
go version devel go1.24-bea9b91f0f Tue Nov 5 01:16:03 2024 +0000 windows/amd64
What did you do?
Run go build -gcflags=-m .
package main
import (
"syscall"
"unsafe"
)
var sink byte
var procProcessPrng = syscall.NewLazyDLL("bcryptprimitives.dll").NewProc("ProcessPrng").Addr()
func main() {
var buf [10]byte
syscall.SyscallN(procProcessPrng, uintptr(unsafe.Pointer(&buf[0])), uintptr(len(buf)))
sink ^= buf[0]
}
What did you see happen?
The syscall.SyscallN
variadic argument escaped to the heap.
./main.go:13:18: ... argument escapes to heap
What did you expect to see?
The syscall.SyscallN
variadic argument didn't escape to the heap, just as other syscall.SyscalX
functions.
./main.go:13:18: ... argument does not escape
Note that syscall.SyscallN
is implemented by runtime.syscall_syscalln
, which makes sure that the variadic argument doesn't escape:
go/src/runtime/syscall_windows.go
Line 519 in bea9b91
c.args = uintptr(noescape(unsafe.Pointer(&args[0]))) |
@golang/compiler @golang/windows
dmitshur and alexbrainman
Metadata
Metadata
Assignees
Labels
CriticalA critical problem that affects the availability or correctness of production systems built using GoA critical problem that affects the availability or correctness of production systems built using GoNeedsFixThe path to resolution is known, but the work has not been done.The path to resolution is known, but the work has not been done.OS-Windowscompiler/runtimeIssues related to the Go compiler and/or runtime.Issues related to the Go compiler and/or runtime.