hooklift / govix

VMware VIX API for Go
Mozilla Public License 2.0
36 stars 18 forks source link

crash in RunProgramInGuest #22

Open brucedang opened 9 years ago

brucedang commented 9 years ago

I am using guest.RunProgram() and it crashes immediately after the guest executes the command. Looks like it is dying after C.VixVM_RunProgramInGuest() completes but during the C.get_program_output().

Here is the stack trace when it crashes:

fatal error: unexpected signal during runtime execution [signal 0xb code=0x1 addr=0x0 pc=0x7f579b6da7dd]

runtime stack: runtime.gothrow(0x589e30, 0x2a) /usr/local/go/src/runtime/panic.go:503 +0x8e runtime.sigpanic() /usr/local/go/src/runtime/sigpanic_unix.go:14 +0x5e

goroutine 1 [syscall, locked to thread]: runtime.cgocall_errno(0x40430a, 0xc20807fcd0, 0x0) /usr/local/go/src/runtime/cgocall.go:130 +0xf5 fp=0xc20807fcb0 sp=0xc20807fc88 github.com/hooklift/govix._Cfunc_get_program_output(0x230003a, 0x0, 0x0, 0x0, 0x0) github.com/hooklift/govix/_obj/_cgo_gotypes.go:536 +0x44 fp=0xc20807fcd0 sp=0xc20807fcb0 github.com/hooklift/govix.(*Guest).RunProgram(0xc20802a604, 0x7fffe62c8287, 0x8, 0x7fffe62c829b, 0x4, 0x0, 0x0, 0x0, 0x0, 0x0, ...) /home/test/blah/src/github.com/hooklift/govix/guest.go:729 +0x1ac fp=0xc20807fd60 sp=0xc20807fcd0 main.cmdOneShot(0xc20802a560, 0x0, 0x0) /home/test/blah/src/test/test/test.go:139 +0x3b4 fp=0xc20807fe70 sp=0xc20807fd60 main.main() /home/test/blah/src/test/test/test.go:94 +0x3a3 fp=0xc20807ff98 sp=0xc20807fe70 runtime.main() /usr/local/go/src/runtime/proc.go:63 +0xf3 fp=0xc20807ffe0 sp=0xc20807ff98 runtime.goexit() /usr/local/go/src/runtime/asm_amd64.s:2232 +0x1 fp=0xc20807ffe8 sp=0xc20807ffe0

goroutine 17 [syscall, locked to thread]: runtime.goexit() /usr/local/go/src/runtime/asm_amd64.s:2232 +0x1

goroutine 18 [syscall, locked to thread]: runtime.goexit()

/usr/local/go/src/runtime/asm_amd64.s:2232 +0x1

I suspect the issue is while it is trying to fill in the pid, duration, and exit code. I have not used VIX before, but can it be that pid/duration/exitcode need to be uint64, int, ... (not uint64 , int , ..) and then we just pass their address to get_program_output?

c4milo commented 9 years ago

Go 1.4.x? VMWare platform and version? VMWare Tools version?

c4milo commented 9 years ago

Also, do you mind sending a piece of code that reproduces de error?

brucedang commented 9 years ago

hi c4milo,

oops, sorry. here is the version info:

Ubuntu 14.04 go version go1.4.2 linux/amd64 VMWare Workstation 11 on Linux

the repro is at http://pastebin.com/us7N4UVX

brucedang commented 9 years ago

guest OS is Windows 7, but that should not matter much.

c4milo commented 9 years ago

@brucedang apologies for taking so long to look into this! the pastebin link seems gone. Did you have VMWare tools installed in the guest?

IsSuEat commented 9 years ago

I'm running into the same issue. Whenever a command completes execution in the vmware, I get a stacktrace printed.

Tried to run it on W10 and Server2012, VMWaretools are installed on both. Sample source attached. I'm very new to Go, so this might very well be my own mistake, but I saw this issue, so I thought I report in aswell

fatal error: unexpected signal during runtime execution
[signal 0xb code=0x1 addr=0x0 pc=0x680fc40]

runtime stack:
runtime.throw(0x41b2080, 0x2a)
        /usr/local/Cellar/go/1.5.1/libexec/src/runtime/panic.go:527 +0x90
runtime.sigpanic()
        /usr/local/Cellar/go/1.5.1/libexec/src/runtime/sigpanic_unix.go:12 +0x5a

goroutine 1 [syscall, locked to thread]:
runtime.cgocall(0x4002600, 0xc820051d48, 0x0)
        /usr/local/Cellar/go/1.5.1/libexec/src/runtime/cgocall.go:120 +0x11b fp=0xc820051d00 sp=0xc820051cd0
github.com/hooklift/govix._Cfunc_get_program_output(0x210003a, 0x0, 0x0, 0x0, 0x0)
        github.com/hooklift/govix/_obj/_cgo_gotypes.go:1149 +0x3a fp=0xc820051d48 sp=0xc820051d00
github.com/hooklift/govix.(*Guest).RunProgram(0xc820077e00, 0x41a25e0, 0x1b, 0x417ff70, 0xb, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
        /Users/armin/projects/go/src/github.com/hooklift/govix/guest.go:725 +0x1bb fp=0xc820051dd8 sp=0xc820051d48
main.main()
        /Users/armin/projects/go/src/sophos/setup/main.go:44 +0x583 fp=0xc820051f50 sp=0xc820051dd8
runtime.main()
        /usr/local/Cellar/go/1.5.1/libexec/src/runtime/proc.go:111 +0x2b0 fp=0xc820051fa0 sp=0xc820051f50
runtime.goexit()
        /usr/local/Cellar/go/1.5.1/libexec/src/runtime/asm_amd64.s:1696 +0x1 fp=0xc820051fa8 sp=0xc820051fa0

goroutine 17 [syscall, locked to thread]:
runtime.goexit()
        /usr/local/Cellar/go/1.5.1/libexec/src/runtime/asm_amd64.s:1696 +0x1
exit status 2

Link to source gist https://gist.github.com/IsSuEat/3040fcc95bbb42aa84e1

edit: Fusion 8 on OSX10.11