From 75a7c5e2d1f09a4a58e7e1f1f4ef0b0f55a33413 Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Mon, 19 Feb 2018 19:35:04 +0100 Subject: prog: rework address allocation 1. mmap all memory always, without explicit mmap calls in the program. This makes lots of things much easier and removes lots of code. Makes mmap not a special syscall and allows to fuzz without mmap enabled. 2. Change address assignment algorithm. Current algorithm allocates unmapped addresses too frequently and allows collisions between arguments of a single syscall. The new algorithm analyzes actual allocations in the program and places new arguments at unused locations. --- prog/minimization.go | 38 -------------------------------------- 1 file changed, 38 deletions(-) (limited to 'prog/minimization.go') diff --git a/prog/minimization.go b/prog/minimization.go index 8a77eec03..f74ad0252 100644 --- a/prog/minimization.go +++ b/prog/minimization.go @@ -29,44 +29,6 @@ func Minimize(p0 *Prog, callIndex0 int, crash bool, pred0 func(*Prog, int) bool) name0 = p0.Calls[callIndex0].Meta.Name } - // Try to glue all mmap's together. - s := analyze(nil, p0, nil) - hi := -1 - lo := -1 - for i := 0; i < maxPages; i++ { - if s.pages[i] { - hi = i - if lo == -1 { - lo = i - } - } - } - if hi != -1 { - p := p0.Clone() - callIndex := callIndex0 - // Remove all mmaps. - for i := 0; i < len(p.Calls); i++ { - c := p.Calls[i] - if i != callIndex && c.Meta == p.Target.MmapSyscall { - p.removeCall(i) - if i < callIndex { - callIndex-- - } - i-- - } - } - // Prepend uber-mmap. - mmap := p0.Target.MakeMmap(uint64(lo), uint64(hi-lo)+1) - p.Calls = append([]*Call{mmap}, p.Calls...) - if callIndex != -1 { - callIndex++ - } - if pred(p, callIndex) { - p0 = p - callIndex0 = callIndex - } - } - // Try to remove all calls except the last one one-by-one. for i := len(p0.Calls) - 1; i >= 0; i-- { if i == callIndex0 { -- cgit mrf-deployment