diff options
| author | Dmitry Vyukov <dvyukov@google.com> | 2019-11-14 16:59:09 +0100 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2019-11-16 09:58:54 +0100 |
| commit | b5c36524a29838b0ec9345fc1a07daeebf50c833 (patch) | |
| tree | b25f237098577e50e3c1387454da625b50280478 /pkg/host | |
| parent | cdac920beb540736200639a6254e6dc01422e705 (diff) | |
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).
Diffstat (limited to 'pkg/host')
| -rw-r--r-- | pkg/host/host.go | 12 |
1 files changed, 5 insertions, 7 deletions
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"} |
