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
Comments
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 |
Yes, we need small example that reproduces your problem.
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 |
Cool, I will try to come up with one.
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. |
Sounds good.
Thanks for checking. Alex |
@alexbrainman here is the updated stack trace from a 1.12.4 machine:
|
Further testing seems to indicate this isn't a syscall bug. Will reopen if anything changes. |
FWIW: the issue was a textbook case of needing to use |
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
OutputWhat did you do?
Made a system call. (I can try and come up with a runnable example, but the actual code is proprietary):
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 useuintptr
instead ofwindows.Handle
(which istype Handle uintptr
insidesys/windows
), the panic goes away.Panic:
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
The text was updated successfully, but these errors were encountered: