aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2024-07-23 14:21:59 +0200
committerDmitry Vyukov <dvyukov@google.com>2024-07-23 13:30:23 +0000
commit790cc189ae51a4af370f9d83141cb58cdbaca6a7 (patch)
tree564db7896df67474c4af5a57a4a2daf1eaaf3f8e
parent53c2e8ad91fd5f64989a4e6a923926990130b5cd (diff)
vm: check preemption string only for gce instances
Fixes #5028
-rw-r--r--vm/gce/gce.go5
-rw-r--r--vm/vm.go6
-rw-r--r--vm/vm_test.go3
-rw-r--r--vm/vmimpl/vmimpl.go4
4 files changed, 14 insertions, 4 deletions
diff --git a/vm/gce/gce.go b/vm/gce/gce.go
index e65ee836b..19fd1eecd 100644
--- a/vm/gce/gce.go
+++ b/vm/gce/gce.go
@@ -36,8 +36,9 @@ import (
func init() {
vmimpl.Register("gce", vmimpl.Type{
- Ctor: ctor,
- Overcommit: true,
+ Ctor: ctor,
+ Overcommit: true,
+ Preemptible: true,
})
}
diff --git a/vm/vm.go b/vm/vm.go
index cc7c656cd..ca22f2be1 100644
--- a/vm/vm.go
+++ b/vm/vm.go
@@ -43,6 +43,7 @@ import (
type Pool struct {
impl vmimpl.Pool
+ typ vmimpl.Type
workdir string
template string
timeouts targets.Timeouts
@@ -128,6 +129,7 @@ func Create(cfg *mgrconfig.Config, debug bool) (*Pool, error) {
}
return &Pool{
impl: impl,
+ typ: typ,
workdir: env.Workdir,
template: cfg.WorkdirTemplate,
timeouts: cfg.Timeouts,
@@ -420,7 +422,9 @@ func (mon *monitor) extractError(defaultError string) *report.Report {
if defaultError != noOutputCrash || diagWait {
mon.waitForOutput()
}
- if bytes.Contains(mon.output, []byte(executorPreemptedStr)) {
+ // Check the executorPreemptedStr only for preemptible instances since executor can print
+ // the string spuriously in some cases (gets SIGTERM from test program somehow).
+ if mon.inst.pool.typ.Preemptible && bytes.Contains(mon.output, []byte(executorPreemptedStr)) {
return nil
}
if defaultError == "" && mon.reporter.ContainsCrash(mon.output[mon.matchPos:]) {
diff --git a/vm/vm_test.go b/vm/vm_test.go
index eb642830f..bede53fb7 100644
--- a/vm/vm_test.go
+++ b/vm/vm_test.go
@@ -82,7 +82,8 @@ func init() {
return &testPool{}, nil
}
vmimpl.Register("test", vmimpl.Type{
- Ctor: ctor,
+ Ctor: ctor,
+ Preemptible: true,
})
}
diff --git a/vm/vmimpl/vmimpl.go b/vm/vmimpl/vmimpl.go
index ac38a6634..564c3e66e 100644
--- a/vm/vmimpl/vmimpl.go
+++ b/vm/vmimpl/vmimpl.go
@@ -133,6 +133,10 @@ type Type struct {
// It's possible to create out-of-thin-air instances of this type.
// Out-of-thin-air instances are used by syz-ci for image testing, patch testing, bisection, etc.
Overcommit bool
+ // Instances of this type can be preempted and lost connection as the result.
+ // For preempted instances executor prints "SYZ-EXECUTOR: PREEMPTED" and then
+ // the host understands that the lost connection was expected and is not a bug.
+ Preemptible bool
}
type ctorFunc func(env *Env) (Pool, error)