aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2024-05-23 10:17:44 +0200
committerDmitry Vyukov <dvyukov@google.com>2024-05-27 14:15:44 +0000
commitf02c04b68795a61c1a8bf8b044dacca2c1f29eb4 (patch)
tree00b1c5c09977b2b21c680c5acd78293bfb1e1606
parent0c94958922ede180cdca867053826c1bb7d4c9e1 (diff)
syz-manager: repair VM-less mode
VM-less mode stopped working after addition of RPCServer.createInstance. Repair it.
-rw-r--r--pkg/mgrconfig/load.go6
-rw-r--r--syz-manager/manager.go5
-rw-r--r--syz-manager/rpc.go13
3 files changed, 19 insertions, 5 deletions
diff --git a/pkg/mgrconfig/load.go b/pkg/mgrconfig/load.go
index cfe26c573..db44caa89 100644
--- a/pkg/mgrconfig/load.go
+++ b/pkg/mgrconfig/load.go
@@ -36,6 +36,11 @@ type Derived struct {
Syscalls []int
NoMutateCalls map[int]bool // Set of IDs of syscalls which should not be mutated.
Timeouts targets.Timeouts
+
+ // Special debugging/development mode specified by VM type "none".
+ // In this mode syz-manager does not start any VMs, but instead a user is supposed
+ // to start syz-fuzzer process in a VM manually.
+ VMLess bool
}
func LoadData(data []byte) (*Config, error) {
@@ -191,6 +196,7 @@ func Complete(cfg *Config) error {
}
}
cfg.initTimeouts()
+ cfg.VMLess = cfg.Type == "none"
return nil
}
diff --git a/syz-manager/manager.go b/syz-manager/manager.go
index 8c4b35f2b..44df6d9fd 100644
--- a/syz-manager/manager.go
+++ b/syz-manager/manager.go
@@ -174,10 +174,7 @@ func RunManager(cfg *mgrconfig.Config) {
}
var vmPool *vm.Pool
- // Type "none" is a special case for debugging/development when manager
- // does not start any VMs, but instead you start them manually
- // and start syz-fuzzer there.
- if cfg.Type != "none" {
+ if !cfg.VMLess {
var err error
vmPool, err = vm.Create(cfg, *flagDebug)
if err != nil {
diff --git a/syz-manager/rpc.go b/syz-manager/rpc.go
index 839adba1c..6fdb1c0ce 100644
--- a/syz-manager/rpc.go
+++ b/syz-manager/rpc.go
@@ -136,6 +136,15 @@ func (serv *RPCServer) handleConn(conn *flatrpc.Conn) {
return
}
+ if serv.cfg.VMLess {
+ // There is no VM loop, so minic what it would do.
+ serv.createInstance(name, nil)
+ defer func() {
+ serv.stopFuzzing(name)
+ serv.shutdownInstance(name, false)
+ }()
+ }
+
serv.mu.Lock()
runner := serv.runners[name]
if runner == nil || runner.stopped {
@@ -168,7 +177,9 @@ func (serv *RPCServer) handshake(conn *flatrpc.Conn) (string, []byte, *cover.Can
}
connectReq := connectReqRaw.UnPack()
log.Logf(1, "fuzzer %v connected", connectReq.Name)
- checkRevisions(connectReq, serv.cfg.Target)
+ if !serv.cfg.VMLess {
+ checkRevisions(connectReq, serv.cfg.Target)
+ }
serv.statVMRestarts.Add(1)
bugFrames := serv.mgr.currentBugFrames()