Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

syscall: panic making syscall if windows.Handle is used instead of uintptr #31825

Closed
elagergren-spideroak opened this issue May 3, 2019 · 8 comments

Comments

@elagergren-spideroak
Copy link

@elagergren-spideroak elagergren-spideroak commented May 3, 2019

What version of Go are you using (go version)?

1.11.4 windows/amd64

Does this issue reproduce with the latest release?

Have not tested tip yet. But, it occurs with 1.12.4.

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
set GOARCH=amd64
set GOBIN=
set GOCACHE=C:\Users\\AppData\Local\go-build
set GOEXE=.exe
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOOS=windows
set GOPATH=Y:\\
set GOPROXY=
set GORACE=
set GOROOT=C:\msys64\mingw64\lib\go
set GOTMPDIR=
set GOTOOLDIR=C:\msys64\mingw64\lib\go\pkg\tool\windows_amd64
set GCCGO=gccgo
set CC=gcc
set CXX=g++
set CGO_ENABLED=1
set GOMOD=
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:\msys64\tmp\go-build660935474=/tmp/go-build -gno-record-gcc-switches

What did you do?

Made a system call. (I can try and come up with a runnable example, but the actual code is proprietary):

func myCall(h windows.Handle, ...) {
    syscall.Syscall9(proc.Addr(), 8, uintptr(h), ...)
    ...
}

What did you expect to see?

The call to succeed.

What did you see instead?

A panic (with GOTRACEBACK=system). See below.

This is similar to #17908, particularly that GODEBUG=gcshrinkstackoff=1 causes the panic to go away.

If I change the wrapper API (myCall) to use uintptr instead of windows.Handle (which is type Handle uintptr inside sys/windows), the panic goes away.

Panic:

