aboutsummaryrefslogtreecommitdiffstats
path: root/prog
diff options
context:
space:
mode:
authorAndrey Konovalov <andreyknvl@google.com>2017-05-18 16:08:43 +0200
committerAndrey Konovalov <andreyknvl@google.com>2017-06-12 19:48:23 +0200
commit4d1df73af9a6d40d3111e3f2a7dfb9f138fbde4b (patch)
tree48e66cf8d6f91fa3bcabc60ee94ca070befef0af /prog
parent10c9064bfc4890e5895057021280a0558131e3eb (diff)
csource: force enable tun flag when required
Diffstat (limited to 'prog')
-rw-r--r--prog/analysis.go26
1 files changed, 26 insertions, 0 deletions
diff --git a/prog/analysis.go b/prog/analysis.go
index 5b786c753..67a254273 100644
--- a/prog/analysis.go
+++ b/prog/analysis.go
@@ -260,3 +260,29 @@ func sanitizeCall(c *Call) {
}
}
}
+
+func RequiresTun(p *Prog) bool {
+ for _, c := range p.Calls {
+ switch c.Meta.CallName {
+ case "syz_emit_ethernet":
+ return true
+ case "syz_extract_tcp_res":
+ return true
+ }
+ }
+ return false
+}
+
+func RequiresBitmasks(p *Prog) bool {
+ result := false
+ for _, c := range p.Calls {
+ foreachArg(c, func(arg, _ *Arg, _ *[]*Arg) {
+ if arg.Kind == ArgConst {
+ if arg.Type.BitfieldOffset() != 0 || arg.Type.BitfieldLength() != 0 {
+ result = true
+ }
+ }
+ })
+ }
+ return result
+}