dynamorio
dynamorio copied to clipboard
APP CRASH: Missing handling of stack ptr == NULL in clone(CLONE_VFORK + CLONE_VM)
Describe the bug
The Go process spawn support invokes clone() with CLONE_VFORK + CLONE_VM + stack_ptr == NULL. Glibc doesn't support this but the syscall itself does. stack_ptr == NULL means set $sp in the child to be $sp in the parent. This is dangerous, but the use of CLONE_VFORK makes this workable.
DR doesn't handle this causing the app to get a segv when it references values off of $sp (== NULL in the child).
To Reproduce
$ cat >test-exec.go <<EOF
package main
import (
"fmt"
"os/exec"
)
func main() {
cmd := exec.Command("/bin/echo", "xyz")
out, err := cmd.CombinedOutput()
fmt.Printf("%s\n", out)
println(err)
println("Done")
}
EOF
$ go build test-exec.go
$ drrun -- ./test-exec
--> signal 11 received during fork fatal error: signal received during fork
Please also answer these questions:
- What happens when you run without any client? Program runs to completion
- What happens when you run with debug build ("-debug" flag to drrun/drconfig/drinject)? Same segv
Expected behavior
Program runs to completion.
Screenshots or Pasted Text
None
Versions
git master @6d1912f6f6655b9185aa6fc73243819c8e905cac on amd64 linux
Additional context
None
Hmm. The repro example got deleted (it was a here document).
package main
import (
"fmt"
"os/exec"
)
func main() {
cmd := exec.Command("/bin/echo", "xyz")
out, err := cmd.CombinedOutput()
fmt.Printf("%s\n", out)
println(err)
println("Done")
}
$ go build test-exec.go
$ drrun -- ./test-exec
It wasn't deleted: hidden by the markdown. I clicked "edit" and fixed the markdown in the original comment.
No issues reported since merging. Closing.