diff options
| author | Dmitry Vyukov <dvyukov@google.com> | 2020-12-02 17:24:59 +0100 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2020-12-03 10:01:52 +0100 |
| commit | 15ab7140c0419b3ca8c88e153d9876b3c8aae0eb (patch) | |
| tree | 6011ed8e432d53f2c9cb06368f57391254702b58 /pkg | |
| parent | 8c9190ef9ef69993519136740a4e67c74f45fdb3 (diff) | |
syz-hub: support input domains
Hub input domain identifier (optional).
The domain is used to avoid duplicate work (input minimization, smashing)
across multiple managers testing similar kernels and connected to the same hub.
If two managers are in the same domain, they will not do input minimization after each other.
If additionally they are in the same smashing sub-domain, they will also not do smashing
after each other.
By default (empty domain) all managers testing the same OS are placed into the same domain,
this is a reasonable setting if managers test roughly the same kernel. In this case they
will not do minimization nor smashing after each other.
The setting can be either a single identifier (e.g. "foo") which will affect both minimization
and smashing; or two identifiers separated with '/' (e.g. "foo/bar"), in this case the first
identifier affects minimization and both affect smashing.
For example, if managers test different Linux kernel versions with different tools,
a reasonable use of domains on these managers can be:
- "upstream/kasan"
- "upstream/kmsan"
- "upstream/kcsan"
- "5.4/kasan"
- "5.4/kcsan"
- "4.19/kasan"
Fixes #2095
Diffstat (limited to 'pkg')
| -rw-r--r-- | pkg/mgrconfig/config.go | 21 | ||||
| -rw-r--r-- | pkg/mgrconfig/load.go | 5 | ||||
| -rw-r--r-- | pkg/rpctype/rpctype.go | 12 |
3 files changed, 37 insertions, 1 deletions
diff --git a/pkg/mgrconfig/config.go b/pkg/mgrconfig/config.go index 3de0814d5..b03d16d67 100644 --- a/pkg/mgrconfig/config.go +++ b/pkg/mgrconfig/config.go @@ -54,6 +54,27 @@ type Config struct { HubClient string `json:"hub_client,omitempty"` HubAddr string `json:"hub_addr,omitempty"` HubKey string `json:"hub_key,omitempty"` + // Hub input domain identifier (optional). + // The domain is used to avoid duplicate work (input minimization, smashing) + // across multiple managers testing similar kernels and connected to the same hub. + // If two managers are in the same domain, they will not do input minimization after each other. + // If additionally they are in the same smashing sub-domain, they will also not do smashing + // after each other. + // By default (empty domain) all managers testing the same OS are placed into the same domain, + // this is a reasonable setting if managers test roughly the same kernel. In this case they + // will not do minimization nor smashing after each other. + // The setting can be either a single identifier (e.g. "foo") which will affect both minimization + // and smashing; or two identifiers separated with '/' (e.g. "foo/bar"), in this case the first + // identifier affects minimization and both affect smashing. + // For example, if managers test different Linux kernel versions with different tools, + // a reasonable use of domains on these managers can be: + // - "upstream/kasan" + // - "upstream/kmsan" + // - "upstream/kcsan" + // - "5.4/kasan" + // - "5.4/kcsan" + // - "4.19/kasan" + HubDomain string `json:"hub_domain,omitempty"` // List of email addresses to receive notifications when bugs are encountered for the first time (optional). // Mailx is the only supported mailer. Please set it up prior to using this function. diff --git a/pkg/mgrconfig/load.go b/pkg/mgrconfig/load.go index 14b98eb01..a11de44be 100644 --- a/pkg/mgrconfig/load.go +++ b/pkg/mgrconfig/load.go @@ -8,6 +8,7 @@ import ( "io/ioutil" "os" "path/filepath" + "regexp" "strings" "github.com/google/syzkaller/pkg/config" @@ -152,6 +153,10 @@ func Complete(cfg *Config) error { return err } } + if cfg.HubDomain != "" && + !regexp.MustCompile(`^[a-zA-Z0-9-_.]{2,50}(/[a-zA-Z0-9-_.]{2,50})?$`).MatchString(cfg.HubDomain) { + return fmt.Errorf("bad value for hub_domain") + } if cfg.DashboardClient != "" { if err := checkNonEmpty( cfg.Name, "name", diff --git a/pkg/rpctype/rpctype.go b/pkg/rpctype/rpctype.go index c370b0a0e..5dc85e0e2 100644 --- a/pkg/rpctype/rpctype.go +++ b/pkg/rpctype/rpctype.go @@ -76,6 +76,8 @@ type HubConnectArgs struct { Key string // Manager name, must start with Client. Manager string + // See pkg/mgrconfig.Config.HubDomain. + Domain string // Manager has started with an empty corpus and requests whole hub corpus. Fresh bool // Set of system call names supported by this manager. @@ -100,7 +102,9 @@ type HubSyncArgs struct { } type HubSyncRes struct { - // Set of programs from other managers. + // Set of inputs from other managers. + Inputs []HubInput + // Same as Inputs but for legacy managers that don't understand new format (remove later). Progs [][]byte // Set of repros from other managers. Repros [][]byte @@ -109,6 +113,12 @@ type HubSyncRes struct { More int } +type HubInput struct { + // Domain of the source manager. + Domain string + Prog []byte +} + type RunTestPollReq struct { Name string } |
