diff options
| -rw-r--r-- | pkg/mgrconfig/config.go | 6 | ||||
| -rw-r--r-- | pkg/mgrconfig/load.go | 4 | ||||
| -rw-r--r-- | syz-manager/manager.go | 9 |
3 files changed, 15 insertions, 4 deletions
diff --git a/pkg/mgrconfig/config.go b/pkg/mgrconfig/config.go index 24854af38..a2e850db1 100644 --- a/pkg/mgrconfig/config.go +++ b/pkg/mgrconfig/config.go @@ -135,6 +135,12 @@ type Config struct { // Reproduce, localize and minimize crashers (default: true). Reproduce bool `json:"reproduce"` + // The number of VMs that are reserved to only perform fuzzing and nothing else. + // Can be helpful e.g. to ensure that the pool of fuzzing VMs is never exhaused and + // the manager continues fuzzing no matter how many new bugs are encountered. + // By default the value is 0, i.e. all VMs can be used for all purposes. + FuzzingVMs int `json:"fuzzing_vms,omitempty"` + // List of syscalls to test (optional). For example: // "enable_syscalls": [ "mmap", "openat$ashmem", "ioctl$ASHMEM*" ] EnabledSyscalls []string `json:"enable_syscalls,omitempty"` diff --git a/pkg/mgrconfig/load.go b/pkg/mgrconfig/load.go index f26b26124..ff9d8e61f 100644 --- a/pkg/mgrconfig/load.go +++ b/pkg/mgrconfig/load.go @@ -167,6 +167,10 @@ func Complete(cfg *Config) error { return err } } + if cfg.FuzzingVMs < 0 { + return fmt.Errorf("fuzzing_vms cannot be less than 0") + } + var err error cfg.Syscalls, err = ParseEnabledSyscalls(cfg.Target, cfg.EnabledSyscalls, cfg.DisabledSyscalls) if err != nil { diff --git a/syz-manager/manager.go b/syz-manager/manager.go index 6bab4bb43..b07a885e2 100644 --- a/syz-manager/manager.go +++ b/syz-manager/manager.go @@ -287,8 +287,9 @@ func (mgr *Manager) vmLoop() { log.Logf(0, "wait for the connection from test machine...") instancesPerRepro := 4 vmCount := mgr.vmPool.Count() - if instancesPerRepro > vmCount { - instancesPerRepro = vmCount + maxReproVMs := vmCount - mgr.cfg.FuzzingVMs + if instancesPerRepro > maxReproVMs && maxReproVMs > 0 { + instancesPerRepro = maxReproVMs } bootInstance := make(chan int) go func() { @@ -329,8 +330,8 @@ func (mgr *Manager) vmLoop() { len(pendingRepro), len(reproducing), len(reproQueue)) canRepro := func() bool { - return phase >= phaseTriagedHub && - len(reproQueue) != 0 && reproInstances+instancesPerRepro <= vmCount + return phase >= phaseTriagedHub && len(reproQueue) != 0 && + reproInstances+instancesPerRepro <= maxReproVMs } if shutdown != nil { |
