aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/fuzzer/fuzzer_test.go
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2024-06-27 12:01:58 +0200
committerDmitry Vyukov <dvyukov@google.com>2024-07-02 15:07:08 +0000
commit07dedd50ee8834dbca4da7667e69e72b7d0565b9 (patch)
tree44925ee15f9fad9ad0641435fd459d25375c811d /pkg/fuzzer/fuzzer_test.go
parent6a2ff1acbd95b320444a729d9d281835be88ec66 (diff)
pkg/fuzzer: remove signal rotation
Signal rotation is intended to make the fuzzer re-discover flaky coverage in non flaky way. However, taking into accout that we get effectively the same effect after each manager restart, and that the fuzzer is overloaded with triage/smash jobs, it does not look to be worth it.
Diffstat (limited to 'pkg/fuzzer/fuzzer_test.go')
-rw-r--r--pkg/fuzzer/fuzzer_test.go60
1 files changed, 0 insertions, 60 deletions
diff --git a/pkg/fuzzer/fuzzer_test.go b/pkg/fuzzer/fuzzer_test.go
index 55ec09666..d8c532e1a 100644
--- a/pkg/fuzzer/fuzzer_test.go
+++ b/pkg/fuzzer/fuzzer_test.go
@@ -22,7 +22,6 @@ import (
"github.com/google/syzkaller/pkg/flatrpc"
"github.com/google/syzkaller/pkg/fuzzer/queue"
"github.com/google/syzkaller/pkg/rpcserver"
- "github.com/google/syzkaller/pkg/signal"
"github.com/google/syzkaller/pkg/testutil"
"github.com/google/syzkaller/pkg/vminfo"
"github.com/google/syzkaller/prog"
@@ -121,65 +120,6 @@ func BenchmarkFuzzer(b *testing.B) {
})
}
-const anyTestProg = `syz_compare(&AUTO="00000000", 0x4, &AUTO=@conditional={0x0, @void, @void}, AUTO)`
-
-func TestRotate(t *testing.T) {
- target, err := prog.GetTarget(targets.TestOS, targets.TestArch64Fuzz)
- if err != nil {
- t.Fatal(err)
- }
-
- ctx, cancel := context.WithCancel(context.Background())
- defer cancel()
-
- corpusObj := corpus.NewCorpus(ctx)
- fuzzer := NewFuzzer(ctx, &Config{
- Debug: true,
- Corpus: corpusObj,
- Coverage: true,
- EnabledCalls: map[*prog.Syscall]bool{
- target.SyscallMap["syz_compare"]: true,
- },
- }, rand.New(testutil.RandSource(t)), target)
-
- fakeSignal := func(size int) signal.Signal {
- var pc []uint64
- for i := 0; i < size; i++ {
- pc = append(pc, uint64(i))
- }
- return signal.FromRaw(pc, 0)
- }
-
- prog, err := target.Deserialize([]byte(anyTestProg), prog.NonStrict)
- assert.NoError(t, err)
- corpusObj.Save(corpus.NewInput{
- Prog: prog,
- Call: 0,
- Signal: fakeSignal(100),
- })
- fuzzer.Cover.AddMaxSignal(fakeSignal(1000))
-
- assert.Equal(t, 1000, len(fuzzer.Cover.maxSignal))
- assert.Equal(t, 100, corpusObj.StatSignal.Val())
-
- // Rotate some of the signal.
- fuzzer.RotateMaxSignal(200)
- assert.Equal(t, 800, len(fuzzer.Cover.maxSignal))
- assert.Equal(t, 100, corpusObj.StatSignal.Val())
-
- plus, minus := fuzzer.Cover.GrabSignalDelta()
- assert.Equal(t, 0, plus.Len())
- assert.Equal(t, 200, minus.Len())
-
- // Rotate the rest.
- fuzzer.RotateMaxSignal(1000)
- assert.Equal(t, 100, len(fuzzer.Cover.maxSignal))
- assert.Equal(t, 100, corpusObj.StatSignal.Val())
- plus, minus = fuzzer.Cover.GrabSignalDelta()
- assert.Equal(t, 0, plus.Len())
- assert.Equal(t, 700, minus.Len())
-}
-
// Based on the example from Go documentation.
var crc32q = crc32.MakeTable(0xD5828281)