aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--syz-fuzzer/fuzzer.go11
-rw-r--r--vm/vmimpl/vmimpl.go3
2 files changed, 14 insertions, 0 deletions
diff --git a/syz-fuzzer/fuzzer.go b/syz-fuzzer/fuzzer.go
index f0b6d9c23..99d04f57f 100644
--- a/syz-fuzzer/fuzzer.go
+++ b/syz-fuzzer/fuzzer.go
@@ -7,6 +7,8 @@ import (
"flag"
"fmt"
"math/rand"
+ "net/http"
+ _ "net/http/pprof"
"os"
"runtime"
"runtime/debug"
@@ -28,6 +30,7 @@ import (
"github.com/google/syzkaller/prog"
_ "github.com/google/syzkaller/sys"
"github.com/google/syzkaller/sys/targets"
+ "github.com/google/syzkaller/vm/vmimpl"
)
type Fuzzer struct {
@@ -194,6 +197,14 @@ func main() {
os.Exit(1)
}()
+ // Necessary for pprof handlers.
+ go func() {
+ err := http.ListenAndServe(fmt.Sprintf("0.0.0.0:%v", vmimpl.PprofPort), nil)
+ if err != nil {
+ log.SyzFatalf("failed to setup a server: %v", err)
+ }
+ }()
+
checkArgs := &checkArgs{
target: target,
sandbox: sandbox,
diff --git a/vm/vmimpl/vmimpl.go b/vm/vmimpl/vmimpl.go
index 0a4ada028..8b63ca77e 100644
--- a/vm/vmimpl/vmimpl.go
+++ b/vm/vmimpl/vmimpl.go
@@ -186,6 +186,9 @@ func Multiplex(cmd *exec.Cmd, merger *OutputMerger, console io.Closer, timeout t
return merger.Output, errc, nil
}
+// On VMs, pprof will be listening to this port.
+const PprofPort = 6060
+
func RandomPort() int {
n, err := rand.Int(rand.Reader, big.NewInt(64<<10-1<<10))
if err != nil {