diff options
| author | Dmitry Vyukov <dvyukov@google.com> | 2020-11-25 09:17:50 +0100 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2020-12-28 14:22:41 +0100 |
| commit | cbd0445ec3b0b184db66966d8a47e6b37d13692e (patch) | |
| tree | 14ed47723c325ef1b388e4e732a70c0fed4fa101 /pkg/mgrconfig | |
| parent | 2242f77fdc5a6c50bd8fa1021d2abc8b83e09e8d (diff) | |
all: make timeouts configurable
Add sys/targets.Timeouts struct that parametrizes timeouts throughout the system.
The struct allows to control syscall/program/no output timeouts for OS/arch/VM/etc.
See comment on the struct for more details.
Diffstat (limited to 'pkg/mgrconfig')
| -rw-r--r-- | pkg/mgrconfig/load.go | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/pkg/mgrconfig/load.go b/pkg/mgrconfig/load.go index a11de44be..9814987a7 100644 --- a/pkg/mgrconfig/load.go +++ b/pkg/mgrconfig/load.go @@ -9,6 +9,7 @@ import ( "os" "path/filepath" "regexp" + "runtime" "strings" "github.com/google/syzkaller/pkg/config" @@ -34,6 +35,7 @@ type Derived struct { ExecutorBin string Syscalls []int + Timeouts targets.Timeouts } func LoadData(data []byte) (*Config, error) { @@ -171,9 +173,27 @@ func Complete(cfg *Config) error { if err != nil { return err } + cfg.initTimeouts() return nil } +func (cfg *Config) initTimeouts() { + slowdown := 1 + switch { + case cfg.Type == "qemu" && runtime.GOARCH != cfg.SysTarget.Arch && runtime.GOARCH != cfg.SysTarget.VMArch: + // Assuming qemu emulation. + // Quick tests of mmap syscall on arm64 show ~9x slowdown. + slowdown = 10 + case cfg.Type == "gvisor" && cfg.Cover && strings.Contains(cfg.Name, "-race"): + // Go coverage+race has insane slowdown of ~350x. We can't afford such large value, + // but a smaller value should be enough to finish at least some syscalls. + // Note: the name check is a hack. + slowdown = 10 + } + // Note: we could also consider heavy debug tools (KASAN/KMSAN/KCSAN/KMEMLEAK) if necessary. + cfg.Timeouts = cfg.SysTarget.Timeouts(slowdown) +} + func checkNonEmpty(fields ...string) error { for i := 0; i < len(fields); i += 2 { if fields[i] == "" { |
