From 15ab7140c0419b3ca8c88e153d9876b3c8aae0eb Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Wed, 2 Dec 2020 17:24:59 +0100 Subject: 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 --- pkg/mgrconfig/config.go | 21 +++++++++++++++++++++ pkg/mgrconfig/load.go | 5 +++++ 2 files changed, 26 insertions(+) (limited to 'pkg/mgrconfig') 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", -- cgit mrf-deployment