aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2018-12-07 14:08:56 +0100
committerDmitry Vyukov <dvyukov@google.com>2018-12-07 14:08:56 +0100
commitc9f43ce69883dd0b9829b27e55eb7b3bb8f8603e (patch)
treec46d1ed0f6c43eed449bed74262e7a5e55922200
parent4f39cef6c2104a54ad45ac29ade31d38905452e0 (diff)
tools/syz-trace2syz/proggen: tidy up shouldSkip
-rw-r--r--tools/syz-trace2syz/proggen/proggen.go25
1 files changed, 10 insertions, 15 deletions
diff --git a/tools/syz-trace2syz/proggen/proggen.go b/tools/syz-trace2syz/proggen/proggen.go
index a1394d057..091068ebd 100644
--- a/tools/syz-trace2syz/proggen/proggen.go
+++ b/tools/syz-trace2syz/proggen/proggen.go
@@ -60,12 +60,11 @@ func genProg(trace *parser.Trace, target *prog.Target) *prog.Prog {
// 2179 --- SIGUSR1 {si_signo=SIGUSR1, si_code=SI_USER, si_pid=2180, si_uid=0} ---
continue
}
- ctx.CurrentStraceCall = sCall
-
- if shouldSkip(ctx) {
- log.Logf(2, "skipping call: %s", ctx.CurrentStraceCall.CallName)
+ if shouldSkip(sCall) {
+ log.Logf(2, "skipping call: %s", sCall.CallName)
continue
}
+ ctx.CurrentStraceCall = sCall
call := genCall(ctx)
if call == nil {
continue
@@ -397,21 +396,17 @@ func reorderStructFields(syzType *prog.StructType, traceType *parser.GroupType,
}
}
-func shouldSkip(ctx *Context) bool {
- syscall := ctx.CurrentStraceCall
- if unsupportedCalls[syscall.CallName] {
- return true
- }
- switch syscall.CallName {
+func shouldSkip(c *parser.Syscall) bool {
+ switch c.CallName {
case "write":
- // We skip all writes to stdout and stderr because they can corrupt our crash summary
- switch a := syscall.Args[0].(type) {
+ // We skip all writes to stdout and stderr because they can corrupt our crash summary.
+ // Also there will be nothing on stdin, so any reads will hang.
+ switch a := c.Args[0].(type) {
case parser.Constant:
- val := a.Val()
- if val == 1 || val == 2 {
+ if a.Val() <= 2 {
return true
}
}
}
- return false
+ return unsupportedCalls[c.CallName]
}