aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--prog/mutation.go6
-rw-r--r--prog/mutation_test.go8
2 files changed, 9 insertions, 5 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++
diff --git a/prog/mutation_test.go b/prog/mutation_test.go
index 44a6eabc3..2f70e0a5d 100644
--- a/prog/mutation_test.go
+++ b/prog/mutation_test.go
@@ -255,15 +255,15 @@ func TestMinimize(t *testing.T) {
// Glue several mmaps together.
{
"sched_yield()\n" +
- "mmap(&(0x7f0000000000/0x1000)=nil, 0x1000, 0x3, 0x32, 0xffffffffffffffff, 0x0)\n" +
- "mmap(&(0x7f0000001000/0x1000)=nil, 0x1000, 0x3, 0x32, 0xffffffffffffffff, 0x0)\n" +
+ "mmap(&(0x7f0000010000/0x1000)=nil, 0x1000, 0x3, 0x32, 0xffffffffffffffff, 0x0)\n" +
+ "mmap(&(0x7f0000011000/0x1000)=nil, 0x1000, 0x3, 0x32, 0xffffffffffffffff, 0x0)\n" +
"getpid()\n" +
- "mmap(&(0x7f0000005000/0x5000)=nil, 0x2000, 0x3, 0x32, 0xffffffffffffffff, 0x0)\n",
+ "mmap(&(0x7f0000015000/0x5000)=nil, 0x2000, 0x3, 0x32, 0xffffffffffffffff, 0x0)\n",
3,
func(p *Prog, callIndex int) bool {
return p.String() == "mmap-sched_yield-getpid"
},
- "mmap(&(0x7f0000000000/0x7000)=nil, 0x7000, 0x0, 0x0, 0xffffffffffffffff, 0x0)\n" +
+ "mmap(&(0x7f0000010000/0x7000)=nil, 0x7000, 0x0, 0x0, 0xffffffffffffffff, 0x0)\n" +
"sched_yield()\n" +
"getpid()\n",
2,