aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/ipc
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2018-07-05 13:03:38 +0200
committerDmitry Vyukov <dvyukov@google.com>2018-07-05 13:03:38 +0200
commit63226a58445e4648fe5abc2d1d75600228557c7c (patch)
tree3ff93303d1ae02dc65e0add972f1f6b4e23038ce /pkg/ipc
parent1c9d3058949b33a8714b7f8034eee566cfc526bd (diff)
pkg/ipc: add rate limiting for akaros
Diffstat (limited to 'pkg/ipc')
-rw-r--r--pkg/ipc/ipc.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/pkg/ipc/ipc.go b/pkg/ipc/ipc.go
index 4ad712999..75c8b3095 100644
--- a/pkg/ipc/ipc.go
+++ b/pkg/ipc/ipc.go
@@ -99,6 +99,10 @@ type Config struct {
// BufferSize is the size of the internal buffer for executor output.
BufferSize uint64
+
+ // RateLimit flag tells to start one executor at a time.
+ // Currently used only for akaros where executor is actually ssh.
+ RateLimit bool
}
func DefaultConfig(target *prog.Target) (*Config, *ExecOpts, error) {
@@ -107,6 +111,7 @@ func DefaultConfig(target *prog.Target) (*Config, *ExecOpts, error) {
Timeout: *flagTimeout,
AbortSignal: *flagAbortSignal,
BufferSize: *flagBufferSize,
+ RateLimit: target.OS == "akaros",
}
if *flagSignal {
c.Flags |= FlagSignal
@@ -532,8 +537,13 @@ type callReply struct {
// signal/cover/comps follow
}
+var rateLimit = time.NewTicker(3 * time.Second)
+
func makeCommand(pid int, bin []string, config *Config, inFile *os.File, outFile *os.File,
outmem []byte) (*command, error) {
+ if config.RateLimit {
+ <-rateLimit.C
+ }
dir, err := ioutil.TempDir("./", "syzkaller-testdir")
if err != nil {
return nil, fmt.Errorf("failed to create temp dir: %v", err)