aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--pkg/mgrconfig/config.go12
-rw-r--r--pkg/mgrconfig/load.go9
-rw-r--r--syz-ci/syz-ci.go1
-rw-r--r--syz-manager/manager.go70
4 files changed, 64 insertions, 28 deletions
diff --git a/pkg/mgrconfig/config.go b/pkg/mgrconfig/config.go
index 46270ab0c..68242faf8 100644
--- a/pkg/mgrconfig/config.go
+++ b/pkg/mgrconfig/config.go
@@ -5,6 +5,8 @@ package mgrconfig
import (
"encoding/json"
+
+ "github.com/google/syzkaller/pkg/asset"
)
type Config struct {
@@ -191,6 +193,16 @@ type Config struct {
// Parameters for concrete types are in Config type in vm/TYPE/TYPE.go, e.g. vm/qemu/qemu.go.
VM json.RawMessage `json:"vm"`
+ // Asset storage configuration. There can be specified the upload location and crash assets
+ // to upload.
+ // A sample config:
+ // {
+ // "upload_to": "gs://bucket",
+ // "public_access": true
+ // }
+ // More details can be found in pkg/asset/config.go.
+ AssetStorage *asset.Config `json:"asset_storage"`
+
// Implementation details beyond this point. Filled after parsing.
Derived `json:"-"`
}
diff --git a/pkg/mgrconfig/load.go b/pkg/mgrconfig/load.go
index f1063ed17..bef05faa4 100644
--- a/pkg/mgrconfig/load.go
+++ b/pkg/mgrconfig/load.go
@@ -182,6 +182,15 @@ func Complete(cfg *Config) error {
if err != nil {
return err
}
+ if !cfg.AssetStorage.IsEmpty() {
+ if cfg.DashboardClient == "" {
+ return fmt.Errorf("asset storage also requires dashboard client")
+ }
+ err = cfg.AssetStorage.Validate()
+ if err != nil {
+ return err
+ }
+ }
cfg.initTimeouts()
return nil
}
diff --git a/syz-ci/syz-ci.go b/syz-ci/syz-ci.go
index 944c0c745..486d66c87 100644
--- a/syz-ci/syz-ci.go
+++ b/syz-ci/syz-ci.go
@@ -403,6 +403,7 @@ func loadManagerConfig(cfg *Config, mgr *ManagerConfig) error {
if (mgr.Jobs.BisectCause || mgr.Jobs.BisectFix) && cfg.BisectBinDir == "" {
return fmt.Errorf("manager %v: enabled bisection but no bisect_bin_dir", mgr.Name)
}
+ managercfg.AssetStorage = cfg.AssetStorage
mgr.managercfg = managercfg
managercfg.Syzkaller = filepath.FromSlash("syzkaller/current")
if managercfg.HTTP == "" {
diff --git a/syz-manager/manager.go b/syz-manager/manager.go
index ee7f4732d..4f12d3a4c 100644
--- a/syz-manager/manager.go
+++ b/syz-manager/manager.go
@@ -19,6 +19,7 @@ import (
"time"
"github.com/google/syzkaller/dashboard/dashapi"
+ "github.com/google/syzkaller/pkg/asset"
"github.com/google/syzkaller/pkg/cover"
"github.com/google/syzkaller/pkg/csource"
"github.com/google/syzkaller/pkg/db"
@@ -92,6 +93,8 @@ type Manager struct {
coverFilter map[uint32]uint32
coverFilterBitmap []byte
modulesInitialized bool
+
+ assetStorage *asset.Storage
}
type CorpusItemUpdate struct {
@@ -215,6 +218,13 @@ func RunManager(cfg *mgrconfig.Config) {
}
}
+ if !cfg.AssetStorage.IsEmpty() {
+ mgr.assetStorage, err = asset.StorageFromConfig(cfg.AssetStorage, mgr.dash)
+ if err != nil {
+ log.Fatalf("failed to init asset storage: %v", err)
+ }
+ }
+
go func() {
for lastTime := time.Now(); ; {
time.Sleep(10 * time.Second)
@@ -242,34 +252,7 @@ func RunManager(cfg *mgrconfig.Config) {
}()
if *flagBench != "" {
- f, err := os.OpenFile(*flagBench, os.O_WRONLY|os.O_CREATE|os.O_EXCL, osutil.DefaultFilePerm)
- if err != nil {
- log.Fatalf("failed to open bench file: %v", err)
- }
- go func() {
- for {
- time.Sleep(time.Minute)
- vals := mgr.stats.all()
- mgr.mu.Lock()
- if mgr.firstConnect.IsZero() {
- mgr.mu.Unlock()
- continue
- }
- mgr.minimizeCorpus()
- vals["corpus"] = uint64(len(mgr.corpus))
- vals["uptime"] = uint64(time.Since(mgr.firstConnect)) / 1e9
- vals["fuzzing"] = uint64(mgr.fuzzingTime) / 1e9
- mgr.mu.Unlock()
-
- data, err := json.MarshalIndent(vals, "", " ")
- if err != nil {
- log.Fatalf("failed to serialize bench data")
- }
- if _, err := f.Write(append(data, '\n')); err != nil {
- log.Fatalf("failed to write bench data")
- }
- }
- }()
+ mgr.initBench()
}
if mgr.dash != nil {
@@ -287,6 +270,37 @@ func RunManager(cfg *mgrconfig.Config) {
mgr.vmLoop()
}
+func (mgr *Manager) initBench() {
+ f, err := os.OpenFile(*flagBench, os.O_WRONLY|os.O_CREATE|os.O_EXCL, osutil.DefaultFilePerm)
+ if err != nil {
+ log.Fatalf("failed to open bench file: %v", err)
+ }
+ go func() {
+ for {
+ time.Sleep(time.Minute)
+ vals := mgr.stats.all()
+ mgr.mu.Lock()
+ if mgr.firstConnect.IsZero() {
+ mgr.mu.Unlock()
+ continue
+ }
+ mgr.minimizeCorpus()
+ vals["corpus"] = uint64(len(mgr.corpus))
+ vals["uptime"] = uint64(time.Since(mgr.firstConnect)) / 1e9
+ vals["fuzzing"] = uint64(mgr.fuzzingTime) / 1e9
+ mgr.mu.Unlock()
+
+ data, err := json.MarshalIndent(vals, "", " ")
+ if err != nil {
+ log.Fatalf("failed to serialize bench data")
+ }
+ if _, err := f.Write(append(data, '\n')); err != nil {
+ log.Fatalf("failed to write bench data")
+ }
+ }
+ }()
+}
+
type RunResult struct {
idx int
crash *Crash