aboutsummaryrefslogtreecommitdiffstats
path: root/pkg
diff options
context:
space:
mode:
authorAleksandr Nogikh <nogikh@google.com>2024-01-19 11:21:04 +0100
committerAleksandr Nogikh <nogikh@google.com>2024-01-22 18:19:43 +0000
commit1c0ecc51adc9f44c7bd3f45c2aa1b62718d1236e (patch)
tree29226f3f3dfbf1f3c072c49fb3d67fa794331101 /pkg
parentef01311589507ea3919e3804f43781eeb0ca9777 (diff)
syz-fuzzer: take executor restart out of gate tickets
On a loaded VM, the restar may easily take 10-20 second, during which all other procs have to wait due to gate ticketing. Restart executor processes outside of synchronization primitives.
Diffstat (limited to 'pkg')
-rw-r--r--pkg/ipc/ipc.go33
1 files changed, 21 insertions, 12 deletions
diff --git a/pkg/ipc/ipc.go b/pkg/ipc/ipc.go
index 0f7746e73..c96134faf 100644
--- a/pkg/ipc/ipc.go
+++ b/pkg/ipc/ipc.go
@@ -270,19 +270,11 @@ func (env *Env) Exec(opts *ExecOpts, p *prog.Prog) (output []byte, info *ProgInf
}
atomic.AddUint64(&env.StatExecs, 1)
- if env.cmd == nil {
- if p.Target.OS != targets.TestOS && targets.Get(p.Target.OS, p.Target.Arch).HostFuzzer {
- // The executor is actually ssh,
- // starting them too frequently leads to timeouts.
- <-rateLimit.C
- }
- tmpDirPath := "./"
- atomic.AddUint64(&env.StatRestarts, 1)
- env.cmd, err0 = makeCommand(env.pid, env.bin, env.config, env.inFile, env.outFile, env.out, tmpDirPath)
- if err0 != nil {
- return
- }
+ err0 = env.RestartIfNeeded(p.Target)
+ if err0 != nil {
+ return
}
+
output, hanged, err0 = env.cmd.exec(opts, progData)
if err0 != nil {
env.cmd.close()
@@ -301,6 +293,23 @@ func (env *Env) Exec(opts *ExecOpts, p *prog.Prog) (output []byte, info *ProgInf
return
}
+// This smethod brings up an executor process if it was stopped.
+func (env *Env) RestartIfNeeded(target *prog.Target) error {
+ if env.cmd == nil {
+ if target.OS != targets.TestOS && targets.Get(target.OS, target.Arch).HostFuzzer {
+ // The executor is actually ssh,
+ // starting them too frequently leads to timeouts.
+ <-rateLimit.C
+ }
+ tmpDirPath := "./"
+ atomic.AddUint64(&env.StatRestarts, 1)
+ var err error
+ env.cmd, err = makeCommand(env.pid, env.bin, env.config, env.inFile, env.outFile, env.out, tmpDirPath)
+ return err
+ }
+ return nil
+}
+
// addFallbackSignal computes simple fallback signal in cases we don't have real coverage signal.
// We use syscall number or-ed with returned errno value as signal.
// At least this gives us all combinations of syscall+errno.