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: syscall.Exec crashes MacOS 10.9.3 #8471

Closed
gopherbot opened this issue Aug 5, 2014 · 10 comments
Closed

syscall: syscall.Exec crashes MacOS 10.9.3 #8471

gopherbot opened this issue Aug 5, 2014 · 10 comments

Comments

@gopherbot
Copy link

@gopherbot gopherbot commented Aug 5, 2014

by MrWanny:

adding the following lines to my go script causes my MacBook pro to crash and reboot.

binary, lookErr := exec.LookPath("cp")
if lookErr != nil {
    panic(lookErr)
}
args := []string{"cp", "-rf", "goTools/data/",
service.Name+"/trunk/"}
env := os.Environ()
                        
execErr := syscall.Exec(binary, args, env)
if execErr != nil {
     panic(execErr)
}
@davecheney
Copy link
Contributor

@davecheney davecheney commented Aug 5, 2014

Comment 1:

I'm sorry that this code crashes your Mac. Can you please provide the following data 
1. If there is any sort of crash report provided by OSX on restart, please attach it
here. 
2. Use the os/exec package which is specifically designed to do what you want.
3. Details about your hardware and OSX version as well as xcode version and the version
of go used. 
It is possible that causing syscall.Exec without the correct arguments could crash the
OSX kernel but that would be an issue in the kernel, not go (we're just an average user
space process)

Status changed to WaitingForReply.

@bradfitz
Copy link
Contributor

@bradfitz bradfitz commented Aug 5, 2014

Comment 2:

Does it still crash if you make args[0] be "/bin/cp" ?
@gopherbot
Copy link
Author

@gopherbot gopherbot commented Aug 5, 2014

Comment 3 by MrWanny:

Thanks for the help,
both of the suggested options works! 
      exec.Command("cp", "-rf", "goTools/data/", service.Name+"/trunk/").Output()
or
      binary, lookErr := exec.LookPath("cp")
      if lookErr != nil {
          panic(lookErr)
       }
      args := []string{"/bin/cp", "-rf", "goTools/data/", service.Name+"/trunk/"}
      env := os.Environ()
                        
     execErr := syscall.Exec(binary, args, env)
     if execErr != nil {
            panic(execErr)
     }
For completeness I attached the kernel panic, and it is happening on OS X 10.9.4
15-inch, Mid 2012 Xcode Version 5.1.1 (5B1008)
Thanks again

Attachments:

  1. Kernel_2014-08-04-175043_Wannys-MacBook.panic (6296 bytes)
@davecheney
Copy link
Contributor

@davecheney davecheney commented Aug 5, 2014

Comment 4:

Does it still crash with your AV software disabled/removed ?

Labels changed: added release-none, repo-main, os-macosx.

@gopherbot
Copy link
Author

@gopherbot gopherbot commented Aug 5, 2014

Comment 5 by MrWanny:

After disabling Sophos AV the program seams works OK
@davecheney
Copy link
Contributor

@davecheney davecheney commented Aug 5, 2014

Comment 6:

Thanks for confirming. You may wish to report this issue to your AV vendor; their kext
is corrupting kernel memory.

Status changed to Fixed.

@gopherbot
Copy link
Author

@gopherbot gopherbot commented Aug 5, 2014

Comment 7 by MrWanny:

Will do, thanks a lot for the help.
@gopherbot
Copy link
Author

@gopherbot gopherbot commented Aug 5, 2014

Comment 8 by bob.cook.sophos:

I'm from Sophos, looking for some help in reproduction steps (maybe a full Go program
rather than just a snippet). Also worth noting the panic log shows an old version
installed, no longer supported. You should upgrade, quite a few stability improvements.
@bradfitz
Copy link
Contributor

@bradfitz bradfitz commented Aug 5, 2014

Comment 9:

Bob,
A full Go program would be:
package main
import (
     "syscall"
     "os"
     "os/exec"
)
func main() {
     // ... that stuff above
}
Then you can:
$ go build -o crash crash-sophos.go && ./crash
@gopherbot
Copy link
Author

@gopherbot gopherbot commented Aug 5, 2014

Comment 10 by bob.cook.sophos:

Very helpful, thanks (I'm a Go noob for sure, glad for the assistance). Couldn't use the
"service.Name" object but it didn't seem relevant to the root cause. Wasn't able to repo
the panic using our current release, but will pursue it some more to see what else might
be going on.
@gopherbot gopherbot added fixed labels Aug 5, 2014
@golang golang locked and limited conversation to collaborators Jun 25, 2016
This issue was closed.
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
3 participants
You can’t perform that action at this time.