aboutsummaryrefslogtreecommitdiffstats
path: root/prog/mutation.go
diff options
context:
space:
mode:
authorAlexander Potapenko <glider@google.com>2017-08-08 16:50:22 +0200
committerDmitry Vyukov <dvyukov@google.com>2017-08-08 17:57:01 +0200
commitd8b0de2df3c9646b9b4d160f1ea6b678381d23be (patch)
treef5ede9e82dc4a5be59ccf657aadd424e3d576c07 /prog/mutation.go
parent1db36864e92915f8d737cee93ab787cf43681d6a (diff)
prog: reduce the "uber-mmap" size
During minimization we create a single memory mapping that contains all the smaller mmap() ranges, so that other mmap() calls can be dropped. This "uber-mmap" used to start at 0x7f0000000000 regardless of where the smaller mappings were located. Change its starting address to the beginning of the first small mmap() range.
Diffstat (limited to 'prog/mutation.go')
-rw-r--r--prog/mutation.go6
1 files changed, 5 insertions, 1 deletions
diff --git a/prog/mutation.go b/prog/mutation.go
index 98e7e567d..853e7141d 100644
--- a/prog/mutation.go
+++ b/prog/mutation.go
@@ -270,9 +270,13 @@ func Minimize(p0 *Prog, callIndex0 int, pred func(*Prog, int) bool, crash bool)
// 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 {
@@ -290,7 +294,7 @@ func Minimize(p0 *Prog, callIndex0 int, pred func(*Prog, int) bool, crash bool)
}
}
// Prepend uber-mmap.
- mmap := createMmapCall(0, uintptr(hi)+1)
+ mmap := createMmapCall(uintptr(lo), uintptr(hi-lo)+1)
p.Calls = append([]*Call{mmap}, p.Calls...)
if callIndex != -1 {
callIndex++