``` Exception 0xc0000005 0x0 0x0 0x7fefc0c2bcf PC=0x7fefc0c2bcf

runtime.cgocall(0x45e360, 0xc000088648, 0x59a8d2)
C:/msys64/mingw64/lib/go/src/runtime/cgocall.go:128 +0x55 fp=0xc0000ffb58 sp=0xc0000ffb20 pc=0x403ce5
syscall.Syscall9(0x7fefc5d6970, 0x8, 0x2e8db0, 0x0, 0xc00000c3e0, 0x20, 0xc000bde000, 0x84, 0xc0000ffcac, 0x0, ...)
C:/msys64/mingw64/lib/go/src/runtime/syscall_windows.go:198 +0x102 fp=0xc0000ffb88 sp=0xc0000ffb58 pc=0x44bb62
//windows/cng/bcrypt/internal/bcrypt.SignHash(0x2e8db0, 0x0, 0xc00000c3e0, 0x20, 0x20, 0xc000bde000, 0x84, 0x84, 0xc0000ffcac, 0x0, ...)
Y:/src///windows/cng/bcrypt/internal/bcrypt/zsyscalls.go:899 +0x149 fp=0xc0000ffc48 sp=0xc0000ffb88 pc=0x5ced09
//windows/cng/bcrypt.Sign(0x80b480, 0xc00003e170, 0xc00000c3e0, 0x20, 0x20, 0x0, 0x0, 0x40ca3f, 0x10, 0xc00000a070, ...)
Y:/src///windows/cng/bcrypt/keys.go:184 +0x1a5 fp=0xc0000ffcd8 sp=0xc0000ffc48 pc=0x5ddc25
//windows/cng/bcrypt.(*KeyPair).Sign(0xc00003e170, 0xc00000c3e0, 0x20, 0x20, 0x0, 0x0, 0x0, 0x0, 0x0, 0x4434be, ...)
Y:/src///windows/cng/bcrypt/keys.go:144 +0x80 fp=0xc0000ffd48 sp=0xc0000ffcd8 pc=0x5dd840
//common/crypto/ecdsa.sign(0x8082a0, 0xc00003edc0, 0xc0000fff70, 0xc00000c3e0, 0x20, 0x20, 0x0, 0x0, 0x0, 0x0)
Y:/src///common/crypto/ecdsa/ecdsa_windows.go:54 +0x310 fp=0xc0000ffe00 sp=0xc0000ffd48 pc=0x5e30b0
//common/crypto/ecdsa.Sign(0x8082a0, 0xc00003edc0, 0xc0000fff70, 0xc00000c3e0, 0x20, 0x20, 0x0, 0x0, 0xc0003f44a0, 0x0)
Y:/src///common/crypto/ecdsa/ecdsa.go:47 +0x6e fp=0xc0000ffe60 sp=0xc0000ffe00 pc=0x5e288e
//common/crypto/ecdsa_test.TestGenerateKey.func1(0xc0000f6500)
Y:/src///common/crypto/ecdsa/ecdsa_test.go:78 +0x49e fp=0xc0000fffa8 sp=0xc0000ffe60 pc=0x6f57ee
testing.tRunner(0xc0000f6500, 0xc000045020)
C:/msys64/mingw64/lib/go/src/testing/testing.go:827 +0xc6 fp=0xc0000fffd0 sp=0xc0000fffa8 pc=0x4f6006
runtime.goexit()
C:/msys64/mingw64/lib/go/src/runtime/asm_amd64.s:1333 +0x1 fp=0xc0000fffd8 sp=0xc0000fffd0 pc=0x45cb61
created by testing.(*T).Run
C:/msys64/mingw64/lib/go/src/testing/testing.go:878 +0x363

goroutine 1 [chan receive]:
runtime.gopark(0x7c6480, 0xc00003c478, 0x49170d, 0x3)
C:/msys64/mingw64/lib/go/src/runtime/proc.go:302 +0x100 fp=0xc00035fb58 sp=0xc00035fb38 pc=0x430d30
runtime.goparkunlock(0xc00003c478, 0x170d, 0x3)
C:/msys64/mingw64/lib/go/src/runtime/proc.go:308 +0x5a fp=0xc00035fb88 sp=0xc00035fb58 pc=0x430dea
runtime.chanrecv(0xc00003c420, 0xc000071c9f, 0xc000002101, 0x4f63c3)
C:/msys64/mingw64/lib/go/src/runtime/chan.go:520 +0x2cc fp=0xc00035fc18 sp=0xc00035fb88 pc=0x40589c
runtime.chanrecv1(0xc00003c420, 0xc000071c9f)
C:/msys64/mingw64/lib/go/src/runtime/chan.go:402 +0x2b fp=0xc00035fc48 sp=0xc00035fc18 pc=0x40557b
testing.(*T).Run(0xc0000f6100, 0x7b105f, 0xf, 0x7c6768, 0x48569d)
C:/msys64/mingw64/lib/go/src/testing/testing.go:879 +0x38a fp=0xc00035fd00 sp=0xc00035fc48 pc=0x4f63ea
testing.runTests.func1(0xc0000f6000)
C:/msys64/mingw64/lib/go/src/testing/testing.go:1119 +0x7f fp=0xc00035fd50 sp=0xc00035fd00 pc=0x4fa2ef
testing.tRunner(0xc0000f6000, 0xc000071e08)
C:/msys64/mingw64/lib/go/src/testing/testing.go:827 +0xc6 fp=0xc00035fd78 sp=0xc00035fd50 pc=0x4f6006
testing.runTests(0xc000044de0, 0xa50e00, 0x4, 0x4, 0x40c179)
C:/msys64/mingw64/lib/go/src/testing/testing.go:1117 +0x2b1 fp=0xc00035fe38 sp=0xc00035fd78 pc=0x4f78d1
testing.(*M).Run(0xc0000ea000, 0x0)
C:/msys64/mingw64/lib/go/src/testing/testing.go:1034 +0x16c fp=0xc00035ff30 sp=0xc00035fe38 pc=0x4f680c
main.main()
_testmain.go:50 +0x144 fp=0xc00035ff98 sp=0xc00035ff30 pc=0x6f7934
runtime.main()
C:/msys64/mingw64/lib/go/src/runtime/proc.go:201 +0x207 fp=0xc00035ffe0 sp=0xc00035ff98 pc=0x430957
runtime.goexit()
C:/msys64/mingw64/lib/go/src/runtime/asm_amd64.s:1333 +0x1 fp=0xc00035ffe8 sp=0xc00035ffe0 pc=0x45cb61

goroutine 2 [force gc (idle)]:
runtime.gopark(0x7c6480, 0xa56e10, 0x1410, 0x1)
C:/msys64/mingw64/lib/go/src/runtime/proc.go:302 +0x100 fp=0xc00002ff80 sp=0xc00002ff60 pc=0x430d30
runtime.goparkunlock(0xa56e10, 0x1410, 0x1)
C:/msys64/mingw64/lib/go/src/runtime/proc.go:308 +0x5a fp=0xc00002ffb0 sp=0xc00002ff80 pc=0x430dea
runtime.forcegchelper()
C:/msys64/mingw64/lib/go/src/runtime/proc.go:251 +0xc1 fp=0xc00002ffe0 sp=0xc00002ffb0 pc=0x430b91
runtime.goexit()
C:/msys64/mingw64/lib/go/src/runtime/asm_amd64.s:1333 +0x1 fp=0xc00002ffe8 sp=0xc00002ffe0 pc=0x45cb61
created by runtime.init.4
C:/msys64/mingw64/lib/go/src/runtime/proc.go:240 +0x3c

goroutine 3 [GC sweep wait]:
runtime.gopark(0x7c6480, 0xa56f80, 0x45140c, 0x1)
C:/msys64/mingw64/lib/go/src/runtime/proc.go:302 +0x100 fp=0xc000031f80 sp=0xc000031f60 pc=0x430d30
runtime.goparkunlock(0xa56f80, 0x80140c, 0x1)
C:/msys64/mingw64/lib/go/src/runtime/proc.go:308 +0x5a fp=0xc000031fb0 sp=0xc000031f80 pc=0x430dea
runtime.bgsweep(0xc0000140e0)
C:/msys64/mingw64/lib/go/src/runtime/mgcsweep.go:71 +0x110 fp=0xc000031fd8 sp=0xc000031fb0 pc=0x420a50
runtime.goexit()
C:/msys64/mingw64/lib/go/src/runtime/asm_amd64.s:1333 +0x1 fp=0xc000031fe0 sp=0xc000031fd8 pc=0x45cb61
created by runtime.gcenable
C:/msys64/mingw64/lib/go/src/runtime/mgc.go:216 +0x5f

goroutine 18 [finalizer wait]:
runtime.gopark(0x7c6480, 0xa74cd8, 0x140f, 0x1)
C:/msys64/mingw64/lib/go/src/runtime/proc.go:302 +0x100 fp=0xc000033f28 sp=0xc000033f08 pc=0x430d30
runtime.goparkunlock(0xa74cd8, 0x7c140f, 0x1)
C:/msys64/mingw64/lib/go/src/runtime/proc.go:308 +0x5a fp=0xc000033f58 sp=0xc000033f28 pc=0x430dea
runtime.runfinq()
C:/msys64/mingw64/lib/go/src/runtime/mfinal.go:175 +0xa7 fp=0xc000033fe0 sp=0xc000033f58 pc=0x4180a7
runtime.goexit()
C:/msys64/mingw64/lib/go/src/runtime/asm_amd64.s:1333 +0x1 fp=0xc000033fe8 sp=0xc000033fe0 pc=0x45cb61
created by runtime.createfing
C:/msys64/mingw64/lib/go/src/runtime/mfinal.go:156 +0x68

goroutine 19 [chan receive]:
runtime.gopark(0x7c6480, 0xc00003c5f8, 0xc00002170d, 0x3)
C:/msys64/mingw64/lib/go/src/runtime/proc.go:302 +0x100 fp=0xc000101e38 sp=0xc000101e18 pc=0x430d30
runtime.goparkunlock(0xc00003c5f8, 0x170d, 0x3)
C:/msys64/mingw64/lib/go/src/runtime/proc.go:308 +0x5a fp=0xc000101e68 sp=0xc000101e38 pc=0x430dea
runtime.chanrecv(0xc00003c5a0, 0x0, 0x1, 0xc000030101)
C:/msys64/mingw64/lib/go/src/runtime/chan.go:520 +0x2cc fp=0xc000101ef8 sp=0xc000101e68 pc=0x40589c
runtime.chanrecv1(0xc00003c5a0, 0x0)
C:/msys64/mingw64/lib/go/src/runtime/chan.go:402 +0x2b fp=0xc000101f28 sp=0xc000101ef8 pc=0x40557b
testing.tRunner.func1(0xc0000f6100)
C:/msys64/mingw64/lib/go/src/testing/testing.go:803 +0x1fa fp=0xc000101fa8 sp=0xc000101f28 pc=0x4fa06a
testing.tRunner(0xc0000f6100, 0x7c6768)
C:/msys64/mingw64/lib/go/src/testing/testing.go:831 +0xd0 fp=0xc000101fd0 sp=0xc000101fa8 pc=0x4f6010
runtime.goexit()
C:/msys64/mingw64/lib/go/src/runtime/asm_amd64.s:1333 +0x1 fp=0xc000101fd8 sp=0xc000101fd0 pc=0x45cb61
created by testing.(*T).Run
C:/msys64/mingw64/lib/go/src/testing/testing.go:878 +0x363

goroutine 21 [chan receive]:
runtime.gopark(0x7c6480, 0xc00003c2f8, 0xc00007170d, 0x3)
C:/msys64/mingw64/lib/go/src/runtime/proc.go:302 +0x100 fp=0xc0000fdc90 sp=0xc0000fdc70 pc=0x430d30
runtime.goparkunlock(0xc00003c2f8, 0x170d, 0x3)
C:/msys64/mingw64/lib/go/src/runtime/proc.go:308 +0x5a fp=0xc0000fdcc0 sp=0xc0000fdc90 pc=0x430dea
runtime.chanrecv(0xc00003c2a0, 0x0, 0xc0000fdd01, 0xc0000fdd98)
C:/msys64/mingw64/lib/go/src/runtime/chan.go:520 +0x2cc fp=0xc0000fdd50 sp=0xc0000fdcc0 pc=0x40589c
runtime.chanrecv1(0xc00003c2a0, 0x0)
C:/msys64/mingw64/lib/go/src/runtime/chan.go:402 +0x2b fp=0xc0000fdd80 sp=0xc0000fdd50 pc=0x40557b
testing.(*testContext).waitParallel(0xc0000e6330)
C:/msys64/mingw64/lib/go/src/testing/testing.go:926 +0x9f fp=0xc0000fdda8 sp=0xc0000fdd80 pc=0x4f65bf
testing.(*T).Parallel(0xc0000f6400)
C:/msys64/mingw64/lib/go/src/testing/testing.go:733 +0x219 fp=0xc0000fde48 sp=0xc0000fdda8 pc=0x4f5d69
//common/testing/testenv.Parallel(0x80c9a0, 0xc0000f6400, 0x4f5f74)
Y:/src///common/testing/testenv/testenv.go:54 +0x67 fp=0xc0000fde60 sp=0xc0000fde48 pc=0x6ee527
//common/crypto/ecdsa_test.TestGenerateKey.func1(0xc0000f6400)
Y:/src///common/crypto/ecdsa/ecdsa_test.go:54 +0x95 fp=0xc0000fdfa8 sp=0xc0000fde60 pc=0x6f53e5
testing.tRunner(0xc0000f6400, 0xc000044fa0)
C:/msys64/mingw64/lib/go/src/testing/testing.go:827 +0xc6 fp=0xc0000fdfd0 sp=0xc0000fdfa8 pc=0x4f6006
runtime.goexit()
C:/msys64/mingw64/lib/go/src/runtime/asm_amd64.s:1333 +0x1 fp=0xc0000fdfd8 sp=0xc0000fdfd0 pc=0x45cb61
created by testing.(*T).Run
C:/msys64/mingw64/lib/go/src/testing/testing.go:878 +0x363

goroutine 23 [syscall, locked to thread]:
runtime.cgocall(0x45e360, 0xc000036d48, 0x59a8d2)
C:/msys64/mingw64/lib/go/src/runtime/cgocall.go:128 +0x55 fp=0xc00010bb08 sp=0xc00010bad0 pc=0x403ce5
syscall.Syscall9(0x7fefc5c1d10, 0x7, 0x2d4110, 0x0, 0xc000048680, 0xc00025b9e0, 0xc0000ba0e0, 0xce, 0x0, 0x0, ...)
C:/msys64/mingw64/lib/go/src/runtime/syscall_windows.go:198 +0x102 fp=0xc00010bb38 sp=0xc00010bb08 pc=0x44bb62
//windows/cng/bcrypt/internal/bcrypt.ImportKeyPair(0x2d4110, 0x0, 0xc000048680, 0xf, 0xf, 0xc00025b9e0, 0xc0000ba0e0, 0xce, 0xd6, 0xc000000000, ...)
Y:/src///windows/cng/bcrypt/internal/bcrypt/zsyscalls.go:653 +0x12b fp=0xc00010bbf0 sp=0xc00010bb38 pc=0x5ce20b
//windows/cng/bcrypt.Import(0x80ab00, 0xc00001e010, 0x80a780, 0xc000084120, 0x0, 0x0, 0x0, 0x0, 0x0)
Y:/src///windows/cng/bcrypt/import.go:672 +0x7af fp=0xc00010bd48 sp=0xc00010bbf0 pc=0x5dc8af
//common/crypto/ecdsa.sign(0x8082a0, 0xc00003edc0, 0xc00010bf70, 0xc000012280, 0x40, 0x40, 0x0, 0x0, 0x0, 0x0)
Y:/src///common/crypto/ecdsa/ecdsa_windows.go:51 +0x2bd fp=0xc00010be00 sp=0xc00010bd48 pc=0x5e305d
//common/crypto/ecdsa.Sign(0x8082a0, 0xc00003edc0, 0xc00010bf70, 0xc000012280, 0x40, 0x40, 0x0, 0x0, 0xc0003f40a0, 0x0)
Y:/src///common/crypto/ecdsa/ecdsa.go:47 +0x6e fp=0xc00010be60 sp=0xc00010be00 pc=0x5e288e
//common/crypto/ecdsa_test.TestGenerateKey.func1(0xc0000f6600)
Y:/src///common/crypto/ecdsa/ecdsa_test.go:78 +0x49e fp=0xc00010bfa8 sp=0xc00010be60 pc=0x6f57ee
testing.tRunner(0xc0000f6600, 0xc0000450c0)
C:/msys64/mingw64/lib/go/src/testing/testing.go:827 +0xc6 fp=0xc00010bfd0 sp=0xc00010bfa8 pc=0x4f6006
runtime.goexit()
C:/msys64/mingw64/lib/go/src/runtime/asm_amd64.s:1333 +0x1 fp=0xc00010bfd8 sp=0xc00010bfd0 pc=0x45cb61
created by testing.(*T).Run
C:/msys64/mingw64/lib/go/src/testing/testing.go:878 +0x363

goroutine 4 [GC worker (idle)]:
runtime.gopark(0x7c6330, 0xc00000a0c0, 0x1417, 0x0)
C:/msys64/mingw64/lib/go/src/runtime/proc.go:302 +0x100 fp=0xc000107f60 sp=0xc000107f40 pc=0x430d30
runtime.gcBgMarkWorker(0xc000020000)
C:/msys64/mingw64/lib/go/src/runtime/mgc.go:1772 +0x111 fp=0xc000107fd8 sp=0xc000107f60 pc=0x41ba91
runtime.goexit()
C:/msys64/mingw64/lib/go/src/runtime/asm_amd64.s:1333 +0x1 fp=0xc000107fe0 sp=0xc000107fd8 pc=0x45cb61
created by runtime.gcBgMarkStartWorkers
C:/msys64/mingw64/lib/go/src/runtime/mgc.go:1720 +0x7e

goroutine 5 [GC worker (idle)]:
runtime.gopark(0x7c6330, 0xc00000a0d0, 0x1417, 0x0)
C:/msys64/mingw64/lib/go/src/runtime/proc.go:302 +0x100 fp=0xc000109f60 sp=0xc000109f40 pc=0x430d30
runtime.gcBgMarkWorker(0xc000022500)
C:/msys64/mingw64/lib/go/src/runtime/mgc.go:1772 +0x111 fp=0xc000109fd8 sp=0xc000109f60 pc=0x41ba91
runtime.goexit()
C:/msys64/mingw64/lib/go/src/runtime/asm_amd64.s:1333 +0x1 fp=0xc000109fe0 sp=0xc000109fd8 pc=0x45cb61
created by runtime.gcBgMarkStartWorkers
C:/msys64/mingw64/lib/go/src/runtime/mgc.go:1720 +0x7e
rax 0x0
rbx 0x1
rcx 0x303510
rdi 0x2e9a40
rsi 0x303510
rbp 0x3dbfcf0
rsp 0x3dbf8d0
r8 0x303510
r9 0x1
r10 0x1
r11 0x3dbf8a0
r12 0x3031c8
r13 0x303558
r14 0x3035a0
r15 0x303630
rip 0x7fefc0c2bcf
rflags 0x10202
cs 0x33
fs 0x53
gs 0x2b
exit status 2

</details>
@odeke-em
Copy link
Member

@odeke-em odeke-em commented May 4, 2019

Thank you for reporting this issue @elagergren-spideroak!

So, yes please from the symptoms you described perhaps that can help with creating a minimal reproduction that we'll use even as the regression test when the fix lands. However, since this is a bug
that wasn't freshly introduced in the Go1.13 cycle, am afraid that it might have to wait until after the Go1.13 code freeze which just got in effect on May 1st. However, bugs shall be evaluated on a case-by-case basis :)

@odeke-em odeke-em changed the title syscall: panic making Windows system call syscall: panic making syscall if windows.Handle is used instead of uintptr May 4, 2019
@alexbrainman
Copy link
Member

@alexbrainman alexbrainman commented May 4, 2019

Yes, we need small example that reproduces your problem.

syscall.Syscall9(0x7fefc5d6970, 0x8, 0x2e8db0, 0x0, 0xc00000c3e0, 0x20, 0xc000bde000, 0x84, 0xc0000ffcac, 0x0, ...)
C:/msys64/mingw64/lib/go/src/runtime/syscall_windows.go:198 +0x102 fp=0xc0000ffb88 sp=0xc0000ffb58 pc=0x44bb62

syscall_windows.go line 198 is part of syscall_Syscall6 function on go1.12.4, not syscall.Syscall9. So, please, provide correct details of your environment.

Thank you.

Alex

@elagergren-spideroak
Copy link
Author

@elagergren-spideroak elagergren-spideroak commented May 4, 2019

Yes, we need small example that reproduces your problem.

Cool, I will try to come up with one.

please, provide correct details of your environment.

That stack trace comes from 1.11.4. I verified it occurs in 1.12.4 as well, though. I edited the original issue to make that clear.

@alexbrainman
Copy link
Member

@alexbrainman alexbrainman commented May 4, 2019

I will try to come up with one.

Sounds good.

That stack trace comes from 1.11.4. I verified it occurs in 1.12.4 as well, though. I edited the original issue to make that clear.

Thanks for checking.

Alex

@elagergren-spideroak
Copy link
Author

@elagergren-spideroak elagergren-spideroak commented May 4, 2019

@alexbrainman here is the updated stack trace from a 1.12.4 machine:

Exception 0xc0000005 0x0 0x0 0x7fefc0c5cee
PC=0x7fefc0c5cee

runtime.cgocall(0x45f620, 0xc0000390d0, 0x5a33b2)
        C:/msys64/mingw64/lib/go/src/runtime/cgocall.go:128 +0x55 fp=0xc000107c28 sp=0xc000107bf0 pc=0x403fd5
syscall.Syscall9(0x7fefc5d6970, 0x8, 0xd252a0, 0x0, 0xc0000102c0, 0x40, 0xc00013c000, 0x84, 0xc000107d7c, 0x0, ...)
        C:/msys64/mingw64/lib/go/src/runtime/syscall_windows.go:210 +0xf3 fp=0xc000107c58 sp=0xc000107c28 pc=0x44cd73
<REDACTED>/<REDACTED>/windows/cng/bcrypt/internal/bcrypt.SignHash(0xd252a0, 0x0, 0xc0000102c0, 0x40, 0x40, 0xc00013c000, 0x84, 0x84, 0xc000107d7c, 0xc000000000, ...)
        Y:/src/<REDACTED>/<REDACTED>/windows/cng/bcrypt/internal/bcrypt/zsyscalls.go:885 +0x149 fp=0xc000107d18 sp=0xc000107c58 pc=0x5d7d49
<REDACTED>/<REDACTED>/windows/cng/bcrypt.Sign(0x8807a0, 0xc0000407e0, 0xc0000102c0, 0x40, 0x40, 0x0, 0x0, 0x0, 0x0, 0x444ad3, ...)
        Y:/src/<REDACTED>/<REDACTED>/windows/cng/bcrypt/keys.go:190 +0x18a fp=0xc000107da0 sp=0xc000107d18 pc=0x5e718a
<REDACTED>/<REDACTED>/windows/cng/bcrypt.(*KeyPair).Sign(...)
        Y:/src/<REDACTED>/<REDACTED>/windows/cng/bcrypt/keys.go:148
<REDACTED>/<REDACTED>/common/crypto/ecdsa.sign(0x878440, 0xc000040d60, 0xc000107f70, 0xc0000102c0, 0x40, 0x40, 0x0, 0x0, 0x0, 0x0)
        Y:/src/<REDACTED>/<REDACTED>/common/crypto/ecdsa/ecdsa_windows.go:54 +0x328 fp=0xc000107e70 sp=0xc000107da0 pc=0x5ec2e8
<REDACTED>/<REDACTED>/common/crypto/ecdsa.Sign(...)
        Y:/src/<REDACTED>/<REDACTED>/common/crypto/ecdsa/ecdsa.go:47
<REDACTED>/<REDACTED>/common/crypto/ecdsa_test.TestGenerateKey.func1(0xc0000ea700)
        Y:/src/<REDACTED>/<REDACTED>/common/crypto/ecdsa/ecdsa_test.go:78 +0x1a3 fp=0xc000107fa8 sp=0xc000107e70 pc=0x73ad73
testing.tRunner(0xc0000ea700, 0xc0000470a0)
        C:/msys64/mingw64/lib/go/src/testing/testing.go:865 +0xc7 fp=0xc000107fd0 sp=0xc000107fa8 pc=0x4fb1a7
runtime.goexit()
        C:/msys64/mingw64/lib/go/src/runtime/asm_amd64.s:1337 +0x1 fp=0xc000107fd8 sp=0xc000107fd0 pc=0x45de21
created by testing.(*T).Run
        C:/msys64/mingw64/lib/go/src/testing/testing.go:916 +0x361

goroutine 1 [chan receive]:
runtime.gopark(0x816d80, 0xc00003e838, 0xc0000e170d, 0x3)
        C:/msys64/mingw64/lib/go/src/runtime/proc.go:301 +0x104 fp=0xc0004e9bb8 sp=0xc0004e9b98 pc=0x4329c4
runtime.goparkunlock(...)
        C:/msys64/mingw64/lib/go/src/runtime/proc.go:307
runtime.chanrecv(0xc00003e7e0, 0xc000079ccf, 0xc00002e001, 0x4fb561)
        C:/msys64/mingw64/lib/go/src/runtime/chan.go:524 +0x2f8 fp=0xc0004e9c48 sp=0xc0004e9bb8 pc=0x405bd8
runtime.chanrecv1(0xc00003e7e0, 0xc000079ccf)
        C:/msys64/mingw64/lib/go/src/runtime/chan.go:406 +0x2b fp=0xc0004e9c78 sp=0xc0004e9c48 pc=0x40588b
testing.(*T).Run(0xc0000ea200, 0x800628, 0xf, 0x817060, 0x48713d)
        C:/msys64/mingw64/lib/go/src/testing/testing.go:917 +0x388 fp=0xc0004e9d28 sp=0xc0004e9c78 pc=0x4fb588
testing.runTests.func1(0xc0000ea100)
        C:/msys64/mingw64/lib/go/src/testing/testing.go:1157 +0x7f fp=0xc0004e9d78 sp=0xc0004e9d28 pc=0x4ff5cf
testing.tRunner(0xc0000ea100, 0xc000079e30)
        C:/msys64/mingw64/lib/go/src/testing/testing.go:865 +0xc7 fp=0xc0004e9da0 sp=0xc0004e9d78 pc=0x4fb1a7
testing.runTests(0xc000046dc0, 0xafcfe0, 0x4, 0x4, 0x0)
        C:/msys64/mingw64/lib/go/src/testing/testing.go:1155 +0x2b0 fp=0xc0004e9e60 sp=0xc0004e9da0 pc=0x4fca20
testing.(*M).Run(0xc0000e8000, 0x0)
        C:/msys64/mingw64/lib/go/src/testing/testing.go:1072 +0x169 fp=0xc0004e9f30 sp=0xc0004e9e60 pc=0x4fb979
main.main()
        _testmain.go:50 +0x145 fp=0xc0004e9f98 sp=0xc0004e9f30 pc=0x73d3f5
runtime.main()
        C:/msys64/mingw64/lib/go/src/runtime/proc.go:200 +0x20c fp=0xc0004e9fe0 sp=0xc0004e9f98 pc=0x4325cc
runtime.goexit()
        C:/msys64/mingw64/lib/go/src/runtime/asm_amd64.s:1337 +0x1 fp=0xc0004e9fe8 sp=0xc0004e9fe0 pc=0x45de21

goroutine 2 [force gc (idle)]:
runtime.gopark(0x816d80, 0xb03130, 0x1410, 0x1)
        C:/msys64/mingw64/lib/go/src/runtime/proc.go:301 +0x104 fp=0xc000031fb0 sp=0xc000031f90 pc=0x4329c4
runtime.goparkunlock(...)
        C:/msys64/mingw64/lib/go/src/runtime/proc.go:307
runtime.forcegchelper()
        C:/msys64/mingw64/lib/go/src/runtime/proc.go:250 +0xc5 fp=0xc000031fe0 sp=0xc000031fb0 pc=0x432855
runtime.goexit()
        C:/msys64/mingw64/lib/go/src/runtime/asm_amd64.s:1337 +0x1 fp=0xc000031fe8 sp=0xc000031fe0 pc=0x45de21
created by runtime.init.5
        C:/msys64/mingw64/lib/go/src/runtime/proc.go:239 +0x3c

goroutine 3 [GC sweep wait]:
runtime.gopark(0x816d80, 0xb032c0, 0x140c, 0x1)
        C:/msys64/mingw64/lib/go/src/runtime/proc.go:301 +0x104 fp=0xc000033fa8 sp=0xc000033f88 pc=0x4329c4
runtime.goparkunlock(...)
        C:/msys64/mingw64/lib/go/src/runtime/proc.go:307
runtime.bgsweep(0xc0000140e0)
        C:/msys64/mingw64/lib/go/src/runtime/mgcsweep.go:89 +0x142 fp=0xc000033fd8 sp=0xc000033fa8 pc=0x422542
runtime.goexit()
        C:/msys64/mingw64/lib/go/src/runtime/asm_amd64.s:1337 +0x1 fp=0xc000033fe0 sp=0xc000033fd8 pc=0x45de21
created by runtime.gcenable
        C:/msys64/mingw64/lib/go/src/runtime/mgc.go:208 +0x5f

goroutine 18 [finalizer wait]:
runtime.gopark(0x816d80, 0xb20148, 0xc00000140f, 0x1)
        C:/msys64/mingw64/lib/go/src/runtime/proc.go:301 +0x104 fp=0xc000035f58 sp=0xc000035f38 pc=0x4329c4
runtime.goparkunlock(...)
        C:/msys64/mingw64/lib/go/src/runtime/proc.go:307
runtime.runfinq()
        C:/msys64/mingw64/lib/go/src/runtime/mfinal.go:175 +0xb4 fp=0xc000035fe0 sp=0xc000035f58 pc=0x418e74
runtime.goexit()
        C:/msys64/mingw64/lib/go/src/runtime/asm_amd64.s:1337 +0x1 fp=0xc000035fe8 sp=0xc000035fe0 pc=0x45de21
created by runtime.createfing
        C:/msys64/mingw64/lib/go/src/runtime/mfinal.go:156 +0x68

goroutine 19 [chan receive]:
runtime.gopark(0x816d80, 0xc00003e9b8, 0x87170d, 0x3)
        C:/msys64/mingw64/lib/go/src/runtime/proc.go:301 +0x104 fp=0xc0000fde68 sp=0xc0000fde48 pc=0x4329c4
runtime.goparkunlock(...)
        C:/msys64/mingw64/lib/go/src/runtime/proc.go:307
runtime.chanrecv(0xc00003e960, 0x0, 0xc00008a501, 0xc000030101)
        C:/msys64/mingw64/lib/go/src/runtime/chan.go:524 +0x2f8 fp=0xc0000fdef8 sp=0xc0000fde68 pc=0x405bd8
runtime.chanrecv1(0xc00003e960, 0x0)
        C:/msys64/mingw64/lib/go/src/runtime/chan.go:406 +0x2b fp=0xc0000fdf28 sp=0xc0000fdef8 pc=0x40588b
testing.tRunner.func1(0xc0000ea200)
        C:/msys64/mingw64/lib/go/src/testing/testing.go:841 +0x20a fp=0xc0000fdfa8 sp=0xc0000fdf28 pc=0x4ff34a
testing.tRunner(0xc0000ea200, 0x817060)
        C:/msys64/mingw64/lib/go/src/testing/testing.go:869 +0xd1 fp=0xc0000fdfd0 sp=0xc0000fdfa8 pc=0x4fb1b1
runtime.goexit()
        C:/msys64/mingw64/lib/go/src/runtime/asm_amd64.s:1337 +0x1 fp=0xc0000fdfd8 sp=0xc0000fdfd0 pc=0x45de21
created by testing.(*T).Run
        C:/msys64/mingw64/lib/go/src/testing/testing.go:916 +0x361

goroutine 21 [chan receive]:
runtime.gopark(0x816d80, 0xc00003e6b8, 0xc00002170d, 0x3)
        C:/msys64/mingw64/lib/go/src/runtime/proc.go:301 +0x104 fp=0xc0000f9ce8 sp=0xc0000f9cc8 pc=0x4329c4
runtime.goparkunlock(...)
        C:/msys64/mingw64/lib/go/src/runtime/proc.go:307
runtime.chanrecv(0xc00003e660, 0x0, 0xc0000f9d01, 0xc0000f9dc0)
        C:/msys64/mingw64/lib/go/src/runtime/chan.go:524 +0x2f8 fp=0xc0000f9d78 sp=0xc0000f9ce8 pc=0x405bd8
runtime.chanrecv1(0xc00003e660, 0x0)
        C:/msys64/mingw64/lib/go/src/runtime/chan.go:406 +0x2b fp=0xc0000f9da8 sp=0xc0000f9d78 pc=0x40588b
testing.(*testContext).waitParallel(0xc0000e42a0)
        C:/msys64/mingw64/lib/go/src/testing/testing.go:964 +0x9c fp=0xc0000f9dd0 sp=0xc0000f9da8 pc=0x4fb73c
testing.(*T).Parallel(0xc0000ea500)
        C:/msys64/mingw64/lib/go/src/testing/testing.go:771 +0x1f8 fp=0xc0000f9e58 sp=0xc0000f9dd0 pc=0x4faf08
<REDACTED>/<REDACTED>/common/testing/testenv.Parallel(0x882f80, 0xc0000ea500, 0x8eed68)
        Y:/src/<REDACTED>/<REDACTED>/common/testing/testenv/testenv.go:54 +0x67 fp=0xc0000f9e70 sp=0xc0000f9e58 pc=0x733887
<REDACTED>/<REDACTED>/common/crypto/ecdsa_test.TestGenerateKey.func1(0xc0000ea500)
        Y:/src/<REDACTED>/<REDACTED>/common/crypto/ecdsa/ecdsa_test.go:54 +0x7a fp=0xc0000f9fa8 sp=0xc0000f9e70 pc=0x73ac4a
testing.tRunner(0xc0000ea500, 0xc000046f80)
        C:/msys64/mingw64/lib/go/src/testing/testing.go:865 +0xc7 fp=0xc0000f9fd0 sp=0xc0000f9fa8 pc=0x4fb1a7
runtime.goexit()
        C:/msys64/mingw64/lib/go/src/runtime/asm_amd64.s:1337 +0x1 fp=0xc0000f9fd8 sp=0xc0000f9fd0 pc=0x45de21
created by testing.(*T).Run
        C:/msys64/mingw64/lib/go/src/testing/testing.go:916 +0x361

goroutine 22 [syscall, locked to thread]:
runtime.cgocall(0x45f620, 0xc000038d50, 0x5a33b2)
        C:/msys64/mingw64/lib/go/src/runtime/cgocall.go:128 +0x55 fp=0xc0000fbc58 sp=0xc0000fbc20 pc=0x403fd5
syscall.Syscall(0x7fefc5d04d0, 0x2, 0xd24ee0, 0x0, 0x0, 0x0, 0x0, 0x0)
        C:/msys64/mingw64/lib/go/src/runtime/syscall_windows.go:184 +0xea fp=0xc0000fbc88 sp=0xc0000fbc58 pc=0x44caea
<REDACTED>/<REDACTED>/windows/cng/bcrypt/internal/bcrypt.FinalizeKeyPair(0xd24ee0, 0x0, 0xc0000fbd38, 0x0)
        Y:/src/<REDACTED>/<REDACTED>/windows/cng/bcrypt/internal/bcrypt/zsyscalls.go:480 +0x6b fp=0xc0000fbce8 sp=0xc0000fbc88 pc=0x5d612b
<REDACTED>/<REDACTED>/windows/cng/bcrypt.NewKeyPair(0x881040, 0xc00010c030, 0x209, 0x0, 0xc00010c030, 0x726afc, 0xc0000ea600)
        Y:/src/<REDACTED>/<REDACTED>/windows/cng/bcrypt/keys.go:116 +0x23e fp=0xc0000fbda8 sp=0xc0000fbce8 pc=0x5e68ee
<REDACTED>/<REDACTED>/common/crypto/elliptic.generateKey(0x87f6c0, 0xc000048780, 0x878440, 0xc000040d60, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
        Y:/src/<REDACTED>/<REDACTED>/common/crypto/elliptic/elliptic_windows.go:30 +0x2cc fp=0xc0000fbe70 sp=0xc0000fbda8 pc=0x5ea32c
<REDACTED>/<REDACTED>/common/crypto/elliptic.GenerateKey(...)
        Y:/src/<REDACTED>/<REDACTED>/common/crypto/elliptic/elliptic.go:30
<REDACTED>/<REDACTED>/common/crypto/ecdsa_test.TestGenerateKey.func1(0xc0000ea600)
        Y:/src/<REDACTED>/<REDACTED>/common/crypto/ecdsa/ecdsa_test.go:60 +0x2d8 fp=0xc0000fbfa8 sp=0xc0000fbe70 pc=0x73aea8
testing.tRunner(0xc0000ea600, 0xc000047000)
        C:/msys64/mingw64/lib/go/src/testing/testing.go:865 +0xc7 fp=0xc0000fbfd0 sp=0xc0000fbfa8 pc=0x4fb1a7
runtime.goexit()
        C:/msys64/mingw64/lib/go/src/runtime/asm_amd64.s:1337 +0x1 fp=0xc0000fbfd8 sp=0xc0000fbfd0 pc=0x45de21
created by testing.(*T).Run
        C:/msys64/mingw64/lib/go/src/testing/testing.go:916 +0x361

goroutine 36 [GC worker (idle)]:
runtime.gopark(0x816c18, 0xc000012160, 0x1417, 0x0)
        C:/msys64/mingw64/lib/go/src/runtime/proc.go:301 +0x104 fp=0xc000103f60 sp=0xc000103f40 pc=0x4329c4
runtime.gcBgMarkWorker(0xc000022500)
        C:/msys64/mingw64/lib/go/src/runtime/mgc.go:1836 +0x114 fp=0xc000103fd8 sp=0xc000103f60 pc=0x41ca24
runtime.goexit()
        C:/msys64/mingw64/lib/go/src/runtime/asm_amd64.s:1337 +0x1 fp=0xc000103fe0 sp=0xc000103fd8 pc=0x45de21
created by runtime.gcBgMarkStartWorkers
        C:/msys64/mingw64/lib/go/src/runtime/mgc.go:1784 +0x7e

goroutine 42 [GC worker (idle)]:
runtime.gopark(0x816c18, 0xc00004c060, 0x871417, 0x0)
        C:/msys64/mingw64/lib/go/src/runtime/proc.go:301 +0x104 fp=0xc0004e5f60 sp=0xc0004e5f40 pc=0x4329c4
runtime.gcBgMarkWorker(0xc000020000)
        C:/msys64/mingw64/lib/go/src/runtime/mgc.go:1836 +0x114 fp=0xc0004e5fd8 sp=0xc0004e5f60 pc=0x41ca24
runtime.goexit()
        C:/msys64/mingw64/lib/go/src/runtime/asm_amd64.s:1337 +0x1 fp=0xc0004e5fe0 sp=0xc0004e5fd8 pc=0x45de21
created by runtime.gcBgMarkStartWorkers
        C:/msys64/mingw64/lib/go/src/runtime/mgc.go:1784 +0x7e
rax     0x3e6fcf0
rbx     0xd95d90
rcx     0xd95d90
rdi     0x0
rsi     0x9
rbp     0x9
rsp     0x3e6f870
r8      0xd95d90
r9      0x0
r10     0x1
r11     0x3e6f8a0
r12     0x48
r13     0x0
r14     0x0
r15     0xd40500
rip     0x7fefc0c5cee
rflags  0x10202
cs      0x33
fs      0x53
gs      0x2b
exit status 2
FAIL    <REDACTED>/<REDACTED>/common/crypto/ecdsa        13.835s
@elagergren-spideroak
Copy link
Author

@elagergren-spideroak elagergren-spideroak commented May 6, 2019

Further testing seems to indicate this isn't a syscall bug. Will reopen if anything changes.

@elagergren-spideroak
Copy link
Author

@elagergren-spideroak elagergren-spideroak commented May 6, 2019

FWIW: the issue was a textbook case of needing to use runtime.KeepAlive. 😁

@golang golang locked and limited conversation to collaborators May 5, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants
You can’t perform that action at this time.