From 587cec15e23ecafc9b00f8ae775a98d0e4803997 Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Fri, 15 Nov 2019 11:42:18 +0100 Subject: [PATCH] pkg/host: add Features.Supported To reduce diff in future changes. Currently no-op. --- pkg/host/features.go | 4 ++++ pkg/host/host_test.go | 2 +- syz-fuzzer/fuzzer.go | 2 +- syz-manager/manager.go | 2 +- tools/syz-execprog/execprog.go | 2 +- tools/syz-runtest/runtest.go | 2 +- 6 files changed, 9 insertions(+), 5 deletions(-) diff --git a/pkg/host/features.go b/pkg/host/features.go index 9c02defb..3bc0127b 100644 --- a/pkg/host/features.go +++ b/pkg/host/features.go @@ -36,6 +36,10 @@ type Feature struct { type Features [numFeatures]Feature +func (features *Features) Supported() *Features { + return features +} + var checkFeature [numFeatures]func() string func unconditionallyEnabled() string { return "" } diff --git a/pkg/host/host_test.go b/pkg/host/host_test.go index c8190dac..dc856592 100644 --- a/pkg/host/host_test.go +++ b/pkg/host/host_test.go @@ -56,7 +56,7 @@ func TestCheck(t *testing.T) { if err != nil { t.Fatal(err) } - for _, feat := range features { + for _, feat := range features.Supported() { t.Logf("%-24v: %v", feat.Name, feat.Reason) } } diff --git a/syz-fuzzer/fuzzer.go b/syz-fuzzer/fuzzer.go index a95480a6..38659aa7 100644 --- a/syz-fuzzer/fuzzer.go +++ b/syz-fuzzer/fuzzer.go @@ -199,7 +199,7 @@ func main() { } } log.Logf(0, "syscalls: %v", len(r.CheckResult.EnabledCalls[sandbox])) - for _, feat := range r.CheckResult.Features { + for _, feat := range r.CheckResult.Features.Supported() { log.Logf(0, "%v: %v", feat.Name, feat.Reason) } if r.CheckResult.Features[host.FeatureExtraCoverage].Enabled { diff --git a/syz-manager/manager.go b/syz-manager/manager.go index a305e744..dc1ce471 100644 --- a/syz-manager/manager.go +++ b/syz-manager/manager.go @@ -943,7 +943,7 @@ func (mgr *Manager) machineChecked(a *rpctype.CheckArgs) { log.Logf(0, "machine check:") log.Logf(0, "%-24v: %v/%v", "syscalls", len(a.EnabledCalls[mgr.cfg.Sandbox]), len(mgr.target.Syscalls)) - for _, feat := range a.Features { + for _, feat := range a.Features.Supported() { log.Logf(0, "%-24v: %v", feat.Name, feat.Reason) } mgr.checkResult = a diff --git a/tools/syz-execprog/execprog.go b/tools/syz-execprog/execprog.go index 5aaf81d2..38412edd 100644 --- a/tools/syz-execprog/execprog.go +++ b/tools/syz-execprog/execprog.go @@ -69,7 +69,7 @@ func main() { log.Fatalf("%v", err) } if *flagOutput { - for _, feat := range features { + for _, feat := range features.Supported() { log.Logf(0, "%-24v: %v", feat.Name, feat.Reason) } } diff --git a/tools/syz-runtest/runtest.go b/tools/syz-runtest/runtest.go index 538646a2..a45ac915 100644 --- a/tools/syz-runtest/runtest.go +++ b/tools/syz-runtest/runtest.go @@ -110,7 +110,7 @@ func main() { } enabledCalls[sandbox] = calls } - for _, feat := range mgr.checkResult.Features { + for _, feat := range mgr.checkResult.Features.Supported() { fmt.Printf("%-24v: %v\n", feat.Name, feat.Reason) } for sandbox, calls := range enabledCalls {