From 0b95b8ec49528f9c878dc6c27f323ff5497ab8ee Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Fri, 6 Jul 2018 20:18:05 +0200 Subject: pkg/host: disable for akaros akaros can't have own host version because fuzzer does not run on akaros, so just disable it all. --- pkg/host/host.go | 17 +++++++++++++++-- pkg/host/host_test.go | 6 +++++- 2 files changed, 20 insertions(+), 3 deletions(-) (limited to 'pkg/host') diff --git a/pkg/host/host.go b/pkg/host/host.go index 2c300189e..4bde8ba02 100644 --- a/pkg/host/host.go +++ b/pkg/host/host.go @@ -13,6 +13,13 @@ func DetectSupportedSyscalls(target *prog.Target, sandbox string) ( map[*prog.Syscall]bool, map[*prog.Syscall]string, error) { supported := make(map[*prog.Syscall]bool) unsupported := make(map[*prog.Syscall]string) + // Akaros does not have own host and parasitizes on some other OS. + if target.OS == "akaros" { + for _, c := range target.Syscalls { + supported[c] = true + } + return supported, unsupported, nil + } for _, c := range target.Syscalls { ok, reason := isSupported(c, sandbox) if ok { @@ -57,7 +64,7 @@ func unconditionallyEnabled() string { return "" } // Check detects features supported on the host. // Empty string for a feature means the feature is supported, // otherwise the string contains the reason why the feature is not supported. -func Check() (*Features, error) { +func Check(target *prog.Target) (*Features, error) { const unsupported = "support is not implemented in syzkaller" res := &Features{ FeatureCoverage: {Name: "code coverage", Reason: unsupported}, @@ -68,6 +75,9 @@ func Check() (*Features, error) { FeatureLeakChecking: {Name: "leak checking", Reason: unsupported}, FeatureNetworkInjection: {Name: "net packed injection", Reason: unsupported}, } + if target.OS == "akaros" { + return res, nil + } for n, check := range checkFeature { if check == nil { continue @@ -84,7 +94,10 @@ func Check() (*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(features *Features) (func(), error) { +func Setup(target *prog.Target, features *Features) (func(), error) { + if target.OS == "akaros" { + return nil, nil + } var callback func() for n, setup := range setupFeature { if setup == nil || !features[n].Enabled { diff --git a/pkg/host/host_test.go b/pkg/host/host_test.go index 19507517f..c8190dac5 100644 --- a/pkg/host/host_test.go +++ b/pkg/host/host_test.go @@ -48,7 +48,11 @@ func TestDetectSupportedSyscalls(t *testing.T) { func TestCheck(t *testing.T) { t.Parallel() - features, err := Check() + target, err := prog.GetTarget(runtime.GOOS, runtime.GOARCH) + if err != nil { + t.Fatal(err) + } + features, err := Check(target) if err != nil { t.Fatal(err) } -- cgit mrf-deployment