From 8af91f61b4d5b8db41cf7d34195bb34c767ef3d4 Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Sun, 6 Aug 2017 16:47:16 +0200 Subject: syz-manager, syz-hub: share repros between managers via hub Currently hub allows managers to exchange programs from corpus. But reproducers are not exchanged and we don't know if a crash happens on other managers as well or not. Allow hub to exchange reproducers. Reproducers are stored in a separate db file with own sequence numbers. This allows to throttle distribution of reproducers to managers, so that they are not overloaded with reproducers and don't lose them on restarts. Based on patch by Andrey Konovalov: https://github.com/google/syzkaller/pull/325 Fixes #282 --- pkg/osutil/osutil.go | 10 ++++++++++ pkg/rpctype/rpctype.go | 15 ++++++++++----- 2 files changed, 20 insertions(+), 5 deletions(-) (limited to 'pkg') diff --git a/pkg/osutil/osutil.go b/pkg/osutil/osutil.go index fecb5f95b..4fbd04506 100644 --- a/pkg/osutil/osutil.go +++ b/pkg/osutil/osutil.go @@ -155,3 +155,13 @@ func WriteFile(filename string, data []byte) error { func WriteExecFile(filename string, data []byte) error { return ioutil.WriteFile(filename, data, DefaultExecPerm) } + +// Return all files in a directory. +func ListDir(dir string) ([]string, error) { + f, err := os.Open(dir) + if err != nil { + return nil, err + } + defer f.Close() + return f.Readdirnames(-1) +} diff --git a/pkg/rpctype/rpctype.go b/pkg/rpctype/rpctype.go index ab3f2243a..a198a90f4 100644 --- a/pkg/rpctype/rpctype.go +++ b/pkg/rpctype/rpctype.go @@ -74,18 +74,23 @@ type HubConnectArgs struct { type HubSyncArgs struct { // see HubConnectArgs. - Client string - Key string - Manager string + Client string + Key string + Manager string + NeedRepros bool // Programs added to corpus since last sync or connect. Add [][]byte - // Hashed of programs removed from corpus since last sync or connect. + // Hashes of programs removed from corpus since last sync or connect. Del []string + // Repros found since last sync. + Repros [][]byte } type HubSyncRes struct { // Set of programs from other managers. - Inputs [][]byte + Progs [][]byte + // Set of repros from other managers. + Repros [][]byte // Number of remaining pending programs, // if >0 manager should do sync again. More int -- cgit mrf-deployment