aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/host
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2018-07-06 20:18:05 +0200
committerDmitry Vyukov <dvyukov@google.com>2018-07-06 20:18:05 +0200
commit0b95b8ec49528f9c878dc6c27f323ff5497ab8ee (patch)
tree2f7b3e45e83aacdf4df7be3416f0bbaa8becad43 /pkg/host
parent00c977447d726cb58f754bb7995659347c9aa8b1 (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.
Diffstat (limited to 'pkg/host')
-rw-r--r--pkg/host/host.go17
-rw-r--r--pkg/host/host_test.go6
2 files changed, 20 insertions, 3 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)
}