From b5c36524a29838b0ec9345fc1a07daeebf50c833 Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Thu, 14 Nov 2019 16:59:09 +0100 Subject: sys/targets: add HostFuzzer flag Move HostFuzzer from vm/qemu. It's needed in a number of other packages and strictly saying is not specific to qemu (it just happened that both fuchsia and akaros only support qemu). --- pkg/host/host.go | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'pkg/host') diff --git a/pkg/host/host.go b/pkg/host/host.go index f18233085..216b9158d 100644 --- a/pkg/host/host.go +++ b/pkg/host/host.go @@ -10,6 +10,7 @@ import ( "github.com/google/syzkaller/pkg/log" "github.com/google/syzkaller/pkg/osutil" "github.com/google/syzkaller/prog" + "github.com/google/syzkaller/sys/targets" ) // DetectSupportedSyscalls returns list on supported and unsupported syscalls on the host. @@ -19,9 +20,8 @@ func DetectSupportedSyscalls(target *prog.Target, sandbox string) ( log.Logf(1, "detecting supported syscalls") supported := make(map[*prog.Syscall]bool) unsupported := make(map[*prog.Syscall]string) - // Akaros does not have own host and parasitizes on some other OS. - switch target.OS { - case "akaros", "fuchsia", "test": + // These do not have own host and parasitize on some other OS. + if targets.Get(target.OS, target.Arch).HostFuzzer { for _, c := range target.Syscalls { supported[c] = true } @@ -111,8 +111,7 @@ func Check(target *prog.Target) (*Features, error) { FeatureKCSAN: {Name: "concurrency sanitizer", Reason: unsupported}, FeatureDevlinkPCI: {Name: "devlink PCI setup", Reason: unsupported}, } - switch target.OS { - case "akaros", "fuchsia", "test": + if targets.Get(target.OS, target.Arch).HostFuzzer { return res, nil } for n, check := range checkFeature { @@ -132,8 +131,7 @@ func Check(target *prog.Target) (*Features, error) { // Setup enables and does any one-time setup for the requested features on the host. // Note: this can be called multiple times and must be idempotent. func Setup(target *prog.Target, features *Features, featureFlags csource.Features, executor string) error { - switch target.OS { - case "akaros", "fuchsia": + if targets.Get(target.OS, target.Arch).HostFuzzer { return nil } args := []string{"setup"} -- cgit mrf-deployment