forked from google/syzkaller
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ipc gate slows down overall execution a lot. Without ipc gate I am getting ~20% more executions with debug kernel and ~100% more executions with a fast non-debug kernel. Replace ipc gate with explicit tracking of last executing programs per proc in syz-manager. Ipc gate was also used for leak checking, but leak checking seems to be still broken. At least in my local runs I am not getting any leaks even with the previous fix. So remove the gate completly for now. Taking into account that we are likely to rewrite this code in C++ soon, it makes little sense to create a special gate for leak checking only in Go. Update google#4728
- Loading branch information
Showing
7 changed files
with
173 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
// Copyright 2024 syzkaller project authors. All rights reserved. | ||
// Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file. | ||
|
||
package main | ||
|
||
import ( | ||
"sort" | ||
"time" | ||
) | ||
|
||
type LastExecuting struct { | ||
count int | ||
procs []ExecRecord | ||
positions []int | ||
} | ||
|
||
type ExecRecord struct { | ||
Proc int | ||
Prog []byte | ||
Time time.Duration | ||
} | ||
|
||
func MakeLastExecuting(procs, count int) *LastExecuting { | ||
return &LastExecuting{ | ||
count: count, | ||
procs: make([]ExecRecord, procs*count), | ||
positions: make([]int, procs), | ||
} | ||
} | ||
|
||
func (last *LastExecuting) Note(proc int, prog []byte, now time.Duration) { | ||
pos := &last.positions[proc] | ||
last.procs[proc*last.count+*pos] = ExecRecord{ | ||
Proc: proc, | ||
Prog: prog, | ||
Time: now, | ||
} | ||
*pos++ | ||
if *pos == last.count { | ||
*pos = 0 | ||
} | ||
} | ||
|
||
func (last *LastExecuting) Collect() []ExecRecord { | ||
procs := last.procs | ||
last.procs = nil // The type must not be used after this. | ||
sort.Slice(procs, func(i, j int) bool { | ||
return procs[i].Time < procs[j].Time | ||
}) | ||
max := procs[len(procs)-1].Time | ||
for i := len(procs) - 1; i >= 0; i-- { | ||
if procs[i].Time == 0 { | ||
procs = procs[i+1:] | ||
break | ||
} | ||
procs[i].Time = max - procs[i].Time | ||
} | ||
return procs | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
// Copyright 2024 syzkaller project authors. All rights reserved. | ||
// Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file. | ||
|
||
package main | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func TestLastExecutingEmpty(t *testing.T) { | ||
last := MakeLastExecuting(10, 10) | ||
assert.Empty(t, last.Collect()) | ||
} | ||
|
||
func TestLastExecuting(t *testing.T) { | ||
last := MakeLastExecuting(10, 3) | ||
last.Note(0, []byte("prog1"), 1) | ||
|
||
last.Note(1, []byte("prog2"), 2) | ||
last.Note(1, []byte("prog3"), 3) | ||
|
||
last.Note(3, []byte("prog4"), 4) | ||
last.Note(3, []byte("prog5"), 5) | ||
last.Note(3, []byte("prog6"), 6) | ||
|
||
last.Note(7, []byte("prog7"), 7) | ||
last.Note(7, []byte("prog8"), 8) | ||
last.Note(7, []byte("prog9"), 9) | ||
last.Note(7, []byte("prog10"), 10) | ||
last.Note(7, []byte("prog11"), 11) | ||
|
||
last.Note(9, []byte("prog12"), 12) | ||
|
||
last.Note(8, []byte("prog13"), 13) | ||
|
||
assert.Equal(t, last.Collect(), []ExecRecord{ | ||
{Proc: 0, Prog: []byte("prog1"), Time: 12}, | ||
|
||
{Proc: 1, Prog: []byte("prog2"), Time: 11}, | ||
{Proc: 1, Prog: []byte("prog3"), Time: 10}, | ||
|
||
{Proc: 3, Prog: []byte("prog4"), Time: 9}, | ||
{Proc: 3, Prog: []byte("prog5"), Time: 8}, | ||
{Proc: 3, Prog: []byte("prog6"), Time: 7}, | ||
|
||
{Proc: 7, Prog: []byte("prog9"), Time: 4}, | ||
{Proc: 7, Prog: []byte("prog10"), Time: 3}, | ||
{Proc: 7, Prog: []byte("prog11"), Time: 2}, | ||
|
||
{Proc: 9, Prog: []byte("prog12"), Time: 1}, | ||
|
||
{Proc: 8, Prog: []byte("prog13"), Time: 0}, | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.