Skip to content

Commit ef44b75

Browse files
committed
all: fix recvcheck errors
1 parent cd3f2c0 commit ef44b75

File tree

12 files changed

+49
-74
lines changed

12 files changed

+49
-74
lines changed

pkg/corpus/corpus_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ func TestCorpusOperation(t *testing.T) {
4848
}
4949

5050
// Verify the total signal.
51-
assert.Equal(t, corpus.StatSignal.Val(), 5)
52-
assert.Equal(t, corpus.StatProgs.Val(), 2)
51+
assert.Equal(t, 5, corpus.StatSignal.Val())
52+
assert.Equal(t, 2, corpus.StatProgs.Val())
5353

5454
corpus.Minimize(true)
5555
}

pkg/cover/cover.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@ func (cov *Cover) MergeDiff(raw []uint64) []uint64 {
4242
return raw[:n]
4343
}
4444

45-
func (cov Cover) Serialize() []uint64 {
46-
res := make([]uint64, 0, len(cov))
47-
for pc := range cov {
45+
func (cov *Cover) Serialize() []uint64 {
46+
res := make([]uint64, 0, len(*cov))
47+
for pc := range *cov {
4848
res = append(res, pc)
4949
}
5050
return res

pkg/fuzzer/queue/queue.go

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ import (
1616

1717
"github.com/google/syzkaller/pkg/flatrpc"
1818
"github.com/google/syzkaller/pkg/hash"
19-
"github.com/google/syzkaller/pkg/signal"
2019
"github.com/google/syzkaller/pkg/stat"
2120
"github.com/google/syzkaller/prog"
2221
)
@@ -32,11 +31,6 @@ type Request struct {
3231
BinaryFile string // for RequestTypeBinary
3332
GlobPattern string // for RequestTypeGlob
3433

35-
// If specified, the resulting signal for call SignalFilterCall
36-
// will include subset of it even if it's not new.
37-
SignalFilter signal.Signal
38-
SignalFilterCall int
39-
4034
// Return all signal for these calls instead of new signal.
4135
ReturnAllSignal []int
4236
ReturnError bool
@@ -123,9 +117,6 @@ func (r *Request) Validate() error {
123117
if len(r.ReturnAllSignal) != 0 && !collectSignal {
124118
return fmt.Errorf("ReturnAllSignal is set, but FlagCollectSignal is not")
125119
}
126-
if r.SignalFilter != nil && !collectSignal {
127-
return fmt.Errorf("SignalFilter must be used with FlagCollectSignal")
128-
}
129120
collectComps := r.ExecOpts.ExecFlags&flatrpc.ExecFlagCollectComps > 0
130121
collectCover := r.ExecOpts.ExecFlags&flatrpc.ExecFlagCollectCover > 0
131122
if (collectComps) && (collectSignal || collectCover) {

pkg/ifuzz/powerpc/powerpc.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ const (
6161
prefixOpcode = uint32(1) << prefixShift
6262
)
6363

64-
func (insn Insn) isPrefixed() bool {
64+
func (insn *Insn) isPrefixed() bool {
6565
return insn.Opcode&prefixMask == prefixOpcode
6666
}
6767

@@ -119,7 +119,7 @@ func encodeBits(n uint, ff []InsnBits) uint32 {
119119
return ret
120120
}
121121

122-
func (insn Insn) Encode(cfg *iset.Config, r *rand.Rand) []byte {
122+
func (insn *Insn) Encode(cfg *iset.Config, r *rand.Rand) []byte {
123123
if insn.Pseudo {
124124
return insn.generator(cfg, r)
125125
}
@@ -132,7 +132,7 @@ func (insn Insn) Encode(cfg *iset.Config, r *rand.Rand) []byte {
132132
return ret
133133
}
134134

135-
func (insn Insn) encodeOpcode(cfg *iset.Config, r *rand.Rand, opcode, mask uint32, f []InsnField) []byte {
135+
func (insn *Insn) encodeOpcode(cfg *iset.Config, r *rand.Rand, opcode, mask uint32, f []InsnField) []byte {
136136
ret := make([]byte, 0)
137137
insn32 := opcode
138138
if len(cfg.MemRegions) != 0 {
@@ -179,7 +179,7 @@ func (insn *Insn) Info() (string, iset.Mode, bool, bool) {
179179
return insn.Name, insn.mode(), insn.Pseudo, insn.Priv
180180
}
181181

182-
func (insn Insn) mode() iset.Mode {
182+
func (insn *Insn) mode() iset.Mode {
183183
return (1 << iset.ModeLong64) | (1 << iset.ModeProt32)
184184
}
185185

pkg/signal/signal.go

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ type (
99
prioType int8
1010
)
1111

12-
type Signal map[elemType]prioType
12+
// Signal was hard to refactor when we enabled recvcheck.
13+
type Signal map[elemType]prioType // nolint: recvcheck
1314

1415
func (s Signal) Len() int {
1516
return len(s)
@@ -38,23 +39,6 @@ func FromRaw(raw []uint64, prio uint8) Signal {
3839
return s
3940
}
4041

41-
func (s Signal) Diff(s1 Signal) Signal {
42-
if s1.Empty() {
43-
return nil
44-
}
45-
var res Signal
46-
for e, p1 := range s1 {
47-
if p, ok := s[e]; ok && p >= p1 {
48-
continue
49-
}
50-
if res == nil {
51-
res = make(Signal)
52-
}
53-
res[e] = p1
54-
}
55-
return res
56-
}
57-
5842
func (s Signal) DiffRaw(raw []uint64, prio uint8) Signal {
5943
var res Signal
6044
for _, e := range raw {

prog/expr.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import (
88
"fmt"
99
)
1010

11-
func (bo *BinaryExpression) Evaluate(finder ArgFinder) (uint64, bool) {
11+
func (bo BinaryExpression) Evaluate(finder ArgFinder) (uint64, bool) {
1212
left, ok := bo.Left.Evaluate(finder)
1313
if !ok {
1414
return 0, false

prog/prog.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ type ArgCommon struct {
9191
dir Dir
9292
}
9393

94-
func (arg ArgCommon) Type() Type {
94+
func (arg *ArgCommon) Type() Type {
9595
if arg.ref == 0 {
9696
panic("broken type ref")
9797
}

prog/types.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ func (bo BinaryExpression) ForEachValue(cb func(*Value)) {
129129
bo.Right.ForEachValue(cb)
130130
}
131131

132-
func (bo *BinaryExpression) Clone() Expression {
132+
func (bo BinaryExpression) Clone() Expression {
133133
return &BinaryExpression{
134134
Operator: bo.Operator,
135135
Left: bo.Left.Clone(),
@@ -144,7 +144,7 @@ type Value struct {
144144
Path []string
145145
}
146146

147-
func (v Value) GoString() string {
147+
func (v *Value) GoString() string {
148148
return fmt.Sprintf("&prog.Value{%#v,%#v}", v.Value, v.Path)
149149
}
150150

tools/syz-testbed/html.go

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ const (
145145
HTMLReproDurationTable = "repro_duration"
146146
)
147147

148-
type uiTableGenerator = func(urlPrefix string, view StatView, r *http.Request) (*uiTable, error)
148+
type uiTableGenerator = func(urlPrefix string, view *StatView, r *http.Request) (*uiTable, error)
149149

150150
type uiTableType struct {
151151
Key string
@@ -171,12 +171,12 @@ type uiMainPage struct {
171171
func (ctx *TestbedContext) getTableTypes() []uiTableType {
172172
allTypeList := []uiTableType{
173173
{HTMLStatsTable, "Statistics", ctx.httpMainStatsTable},
174-
{HTMLBugsTable, "Bugs", ctx.genSimpleTableController((StatView).GenerateBugTable, true)},
175-
{HTMLBugCountsTable, "Bug Counts", ctx.genSimpleTableController((StatView).GenerateBugCountsTable, false)},
176-
{HTMLReprosTable, "Repros", ctx.genSimpleTableController((StatView).GenerateReproSuccessTable, true)},
177-
{HTMLCReprosTable, "C Repros", ctx.genSimpleTableController((StatView).GenerateCReproSuccessTable, true)},
178-
{HTMLReproAttemptsTable, "All Repros", ctx.genSimpleTableController((StatView).GenerateReproAttemptsTable, false)},
179-
{HTMLReproDurationTable, "Duration", ctx.genSimpleTableController((StatView).GenerateReproDurationTable, true)},
174+
{HTMLBugsTable, "Bugs", ctx.genSimpleTableController((*StatView).GenerateBugTable, true)},
175+
{HTMLBugCountsTable, "Bug Counts", ctx.genSimpleTableController((*StatView).GenerateBugCountsTable, false)},
176+
{HTMLReprosTable, "Repros", ctx.genSimpleTableController((*StatView).GenerateReproSuccessTable, true)},
177+
{HTMLCReprosTable, "C Repros", ctx.genSimpleTableController((*StatView).GenerateCReproSuccessTable, true)},
178+
{HTMLReproAttemptsTable, "All Repros", ctx.genSimpleTableController((*StatView).GenerateReproAttemptsTable, false)},
179+
{HTMLReproDurationTable, "Duration", ctx.genSimpleTableController((*StatView).GenerateReproDurationTable, true)},
180180
}
181181
typeList := []uiTableType{}
182182
for _, t := range allTypeList {
@@ -187,9 +187,9 @@ func (ctx *TestbedContext) getTableTypes() []uiTableType {
187187
return typeList
188188
}
189189

190-
func (ctx *TestbedContext) genSimpleTableController(method func(view StatView) (*Table, error),
190+
func (ctx *TestbedContext) genSimpleTableController(method func(view *StatView) (*Table, error),
191191
hasFooter bool) uiTableGenerator {
192-
return func(urlPrefix string, view StatView, r *http.Request) (*uiTable, error) {
192+
return func(urlPrefix string, view *StatView, r *http.Request) (*uiTable, error) {
193193
table, err := method(view)
194194
if err != nil {
195195
return nil, fmt.Errorf("table generation failed: %w", err)
@@ -201,7 +201,7 @@ func (ctx *TestbedContext) genSimpleTableController(method func(view StatView) (
201201
}
202202
}
203203

204-
func (ctx *TestbedContext) httpMainStatsTable(urlPrefix string, view StatView, r *http.Request) (*uiTable, error) {
204+
func (ctx *TestbedContext) httpMainStatsTable(urlPrefix string, view *StatView, r *http.Request) (*uiTable, error) {
205205
alignBy := r.FormValue("align")
206206
table, err := view.AlignedStatsTable(alignBy)
207207
if err != nil {
@@ -276,7 +276,7 @@ func (ctx *TestbedContext) httpMain(w http.ResponseWriter, r *http.Request) {
276276
v.Set("table", t.Key)
277277
return "/?" + v.Encode()
278278
}
279-
uiView.ActiveTable, err = tableType.Generator(uiView.GenTableURL(tableType)+"&", *activeView, r)
279+
uiView.ActiveTable, err = tableType.Generator(uiView.GenTableURL(tableType)+"&", activeView, r)
280280
if err != nil {
281281
http.Error(w, fmt.Sprintf("%s", err), http.StatusInternalServerError)
282282
return

tools/syz-testbed/stats.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ func summarizeBugs(groups []RunResultGroup) ([]*BugSummary, error) {
134134

135135
// For each checkout, take the union of sets of bugs found by each instance.
136136
// Then output these unions as a single table.
137-
func (view StatView) GenerateBugTable() (*Table, error) {
137+
func (view *StatView) GenerateBugTable() (*Table, error) {
138138
table := NewTable("Bug")
139139
for _, group := range view.Groups {
140140
table.AddColumn(group.Name)
@@ -153,7 +153,7 @@ func (view StatView) GenerateBugTable() (*Table, error) {
153153
return table, nil
154154
}
155155

156-
func (view StatView) GenerateBugCountsTable() (*Table, error) {
156+
func (view *StatView) GenerateBugCountsTable() (*Table, error) {
157157
table := NewTable("Bug")
158158
for _, group := range view.Groups {
159159
table.AddColumn(group.Name)
@@ -242,11 +242,11 @@ func (group RunResultGroup) groupLastRecord() map[string]*sample.Sample {
242242
return groupSamples(records)
243243
}
244244

245-
func (view StatView) StatsTable() (*Table, error) {
245+
func (view *StatView) StatsTable() (*Table, error) {
246246
return view.AlignedStatsTable("uptime")
247247
}
248248

249-
func (view StatView) AlignedStatsTable(field string) (*Table, error) {
249+
func (view *StatView) AlignedStatsTable(field string) (*Table, error) {
250250
// We assume that the stats values are nonnegative.
251251
table := NewTable("Property")
252252
if field == "" {
@@ -300,7 +300,7 @@ func (view StatView) AlignedStatsTable(field string) (*Table, error) {
300300
return table, nil
301301
}
302302

303-
func (view StatView) InstanceStatsTable() (*Table, error) {
303+
func (view *StatView) InstanceStatsTable() (*Table, error) {
304304
newView := StatView{}
305305
for _, group := range view.Groups {
306306
for i, result := range group.Results {
@@ -314,7 +314,7 @@ func (view StatView) InstanceStatsTable() (*Table, error) {
314314
}
315315

316316
// How often we find a repro to each crash log.
317-
func (view StatView) GenerateReproSuccessTable() (*Table, error) {
317+
func (view *StatView) GenerateReproSuccessTable() (*Table, error) {
318318
table := NewTable("Bug")
319319
for _, group := range view.Groups {
320320
table.AddColumn(group.Name)
@@ -337,7 +337,7 @@ func (view StatView) GenerateReproSuccessTable() (*Table, error) {
337337
}
338338

339339
// What share of found repros also have a C repro.
340-
func (view StatView) GenerateCReproSuccessTable() (*Table, error) {
340+
func (view *StatView) GenerateCReproSuccessTable() (*Table, error) {
341341
table := NewTable("Bug")
342342
for _, group := range view.Groups {
343343
table.AddColumn(group.Name)
@@ -363,7 +363,7 @@ func (view StatView) GenerateCReproSuccessTable() (*Table, error) {
363363
}
364364

365365
// What share of found repros also have a C repro.
366-
func (view StatView) GenerateReproDurationTable() (*Table, error) {
366+
func (view *StatView) GenerateReproDurationTable() (*Table, error) {
367367
table := NewTable("Bug")
368368
for _, group := range view.Groups {
369369
table.AddColumn(group.Name)
@@ -389,7 +389,7 @@ func (view StatView) GenerateReproDurationTable() (*Table, error) {
389389
}
390390

391391
// List all repro attempts.
392-
func (view StatView) GenerateReproAttemptsTable() (*Table, error) {
392+
func (view *StatView) GenerateReproAttemptsTable() (*Table, error) {
393393
table := NewTable("Result #", "Bug", "Checkout", "Repro found", "C repro found", "Repro title", "Duration")
394394
for gid, group := range view.Groups {
395395
for rid, result := range group.SyzReproResults() {
@@ -408,7 +408,7 @@ func (view StatView) GenerateReproAttemptsTable() (*Table, error) {
408408
}
409409

410410
// Average bench files of several instances into a single bench file.
411-
func (group *RunResultGroup) SaveAvgBenchFile(fileName string) error {
411+
func (group RunResultGroup) SaveAvgBenchFile(fileName string) error {
412412
f, err := os.Create(fileName)
413413
if err != nil {
414414
return err

0 commit comments

Comments
 (0)