-
Notifications
You must be signed in to change notification settings - Fork 1.2k
/
rpctype.go
214 lines (190 loc) · 5.75 KB
/
rpctype.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
// Copyright 2015 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 rpctype contains types of message passed via net/rpc connections
// between various parts of the system.
package rpctype
import (
"math"
"time"
"github.com/google/syzkaller/pkg/flatrpc"
"github.com/google/syzkaller/pkg/host"
"github.com/google/syzkaller/pkg/ipc"
"github.com/google/syzkaller/pkg/signal"
)
// ExecutionRequest describes the task of executing a particular program.
// Corresponds to Fuzzer.Request.
type ExecutionRequest struct {
ID int64
ProgData []byte
ExecOpts ipc.ExecOpts
NewSignal bool
// If set, ProgData contains compiled executable binary
// that needs to be written to disk and executed.
IsBinary bool
// If set, fully reset executor state befor executing the test.
ResetState bool
// If set, collect program output and return in ExecutionResult.Output.
ReturnOutput bool
// If set, don't fail on program failures, instead return the error in ExecutionResult.Error.
ReturnError bool
SignalFilter signal.Signal
SignalFilterCall int
// Repeat the program that many times (0 means 1).
Repeat int
}
// ExecutionResult is sent after ExecutionRequest is completed.
type ExecutionResult struct {
ID int64
ProcID int
Try int
Info ipc.ProgInfo
Output []byte
Error string
}
// ExchangeInfoRequest is periodically sent by syz-fuzzer to syz-manager.
type ExchangeInfoRequest struct {
Name string
NeedProgs int
StatsDelta map[string]uint64
Results []ExecutionResult
Latency time.Duration // latency of the previous ExchangeInfo request
}
// ExchangeInfoReply is a reply to ExchangeInfoRequest.
type ExchangeInfoReply struct {
Requests []ExecutionRequest
NewMaxSignal []uint32
DropMaxSignal []uint32
}
// ExecutingRequest is notification from the fuzzer that it started executing
// the program ProgID. We want this request to be as small and as fast as possible
// b/c we want it to reach manager (or at least leave the VM) before it crashes
// executing this program.
type ExecutingRequest struct {
Name string
ID int64
ProcID int
Try int
}
// TODO: merge ExecutionRequest and ExecTask.
type ExecTask struct {
Prog []byte
ID int64
}
type ConnectArgs struct {
Name string
GitRevision string
SyzRevision string
ExecutorArch string
ExecutorGitRevision string
ExecutorSyzRevision string
}
type ConnectRes struct {
MemoryLeakFrames []string
DataRaceFrames []string
// This is forwarded from CheckArgs, if checking was already done.
Features *host.Features
// Fuzzer reads these files inside of the VM and returns contents in CheckArgs.Files.
ReadFiles []string
ReadGlobs []string
}
type CheckArgs struct {
Name string
Error string
Features *host.Features
Globs map[string][]string
Files []flatrpc.FileInfo
}
type CheckRes struct {
CoverFilterBitmap []byte
}
type SyscallReason struct {
ID int
Reason string
}
type RunnerConnectArgs struct {
Pool, VM int
}
type RunnerConnectRes struct {
// CheckUnsupportedCalls is set to true if the Runner needs to query the kernel
// for unsupported system calls and report them back to the server.
CheckUnsupportedCalls bool
}
// UpdateUnsupportedArgs contains the data passed from client to server in an
// UpdateSupported call, namely the system calls not supported by the client's
// kernel.
type UpdateUnsupportedArgs struct {
// Pool is used to identify the checked kernel.
Pool int
// UnsupportedCalls contains the ID's of system calls not supported by the
// client and the reason for this.
UnsupportedCalls []SyscallReason
}
// NextExchangeArgs contains the data passed from client to server namely
// identification information of the VM and program execution results.
type NextExchangeArgs struct {
// Pool/VM are used to identify the instance on which the client is running.
Pool, VM int
// ExecTaskID is used to uniquely identify the program for which the client is
// sending results.
ExecTaskID int64
// Hanged is set to true if the program for which we are sending results
// was killed due to hanging.
Hanged bool
// Info contains information about the execution of each system call in the
// program.
Info ipc.ProgInfo
}
// NextExchaneRes contains the data passed from server to client namely
// programs to execute on the VM.
type NextExchangeRes struct {
ExecTask
}
const (
NoTask int64 = math.MaxInt64
)
type HubConnectArgs struct {
// Client/Key are used for authentication.
Client string
// The key may be a secret password or the oauth token prefixed by "Bearer ".
Key string
// Manager name, must start with Client.
Manager string
// See pkg/mgrconfig.Config.HubDomain.
Domain string
// Manager has started with an empty corpus and requests whole hub corpus.
Fresh bool
// Set of system call names supported by this manager.
// Used to filter out programs with unsupported calls.
Calls []string
// Current manager corpus.
Corpus [][]byte
}
type HubSyncArgs struct {
// see HubConnectArgs.
Client string
Key string
Manager string
NeedRepros bool
// Programs added to corpus since last sync or connect.
Add [][]byte
// Hashes of programs removed from corpus since last sync or connect.
Del []string
// Repros found since last sync.
Repros [][]byte
}
type HubSyncRes struct {
// Set of inputs from other managers.
Inputs []HubInput
// Same as Inputs but for legacy managers that don't understand new format (remove later).
Progs [][]byte
// Set of repros from other managers.
Repros [][]byte
// Number of remaining pending programs,
// if >0 manager should do sync again.
More int
}
type HubInput struct {
// Domain of the source manager.
Domain string
Prog []byte
}