aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--pkg/flatrpc/flatrpc.fbs3
-rw-r--r--pkg/flatrpc/flatrpc.go86
-rw-r--r--pkg/flatrpc/flatrpc.h58
-rw-r--r--pkg/instance/instance.go5
-rw-r--r--syz-fuzzer/fuzzer.go7
-rw-r--r--syz-manager/manager.go4
-rw-r--r--syz-manager/rpc.go3
7 files changed, 135 insertions, 31 deletions
diff --git a/pkg/flatrpc/flatrpc.fbs b/pkg/flatrpc/flatrpc.fbs
index ef2527422..7800d6779 100644
--- a/pkg/flatrpc/flatrpc.fbs
+++ b/pkg/flatrpc/flatrpc.fbs
@@ -34,6 +34,9 @@ table ConnectRequestRaw {
}
table ConnectReplyRaw {
+ debug :bool;
+ procs :int32;
+ slowdown :int32;
leak_frames :[string];
race_frames :[string];
// Fuzzer sets up these features and returns results in InfoRequest.features.
diff --git a/pkg/flatrpc/flatrpc.go b/pkg/flatrpc/flatrpc.go
index 8a6827e38..9fbd2d0ae 100644
--- a/pkg/flatrpc/flatrpc.go
+++ b/pkg/flatrpc/flatrpc.go
@@ -488,6 +488,9 @@ func ConnectRequestRawEnd(builder *flatbuffers.Builder) flatbuffers.UOffsetT {
}
type ConnectReplyRawT struct {
+ Debug bool `json:"debug"`
+ Procs int32 `json:"procs"`
+ Slowdown int32 `json:"slowdown"`
LeakFrames []string `json:"leak_frames"`
RaceFrames []string `json:"race_frames"`
Features Feature `json:"features"`
@@ -552,6 +555,9 @@ func (t *ConnectReplyRawT) Pack(builder *flatbuffers.Builder) flatbuffers.UOffse
globsOffset = builder.EndVector(globsLength)
}
ConnectReplyRawStart(builder)
+ ConnectReplyRawAddDebug(builder, t.Debug)
+ ConnectReplyRawAddProcs(builder, t.Procs)
+ ConnectReplyRawAddSlowdown(builder, t.Slowdown)
ConnectReplyRawAddLeakFrames(builder, leakFramesOffset)
ConnectReplyRawAddRaceFrames(builder, raceFramesOffset)
ConnectReplyRawAddFeatures(builder, t.Features)
@@ -561,6 +567,9 @@ func (t *ConnectReplyRawT) Pack(builder *flatbuffers.Builder) flatbuffers.UOffse
}
func (rcv *ConnectReplyRaw) UnPackTo(t *ConnectReplyRawT) {
+ t.Debug = rcv.Debug()
+ t.Procs = rcv.Procs()
+ t.Slowdown = rcv.Slowdown()
leakFramesLength := rcv.LeakFramesLength()
t.LeakFrames = make([]string, leakFramesLength)
for j := 0; j < leakFramesLength; j++ {
@@ -620,9 +629,45 @@ func (rcv *ConnectReplyRaw) Table() flatbuffers.Table {
return rcv._tab
}
-func (rcv *ConnectReplyRaw) LeakFrames(j int) []byte {
+func (rcv *ConnectReplyRaw) Debug() bool {
o := flatbuffers.UOffsetT(rcv._tab.Offset(4))
if o != 0 {
+ return rcv._tab.GetBool(o + rcv._tab.Pos)
+ }
+ return false
+}
+
+func (rcv *ConnectReplyRaw) MutateDebug(n bool) bool {
+ return rcv._tab.MutateBoolSlot(4, n)
+}
+
+func (rcv *ConnectReplyRaw) Procs() int32 {
+ o := flatbuffers.UOffsetT(rcv._tab.Offset(6))
+ if o != 0 {
+ return rcv._tab.GetInt32(o + rcv._tab.Pos)
+ }
+ return 0
+}
+
+func (rcv *ConnectReplyRaw) MutateProcs(n int32) bool {
+ return rcv._tab.MutateInt32Slot(6, n)
+}
+
+func (rcv *ConnectReplyRaw) Slowdown() int32 {
+ o := flatbuffers.UOffsetT(rcv._tab.Offset(8))
+ if o != 0 {
+ return rcv._tab.GetInt32(o + rcv._tab.Pos)
+ }
+ return 0
+}
+
+func (rcv *ConnectReplyRaw) MutateSlowdown(n int32) bool {
+ return rcv._tab.MutateInt32Slot(8, n)
+}
+
+func (rcv *ConnectReplyRaw) LeakFrames(j int) []byte {
+ o := flatbuffers.UOffsetT(rcv._tab.Offset(10))
+ if o != 0 {
a := rcv._tab.Vector(o)
return rcv._tab.ByteVector(a + flatbuffers.UOffsetT(j*4))
}
@@ -630,7 +675,7 @@ func (rcv *ConnectReplyRaw) LeakFrames(j int) []byte {
}
func (rcv *ConnectReplyRaw) LeakFramesLength() int {
- o := flatbuffers.UOffsetT(rcv._tab.Offset(4))
+ o := flatbuffers.UOffsetT(rcv._tab.Offset(10))
if o != 0 {
return rcv._tab.VectorLen(o)
}
@@ -638,7 +683,7 @@ func (rcv *ConnectReplyRaw) LeakFramesLength() int {
}
func (rcv *ConnectReplyRaw) RaceFrames(j int) []byte {
- o := flatbuffers.UOffsetT(rcv._tab.Offset(6))
+ o := flatbuffers.UOffsetT(rcv._tab.Offset(12))
if o != 0 {
a := rcv._tab.Vector(o)
return rcv._tab.ByteVector(a + flatbuffers.UOffsetT(j*4))
@@ -647,7 +692,7 @@ func (rcv *ConnectReplyRaw) RaceFrames(j int) []byte {
}
func (rcv *ConnectReplyRaw) RaceFramesLength() int {
- o := flatbuffers.UOffsetT(rcv._tab.Offset(6))
+ o := flatbuffers.UOffsetT(rcv._tab.Offset(12))
if o != 0 {
return rcv._tab.VectorLen(o)
}
@@ -655,7 +700,7 @@ func (rcv *ConnectReplyRaw) RaceFramesLength() int {
}
func (rcv *ConnectReplyRaw) Features() Feature {
- o := flatbuffers.UOffsetT(rcv._tab.Offset(8))
+ o := flatbuffers.UOffsetT(rcv._tab.Offset(14))
if o != 0 {
return Feature(rcv._tab.GetUint64(o + rcv._tab.Pos))
}
@@ -663,11 +708,11 @@ func (rcv *ConnectReplyRaw) Features() Feature {
}
func (rcv *ConnectReplyRaw) MutateFeatures(n Feature) bool {
- return rcv._tab.MutateUint64Slot(8, uint64(n))
+ return rcv._tab.MutateUint64Slot(14, uint64(n))
}
func (rcv *ConnectReplyRaw) Files(j int) []byte {
- o := flatbuffers.UOffsetT(rcv._tab.Offset(10))
+ o := flatbuffers.UOffsetT(rcv._tab.Offset(16))
if o != 0 {
a := rcv._tab.Vector(o)
return rcv._tab.ByteVector(a + flatbuffers.UOffsetT(j*4))
@@ -676,7 +721,7 @@ func (rcv *ConnectReplyRaw) Files(j int) []byte {
}
func (rcv *ConnectReplyRaw) FilesLength() int {
- o := flatbuffers.UOffsetT(rcv._tab.Offset(10))
+ o := flatbuffers.UOffsetT(rcv._tab.Offset(16))
if o != 0 {
return rcv._tab.VectorLen(o)
}
@@ -684,7 +729,7 @@ func (rcv *ConnectReplyRaw) FilesLength() int {
}
func (rcv *ConnectReplyRaw) Globs(j int) []byte {
- o := flatbuffers.UOffsetT(rcv._tab.Offset(12))
+ o := flatbuffers.UOffsetT(rcv._tab.Offset(18))
if o != 0 {
a := rcv._tab.Vector(o)
return rcv._tab.ByteVector(a + flatbuffers.UOffsetT(j*4))
@@ -693,7 +738,7 @@ func (rcv *ConnectReplyRaw) Globs(j int) []byte {
}
func (rcv *ConnectReplyRaw) GlobsLength() int {
- o := flatbuffers.UOffsetT(rcv._tab.Offset(12))
+ o := flatbuffers.UOffsetT(rcv._tab.Offset(18))
if o != 0 {
return rcv._tab.VectorLen(o)
}
@@ -701,31 +746,40 @@ func (rcv *ConnectReplyRaw) GlobsLength() int {
}
func ConnectReplyRawStart(builder *flatbuffers.Builder) {
- builder.StartObject(5)
+ builder.StartObject(8)
+}
+func ConnectReplyRawAddDebug(builder *flatbuffers.Builder, debug bool) {
+ builder.PrependBoolSlot(0, debug, false)
+}
+func ConnectReplyRawAddProcs(builder *flatbuffers.Builder, procs int32) {
+ builder.PrependInt32Slot(1, procs, 0)
+}
+func ConnectReplyRawAddSlowdown(builder *flatbuffers.Builder, slowdown int32) {
+ builder.PrependInt32Slot(2, slowdown, 0)
}
func ConnectReplyRawAddLeakFrames(builder *flatbuffers.Builder, leakFrames flatbuffers.UOffsetT) {
- builder.PrependUOffsetTSlot(0, flatbuffers.UOffsetT(leakFrames), 0)
+ builder.PrependUOffsetTSlot(3, flatbuffers.UOffsetT(leakFrames), 0)
}
func ConnectReplyRawStartLeakFramesVector(builder *flatbuffers.Builder, numElems int) flatbuffers.UOffsetT {
return builder.StartVector(4, numElems, 4)
}
func ConnectReplyRawAddRaceFrames(builder *flatbuffers.Builder, raceFrames flatbuffers.UOffsetT) {
- builder.PrependUOffsetTSlot(1, flatbuffers.UOffsetT(raceFrames), 0)
+ builder.PrependUOffsetTSlot(4, flatbuffers.UOffsetT(raceFrames), 0)
}
func ConnectReplyRawStartRaceFramesVector(builder *flatbuffers.Builder, numElems int) flatbuffers.UOffsetT {
return builder.StartVector(4, numElems, 4)
}
func ConnectReplyRawAddFeatures(builder *flatbuffers.Builder, features Feature) {
- builder.PrependUint64Slot(2, uint64(features), 0)
+ builder.PrependUint64Slot(5, uint64(features), 0)
}
func ConnectReplyRawAddFiles(builder *flatbuffers.Builder, files flatbuffers.UOffsetT) {
- builder.PrependUOffsetTSlot(3, flatbuffers.UOffsetT(files), 0)
+ builder.PrependUOffsetTSlot(6, flatbuffers.UOffsetT(files), 0)
}
func ConnectReplyRawStartFilesVector(builder *flatbuffers.Builder, numElems int) flatbuffers.UOffsetT {
return builder.StartVector(4, numElems, 4)
}
func ConnectReplyRawAddGlobs(builder *flatbuffers.Builder, globs flatbuffers.UOffsetT) {
- builder.PrependUOffsetTSlot(4, flatbuffers.UOffsetT(globs), 0)
+ builder.PrependUOffsetTSlot(7, flatbuffers.UOffsetT(globs), 0)
}
func ConnectReplyRawStartGlobsVector(builder *flatbuffers.Builder, numElems int) flatbuffers.UOffsetT {
return builder.StartVector(4, numElems, 4)
diff --git a/pkg/flatrpc/flatrpc.h b/pkg/flatrpc/flatrpc.h
index af9150a0c..aa02046b1 100644
--- a/pkg/flatrpc/flatrpc.h
+++ b/pkg/flatrpc/flatrpc.h
@@ -741,6 +741,9 @@ flatbuffers::Offset<ConnectRequestRaw> CreateConnectRequestRaw(flatbuffers::Flat
struct ConnectReplyRawT : public flatbuffers::NativeTable {
typedef ConnectReplyRaw TableType;
+ bool debug = false;
+ int32_t procs = 0;
+ int32_t slowdown = 0;
std::vector<std::string> leak_frames{};
std::vector<std::string> race_frames{};
rpc::Feature features = static_cast<rpc::Feature>(0);
@@ -752,12 +755,24 @@ struct ConnectReplyRaw FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
typedef ConnectReplyRawT NativeTableType;
typedef ConnectReplyRawBuilder Builder;
enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
- VT_LEAK_FRAMES = 4,
- VT_RACE_FRAMES = 6,
- VT_FEATURES = 8,
- VT_FILES = 10,
- VT_GLOBS = 12
+ VT_DEBUG = 4,
+ VT_PROCS = 6,
+ VT_SLOWDOWN = 8,
+ VT_LEAK_FRAMES = 10,
+ VT_RACE_FRAMES = 12,
+ VT_FEATURES = 14,
+ VT_FILES = 16,
+ VT_GLOBS = 18
};
+ bool debug() const {
+ return GetField<uint8_t>(VT_DEBUG, 0) != 0;
+ }
+ int32_t procs() const {
+ return GetField<int32_t>(VT_PROCS, 0);
+ }
+ int32_t slowdown() const {
+ return GetField<int32_t>(VT_SLOWDOWN, 0);
+ }
const flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>> *leak_frames() const {
return GetPointer<const flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>> *>(VT_LEAK_FRAMES);
}
@@ -775,6 +790,9 @@ struct ConnectReplyRaw FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
}
bool Verify(flatbuffers::Verifier &verifier) const {
return VerifyTableStart(verifier) &&
+ VerifyField<uint8_t>(verifier, VT_DEBUG, 1) &&
+ VerifyField<int32_t>(verifier, VT_PROCS, 4) &&
+ VerifyField<int32_t>(verifier, VT_SLOWDOWN, 4) &&
VerifyOffset(verifier, VT_LEAK_FRAMES) &&
verifier.VerifyVector(leak_frames()) &&
verifier.VerifyVectorOfStrings(leak_frames()) &&
@@ -799,6 +817,15 @@ struct ConnectReplyRawBuilder {
typedef ConnectReplyRaw Table;
flatbuffers::FlatBufferBuilder &fbb_;
flatbuffers::uoffset_t start_;
+ void add_debug(bool debug) {
+ fbb_.AddElement<uint8_t>(ConnectReplyRaw::VT_DEBUG, static_cast<uint8_t>(debug), 0);
+ }
+ void add_procs(int32_t procs) {
+ fbb_.AddElement<int32_t>(ConnectReplyRaw::VT_PROCS, procs, 0);
+ }
+ void add_slowdown(int32_t slowdown) {
+ fbb_.AddElement<int32_t>(ConnectReplyRaw::VT_SLOWDOWN, slowdown, 0);
+ }
void add_leak_frames(flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>>> leak_frames) {
fbb_.AddOffset(ConnectReplyRaw::VT_LEAK_FRAMES, leak_frames);
}
@@ -827,6 +854,9 @@ struct ConnectReplyRawBuilder {
inline flatbuffers::Offset<ConnectReplyRaw> CreateConnectReplyRaw(
flatbuffers::FlatBufferBuilder &_fbb,
+ bool debug = false,
+ int32_t procs = 0,
+ int32_t slowdown = 0,
flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>>> leak_frames = 0,
flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<flatbuffers::String>>> race_frames = 0,
rpc::Feature features = static_cast<rpc::Feature>(0),
@@ -838,11 +868,17 @@ inline flatbuffers::Offset<ConnectReplyRaw> CreateConnectReplyRaw(
builder_.add_files(files);
builder_.add_race_frames(race_frames);
builder_.add_leak_frames(leak_frames);
+ builder_.add_slowdown(slowdown);
+ builder_.add_procs(procs);
+ builder_.add_debug(debug);
return builder_.Finish();
}
inline flatbuffers::Offset<ConnectReplyRaw> CreateConnectReplyRawDirect(
flatbuffers::FlatBufferBuilder &_fbb,
+ bool debug = false,
+ int32_t procs = 0,
+ int32_t slowdown = 0,
const std::vector<flatbuffers::Offset<flatbuffers::String>> *leak_frames = nullptr,
const std::vector<flatbuffers::Offset<flatbuffers::String>> *race_frames = nullptr,
rpc::Feature features = static_cast<rpc::Feature>(0),
@@ -854,6 +890,9 @@ inline flatbuffers::Offset<ConnectReplyRaw> CreateConnectReplyRawDirect(
auto globs__ = globs ? _fbb.CreateVector<flatbuffers::Offset<flatbuffers::String>>(*globs) : 0;
return rpc::CreateConnectReplyRaw(
_fbb,
+ debug,
+ procs,
+ slowdown,
leak_frames__,
race_frames__,
features,
@@ -2212,6 +2251,9 @@ inline ConnectReplyRawT *ConnectReplyRaw::UnPack(const flatbuffers::resolver_fun
inline void ConnectReplyRaw::UnPackTo(ConnectReplyRawT *_o, const flatbuffers::resolver_function_t *_resolver) const {
(void)_o;
(void)_resolver;
+ { auto _e = debug(); _o->debug = _e; }
+ { auto _e = procs(); _o->procs = _e; }
+ { auto _e = slowdown(); _o->slowdown = _e; }
{ auto _e = leak_frames(); if (_e) { _o->leak_frames.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->leak_frames[_i] = _e->Get(_i)->str(); } } }
{ auto _e = race_frames(); if (_e) { _o->race_frames.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->race_frames[_i] = _e->Get(_i)->str(); } } }
{ auto _e = features(); _o->features = _e; }
@@ -2227,6 +2269,9 @@ inline flatbuffers::Offset<ConnectReplyRaw> CreateConnectReplyRaw(flatbuffers::F
(void)_rehasher;
(void)_o;
struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const ConnectReplyRawT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va;
+ auto _debug = _o->debug;
+ auto _procs = _o->procs;
+ auto _slowdown = _o->slowdown;
auto _leak_frames = _o->leak_frames.size() ? _fbb.CreateVectorOfStrings(_o->leak_frames) : 0;
auto _race_frames = _o->race_frames.size() ? _fbb.CreateVectorOfStrings(_o->race_frames) : 0;
auto _features = _o->features;
@@ -2234,6 +2279,9 @@ inline flatbuffers::Offset<ConnectReplyRaw> CreateConnectReplyRaw(flatbuffers::F
auto _globs = _o->globs.size() ? _fbb.CreateVectorOfStrings(_o->globs) : 0;
return rpc::CreateConnectReplyRaw(
_fbb,
+ _debug,
+ _procs,
+ _slowdown,
_leak_frames,
_race_frames,
_features,
diff --git a/pkg/instance/instance.go b/pkg/instance/instance.go
index f65311db0..cc4efb5a3 100644
--- a/pkg/instance/instance.go
+++ b/pkg/instance/instance.go
@@ -452,7 +452,6 @@ type FuzzerCmdArgs struct {
Arch string
FwdAddr string
Sandbox string
- Procs int
Verbosity int
Cover bool
Debug bool
@@ -481,9 +480,9 @@ func FuzzerCmd(args *FuzzerCmdArgs) string {
optionalArg = " " + tool.OptionalFlags(flags)
}
return fmt.Sprintf("%v -executor=%v -name=%v -arch=%v%v -manager=%v -sandbox=%v"+
- " -procs=%v -cover=%v -debug=%v %v%v",
+ " -cover=%v -debug=%v %v%v",
args.Fuzzer, args.Executor, args.Name, args.Arch, osArg, args.FwdAddr, args.Sandbox,
- args.Procs, args.Cover, args.Debug, verbosityArg, optionalArg)
+ args.Cover, args.Debug, verbosityArg, optionalArg)
}
func ExecprogCmd(execprog, executor, OS, arch, sandbox string, sandboxArg int, repeat, threaded, collide bool,
diff --git a/syz-fuzzer/fuzzer.go b/syz-fuzzer/fuzzer.go
index efc02df4f..8527330e0 100644
--- a/syz-fuzzer/fuzzer.go
+++ b/syz-fuzzer/fuzzer.go
@@ -53,7 +53,6 @@ func main() {
flagOS = flag.String("os", runtime.GOOS, "target OS")
flagArch = flag.String("arch", runtime.GOARCH, "target arch")
flagManager = flag.String("manager", "", "manager rpc address")
- flagProcs = flag.Int("procs", 1, "number of parallel test processes")
flagPprofPort = flag.Int("pprof_port", 0, "HTTP port for the pprof endpoint (disabled if 0)")
)
defer tool.Init()()
@@ -149,14 +148,14 @@ func main() {
timeouts: timeouts,
leakFrames: connectReply.LeakFrames,
- requests: make(chan *flatrpc.ExecRequest, *flagProcs*4),
+ requests: make(chan *flatrpc.ExecRequest, connectReply.Procs*4),
}
fuzzerTool.filterDataRaceFrames(connectReply.RaceFrames)
// TODO: repair leak checking.
_ = fuzzerTool.leakGateCallback
- log.Logf(0, "starting %v executor processes", *flagProcs)
- for pid := 0; pid < *flagProcs; pid++ {
+ log.Logf(0, "starting %v executor processes", connectReply.Procs)
+ for pid := 0; pid < int(connectReply.Procs); pid++ {
startProc(fuzzerTool, pid, config)
}
diff --git a/syz-manager/manager.go b/syz-manager/manager.go
index 3189c52af..789e2dc7a 100644
--- a/syz-manager/manager.go
+++ b/syz-manager/manager.go
@@ -853,10 +853,9 @@ func (mgr *Manager) runInstanceInner(index int, instanceName string, injectExec
}
fuzzerV := 0
- procs := mgr.cfg.Procs
if *flagDebug {
fuzzerV = 100
- procs = 1
+ mgr.cfg.Procs = 1
}
// Run the fuzzer binary.
@@ -871,7 +870,6 @@ func (mgr *Manager) runInstanceInner(index int, instanceName string, injectExec
Arch: mgr.cfg.TargetArch,
FwdAddr: fwdAddr,
Sandbox: mgr.cfg.Sandbox,
- Procs: procs,
Verbosity: fuzzerV,
Cover: mgr.cfg.Cover,
Debug: *flagDebug,
diff --git a/syz-manager/rpc.go b/syz-manager/rpc.go
index 84cdaac49..7e4a8b634 100644
--- a/syz-manager/rpc.go
+++ b/syz-manager/rpc.go
@@ -185,6 +185,9 @@ func (serv *RPCServer) handshake(conn *flatrpc.Conn) (string, []byte, *cover.Can
bugFrames := serv.mgr.currentBugFrames()
connectReply := &flatrpc.ConnectReply{
+ Debug: *flagDebug,
+ Procs: int32(serv.cfg.Procs),
+ Slowdown: int32(serv.cfg.Timeouts.Slowdown),
LeakFrames: bugFrames.memoryLeaks,
RaceFrames: bugFrames.dataRaces,
}