]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Tweak as_mmap for the possibility of a PIE-supporting system with a 4GB user
authorNicholas Nethercote <n.nethercote@gmail.com>
Tue, 26 Oct 2004 16:30:01 +0000 (16:30 +0000)
committerNicholas Nethercote <n.nethercote@gmail.com>
Tue, 26 Oct 2004 16:30:01 +0000 (16:30 +0000)
space.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2855

corecheck/tests/Makefile.am
corecheck/tests/as_mmap.c
corecheck/tests/as_mmap.stderr.exp
corecheck/tests/as_mmap.stderr.exp2
corecheck/tests/as_mmap.vgtest
corecheck/tests/filter_as_mmap [new file with mode: 0755]

index fa0c30ffa9ecc799b979909749ba68e1f670bdbe..26cac4fdd4ce8cde603f7fd0bd896f1638ef455f 100644 (file)
@@ -4,7 +4,7 @@
 ## blocking syscalls, etc.
 ##---------------------------------------------------------------------------
 
-noinst_SCRIPTS = filter_stderr filter_fdleak
+noinst_SCRIPTS = filter_stderr filter_as_mmap filter_fdleak
 
 EXTRA_DIST = $(noinst_SCRIPTS) \
        as_mmap.stderr.exp as_mmap.stderr.exp2 as_mmap.vgtest \
index da40a8612aae6ca79379d03b6242f171ee4eab72..2d9f04e96e069bae331a8fe6399b9dfefa4bfb78 100644 (file)
@@ -6,21 +6,30 @@ int main()
        char local;
        char *top = (char *)(((unsigned long)&local + 0x0fffffff) & ~0x0fffffff);
 
+        fprintf(stderr, "1\n");
        if (mmap((void *)0x00000000, 0x10000, PROT_READ|PROT_WRITE, 
                 MAP_PRIVATE|MAP_ANON|MAP_FIXED, -1, 0) == MAP_FAILED)
-               perror("mmap @ 0x00000000");
+               fprintf(stderr, "mmap @ 0x00000000\n");
+
+        fprintf(stderr, "2\n");
        if (mmap((void *)0x00010000, 0x10000, PROT_READ|PROT_WRITE, 
                 MAP_PRIVATE|MAP_ANON|MAP_FIXED, -1, 0) == MAP_FAILED)
-               perror("mmap @ 0x00010000");
+               fprintf(stderr, "mmap @ 0x00010000\n");
+
+        fprintf(stderr, "3\n");
        if (mmap((void *)0x50000000, 0x10000, PROT_READ|PROT_WRITE, 
                 MAP_PRIVATE|MAP_ANON|MAP_FIXED, -1, 0) == MAP_FAILED)
-               perror("mmap @ 0x50000000");
+               fprintf(stderr, "mmap @ 0x50000000\n");
+
+        fprintf(stderr, "4\n");
        if (mmap(top, 0x10000, PROT_READ|PROT_WRITE, 
                 MAP_PRIVATE|MAP_ANON|MAP_FIXED, -1, 0) == MAP_FAILED)
-               perror("mmap @ top");
+               fprintf(stderr, "mmap @ top\n");
+
+        fprintf(stderr, "5\n");
        if (mmap(top+0x08000000, 0x10000, PROT_READ|PROT_WRITE, 
                 MAP_PRIVATE|MAP_ANON|MAP_FIXED, -1, 0) == MAP_FAILED)
-               perror("mmap @ top+.5G");
+               fprintf(stderr, "mmap @ top+.5G\n");
 
        return 0;
 }
index e5314c8dedecf3e739e153681420a90fb038a38f..bc52d12630ace6c2d472e2623b4ce786f5d3cde2 100644 (file)
@@ -1,9 +1,14 @@
 
-Warning: client syscall mmap2 tried to modify addresses 0x0-0x10000
-mmap @ 0x00000000: Cannot allocate memory
-Warning: client syscall mmap2 tried to modify addresses 0xB0000000-0xB0010000
-mmap @ top: Cannot allocate memory
-Warning: client syscall mmap2 tried to modify addresses 0xB8000000-0xB8010000
-mmap @ top+.5G: Cannot allocate memory
+1
+Warning: client syscall mmap2 tried to modify addresses 0x........-0x........
+mmap @ 0x........
+2
+3
+4
+Warning: client syscall mmap2 tried to modify addresses 0x........-0x........
+mmap @ top
+5
+Warning: client syscall mmap2 tried to modify addresses 0x........-0x........
+mmap @ top+.5G
 
 ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
index d400151966391ad7ac22a4cd9c855344822af06f..2400662114f0187d59b045e9f5cf39adeed13373 100644 (file)
@@ -1,8 +1,13 @@
 
+1
 Warning: client syscall mmap tried to modify addresses 0x0-0x10000
 mmap @ 0x00000000: Cannot allocate memory
+2
+3
+4
 Warning: client syscall mmap tried to modify addresses 0xB0000000-0xB0010000
 mmap @ top: Cannot allocate memory
+5
 Warning: client syscall mmap tried to modify addresses 0xB8000000-0xB8010000
 mmap @ top+.5G: Cannot allocate memory
 
index 13cb4513c1227760a2996463acb466d50fadab45..b9c615445ed74f6679b2d1dacc79d97edcc74678 100644 (file)
@@ -1 +1,2 @@
 prog: as_mmap
+stderr_filter: filter_as_mmap
diff --git a/corecheck/tests/filter_as_mmap b/corecheck/tests/filter_as_mmap
new file mode 100755 (executable)
index 0000000..e188381
--- /dev/null
@@ -0,0 +1,8 @@
+#! /bin/sh
+
+dir=`dirname $0`
+
+$dir/../../tests/filter_stderr_basic                    |
+
+# Anonymise addresses
+$dir/../../tests/filter_addresses