From 6ce93dd4258e133bb60b00fb7a0435b755be7bf4 Mon Sep 17 00:00:00 2001 From: Aleksandr Nogikh Date: Fri, 2 Feb 2024 12:20:16 +0100 Subject: syz-manager: don't set up pprof endpoints for host fuzzing In this mode, all syz-fuzzers will be on the same network and will start competing with each other for binding to the same port. For now, we don't have the need to use pprof in the host fuzzer mode, so let's just disable it. --- vm/vm.go | 37 +++++++++++++++++++++++-------------- vm/vm_test.go | 1 + 2 files changed, 24 insertions(+), 14 deletions(-) diff --git a/vm/vm.go b/vm/vm.go index 434a3da2e..b129c5aa9 100644 --- a/vm/vm.go +++ b/vm/vm.go @@ -46,14 +46,16 @@ type Pool struct { template string timeouts targets.Timeouts activeCount int32 + hostFuzzer bool } type Instance struct { - impl vmimpl.Instance - workdir string - timeouts targets.Timeouts - index int - onClose func() + impl vmimpl.Instance + workdir string + timeouts targets.Timeouts + index int + onClose func() + hostFuzzer bool } var ( @@ -115,10 +117,11 @@ func Create(cfg *mgrconfig.Config, debug bool) (*Pool, error) { return nil, err } return &Pool{ - impl: impl, - workdir: env.Workdir, - template: cfg.WorkdirTemplate, - timeouts: cfg.Timeouts, + impl: impl, + workdir: env.Workdir, + template: cfg.WorkdirTemplate, + timeouts: cfg.Timeouts, + hostFuzzer: cfg.SysTarget.HostFuzzer, }, nil } @@ -146,11 +149,12 @@ func (pool *Pool) Create(index int) (*Instance, error) { } atomic.AddInt32(&pool.activeCount, 1) return &Instance{ - impl: impl, - workdir: workdir, - timeouts: pool.timeouts, - index: index, - onClose: func() { atomic.AddInt32(&pool.activeCount, -1) }, + impl: impl, + workdir: workdir, + timeouts: pool.timeouts, + index: index, + onClose: func() { atomic.AddInt32(&pool.activeCount, -1) }, + hostFuzzer: pool.hostFuzzer, }, nil } @@ -188,6 +192,11 @@ func (inst *Instance) Info() ([]byte, error) { } func (inst *Instance) PprofPort() int { + if inst.hostFuzzer { + // In the fuzzing on host mode, fuzzers are always on the same network. + // Don't set up pprof endpoints in this case. + return 0 + } if ii, ok := inst.impl.(vmimpl.PprofPortProvider); ok { return ii.PprofPort() } diff --git a/vm/vm_test.go b/vm/vm_test.go index d01e97310..2a3f1171a 100644 --- a/vm/vm_test.go +++ b/vm/vm_test.go @@ -347,6 +347,7 @@ func testMonitorExecution(t *testing.T, test *Test) { Slowdown: 1, NoOutput: 5 * time.Second, }, + SysTarget: targets.Get(targets.Linux, targets.AMD64), }, Workdir: dir, Type: "test", -- cgit mrf-deployment