aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2018-07-29 10:07:30 +0200
committerDmitry Vyukov <dvyukov@google.com>2018-07-29 10:07:30 +0200
commit419000cc0a031e3cf5cf3a96f8f6dee5e5f7fdf5 (patch)
tree33fe37ab094dab21b42c7176a5d55e785de4cd52
parentebf656d79bf25a135f1b295b5fd582004e1ac7b3 (diff)
vm: fix "kill fuzzer on first kernel bug"
The problem with that commit is that for GCE implementation we immidiately kill console connection too when receive diagnose signal. This leads to truncated output.
-rw-r--r--vm/gce/gce.go49
-rw-r--r--vm/qemu/qemu.go2
2 files changed, 23 insertions, 28 deletions
diff --git a/vm/gce/gce.go b/vm/gce/gce.go
index 1bdf83444..cc2cd62cd 100644
--- a/vm/gce/gce.go
+++ b/vm/gce/gce.go
@@ -49,17 +49,16 @@ type Pool struct {
}
type instance struct {
- env *vmimpl.Env
- cfg *Config
- GCE *gce.Context
- debug bool
- name string
- ip string
- gceKey string // per-instance private ssh key associated with the instance
- sshKey string // ssh key
- sshUser string
- closed chan bool
- diagnose chan bool
+ env *vmimpl.Env
+ cfg *Config
+ GCE *gce.Context
+ debug bool
+ name string
+ ip string
+ gceKey string // per-instance private ssh key associated with the instance
+ sshKey string // ssh key
+ sshUser string
+ closed chan bool
}
func ctor(env *vmimpl.Env) (vmimpl.Pool, error) {
@@ -172,17 +171,16 @@ func (pool *Pool) Create(workdir string, index int) (vmimpl.Instance, error) {
}
ok = true
inst := &instance{
- env: pool.env,
- cfg: pool.cfg,
- debug: pool.env.Debug,
- GCE: pool.GCE,
- name: name,
- ip: ip,
- gceKey: gceKey,
- sshKey: sshKey,
- sshUser: sshUser,
- closed: make(chan bool),
- diagnose: make(chan bool, 1),
+ env: pool.env,
+ cfg: pool.cfg,
+ debug: pool.env.Debug,
+ GCE: pool.GCE,
+ name: name,
+ ip: ip,
+ gceKey: gceKey,
+ sshKey: sshKey,
+ sshUser: sshUser,
+ closed: make(chan bool),
}
return inst, nil
}
@@ -316,6 +314,7 @@ func (inst *instance) Run(timeout time.Duration, stop <-chan bool, command strin
}
go func() {
+ retry:
select {
case <-time.After(timeout):
signal(vmimpl.ErrTimeout)
@@ -323,8 +322,6 @@ func (inst *instance) Run(timeout time.Duration, stop <-chan bool, command strin
signal(vmimpl.ErrTimeout)
case <-inst.closed:
signal(fmt.Errorf("instance closed"))
- case <-inst.diagnose:
- ssh.Process.Kill()
case err := <-merger.Err:
con.Process.Kill()
ssh.Process.Kill()
@@ -360,10 +357,6 @@ func (inst *instance) Run(timeout time.Duration, stop <-chan bool, command strin
}
func (inst *instance) Diagnose() bool {
- select {
- case inst.diagnose <- true:
- default:
- }
return false
}
diff --git a/vm/qemu/qemu.go b/vm/qemu/qemu.go
index 6ba33c0ad..501a6b02b 100644
--- a/vm/qemu/qemu.go
+++ b/vm/qemu/qemu.go
@@ -476,6 +476,7 @@ func (inst *instance) Run(timeout time.Duration, stop <-chan bool, command strin
}
go func() {
+ retry:
select {
case <-time.After(timeout):
signal(vmimpl.ErrTimeout)
@@ -483,6 +484,7 @@ func (inst *instance) Run(timeout time.Duration, stop <-chan bool, command strin
signal(vmimpl.ErrTimeout)
case <-inst.diagnose:
cmd.Process.Kill()
+ goto retry
case err := <-inst.merger.Err:
cmd.Process.Kill()
if cmdErr := cmd.Wait(); cmdErr == nil {