aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/host
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2017-10-16 12:18:50 +0200
committerDmitry Vyukov <dvyukov@google.com>2017-10-16 14:21:54 +0200
commit85b1f93f8dbbc767c564e494a6353aa3517d5d49 (patch)
tree702d2318a2ddcf1a576294a6a4981c58abcfcf61 /pkg/host
parentf78642861b4dbe396a67d5e2a750e22f83f3edd5 (diff)
executor, pkg/ipc: unify ipc protocol between linux and other OSes
We currently use more complex and functional protocol on linux, and a simple ad-hoc protocol on other OSes. This leads to code duplication in both ipc and executor. Linux supports coverage, shared memory communication and fork server, which would also be useful for most other OSes. Unify communication protocol and parametrize it by (1) use of shmem or only pipes, (2) use of fork server. This reduces duplication in ipc and executor and will allow to support the useful features for other OSes easily. Finally, this fixes akaros support as it currently uses syz-stress running on host (linux) and executor running on akaros.
Diffstat (limited to 'pkg/host')
-rw-r--r--pkg/host/host_akaros.go4
-rw-r--r--pkg/host/host_freebsd.go4
-rw-r--r--pkg/host/host_fuchsia.go4
-rw-r--r--pkg/host/host_linux.go11
-rw-r--r--pkg/host/host_windows.go4
5 files changed, 27 insertions, 0 deletions
diff --git a/pkg/host/host_akaros.go b/pkg/host/host_akaros.go
index 4e3065d91..6c3fbb6d3 100644
--- a/pkg/host/host_akaros.go
+++ b/pkg/host/host_akaros.go
@@ -17,3 +17,7 @@ func DetectSupportedSyscalls(target *prog.Target) (map[*prog.Syscall]bool, error
}
return supported, nil
}
+
+func EnableFaultInjection() error {
+ return nil
+}
diff --git a/pkg/host/host_freebsd.go b/pkg/host/host_freebsd.go
index b931b5c6c..d2745e376 100644
--- a/pkg/host/host_freebsd.go
+++ b/pkg/host/host_freebsd.go
@@ -15,3 +15,7 @@ func DetectSupportedSyscalls(target *prog.Target) (map[*prog.Syscall]bool, error
}
return supported, nil
}
+
+func EnableFaultInjection() error {
+ return nil
+}
diff --git a/pkg/host/host_fuchsia.go b/pkg/host/host_fuchsia.go
index 7f4abc47b..37cf8b847 100644
--- a/pkg/host/host_fuchsia.go
+++ b/pkg/host/host_fuchsia.go
@@ -17,3 +17,7 @@ func DetectSupportedSyscalls(target *prog.Target) (map[*prog.Syscall]bool, error
}
return supported, nil
}
+
+func EnableFaultInjection() error {
+ return nil
+}
diff --git a/pkg/host/host_linux.go b/pkg/host/host_linux.go
index ef301e2dc..6da153f2d 100644
--- a/pkg/host/host_linux.go
+++ b/pkg/host/host_linux.go
@@ -5,6 +5,7 @@ package host
import (
"bytes"
+ "fmt"
"io/ioutil"
"runtime"
"strconv"
@@ -159,3 +160,13 @@ func extractStringConst(typ prog.Type) (string, bool) {
v = v[:len(v)-1] // string terminating \x00
return v, true
}
+
+func EnableFaultInjection() error {
+ if err := osutil.WriteFile("/sys/kernel/debug/failslab/ignore-gfp-wait", []byte("N")); err != nil {
+ return fmt.Errorf("failed to write /sys/kernel/debug/failslab/ignore-gfp-wait: %v", err)
+ }
+ if err := osutil.WriteFile("/sys/kernel/debug/fail_futex/ignore-private", []byte("N")); err != nil {
+ return fmt.Errorf("failed to write /sys/kernel/debug/fail_futex/ignore-private: %v", err)
+ }
+ return nil
+}
diff --git a/pkg/host/host_windows.go b/pkg/host/host_windows.go
index b931b5c6c..d2745e376 100644
--- a/pkg/host/host_windows.go
+++ b/pkg/host/host_windows.go
@@ -15,3 +15,7 @@ func DetectSupportedSyscalls(target *prog.Target) (map[*prog.Syscall]bool, error
}
return supported, nil
}
+
+func EnableFaultInjection() error {
+ return nil
+}