You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Does this issue reproduce with the latest release?
Yes.
What operating system and processor architecture are you using (go env)?
Microsoft Windows [version 10.0.19041.867]
64-bit
RAM: 12GB
CPU: Intel(R) Core(TM) i7-8550U @ 1.8GHz
go env Output
$ go env
set GO111MODULE=
set GOARCH=amd64
set GOBIN=
set GOCACHE=C:\Users\idras\AppData\Local\go-build
set GOENV=C:\Users\idras\AppData\Roaming\go\env
set GOEXE=.exe
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOINSECURE=
set GOMODCACHE=C:\Users\idras\go\pkg\mod
set GONOPROXY=
set GONOSUMDB=
set GOOS=windows
set GOPATH=C:\Users\idras\go
set GOPRIVATE=
set GOPROXY=https://proxy.golang.org,direct
set GOROOT=C:\Program Files\Go
set GOSUMDB=sum.golang.org
set GOTMPDIR=
set GOTOOLDIR=C:\Program Files\Go\pkg\tool\windows_amd64
set GOVCS=
set GOVERSION=go1.16.3
set GCCGO=gccgo
set AR=ar
set CC=gcc
set CXX=g++
set CGO_ENABLED=1
set GOMOD=C:\Users\idras\Source\temp\syscall18Bug\go\go.mod
set CGO_CFLAGS=-g -O2
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-g -O2
set CGO_FFLAGS=-g -O2
set CGO_LDFLAGS=-g -O2
set PKG_CONFIG=pkg-config
set GOGCCFLAGS=-m64 -mthreads -fmessage-length=0 -fdebug-prefix-map=C:\Users\idras\AppData\Local\Temp\go-build234891192=/tmp/go-build -gno-record-gcc-switches
What did you do?
git clone https://github.com/ElMostafaIdrassi/syscall18Bug
cd syscall18Bug/go
go build -v .
longsyscall.exe
The code essentially loads a Sample DLL which exports a single function that accepts 17 arguments, and calls that function using syscall.Syscall18.
I managed to fix the crash by changing the value of maxargs in src/runtime/sys_windows_amd64.s from 16 to 18. I guess 16 was enough back when syscall18 was not yet implemented, and seeing how little to no Win32 API functions accept that many arguments, this bug went unnoticed for quite some time.
Thanks for reporting the issue and figuring out a solution!
I think it's reasonable that that's the problem. I've been digging around here lately and your solution seems plausible; we have all sorts of hard-coded limits for the various Windows syscall oddities. There could just be a discrepancy (but I have not looked into this yet). I probably won't have time to look into this for a few days so:
ElMostafaIdrassi
changed the title
runtime: unexpected return pc for runtime.asmstdcall when calling COM interface pointer using elevation
runtime: unexpected return pc for runtime.asmstdcall when using syscall18
Apr 12, 2021
dmitshur
added
NeedsFix
The path to resolution is known, but the work has not been done.
and removed
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
labels
Apr 15, 2021
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes.
What operating system and processor architecture are you using (
go env
)?Microsoft Windows [version 10.0.19041.867]
64-bit
RAM: 12GB
CPU: Intel(R) Core(TM) i7-8550U @ 1.8GHz
go env
OutputWhat did you do?
The code essentially loads a Sample DLL which exports a single function that accepts 17 arguments, and calls that function using
syscall.Syscall18
.What did you expect to see?
I expected the call to succeed.
What did you see instead?
Remarks
In the stack trace, I see that the crash resulted from
C:/Program Files/Go/src/runtime/sys_windows_amd64.s:34 +0x2e
, which corresponds to :go/src/runtime/sys_windows_amd64.s
Lines 31 to 34 in 117b1c8
I am not savvy enough in assembly, but does this mean there is not enough room for all the 17 args I'm passing to the
syscall18
function?Regards,
The text was updated successfully, but these errors were encountered: