aboutsummaryrefslogtreecommitdiffstats
path: root/prog/mutation.go
diff options
context:
space:
mode:
authorAndrey Konovalov <andreyknvl@google.com>2017-01-25 16:18:05 +0100
committerAndrey Konovalov <andreyknvl@google.com>2017-01-25 20:31:13 +0100
commit63b16a5d5cfd3b41f596daccd56d32b2548ec119 (patch)
tree3dfa93b07083b7ee4c21aa430aeedc92b9a16bb4 /prog/mutation.go
parentc8d03a05f3acd375badcde94264909d149784778 (diff)
prog, sys: add csum type, embed checksums for ipv4 packets
This change adds a `csum[kind, type]` type. The only available kind right now is `ipv4`. Using `csum[ipv4, int16be]` in `ipv4_header` makes syzkaller calculate and embed correct checksums into ipv4 packets.
Diffstat (limited to 'prog/mutation.go')
-rw-r--r--prog/mutation.go7
1 files changed, 6 insertions, 1 deletions
diff --git a/prog/mutation.go b/prog/mutation.go
index 04465a424..358a2b104 100644
--- a/prog/mutation.go
+++ b/prog/mutation.go
@@ -197,6 +197,8 @@ func (p *Prog) Mutate(rs rand.Source, ncalls int, ct *ChoiceTable, corpus []*Pro
p.replaceArg(c, arg, arg1, calls)
case *sys.LenType:
panic("bad arg returned by mutationArgs: LenType")
+ case *sys.CsumType:
+ panic("bad arg returned by mutationArgs: CsumType")
case *sys.ConstType:
panic("bad arg returned by mutationArgs: ConstType")
default:
@@ -397,7 +399,7 @@ func Minimize(p0 *Prog, callIndex0 int, pred func(*Prog, int) bool, crash bool)
}
}
p0 = p
- case *sys.VmaType, *sys.LenType, *sys.ConstType:
+ case *sys.VmaType, *sys.LenType, *sys.CsumType, *sys.ConstType:
// TODO: try to remove offset from vma
return false
default:
@@ -460,6 +462,9 @@ func mutationArgs(c *Call) (args, bases []*Arg) {
case *sys.LenType:
// Size is updated when the size-of arg change.
return
+ case *sys.CsumType:
+ // Checksum is updated when the checksummed data changes.
+ return
case *sys.ConstType:
// Well, this is const.
return