aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/repro
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2024-05-21 21:13:39 +0200
committerDmitry Vyukov <dvyukov@google.com>2024-05-27 07:21:25 +0000
commit282e82b3010e362d6160ad2b137c13c74fc3fd12 (patch)
treebfc205a0ea4b728deb98b865fa529d8e61c4fbd9 /pkg/repro
parenta10a183e260f0ea1a0c37e84ca5c60f28c13e3fd (diff)
pkg/instance: use execprog to do basic instance testing
When we accept new kernels for fuzzing we need more extensive testing, but syz-ci switched to using syz-manager for this purpose. Now instance testing is used only for bisection and patch testing, which does not need such extensive image testing (it may even harm). So just run a simple program as a testing. It also uses the same features as the target reproducer, so e.g. if the reproducer does not use wifi, we won't test it, which reduces changes of unrelated kernel bugs.
Diffstat (limited to 'pkg/repro')
-rw-r--r--pkg/repro/repro.go5
-rw-r--r--pkg/repro/repro_test.go5
-rw-r--r--pkg/repro/strace.go3
3 files changed, 8 insertions, 5 deletions
diff --git a/pkg/repro/repro.go b/pkg/repro/repro.go
index f8148a463..68d67f11b 100644
--- a/pkg/repro/repro.go
+++ b/pkg/repro/repro.go
@@ -69,7 +69,8 @@ type context struct {
type execInterface interface {
Close()
RunCProg(p *prog.Prog, duration time.Duration, opts csource.Options) (*instance.RunResult, error)
- RunSyzProg(syzProg []byte, duration time.Duration, opts csource.Options) (*instance.RunResult, error)
+ RunSyzProg(syzProg []byte, duration time.Duration, opts csource.Options, exitCondition vm.ExitCondition) (
+ *instance.RunResult, error)
}
var ErrNoPrograms = errors.New("crash log does not contain any programs")
@@ -604,7 +605,7 @@ func (ctx *context) testProgs(entries []*prog.LogEntry, duration time.Duration,
ctx.reproLogf(2, "testing program (duration=%v, %+v): %s", duration, opts, program)
ctx.reproLogf(3, "detailed listing:\n%s", pstr)
return ctx.testWithInstance(func(exec execInterface) (*instance.RunResult, error) {
- return exec.RunSyzProg(pstr, duration, opts)
+ return exec.RunSyzProg(pstr, duration, opts, instance.SyzExitConditions)
})
}
diff --git a/pkg/repro/repro_test.go b/pkg/repro/repro_test.go
index c61484754..3ceacae5f 100644
--- a/pkg/repro/repro_test.go
+++ b/pkg/repro/repro_test.go
@@ -20,6 +20,7 @@ import (
"github.com/google/syzkaller/pkg/testutil"
"github.com/google/syzkaller/prog"
"github.com/google/syzkaller/sys/targets"
+ "github.com/google/syzkaller/vm"
)
func initTest(t *testing.T) (*rand.Rand, int) {
@@ -133,11 +134,11 @@ func (tei *testExecInterface) Close() {}
func (tei *testExecInterface) RunCProg(p *prog.Prog, duration time.Duration,
opts csource.Options) (*instance.RunResult, error) {
- return tei.RunSyzProg(p.Serialize(), duration, opts)
+ return tei.RunSyzProg(p.Serialize(), duration, opts, instance.SyzExitConditions)
}
func (tei *testExecInterface) RunSyzProg(syzProg []byte, duration time.Duration,
- opts csource.Options) (*instance.RunResult, error) {
+ opts csource.Options, exitCondition vm.ExitCondition) (*instance.RunResult, error) {
return tei.run(syzProg)
}
diff --git a/pkg/repro/strace.go b/pkg/repro/strace.go
index ef4f7c934..a34760c41 100644
--- a/pkg/repro/strace.go
+++ b/pkg/repro/strace.go
@@ -44,7 +44,8 @@ func RunStrace(result *Result, cfg *mgrconfig.Config, reporter *report.Reporter,
runRes, err = inst.RunCProg(result.Prog, result.Duration, result.Opts)
} else {
log.Logf(1, "running syz repro under strace")
- runRes, err = inst.RunSyzProg(result.Prog.Serialize(), result.Duration, result.Opts)
+ runRes, err = inst.RunSyzProg(result.Prog.Serialize(), result.Duration,
+ result.Opts, instance.SyzExitConditions)
}
if err != nil {
return straceFailed(fmt.Errorf("failed to generate strace log: %w", err))