diff options
| author | Dmitry Vyukov <dvyukov@google.com> | 2018-07-06 20:18:05 +0200 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2018-07-06 20:18:05 +0200 |
| commit | 0b95b8ec49528f9c878dc6c27f323ff5497ab8ee (patch) | |
| tree | 2f7b3e45e83aacdf4df7be3416f0bbaa8becad43 | |
| parent | 00c977447d726cb58f754bb7995659347c9aa8b1 (diff) | |
pkg/host: disable for akaros
akaros can't have own host version
because fuzzer does not run on akaros,
so just disable it all.
| -rw-r--r-- | pkg/host/host.go | 17 | ||||
| -rw-r--r-- | pkg/host/host_test.go | 6 | ||||
| -rw-r--r-- | syz-fuzzer/fuzzer.go | 2 | ||||
| -rw-r--r-- | syz-fuzzer/testing.go | 2 | ||||
| -rw-r--r-- | tools/syz-execprog/execprog.go | 4 | ||||
| -rw-r--r-- | tools/syz-stress/stress.go | 4 |
6 files changed, 26 insertions, 9 deletions
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) } diff --git a/syz-fuzzer/fuzzer.go b/syz-fuzzer/fuzzer.go index b644ebb93..f2b6b215e 100644 --- a/syz-fuzzer/fuzzer.go +++ b/syz-fuzzer/fuzzer.go @@ -196,7 +196,7 @@ func main() { for _, feat := range r.CheckResult.Features { log.Logf(0, "%v: %v", feat.Name, feat.Reason) } - periodicCallback, err := host.Setup(r.CheckResult.Features) + periodicCallback, err := host.Setup(target, r.CheckResult.Features) if err != nil { log.Fatalf("BUG: %v", err) } diff --git a/syz-fuzzer/testing.go b/syz-fuzzer/testing.go index 00859366a..5310df044 100644 --- a/syz-fuzzer/testing.go +++ b/syz-fuzzer/testing.go @@ -60,7 +60,7 @@ func checkMachine(args *checkArgs) (*rpctype.CheckArgs, error) { if err := checkRevisions(args); err != nil { return nil, err } - features, err := host.Check() + features, err := host.Check(args.target) if err != nil { return nil, err } diff --git a/tools/syz-execprog/execprog.go b/tools/syz-execprog/execprog.go index 9e591a8ac..244c4b731 100644 --- a/tools/syz-execprog/execprog.go +++ b/tools/syz-execprog/execprog.go @@ -54,11 +54,11 @@ func main() { return } - features, err := host.Check() + features, err := host.Check(target) if err != nil { log.Fatalf("%v", err) } - if _, err = host.Setup(features); err != nil { + if _, err = host.Setup(target, features); err != nil { log.Fatalf("%v", err) } config, execOpts := createConfig(target, entries, features) diff --git a/tools/syz-stress/stress.go b/tools/syz-stress/stress.go index 03866a49b..cabc87f95 100644 --- a/tools/syz-stress/stress.go +++ b/tools/syz-stress/stress.go @@ -48,11 +48,11 @@ func main() { log.Fatalf("nothing to mutate (-generate=false and no corpus)") } - features, err := host.Check() + features, err := host.Check(target) if err != nil { log.Fatalf("%v", err) } - if _, err = host.Setup(features); err != nil { + if _, err = host.Setup(target, features); err != nil { log.Fatalf("%v", err) } |
